-
Notifications
You must be signed in to change notification settings - Fork 26
155 lines (138 loc) · 5.47 KB
/
e2e-tests-release.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: E2E tests (release)
on:
pull_request:
types: [closed]
concurrency:
group: end-to-end
cancel-in-progress: false
jobs:
test:
name: E2E tests (release)
runs-on: ubuntu-latest
timeout-minutes: 60
if: ${{ github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release-v') }}
env:
REF_BRANCH: ${{ github.event.pull_request.head.ref }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Edit /etc/hosts
run: |
sudo echo "127.0.0.1 banking.swan.localhost" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 onboarding.swan.localhost" | sudo tee -a /etc/hosts
- name: Write .env.e2e file
run: |
echo "NODE_ENV=test" > .env.e2e
echo "LOG_LEVEL=error" >> .env.e2e
echo "PARTNER_ADMIN_API_URL=${{ secrets.E2E_PARTNER_ADMIN_API_URL }}" >> .env.e2e
echo "PARTNER_API_URL=${{ secrets.E2E_PARTNER_API_URL }}" >> .env.e2e
echo "UNAUTHENTICATED_API_URL=${{ secrets.E2E_UNAUTHENTICATED_API_URL }}" >> .env.e2e
echo "OAUTH_SERVER_URL=${{ secrets.E2E_OAUTH_SERVER_URL }}" >> .env.e2e
echo "OAUTH_CLIENT_ID=${{ secrets.E2E_OAUTH_CLIENT_ID }}" >> .env.e2e
echo "OAUTH_CLIENT_SECRET=${{ secrets.E2E_OAUTH_CLIENT_SECRET }}" >> .env.e2e
echo "COOKIE_KEY=${{ secrets.E2E_COOKIE_KEY }}" >> .env.e2e
echo "BANKING_URL=http://banking.swan.localhost:8080" >> .env.e2e
echo "ONBOARDING_URL=http://onboarding.swan.localhost:8080" >> .env.e2e
echo "PAYMENT_URL=http://payment.swan.localhost:8080" >> .env.e2e
echo "TEST_KEY=${{ secrets.E2E_TEST_KEY }}" >> .env.e2e
echo "PHONE_NUMBER=${{ secrets.E2E_PHONE_NUMBER }}" >> .env.e2e
echo "PASSCODE=${{ secrets.E2E_PASSCODE }}" >> .env.e2e
echo "TWILIO_ACCOUNT_ID=${{ secrets.E2E_TWILIO_ACCOUNT_ID }}" >> .env.e2e
echo "TWILIO_AUTH_TOKEN=${{ secrets.E2E_TWILIO_AUTH_TOKEN }}" >> .env.e2e
echo "WEBHOOK_SITE_API_KEY=${{ secrets.E2E_WEBHOOK_SITE_API_KEY }}" >> .env.e2e
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Get playwright version
run: |
PLAYWRIGHT_VERSION=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//')
echo "Playwright version: $PLAYWRIGHT_VERSION"
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: Cache playwright
id: cache-playwright
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ env.PLAYWRIGHT_VERSION }}
- name: Setup playwright
if: ${{ steps.cache-playwright.outputs.cache-hit != 'true' }}
run: pnpm playwright install --with-deps
- name: GraphQL Codegen
run: pnpm graphql-codegen
- name: Run E2E tests
run: pnpm test-e2e
env:
CI: true
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: tests-results
path: tests/results/
retention-days: 7
- name: Get version
id: version
run: echo version="$REF_BRANCH" | sed -e 's/release-//g' >> $GITHUB_OUTPUT
- name: Notify Slack about success
if: ${{ success() }}
uses: slackapi/slack-github-action@v1
with:
channel-id: "C04HS607GMD"
payload: |
{
"unfurl_links": false,
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "✨ End to End tests succeeded for pre-release ${{ steps.version.outputs.version }}"
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "Open on GitHub",
"emoji": true
},
"value": "github",
"url": "https://github.com/swan-io/swan-partner-frontend/actions/runs/${{ github.run_id }}",
"action_id": "button-action"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.E2E_SLACK_BOT_TOKEN }}
- name: Notify Slack about failure
if: ${{ failure() }}
uses: slackapi/slack-github-action@v1
with:
channel-id: "C04HS607GMD"
payload: |
{
"unfurl_links": false,
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "💥 End to End tests failed for pre-release ${{ steps.version.outputs.version }}"
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "Open on GitHub",
"emoji": true
},
"value": "github",
"url": "https://github.com/swan-io/swan-partner-frontend/actions/runs/${{ github.run_id }}",
"action_id": "button-action"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.E2E_SLACK_BOT_TOKEN }}