Skip to content

Commit 2dd97a8

Browse files
authored
test: add playwright mobile config (#452)
- Added mobile WebKit steps to `playwright-local` config - Updated `main.yml` with playwright-mobile task. - Pinned the mobile job to `ubuntu-22.04` and kept Node 16 with Playwright 1.38.1, as newer combinations were failing due to WebKit dependency and OpenSSL issues. Note: Playwright-staging uses 1.56.1 version as it has its own package.json and so won't be affected by Node 16 but for playwright-local we need to update the project node version ">=18" so it's compatible with playwright 1.56.1 Mobile tests are now running successfully on GitHub actions
1 parent cb790a8 commit 2dd97a8

4 files changed

Lines changed: 96 additions & 22 deletions

File tree

.github/workflows/main.yml

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Commit checks
33
on: [push]
44

55
jobs:
6-
playwright:
7-
name: Playwright test
6+
playwright-chromium:
7+
name: Playwright Chrome test
88
timeout-minutes: 30
99
runs-on: ubuntu-latest
1010
steps:
@@ -34,8 +34,59 @@ jobs:
3434
- name: Install playwright browsers
3535
run: yarn playwright install chromium
3636

37-
- name: Run end-to-end tests
38-
run: yarn test:playwright-local:ci
37+
- name: Run Playwright Chrome Tests
38+
run: yarn test:playwright-local:ci:chromium
39+
continue-on-error: false
40+
env:
41+
NODE_ENV: development
42+
REACT_APP_ENDPOINT_URL: ${{ secrets.REACT_APP_ENDPOINT_URL }}
43+
FORCE_COLOR: 1
44+
45+
# Test run video was always captured, so this action uses "always()" condition
46+
- name: Upload videos
47+
uses: actions/upload-artifact@v4
48+
if: always()
49+
with:
50+
name: playwright-report
51+
path: playwright-report/
52+
retention-days: 3
53+
54+
playwright-mobile:
55+
name: Playwright Mobile test
56+
timeout-minutes: 30
57+
runs-on: ubuntu-22.04
58+
steps:
59+
- name: Checkout
60+
uses: actions/checkout@v3
61+
62+
- name: Set up Node
63+
uses: actions/setup-node@v3
64+
with:
65+
node-version: 16
66+
67+
- name: Restore packages cache
68+
uses: actions/cache@v3
69+
with:
70+
path: '**/node_modules'
71+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
72+
73+
- name: Install dependencies
74+
run: |
75+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
76+
yarn install --frozen-lockfile --ignore-scripts
77+
npm rebuild node-sass
78+
rm .npmrc
79+
env:
80+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
81+
82+
- name: Install WebKit system dependencies
83+
run: yarn playwright install-deps webkit
84+
85+
- name: Install playwright browsers (WebKit)
86+
run: yarn playwright install webkit
87+
88+
- name: Run Mobile WebKit Tests
89+
run: yarn test:playwright-local:ci:mobile
3990
continue-on-error: false
4091
env:
4192
NODE_ENV: development

package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,15 @@
3737
"start": "node scripts/start.js",
3838
"build": "node scripts/build.js",
3939
"lint": "eslint --color src",
40-
"test:playwright-local": "playwright test --config=./playwright-local/playwright-local.config.js --project=chromium",
41-
"test:playwright-local--h": "playwright test --config=./playwright-local/playwright-local.config.js --project=chromium --headed",
40+
"test:playwright-local:local": "playwright test --config=./playwright-local/playwright-local.config.js",
41+
"test:playwright-local:local:chromium": "playwright test --config=./playwright-local/playwright-local.config.js --project=chromium",
42+
"test:playwright-local:local:chromium--h": "playwright test --config=./playwright-local/playwright-local.config.js --project=chromium --headed",
43+
"test:playwright-local:local:mobile": "playwright test --config=./playwright-local/playwright-local.config.js --project=mobile-safari",
44+
"test:playwright-local:local:mobile--h": "playwright test --config=./playwright-local/playwright-local.config.js --project=mobile-safari --headed",
4245
"test:playwright-local:ci": "export NODE_ENV=development; start-server-and-test start http://localhost:3000 test:playwright-local",
43-
"test:playwright-local:local": "export NODE_ENV=development; start-server-and-test start http://localhost:3000 test:playwright-local",
46+
"test:playwright-local:ci:chromium": "export NODE_ENV=development; start-server-and-test start http://localhost:3000 test:playwright-local:local:chromium",
47+
"test:playwright-local:ci:mobile": "export NODE_ENV=development; start-server-and-test start http://localhost:3000 test:playwright-local:local:mobile",
48+
"test:playwright-local:local:chrome:mobile": "export NODE_ENV=development; start-server-and-test start http://localhost:3000 test:playwright-local:local",
4449
"snyk-protect": "snyk-protect",
4550
"prepublish": "yarn snyk-protect"
4651
},
@@ -54,7 +59,7 @@
5459
"@babel/runtime": "^7.11.2",
5560
"@comicrelief/data-models": "^1.15.4",
5661
"@comicrelief/test-utils": "^1.5.13",
57-
"@playwright/test": "1.33.0",
62+
"@playwright/test": "1.38.1",
5863
"babel-eslint": "^10.1.0",
5964
"babel-loader": "^8.1.0",
6065
"babel-preset-react-app": "^9.1.2",

