From 614fa8f85efea877dfa1d62da4a4fe594259e2f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=BF=94?= Date: Fri, 6 Mar 2026 10:09:44 +0800 Subject: [PATCH] feat: add one-click test runner script --- scripts/run-all-tests.sh | 82 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100755 scripts/run-all-tests.sh diff --git a/scripts/run-all-tests.sh b/scripts/run-all-tests.sh new file mode 100755 index 0000000..ba758e7 --- /dev/null +++ b/scripts/run-all-tests.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +set -e + +echo "🚀 开始运行所有开发环境测试..." +echo "========================================" +echo "" + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' + +mkdir -p test-results + +echo "📡 检查开发服务器..." +if ! curl -s http://localhost:3000 > /dev/null; then + echo -e "${RED}❌ 开发服务器未运行${NC}" + echo "请先运行: npm run dev" + exit 1 +fi +echo -e "${GREEN}✅ 开发服务器运行正常${NC}" +echo "" + +echo "⚡ 运行性能审计..." +node scripts/performance-audit.js +if [ $? -eq 0 ]; then + echo -e "${GREEN}✅ 性能审计完成${NC}" +else + echo -e "${RED}❌ 性能审计失败${NC}" +fi +echo "" + +echo "🔍 运行SEO检查..." +node scripts/seo-check.js +if [ $? -eq 0 ]; then + echo -e "${GREEN}✅ SEO检查完成${NC}" +else + echo -e "${RED}❌ SEO检查失败${NC}" +fi +echo "" + +echo "♿ 运行可访问性测试..." +node scripts/accessibility-test.js +if [ $? -eq 0 ]; then + echo -e "${GREEN}✅ 可访问性测试完成${NC}" +else + echo -e "${RED}❌ 可访问性测试失败${NC}" +fi +echo "" + +echo "📝 运行表单验证..." +node scripts/form-validation.js +if [ $? -eq 0 ]; then + echo -e "${GREEN}✅ 表单验证完成${NC}" +else + echo -e "${RED}❌ 表单验证失败${NC}" +fi +echo "" + +echo "📊 生成综合测试报告..." +node scripts/generate-test-report.js +if [ $? -eq 0 ]; then + echo -e "${GREEN}✅ 报告生成完成${NC}" +else + echo -e "${RED}❌ 报告生成失败${NC}" +fi +echo "" + +echo "========================================" +echo "📈 测试完成!" +echo "" +echo "📁 结果文件位置:" +echo " - test-results/performance-summary.json" +echo " - test-results/performance/*.html" +echo " - test-results/seo-summary.json" +echo " - test-results/accessibility-summary.json" +echo " - test-results/form-validation-summary.json" +echo " - test-results/test-report.html" +echo "" +echo -e "${GREEN}💡 在浏览器中打开 test-results/test-report.html 查看详细报告${NC}" +echo "" \ No newline at end of file