- 在 GitLab CI 配置文件中为 Playwright 测试阶段添加 60 分钟的超时限制 - 在测试完成后生成报告,无论测试是否成功 - 优化测试报告的生成和存储,确保在所有情况下都能生成报告
30 lines
762 B
YAML
30 lines
762 B
YAML
playwright_tests:
|
|
stage: test
|
|
image: mcr.microsoft.com/playwright:v1.51.0-noble
|
|
timeout: 60 minutes
|
|
cache:
|
|
key: $CI_COMMIT_REF_SLUG
|
|
paths:
|
|
- node_modules/
|
|
before_script:
|
|
- npm config set registry https://registry.npmmirror.com
|
|
script:
|
|
- npm install
|
|
- npx playwright test /touch/boss_cashier.spec.ts --project '慧来客touch(管理员身份) - Desktop Chrome'
|
|
after_script:
|
|
- |
|
|
if [ "$CI_JOB_STATUS" == "success" ]; then
|
|
echo "Tests passed! Sending success message..."
|
|
else
|
|
echo "Tests failed! Sending failure message..."
|
|
fi
|
|
- ls -la playwright-report/
|
|
artifacts:
|
|
paths:
|
|
- playwright-report/
|
|
expire_in: 1 week
|
|
when: always
|
|
tags:
|
|
- test
|
|
only:
|
|
- main |