PavelArabadzhy/test-automation-framework-for-agromanagement

GitHub: PavelArabadzhy/test-automation-framework-for-agromanagement

一个基于 Playwright + TypeScript 的端到端测试自动化框架,为 AgroManagement 提供 UI、API 与安全的一体化质量保障。

Stars: 0 | Forks: 0

# AgroManagement 自动测试 针对 **AgroManagement** 的端到端 QA 自动化项目,采用专用的 Playwright + TypeScript 框架和 CI/CD 流水线。 [![Autotests Pipeline](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/6e6a29056b143803.svg)](https://github.com/PavelArabadzhy/test-automation-framework-for-agromanagement/actions/workflows/test-automation-pr-gate.yml) [![Playwright Report (Pages)](https://img.shields.io/badge/Playwright%20Report-GitHub%20Pages-2ea44f)](https://pavelarabadzhy.github.io/test-automation-framework-for-agromanagement/) ## 项目目标 构建一个生产级别的自动化解决方案,用于以下 Web 系统: - UI 测试 - API 测试 - 安全/权限检查 - 业务端到端场景 - GitHub Actions 执行 - 自动发布的 Playwright 报告 ## 仓库结构 本仓库包含 **两个项目**: - `AgroManagement/` - 待测试的 Spring Boot 应用(后端 + Thymeleaf UI) - `test-automation-framework/` - Playwright + TypeScript 测试框架 附加产物: - `AGROMANAGEMENT_DEEP_QA_ANALYSIS.md` - 系统深度 QA 分析 - `AGROMANAGEMENT_TEST_FRAMEWORK_ARCHITECTURE.md` - 框架架构/设计文档 ## 测试框架架构 位于 `test-automation-framework/` 目录下: - `tests/` - UI、API、安全、校验与端到端测试套件 - `pages/` - 页面对象模型(UI 层) - `api/clients` - API 客户端层 - `api/services` - API 服务抽象层 - `fixtures/` - 认证/领域数据夹具 - `data/factories` - 可确定的测试数据生成器 - `utils/` - 共享工具、解析器与安全断言 - `scripts/cleanupTestData.ts` - 清理策略 ## 快速开始(本地) ### 1) 启动应用栈 ``` cd AgroManagement docker compose up -d --build ``` ### 2) 运行自动测试 ``` cd test-automation-framework cp .env.example .env npm ci npx playwright install chromium npm run test:smoke ``` ### 3) 打开报告 ``` npm run report:open ``` ## 可用测试套件 在 `test-automation-framework/` 中执行: - `npm run test:smoke` - 冒烟测试 - `npm run test:ui` - 仅 UI 测试 - `npm run test:api` - 仅 API 测试 - `npm run test:security` - 安全/权限检查 - `npx playwright test --grep @regression` - 回归标签测试 - `npm test` - 完整运行 ## CI/CD(GitHub Actions) 工作流:`test-automation-pr-gate.yml` CI 执行以下操作: 1. 安装 Node.js 与 Playwright 依赖 2. 使用 Docker Compose 启动 `AgroManagement` 栈 3. 等待服务就绪(MySQL、Keycloak、应用) 4. 为测试执行播种所需的角色与用户 5. 运行选定的测试套件 6. 上传产物(`test-results`、`playwright-report`) 7. 将 Playwright HTML 报告部署到 GitHub Pages 手动运行支持套件选择: - `smoke` - `ui` - `api` - `regression` - `security` - `smoke+security` - `full` ## 质量门禁策略 - **冒烟测试**:严格门禁(用于快速信心检查) - **扩展套件**(如 `security`、`full` 等):可作为信息性诊断运行 这允许在不阻塞所有手动分析运行的情况下展示真实的产品缺陷。 ## 技术栈 - Playwright - TypeScript - Node.js - Spring Boot(待测试应用) - Docker / Docker Compose - GitHub Actions - GitHub Pages(报告托管) ## 报告链接 最新的已发布 Playwright 报告: https://pavelarabadzhy.github.io/test-automation-framework-for-agromanagement/
标签:AgroManagement, API测试, E2E测试, GitHub Actions, MITM代理, Page Object Model, Playwright, Spring Boot, Thymeleaf, TypeScript, UI测试, 业务场景测试, 农业管理, 前端测试, 安全分析, 安全插件, 安全断言, 安全测试, 开源框架, 持续集成, 攻击性安全, 权限检查, 测试报告, 测试数据生成, 测试框架, 清理策略, 版权保护, 特征检测, 端到端测试, 自动化攻击, 自动笔记, 请求拦截, 质量保障, 页面工厂