# playwright_ui_test **Repository Path**: super_coding/playwright_ui_test ## Basic Information - **Project Name**: playwright_ui_test - **Description**: 技术栈:python + playwright + pytest + allure + docker + jenkins WMS自动化测试框架基于 **Playwright + Pytest**,专为仓库管理系统设计,支持多环境测试、数据驱动、持续集成。 - **Primary Language**: Python - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 4 - **Forks**: 0 - **Created**: 2025-10-16 - **Last Updated**: 2025-12-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 🚀 WMS 自动化测试框架 > 基于 Playwright + Pytest 的 Web UI 自动化测试框架 > **版本**: 2.0 | **更新时间**: 2025-12-11 ## ✨ 核心特性 - 🎯 **Page Object 模式** - 页面元素与业务逻辑分离 - 📊 **数据驱动测试** - 支持 Excel/JSON 数据源 - 🔄 **登录态持久化** - 自动保存登录状态,提升效率 - 📈 **Allure 测试报告** - 可视化报告,支持趋势分析 - 🔔 **钉钉/邮件通知** - 测试结果实时推送 - ⚡ **用例顺序控制** - 灵活控制测试执行顺序 - 🐳 **Docker 容器化** - 支持容器化部署和Jenkins集成 - 🌐 **多环境支持** - QA4/PR/ON环境自动切换 --- ## 🚀 快速开始 ### 1. 安装依赖 ```bash # 克隆项目 git clone https://gitee.com/super_coding/playwright_ui_test.git cd playwright_ui_test # 创建虚拟环境 python -m venv venv venv\Scripts\activate # Windows source venv/bin/activate # Linux/Mac # 安装依赖 pip install -r requirements.txt playwright install chromium ``` ### 2. 配置环境 编辑 `conf/login_conf.ini` 和 `conf/env_config.ini` ### 3. 运行测试 ```bash # 执行所有测试 python run.py -w # 执行测试并发送通知 python run.py -w -notify # 查看报告 allure open case_report/allure-report ``` --- ## 📁 项目结构 ``` pw_test/ ├── base/ # 基础框架层 ├── page/ # 页面对象层(Page Object) ├── business/ # 业务逻辑层 ├── case_scripts/ # 测试用例脚本 ├── case_data/ # 测试数据(Excel/JSON) ├── case_report/ # 测试报告输出 ├── conf/ # 配置文件 ├── tools/ # 工具模块 ├── run.py # 主执行脚本 ⭐ ├── pytest.ini # Pytest配置 ├── Dockerfile # Docker镜像构建 └── Jenkinsfile # Jenkins流水线 ``` --- ## 📚 完整文档 **详细文档请查看**: [WMS自动化测试框架文档.md](./WMS自动化测试框架文档.md) 文档包含: - 技术架构详解 - 环境搭建指南 - 配置文件说明 - 测试用例开发 - Docker部署 - Jenkins集成 - 常见问题解答 - 开发规范 --- ## 💻 常用命令 ```bash # 运行测试 python run.py -w # 执行所有测试 python run.py -w -env qa4 # 指定环境 python run.py -w -notify # 发送通知 # 查看报告 allure open case_report/allure-report # Pytest直接运行 pytest -v -s pytest case_scripts/web_ui/wms/in_warehouse_manage/test_in_asn_list_case.py ``` --- ## 🐛 快速排错 | 问题 | 解决方案 | |------|----------| | Playwright安装失败 | `playwright install chromium` | | 登录失败 | `rm auth/storage_state.json` | | 报告打不开 | `allure open case_report/allure-report` | | 用例顺序不生效 | `pip install pytest-order` | --- ## 📞 技术栈 - **Python** 3.9+ - **Playwright** 1.55 - **Pytest** 8.4.2 - **Allure** 2.15 - **Docker** + **Jenkins** --- **祝测试愉快!** 🎉