-
Notifications
You must be signed in to change notification settings - Fork 196
129 lines (128 loc) · 3.98 KB
/
playwright.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Relay e2e tests
on:
schedule:
- cron: 0 8 * * *
workflow_call:
inputs:
environment:
required: true
default: stage
type: string
health_check:
required: false
default: false
type: boolean
secrets:
E2E_TEST_ACCOUNT_FREE:
required: true
E2E_TEST_ACCOUNT_PASSWORD:
required: true
E2E_TEST_ACCOUNT_PREMIUM:
required: true
E2E_TEST_BASE_URL:
required: true
workflow_dispatch:
inputs:
environment:
description: Environment to run the e2e against
required: true
default: stage
type: choice
options:
- stage
- prod
- dev
health_check:
description: Enable health check
required: false
default: false
type: boolean
jobs:
relaye2e:
name: ${{ inputs.health_check && 'Relay e2e health check' || 'Relay e2e all tests' }}
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
node-version-file: frontend/package.json
cache: npm
- name: Install Node dependencies
run: npm install
- name: Install Playwright Browsers
run: |
npm install -D @playwright/test --with-deps
npx playwright install
- name: Run Playwright tests
run: >
commandenv="${{ inputs.environment != null && inputs.environment || 'stage'
}}"
if ${{ contains(inputs.health_check, 'true') }}; then
E2E_TEST_ENV=$commandenv npx playwright test --grep "@health_check"
else
npm run test:$commandenv
fi
env:
E2E_TEST_ENV: ${{ inputs.environment != null && inputs.environment || 'stage' }}
E2E_TEST_ACCOUNT_FREE: ${{ secrets.E2E_TEST_ACCOUNT_FREE }}
E2E_TEST_ACCOUNT_PASSWORD: ${{ secrets.E2E_TEST_ACCOUNT_PASSWORD }}
E2E_TEST_ACCOUNT_PREMIUM: ${{ secrets.E2E_TEST_ACCOUNT_PREMIUM }}
E2E_TEST_BASE_URL: ${{ secrets.E2E_TEST_BASE_URL }}
- name: Upload html report as artifact to troubleshoot failures.
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 5
- name: Send GitHub Action trigger data to Slack workflow
id: slack
uses: slackapi/[email protected]
if: failure()
with:
# For posting a rich message using Block Kit
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Link to job:* *<https://github.com/mozilla/fx-private-relay/actions/runs/${{ github.run_id }}|Relay e2e tests>*"
}
},
{
"type": "divider"
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Workflow:* \n ${{ github.workflow }}"
},
{
"type": "mrkdwn",
"text": "*Status:*\n ${{ job.status }} "
}
]
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Ref:*\n ${{ github.ref }} "
},
{
"type": "mrkdwn",
"text": "*Triggered by:*\n ${{ github.triggering_actor }}"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_FAILURES_WEBHOOK }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK