Skip to content

Commit 33f3d77

Browse files
authored
test(e2e): Fix Chrome Beta channel (#1691)
1 parent 473067c commit 33f3d77

File tree

11 files changed

+144
-52
lines changed

11 files changed

+144
-52
lines changed

.changeset/dry-flies-add.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"fuels-wallet": patch
3+
---
4+
5+
### Changed
6+
7+
Updated nanoid to the latest versions for better performance and security.

.github/actions/e2e-tests-contracts/action.yaml

+2-17
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,9 @@ runs:
2929
NODE_OPTIONS: "--max-old-space-size=4096"
3030
NODE_ENV: test
3131

32-
- name: Cache Playwright browsers
33-
uses: actions/cache@v3
32+
- uses: ./.github/actions/setup-playwright
3433
with:
35-
path: ~/.cache/ms-playwright
36-
key: ${{ runner.os }}-playwright-${{ inputs.browser }}
37-
restore-keys: |
38-
${{ runner.os }}-playwright-
39-
40-
# E2E tests running with Playwright
41-
- name: Install Playwright Browsers
42-
shell: bash
43-
run: |
44-
pnpm playwright install --with-deps chromium chrome-beta --force
45-
46-
- name: Install Playwright Browsers (${{ inputs.browser }})
47-
if: inputs.browser != '' && inputs.browser != 'chromium'
48-
shell: bash
49-
run: npx playwright install --with-deps ${{ inputs.browser }}
34+
browser: ${{ inputs.browser }}
5035

5136
- name: Run E2E Contract Tests
5237
shell: bash
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: 'E2E Contract Tests'
2+
3+
inputs:
4+
providerUrl:
5+
description: Provider URL (e.g., https://testnet.fuel.network/v1/graphql)
6+
required: true
7+
masterMnemonic:
8+
description: Mnemonic of the master wallet that will fund the tests
9+
required: true
10+
genesisSecret:
11+
description: Secret of genesis to fund the master wallet
12+
required: false
13+
browser:
14+
description: Browser to run tests on (chromium, chrome-beta, or both)
15+
required: false
16+
default: chromium
17+
18+
runs:
19+
using: 'composite'
20+
steps:
21+
- name: Cache Playwright browsers
22+
uses: actions/cache@v3
23+
with:
24+
path: ~/.cache/ms-playwright
25+
key: ${{ runner.os }}-playwright-${{ inputs.browser }}
26+
restore-keys: |
27+
${{ runner.os }}-playwright-
28+
29+
- name: Install Playwright Browsers
30+
shell: bash
31+
continue-on-error: true
32+
run: |
33+
pnpm playwright install --with-deps ${{ inputs.browser }}

.github/workflows/pr-tests-e2e-contracts.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
providerUrl: "http://localhost:4000/v1/graphql"
4848
masterMnemonic: ${{ secrets.VITE_MASTER_WALLET_MNEMONIC }}
4949
genesisSecret: "0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298"
50+
browser: 'chromium'
5051

5152
- uses: actions/upload-artifact@v4
5253
if: always()
@@ -58,7 +59,7 @@ jobs:
5859
tests-e2e-contracts-beta:
5960
name: Test (Chrome Beta)
6061
runs-on: buildjet-8vcpu-ubuntu-2204
61-
timeout-minutes: 10
62+
timeout-minutes: 15
6263
continue-on-error: true
6364
steps:
6465
- uses: actions/checkout@v4

.github/workflows/pr-tests-e2e-crx-lock.yml

+1-8
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,7 @@ jobs:
3838
## with sourcemaps
3939
NODE_OPTIONS: "--max-old-space-size=4096"
4040

41-
- name: Install Playwright Browsers
42-
shell: bash
43-
run: |
44-
pnpm playwright install --with-deps chromium chrome-beta --force
45-
46-
# E2E tests running with Playwright
47-
- name: Install Playwright Browsers
48-
run: npx playwright install --with-deps chromium
41+
- uses: ./.github/actions/setup-playwright
4942

5043
- name: Run E2E Tests
5144
run: xvfb-run --auto-servernum -- pnpm test:e2e:crx-lock

.github/workflows/pr-tests-e2e.yml

+53-11
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ concurrency:
1111

1212
jobs:
1313
tests-e2e:
14-
name: Test
15-
timeout-minutes: 20
14+
name: Test (Chrome Stable)
15+
timeout-minutes: 15
1616
runs-on: buildjet-8vcpu-ubuntu-2204
1717
steps:
1818
- uses: actions/checkout@v3
@@ -38,14 +38,7 @@ jobs:
3838
## with sourcemaps
3939
NODE_OPTIONS: "--max-old-space-size=4096"
4040

41-
- name: Install Playwright Browsers
42-
shell: bash
43-
run: |
44-
pnpm playwright install --with-deps chromium chrome-beta --force
45-
46-
# E2E tests running with Playwright
47-
- name: Install Playwright Browsers
48-
run: npx playwright install --with-deps chromium
41+
- uses: ./.github/actions/setup-playwright
4942

5043
- name: Run E2E Tests
5144
run: xvfb-run --auto-servernum -- pnpm test:e2e
@@ -56,7 +49,56 @@ jobs:
5649
- uses: actions/upload-artifact@v4
5750
if: always()
5851
with:
59-
name: playwright-app-report
52+
name: playwright-app-report-stable
53+
path: packages/app/playwright-results
54+
retention-days: 30
55+
56+
- name: Stop Test Node
57+
run: pnpm node:clean
58+
59+
tests-e2e-beta:
60+
name: Test (Chrome Beta)
61+
timeout-minutes: 15
62+
runs-on: buildjet-8vcpu-ubuntu-2204
63+
continue-on-error: true
64+
steps:
65+
- uses: actions/checkout@v3
66+
- uses: FuelLabs/github-actions/setups/node@master
67+
with:
68+
node-version: 20.11.0
69+
pnpm-version: 9.5.0
70+
- uses: FuelLabs/github-actions/setups/docker@master
71+
with:
72+
username: ${{ github.repository_owner }}
73+
password: ${{ secrets.GITHUB_TOKEN }}
74+
75+
- name: Start Test Node
76+
run: pnpm node:up
77+
78+
- name: Generate .env
79+
run: cp packages/app/.env.example packages/app/.env
80+
81+
- name: Build Application
82+
run: pnpm build:app
83+
env:
84+
## increase node.js m memory limit for building
85+
## with sourcemaps
86+
NODE_OPTIONS: "--max-old-space-size=4096"
87+
88+
- uses: ./.github/actions/setup-playwright
89+
with:
90+
browser: 'chrome-beta'
91+
92+
- name: Run E2E Tests
93+
run: xvfb-run --auto-servernum -- pnpm test:e2e:beta
94+
timeout-minutes: 15
95+
env:
96+
NODE_ENV: test
97+
98+
- uses: actions/upload-artifact@v4
99+
if: always()
100+
with:
101+
name: playwright-app-report-beta
60102
path: packages/app/playwright-results
61103
retention-days: 30
62104

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
"test:ci": "turbo run test --parallel -- --ci --testLocationInResults --json --coverage",
5151
"test:clear": "pnpm -r exec jest --clearCache",
5252
"test:coverage": "turbo run test --parallel -- --coverage",
53-
"test:e2e": "NODE_ENV=test pnpm build:crx && playwright test --config=packages/app/playwright.config.ts",
53+
"test:e2e": "NODE_ENV=test pnpm build:crx && playwright test --config=packages/app/playwright.config.ts --project=chromium",
54+
"test:e2e:beta": "NODE_ENV=test pnpm build:crx && playwright test --config=packages/app/playwright.config.ts --project=chrome-beta",
5455
"test:e2e:crx-lock": "NODE_ENV=test pnpm build:crx && playwright test --config=packages/app/playwright.crx-lock.config.ts",
5556
"test:e2e:contracts": "NODE_ENV=test pnpm build:crx && pnpm --filter=@fuel-wallet/e2e-contract-tests test:e2e",
5657
"test:appfile": "pnpm --filter=fuels-wallet test --",
@@ -125,7 +126,8 @@
125126
"fuels": "0.96.1",
126127
"secp256k1@=5.0.0": ">=5.0.1",
127128
"elliptic@<6.6.0": ">=6.6.0",
128-
"cross-spawn@<7.0.5": ">=7.0.5"
129+
"cross-spawn@<7.0.5": ">=7.0.5",
130+
"nanoid@<3.3.8": "3.3.8"
129131
}
130132
}
131133
}

