ci: 添加测试失败消息发送功能并调整 trace 配置

- 在 .gitlab-ci.yml 中添加 after_script 部分,根据测试结果发送相应消息
- 在 playwright.config.js 中将 trace 配置从 'retain-on-failure' 改为 'on',以收集所有测试的 trace 信息
This commit is contained in:
LingandRX 2025-03-17 22:53:57 +08:00
parent bac0dbfdbe
commit 88eae96f63
2 changed files with 9 additions and 1 deletions

View File

@ -10,6 +10,14 @@ playwright_tests:
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/

View File

@ -55,7 +55,7 @@ module.exports = defineConfig({
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
hasTouch: true,
trace: 'retain-on-failure',
trace: 'on',
screenshot: 'only-on-failure',
timezoneId: 'Asia/Shanghai',
locale: 'zh-CN',