Skip to content

Commit 3b71c7a

Browse files
committed
fix: CI synpress issues
1 parent 603b7d7 commit 3b71c7a

File tree

2 files changed

+57
-6
lines changed

2 files changed

+57
-6
lines changed

.github/workflows/shared-bv.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989

9090
- name: Build Synpress wallet cache
9191
if: steps.synpress-cache.outputs.cache-hit != 'true'
92-
run: xvfb-run pnpm exec synpress e2e/setup --force && node e2e/scripts/syncWalletSetupCache.mjs
92+
run: xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24" pnpm exec synpress e2e/setup --force && node e2e/scripts/syncWalletSetupCache.mjs
9393

9494
- name: Warmup deployment
9595
run: |
@@ -106,7 +106,7 @@ jobs:
106106
- name: Run BV tests
107107
id: bv
108108
continue-on-error: true
109-
run: xvfb-run pnpm e2e:bv
109+
run: xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24" pnpm e2e:bv
110110
env:
111111
E2E_BASE_URL: ${{ inputs.deployment-url }}
112112

e2e/setup/wallet.setup.ts

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'node:path';
22
import { defineWalletSetup } from '@synthetixio/synpress';
3-
import { getExtensionId, MetaMask } from '@synthetixio/synpress/playwright';
3+
import { getExtensionId } from '@synthetixio/synpress/playwright';
44
import dotenv from 'dotenv';
55

66
dotenv.config({ path: path.resolve('e2e/.env') });
@@ -14,14 +14,65 @@ if (!SEED_PHRASE || !PASSWORD) {
1414
);
1515
}
1616

17+
/**
18+
* Fill the MetaMask 13.x SRP input via per-word fields.
19+
*
20+
* MM 13.x `SrpInputImport` starts as a single `<Textarea>` and transitions
21+
* to individual `<TextField>` inputs after the first word + Space. Synpress's
22+
* `.type(phrase)` races with the React DOM swap on CI/xvfb, leaving the
23+
* Continue button disabled.
24+
*
25+
* Approach: type the first word into the textarea, press Space to switch to
26+
* per-word mode, then `.fill()` each remaining word — exactly how MetaMask's
27+
* own Playwright tests handle it.
28+
*/
29+
async function fillSrpPerWord(
30+
page: import('@playwright/test').Page,
31+
seedPhrase: string,
32+
) {
33+
const words = seedPhrase.split(' ');
34+
35+
const textarea = page.getByTestId('srp-input-import__srp-note');
36+
await textarea.fill(words[0]);
37+
await textarea.press('Space');
38+
39+
for (let i = 1; i < words.length; i++) {
40+
const field = page.getByTestId(`import-srp__srp-word-${i}`);
41+
await field.fill(words[i]);
42+
if (i < words.length - 1) {
43+
await field.press('Space');
44+
}
45+
}
46+
}
47+
1748
const walletSetup = defineWalletSetup(PASSWORD, async (context, walletPage) => {
1849
const extensionId = await getExtensionId(context, 'MetaMask');
19-
const metamask = new MetaMask(context, walletPage, PASSWORD, extensionId);
50+
const homeUrl = `chrome-extension://${extensionId}/home.html`;
51+
52+
await walletPage
53+
.locator('[data-testid="onboarding-import-wallet"]')
54+
.click();
55+
await walletPage.getByTestId('onboarding-import-with-srp-button').click();
2056

21-
await metamask.importWallet(SEED_PHRASE);
57+
await fillSrpPerWord(walletPage, SEED_PHRASE);
2258

23-
const homeUrl = `chrome-extension://${extensionId}/home.html`;
59+
await walletPage.getByTestId('import-srp-confirm').click();
60+
61+
// Create password.
62+
await walletPage
63+
.locator('[data-testid="create-password-new-input"]')
64+
.fill(PASSWORD);
65+
await walletPage
66+
.locator('[data-testid="create-password-confirm-input"]')
67+
.fill(PASSWORD);
68+
await walletPage.locator('[data-testid="create-password-terms"]').click();
69+
await walletPage.locator('[data-testid="create-password-submit"]').click();
70+
71+
// Analytics opt-out.
72+
await walletPage.locator('#metametrics-opt-in').click();
73+
await walletPage.locator('[data-testid="metametrics-i-agree"]').click();
2474

75+
// Post-import: navigate home, unlock if needed, complete onboarding.
2576
await walletPage.goto(homeUrl);
2677
await walletPage.waitForTimeout(2000);
2778

0 commit comments

Comments
 (0)