packages/app/playwright.config.ts

+23-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { join } from 'node:path';
2-
import { type PlaywrightTestConfig, defineConfig } from '@playwright/test';
2+
// biome-ignore lint/style/useNodejsImportProtocol: <explanation>
3+
import {
4+
type PlaywrightTestConfig,
5+
defineConfig,
6+
devices,
7+
} from '@playwright/test';
8+
import './load.envs';
39
import './load.envs.cts';
410

511
const PORT = process.env.PORT;
@@ -12,7 +18,7 @@ export const playwrightConfig: PlaywrightTestConfig = {
1218
testDir: 'playwright/',
1319
outputDir: 'playwright-results/',
1420
// stop on first failure
15-
maxFailures: IS_CI ? 1 : undefined,
21+
maxFailures: IS_CI ? 2 : undefined,
1622
reporter: [
1723
['list', { printSteps: true }],
1824
['html', { outputFolder: './playwright-html/' }],
@@ -31,7 +37,21 @@ export const playwrightConfig: PlaywrightTestConfig = {
3137
screenshot: 'only-on-failure',
3238
headless: false,
3339
},
34-
// ignore lock test because it takes too long and it will be tested in a separate config
40+
projects: [
41+
{
42+
name: 'chromium',
43+
use: {
44+
...devices['Desktop Chromium'],
45+
},
46+
},
47+
{
48+
name: 'chrome-beta',
49+
use: {
50+
channel: 'chrome-beta',
51+
...devices['Desktop Chrome'],
52+
},
53+
},
54+
],
3555
testIgnore: ['playwright/crx/lock.test.ts'],
3656
};
3757

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// biome-ignore lint/style/useNodejsImportProtocol: <explanation>
22
import { join } from 'path';
3-
import { defineConfig } from '@playwright/test';
3+
import { defineConfig, devices } from '@playwright/test';
44
import { playwrightConfig } from './playwright.config';
55

66
const __dirname = new URL('.', import.meta.url).pathname;
@@ -9,4 +9,12 @@ export default defineConfig({
99
...playwrightConfig,
1010
testMatch: join(__dirname, './playwright/crx/lock.test.ts'),
1111
testIgnore: undefined,
12+
projects: [
13+
{
14+
name: 'chromium',
15+
use: {
16+
...devices['Desktop Chromium'],
17+
},
18+
},
19+
],
1220
});

packages/e2e-contract-tests/playwright.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ const IS_CI = process.env.CI;
1010
const config: PlaywrightTestConfig = defineConfig({
1111
testDir: './playwright',
1212
outputDir: './playwright-results/',
13-
retries: IS_CI ? 1 : 0,
13+
retries: IS_CI ? 2 : 0,
1414
workers: 1,
15-
timeout: 60_000,
15+
timeout: 120_000,
1616
reporter: [['html', { printSteps: true }]],
1717
webServer: {
1818
command: `pnpm dev:e2e-contracts --port ${process.env.PORT}`,

pnpm-lock.yaml

+8-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)