优化分批执行点击菜单
This commit is contained in:
parent
3921448aa1
commit
aa3f497434
@ -92,6 +92,8 @@ Playwright配置文件统一管理所有浏览器相关的配置:
|
|||||||
1. **安装依赖**
|
1. **安装依赖**
|
||||||
```bash
|
```bash
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
|
npx playwright install
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **配置环境变量**
|
2. **配置环境变量**
|
||||||
@ -106,6 +108,7 @@ Playwright配置文件统一管理所有浏览器相关的配置:
|
|||||||
4. **查看报告**
|
4. **查看报告**
|
||||||
```bash
|
```bash
|
||||||
npm run show-report
|
npm run show-report
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 最佳实践
|
## 最佳实践
|
||||||
|
|||||||
BIN
playwright.rar
Normal file
BIN
playwright.rar
Normal file
Binary file not shown.
@ -1,22 +1,34 @@
|
|||||||
@echo off
|
server {
|
||||||
echo Starting automated tests...
|
listen 80;
|
||||||
cd /d %~dp0
|
server_name devops.iscmtech.com;
|
||||||
|
|
||||||
:: 设置控制台编码为UTF-8
|
|
||||||
chcp 65001 > nul
|
|
||||||
|
|
||||||
:: 设置默认环境为dev
|
location ~ ^/(deploy/longi|notice/zentao/statistics) {
|
||||||
if "%1"=="" (
|
proxy_pass http://127.0.0.1:8080;
|
||||||
set TEST_ENV=dev
|
proxy_set_header Host $host;
|
||||||
) else (
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
set TEST_ENV=%1
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
)
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
echo [Batch] Preparing to run tests in %TEST_ENV% environment...
|
location /deploy-ease/ {
|
||||||
|
proxy_pass http://127.0.0.1:8081;
|
||||||
:: 运行测试并发送报告
|
proxy_set_header Host $host;
|
||||||
set NODE_ENV=%TEST_ENV%
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
node src/scripts/runTestsAndSendReport.js
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
echo.
|
}
|
||||||
echo [Batch] Execution completed
|
location /prod/longi/ {
|
||||||
|
proxy_pass http://127.0.0.1:8082;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
location /order/longi/ {
|
||||||
|
proxy_pass http://127.0.0.1:8084;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -74,7 +74,7 @@ async function runTestsAndSendReport() {
|
|||||||
if (fs.existsSync(reportPath)) {
|
if (fs.existsSync(reportPath)) {
|
||||||
const performanceReport = fs.readFileSync(reportPath, 'utf8');
|
const performanceReport = fs.readFileSync(reportPath, 'utf8');
|
||||||
const result = await emailService.sendMail({
|
const result = await emailService.sendMail({
|
||||||
to: 'dengqichen@iscmtech.com',
|
to: 'wanghaipeng@iscmtech.com',
|
||||||
subject: `[失败] Playwright自动化测试报告 (${env}) - ${startTime.toLocaleDateString()}`,
|
subject: `[失败] Playwright自动化测试报告 (${env}) - ${startTime.toLocaleDateString()}`,
|
||||||
html: performanceReport
|
html: performanceReport
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,14 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"id": 1,
|
|
||||||
"text": "主数据",
|
|
||||||
"path": "主数据",
|
|
||||||
"hasThirdMenu": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 2,
|
|
||||||
"text": "业务数据",
|
|
||||||
"path": "业务数据",
|
|
||||||
"hasThirdMenu": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@ -1 +0,0 @@
|
|||||||
[]
|
|
||||||
Loading…
Reference in New Issue
Block a user