playwright-local/playwright-local.config.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,26 @@ module.exports = defineConfig({
3434
projects: [
3535
{
3636
name: 'chromium',
37-
use: { ...devices['Desktop Chrome'] },
37+
use: {
38+
...devices['Desktop Chrome'],
39+
viewport: {
40+
width: 1300,
41+
height: 1000
42+
}
43+
}
3844
},
45+
{
46+
name: 'mobile-safari',
47+
use: { ...devices['iPhone 12'] },
48+
timeout: 360_000,
49+
expect: { timeout: 20_000 }
50+
}
3951
],
4052

4153
/* Run your local dev server before starting the tests */
4254
webServer: {
4355
command: 'yarn start',
44-
port: '3000',
56+
port: 3000,
4557
timeout: 120000,
4658
reuseExistingServer: true,
4759
},

yarn.lock

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,15 +1687,12 @@
16871687
mkdirp "^1.0.4"
16881688
rimraf "^3.0.2"
16891689

1690-
"@playwright/test@1.33.0":
1691-
version "1.33.0"
1692-
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.33.0.tgz#669ef859efb81b143dfc624eef99d1dd92a81b67"
1693-
integrity sha512-YunBa2mE7Hq4CfPkGzQRK916a4tuZoVx/EpLjeWlTVOnD4S2+fdaQZE0LJkbfhN5FTSKNLdcl7MoT5XB37bTkg==
1690+
"@playwright/test@1.38.1":
1691+
version "1.38.1"
1692+
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.38.1.tgz#8ef4263e355cd1d8ad7905d471d268e8acb82ed6"
1693+
integrity sha512-NqRp8XMwj3AK+zKLbZShl0r/9wKgzqI/527bkptKXomtuo+dOjU9NdMASQ8DNC9z9zLOMbG53T4eihYr3XR+BQ==
16941694
dependencies:
1695-
"@types/node" "*"
1696-
playwright-core "1.33.0"
1697-
optionalDependencies:
1698-
fsevents "2.3.2"
1695+
playwright "1.38.1"
16991696

17001697
"@reach/router@^1.2.1":
17011698
version "1.3.4"
@@ -12263,10 +12260,19 @@ pkg-up@^3.1.0:
1226312260
dependencies:
1226412261
find-up "^3.0.0"
1226512262

12266-
playwright-core@1.33.0:
12267-
version "1.33.0"
12268-
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.33.0.tgz#269efe29a927cd6d144d05f3c2d2f72bd72447a1"
12269-
integrity sha512-aizyPE1Cj62vAECdph1iaMILpT0WUDCq3E6rW6I+dleSbBoGbktvJtzS6VHkZ4DKNEOG9qJpiom/ZxO+S15LAw==
12263+
playwright-core@1.38.1:
12264+
version "1.38.1"
12265+
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.38.1.tgz#75a3c470aa9576b7d7c4e274de3d79977448ba08"
12266+
integrity sha512-tQqNFUKa3OfMf4b2jQ7aGLB8o9bS3bOY0yMEtldtC2+spf8QXG9zvXLTXUeRsoNuxEYMgLYR+NXfAa1rjKRcrg==
12267+
12268+
playwright@1.38.1:
12269+
version "1.38.1"
12270+
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.38.1.tgz#82ecd9bc4f4f64dbeee8a11c31793748e2528130"
12271+
integrity sha512-oRMSJmZrOu1FP5iu3UrCx8JEFRIMxLDM0c/3o4bpzU5Tz97BypefWf7TuTNPWeCe279TPal5RtPPZ+9lW/Qkow==
12272+
dependencies:
12273+
playwright-core "1.38.1"
12274+
optionalDependencies:
12275+
fsevents "2.3.2"
1227012276

1227112277
pngquant-bin@^5.0.0:
1227212278
version "5.0.2"

0 commit comments

Comments
 (0)