feat: add one-click test runner script
This commit is contained in:
Executable
+82
@@ -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 ""
|
||||||
Reference in New Issue
Block a user