Repository navigation
Expand file tree
/
Copy pathtest-e2e.ps1
More file actions
53 lines (45 loc) · 1.58 KB
/
Copy pathtest-e2e.ps1
File metadata and controls
53 lines (45 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<#
.SYNOPSIS
Runs the Playwright End-to-End (E2E) UI test suite for PyTransDatRO.
.DESCRIPTION
Builds the web application into dist-e2e, boots an isolated FastAPI test server
using the conda python environment, and executes the Playwright test runner.
Supports interactive UI mode with -Ui or -Interactive.
.EXAMPLE
.\test-e2e.ps1
Runs all 19 E2E browser tests in headless mode.
.EXAMPLE
.\test-e2e.ps1 -Ui
Opens Playwright's visual interactive UI runner with time-travel debugging.
#>
[CmdletBinding()]
param(
[string]$PythonPath = "D:\anaconda3\envs\pytransdat\python.exe",
[switch]$Ui,
[switch]$Interactive
)
$rootDir = $PSScriptRoot
$webappDir = Join-Path $rootDir "webapp"
Write-Host "=================================================" -ForegroundColor Cyan
Write-Host " PyTransDatRO E2E Test Runner (Playwright) " -ForegroundColor Cyan
Write-Host "=================================================" -ForegroundColor Cyan
# 1. Validate Python environment
if (Test-Path $PythonPath) {
$env:PYTHON = $PythonPath
Write-Host "Using Python: $PythonPath" -ForegroundColor Green
} else {
Write-Warning "Conda python not found at $PythonPath, falling back to system 'python'..."
}
# 2. Execute Playwright tests
Push-Location $webappDir
try {
if ($Ui -or $Interactive) {
Write-Host "Launching Playwright Interactive UI Mode..." -ForegroundColor Yellow
npm run test:e2e:ui
} else {
Write-Host "Running Playwright E2E Suite (Headless)..." -ForegroundColor Green
npm run test:e2e
}
} finally {
Pop-Location
}