46 lines
1.4 KiB
PowerShell
46 lines
1.4 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Run the browser end-to-end suite against the local fixture page.
|
|
|
|
.DESCRIPTION
|
|
The suite needs a real Chromium-based browser; it is ignored by default so
|
|
that "cargo test" stays usable without a browser. It drives a local static
|
|
fake of the ChatGPT page (tests/fixtures/chatgpt_mock.html): full pipeline,
|
|
streaming, conversation reuse, login, captcha, rate limit, error banner,
|
|
first-token timeout, missing selector, mid-stream rewrite and attachments.
|
|
|
|
.EXAMPLE
|
|
./scripts/e2e.ps1
|
|
./scripts/e2e.ps1 -Test fixture_full_pipeline
|
|
#>
|
|
param(
|
|
[string]$Test = ''
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
$root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
|
Push-Location $root
|
|
|
|
$chrome = @(
|
|
"$env:ProgramFiles\Google\Chrome\Application\chrome.exe",
|
|
"$env:LOCALAPPDATA\Google\Chrome\Application\chrome.exe",
|
|
"$env:ProgramFiles\Microsoft\Edge\Application\msedge.exe",
|
|
"$env:LOCALAPPDATA\BraveSoftware\Brave-Browser\Application\brave.exe"
|
|
) | Where-Object { Test-Path $_ } | Select-Object -First 1
|
|
|
|
if (-not $chrome) {
|
|
Write-Warning 'no Chromium-based browser found: the browser suite cannot run'
|
|
Pop-Location
|
|
exit 2
|
|
}
|
|
Write-Host "using $chrome" -ForegroundColor Cyan
|
|
|
|
$arguments = @('test', '--test', 'e2e_browser')
|
|
if ($Test) { $arguments += $Test }
|
|
$arguments += @('--', '--ignored', '--test-threads=1', '--nocapture')
|
|
|
|
& cargo @arguments
|
|
$code = $LASTEXITCODE
|
|
Pop-Location
|
|
exit $code
|