Files
E2E-Test/运行测试.bat
2025-11-04 16:29:07 +08:00

86 lines
1.5 KiB
Batchfile

@echo off
echo.
echo ================================
echo E2E 测试运行工具
echo ================================
echo.
:menu
echo.
echo 请选择测试:
echo.
echo [1] test-1.spec.ts
echo [2] 文书管理.spec.ts
echo [3] 文书管理-refactored.spec.ts (推荐)
echo [4] 运行所有测试
echo [0] 退出
echo.
set /p choice=请输入选项:
if "%choice%"=="0" goto end
if "%choice%"=="1" goto test1
if "%choice%"=="2" goto test2
if "%choice%"=="3" goto test3
if "%choice%"=="4" goto testall
echo 无效选项,请重试
goto menu
:test1
echo.
echo 运行 test-1.spec.ts...
echo.
npx playwright test e2e/test-1.spec.ts
goto result
:test2
echo.
echo 运行 文书管理.spec.ts...
echo.
npx playwright test "e2e/文书管理.spec.ts"
goto result
:test3
echo.
echo 运行 文书管理-refactored.spec.ts...
echo.
npx playwright test "e2e/文书管理-refactored.spec.ts"
goto result
:testall
echo.
echo 运行所有测试...
echo.
npx playwright test
goto result
:result
echo.
echo ================================
echo 测试完成
echo ================================
echo.
REM 查找并显示错误报告
for /f "delims=" %%f in ('dir /b /o-d test-error-report-*.txt 2^>nul') do (
echo 找到错误报告: %%f
echo.
type "%%f"
goto :done_report
)
:done_report
echo.
set /p view=是否查看HTML报告? (y/n):
if /i "%view%"=="y" npx playwright show-report
echo.
set /p again=是否继续测试? (y/n):
if /i "%again%"=="y" goto menu
:end
echo.
echo 感谢使用!
pause