-
Notifications
You must be signed in to change notification settings - Fork 17
61 lines (59 loc) · 2.09 KB
/
e2e.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
name: End-to-end Test
# Controls when the workflow will run
on:
workflow_dispatch:
workflow_call:
outputs:
e2e_result:
description: "Outcome of the e2e suite, enum<success, failure, skipped, cancelled>"
value: ${{ jobs.playwright-run.outputs.outcome }}
jobs:
set_environment:
outputs:
current_env: ${{ steps.set-environment.outputs.current_env }}
runs-on: ubuntu-latest
steps:
- id: set-environment
run: |
echo "Running on branch ${{ github.ref }}"
if [ "${{ github.ref }}" = "refs/heads/master" ]; then
echo "current_env=production" >> $GITHUB_OUTPUT
else
echo "current_env=staging" >> $GITHUB_OUTPUT
fi
playwright-run:
runs-on: ubuntu-latest
needs: [set_environment]
environment:
name: ${{ needs.set_environment.outputs.current_env }}
outputs:
outcome: ${{ steps.playwright.outcome }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Write gmail credentials file
env:
GMAIL_CREDENTIALS: ${{ secrets.GMAIL_CREDENTIALS }}
GMAIL_TOKEN: ${{ secrets.GMAIL_TOKEN }}
run: |
echo $GMAIL_CREDENTIALS > credentials.json
echo $GMAIL_TOKEN > gmail_token.json
working-directory: e2e
- run: npm ci
working-directory: e2e
- run: npm run test
id: playwright
env:
API_URL: ${{ github.ref == 'refs/heads/master' && 'https://api.postman.gov.sg' || 'https://api-staging.postman.gov.sg' }}
DASHBOARD_URL: ${{ github.ref == 'refs/heads/master' && 'https://postman.gov.sg' || 'https://staging.postman.gov.sg' }}
API_KEY: ${{ secrets.E2E_API_KEY }}
TWILIO_ACC_SID: ${{ secrets.E2E_TWILIO_ACC_SID }}
TWILIO_AUTH_TOKEN: ${{ secrets.E2E_TWILIO_AUTH_TOKEN }}
SMS_NUMBER: "+6582410222"
MAILBOX: [email protected]
working-directory: e2e
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: e2e/playwright-report/