#!/usr/bin/env bash set -u pipefail # 定位到 erp-frontend-vue 项目根目录 ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$ROOT_DIR" echo "Project root: $ROOT_DIR" echo "Running all Playwright specs together..." echo "This will generate a complete report with all test results." echo # 一次性运行所有测试,这样所有测试结果都会被保存到一个报告中 if npx playwright test tests/; then echo echo "============================================================" echo "✅ All tests completed successfully!" echo "============================================================" echo echo "📊 Test results have been saved to:" echo " - HTML report: playwright-report/index.html" echo " - JSON results: test-results/results.json" echo " - Screenshots: test-results/" echo echo "🔍 To view the HTML report, run:" echo " npx playwright show-report" echo exit 0 else echo echo "============================================================" echo "❌ Some tests failed!" echo "============================================================" echo echo "📊 Test results have been saved to:" echo " - HTML report: playwright-report/index.html" echo " - JSON results: test-results/results.json" echo " - Screenshots: test-results/" echo echo "🔍 To view the HTML report, run:" echo " npx playwright show-report" echo exit 1 fi