-
Notifications
You must be signed in to change notification settings - Fork 1.4k
162 lines (147 loc) · 5.79 KB
/
ui_tests.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
156
157
158
159
160
161
162
name: UI Tests
on:
workflow_call:
inputs:
branch:
description: 'The branch to use'
default: 'main'
required: false
type: string
base-url:
description: 'The AppKit lab url'
default: 'http://localhost:3000/'
required: false
type: string
wallet-url:
description: 'The wallet url'
default: 'https://react-wallet.walletconnect.com/'
required: false
type: string
command:
description: 'The test command to run'
default: 'playwright:test'
required: false
type: string
skip-playwright-webserver:
description: 'Skip setting up a local test server'
default: false
required: false
type: boolean
secure-site-url:
description: 'Secure site SDK url'
default: 'https://secure.walletconnect.org/sdk'
required: false
type: string
secrets:
NEXT_PUBLIC_PROJECT_ID:
required: true
RELEASE_TOKEN_V2:
required: true
TFC_INFRA_TOKEN:
required: true
TESTS_NEXTAUTH_SECRET:
required: false
TESTS_MAILSAC_API_KEY:
required: false
TESTS_SOCIAL_EMAIL:
required: false
TESTS_SOCIAL_PASSWORD:
required: false
jobs:
ui_tests:
name: 'Playwright Tests'
runs-on: [self-hosted, aws-ecs-16cpu-64mem-30m]
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5]
shardTotal: [5]
timeout-minutes: 20
steps:
# Possibly this helps with GitHub-hosted runner network issues, but it's not confirmed
# It's not supported in self-hosted runners, however, so commenting it out for now
# - name: Tune GitHub-hosted runner network
# uses: smorimoto/tune-github-hosted-runner-network@v1
- name: checkout
uses: actions/checkout@v4
with:
repository: reown-com/appkit
ref: ${{ inputs.branch }}
- uses: pnpm/action-setup@v4
name: Install pnpm
- name: setup-node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'
# - name: Get installed Playwright version
# id: playwright-version
# run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').packages['apps/laboratory']['devDependencies']['@playwright/test'])")" >> $GITHUB_ENV
# This cache causes weird errors on retry runs when using the self-hosted runners, disabling for now
# - name: Cache playwright binaries
# uses: actions/cache@v4
# id: playwright-cache
# with:
# path: |
# ~/.cache/ms-playwright
# key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}-${{ hashFiles('apps/laboratory/tests/shared/constants/devices.ts') }}
- name: Install dependencies
run: pnpm install
- name: build packages and lab
run: pnpm build:laboratory
env:
NEXT_PUBLIC_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_PROJECT_ID }}
NEXTAUTH_SECRET: ${{ secrets.TESTS_NEXTAUTH_SECRET }}
MAILSAC_API_KEY: ${{ secrets.TESTS_MAILSAC_API_KEY }}
NEXT_PUBLIC_SECURE_SITE_SDK_URL: ${{ inputs.secure-site-url }}
SOCIAL_TEST_EMAIL: ${{ secrets.TESTS_SOCIAL_EMAIL }}
SOCIAL_TEST_PASSWORD: ${{ secrets.TESTS_SOCIAL_PASSWORD }}
- name: Install Playwright Browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
working-directory: ./apps/laboratory/
run: pnpm playwright:install
# - name: Build MetaMask wallet cache
# working-directory: ./apps/laboratory/
# run: xvfb-run pnpm synpress
# - name: Run MetaMask Playwright tests (headful)
# working-directory: ./apps/laboratory/
# env:
# BASE_URL: ${{ inputs.base-url }}
# WALLET_URL: ${{ inputs.wallet-url }}
# NEXT_PUBLIC_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_PROJECT_ID }}
# SKIP_PLAYWRIGHT_WEBSERVER: ${{ inputs.skip-playwright-webserver }}
# NEXTAUTH_SECRET: ${{ secrets.TESTS_NEXTAUTH_SECRET }}
# MAILSAC_API_KEY: ${{ secrets.TESTS_MAILSEC_API_KEY }}
# NEXT_PUBLIC_SECURE_SITE_SDK_URL: ${{ inputs.secure-site-url }}
# SOCIAL_TEST_EMAIL: ${{ secrets.TESTS_SOCIAL_EMAIL }}
# SOCIAL_TEST_PASSWORD: ${{ secrets.TESTS_SOCIAL_PASSWORD }}
# CI: true
# run: xvfb-run pnpm playwright:test:metamask
- name: Run Playwright tests
env:
BASE_URL: ${{ inputs.base-url }}
WALLET_URL: ${{ inputs.wallet-url }}
NEXT_PUBLIC_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_PROJECT_ID }}
SKIP_PLAYWRIGHT_WEBSERVER: ${{ inputs.skip-playwright-webserver }}
NEXTAUTH_SECRET: ${{ secrets.TESTS_NEXTAUTH_SECRET }}
MAILSAC_API_KEY: ${{ secrets.TESTS_MAILSAC_API_KEY }}
NEXT_PUBLIC_SECURE_SITE_SDK_URL: ${{ inputs.secure-site-url }}
SOCIAL_TEST_EMAIL: ${{ secrets.TESTS_SOCIAL_EMAIL }}
SOCIAL_TEST_PASSWORD: ${{ secrets.TESTS_SOCIAL_PASSWORD }}
CI: true
working-directory: ./apps/laboratory/
run: pnpm ${{ inputs.command }} --shard=${{ matrix.shard }}/${{ matrix.shardTotal }}
- name: Run canary with minimal environment config
env:
# DO NOT MODIFY THIS. If you are required to add variables here without adding
# them to the rs-relay repo it will cause alarms.
NEXT_PUBLIC_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_PROJECT_ID }}
CI: true
working-directory: ./apps/laboratory/
run: pnpm playwright:test:canary
- uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report-${{ matrix.shard }}
path: ./apps/laboratory/playwright-report/
retention-days: 7