- 在 .gitlab-ci.yml 中添加 after_script 部分,根据测试结果发送相应消息 - 在 playwright.config.js 中将 trace 配置从 'retain-on-failure' 改为 'on',以收集所有测试的 trace 信息
28 lines
760 B
YAML
28 lines
760 B
YAML
playwright_tests:
|
|
stage: test
|
|
image: mcr.microsoft.com/playwright:v1.51.0-noble
|
|
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 --grep "挂单" --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..."
|
|
node scripts/send-message.js "Some tests failed!"
|
|
fi
|
|
artifacts:
|
|
paths:
|
|
- test-results/
|
|
expire_in: 1 week
|
|
tags:
|
|
- test
|
|
only:
|
|
- main |