@echo off setlocal enabledelayedexpansion REM ============================ REM QKF – Full Test Runner REM ============================ echo. echo ============================ echo QKF Test Execution echo ============================ echo. REM ---------------------------- REM Arguments REM ---------------------------- set FORCE_INSTALL=false if "%1"=="--install" set FORCE_INSTALL=true REM ---------------------------- REM Config (edit if needed) REM ---------------------------- set QKF_BROWSER=chrome set QKF_HEADLESS=true set QKF_TEST_TIMEOUT_MS=120000 set QKF_BASE_URL=http://gitea.cloud.qacg/user/login REM ---------------------------- REM Paths REM ---------------------------- set FEATURES_DIR=features set GENERATED_DIR=test\generated set ALLURE_RESULTS=allure-results set ALLURE_REPORT=allure-report REM ---------------------------- REM Node dependencies REM ---------------------------- if not exist "node_modules" ( echo. echo node_modules not found — running npm install... npm install if errorlevel 1 ( echo ❌ npm install failed exit /b 1 ) ) else if "%FORCE_INSTALL%"=="true" ( echo. echo --install flag detected — running npm install... npm install if errorlevel 1 ( echo ❌ npm install failed exit /b 1 ) ) else ( echo. echo node_modules already present — skipping npm install ) REM ---------------------------- REM Clean previous output REM ---------------------------- if exist "%GENERATED_DIR%" ( echo Cleaning generated specs... rmdir /s /q "%GENERATED_DIR%" ) if exist "%ALLURE_RESULTS%" ( echo Cleaning Allure results... rmdir /s /q "%ALLURE_RESULTS%" ) if exist "%ALLURE_REPORT%" ( echo Cleaning Allure report... rmdir /s /q "%ALLURE_REPORT%" ) REM ---------------------------- REM Generate specs REM ---------------------------- echo. echo [1/4] Generating specs from Gherkin... node scripts\transform.js --features "%FEATURES_DIR%" --verbose if errorlevel 1 ( echo ❌ Spec generation failed exit /b 1 ) REM ---------------------------- REM Run tests REM ---------------------------- echo. echo [2/4] Running Mocha + Selenium + Allure... npx mocha ^ --timeout %QKF_TEST_TIMEOUT_MS% ^ --reporter allure-mocha ^ "%GENERATED_DIR%\*.spec.js" if errorlevel 1 ( echo ⚠️ Tests finished with failures (continuing to report generation) ) REM ---------------------------- REM Generate Allure report REM ---------------------------- echo. echo [3/4] Generating Allure report... allure generate "%ALLURE_RESULTS%" -o "%ALLURE_REPORT%" --clean if errorlevel 1 ( echo ❌ Allure report generation failed exit /b 1 ) REM ---------------------------- REM Open Allure report REM ---------------------------- echo. echo [4/4] Opening Allure report... allure open "%ALLURE_REPORT%" echo. echo ✅ Done. endlocal