Skip to content

Commit 1eec992

Browse files
committed
feat: add e2e test for guardian
1 parent 9883172 commit 1eec992

File tree

12 files changed

+523
-9
lines changed

12 files changed

+523
-9
lines changed

examples/demo-app/project.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@
120120
},
121121
"dependsOn": ["e2e:setup"]
122122
},
123+
"e2e:guardian": {
124+
"executor": "nx:run-commands",
125+
"options": {
126+
"cwd": "examples/demo-app",
127+
"command": "PW_TEST_HTML_REPORT_OPEN=never playwright test tests/guardian.spec.ts --config=playwright-erc4337.config.ts"
128+
},
129+
"dependsOn": ["e2e:setup:erc4337"]
130+
},
123131
"e2e:demo-only": {
124132
"executor": "nx:run-commands",
125133
"options": {

packages/auth-server/components/account-recovery/AddRecoveryMethodModal.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<template #trigger>
1111
<slot name="trigger">
1212
<Button
13+
data-testid="add-recovery-method-modal"
1314
class="w-full lg:w-auto"
1415
type="primary"
1516
>
@@ -44,6 +45,7 @@
4445
<div class="flex flex-col gap-5 w-full max-w-xs">
4546
<Button
4647
class="w-full"
48+
data-testid="add-guardian-method"
4749
@click="selectMethod('guardian')"
4850
>
4951
Recover with Guardian

packages/auth-server/components/account-recovery/guardian-flow/Step1.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
<ZkButton
77
type="primary"
88
class="w-full md:max-w-48 mt-4"
9+
data-testid="continue-recovery-method"
910
@click="emit('next')"
1011
>
1112
Continue
1213
</ZkButton>
1314
<ZkButton
1415
type="secondary"
1516
class="w-full md:max-w-48"
17+
data-testid="back-recovery-method"
1618
@click="$emit('back')"
1719
>
1820
Back

packages/auth-server/components/account-recovery/guardian-flow/Step2.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
v-model="guardianAddress"
77
:error="!!addressError"
88
:messages="addressError ? [addressError] : undefined"
9+
data-testid="guardian-address-input"
910
placeholder="0x..."
1011
class="w-full text-left"
1112
@input="validateAddress"

packages/auth-server/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"zod": "^3.24.1"
4545
},
4646
"devDependencies": {
47+
"@playwright/test": "^1.48.2",
4748
"@walletconnect/types": "^2.19.1",
4849
"tailwindcss": "^3.4.14",
4950
"vite-plugin-top-level-await": "^1.6.0",

packages/auth-server/pages/dashboard/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
<div class="flex flex-col items-end">
1414
<ZkTooltip :label="copyLabel">
1515
<button
16+
data-testid="account-address"
17+
:data-address="address"
1618
class="text-lg leading-tight font-medium text-neutral-900 dark:text-neutral-100 cursor-pointer border-b border-dashed border-neutral-300 dark:border-neutral-600 hover:border-neutral-500 dark:hover:border-neutral-400 hover:scale-105 transition-all duration-200"
1719
@click="copyContent"
1820
>

packages/auth-server/pages/dashboard/settings/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
>
1616
<template #trigger>
1717
<Button
18+
data-testid="add-recovery-method"
1819
class="bg-yellow-500 hover:bg-yellow-600 text-white dark:bg-yellow-600 dark:hover:bg-yellow-700 focus:bg-yellow-600 active:bg-yellow-700 disabled:bg-yellow-500 disabled:text-yellow-300 disabled:dark:bg-yellow-600 disabled:dark:hover:bg-yellow-700 dark:focus:bg-yellow-700 dark:active:bg-yellow-800 focus:ring-yellow-400 dark:focus:ring-yellow-800"
1920
>
2021
Add Recovery Method
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { defineConfig, devices } from "@playwright/test";
2+
3+
/**
4+
* See https://playwright.dev/docs/test-configuration.
5+
*/
6+
export default defineConfig({
7+
testDir: "./tests",
8+
fullyParallel: false,
9+
forbidOnly: !!process.env.CI,
10+
retries: process.env.CI ? 2 : 0,
11+
workers: 1,
12+
reporter: "html",
13+
use: {
14+
baseURL: "http://localhost:3002",
15+
trace: "on-first-retry",
16+
video: "retain-on-failure",
17+
},
18+
19+
projects: [
20+
{
21+
name: "chromium",
22+
use: { ...devices["Desktop Chrome"] },
23+
},
24+
],
25+
26+
webServer: [
27+
{
28+
command: "PORT=3004 pnpm nx dev auth-server-api",
29+
url: "http://localhost:3004/api/health",
30+
reuseExistingServer: !process.env.CI,
31+
stdout: "pipe",
32+
stderr: "pipe",
33+
timeout: 180_000,
34+
},
35+
{
36+
command:
37+
"NUXT_PUBLIC_AUTH_SERVER_API_URL=http://localhost:3004 PORT=3002 pnpm nx dev:no-deploy auth-server",
38+
url: "http://localhost:3002",
39+
reuseExistingServer: !process.env.CI,
40+
stdout: "pipe",
41+
stderr: "pipe",
42+
timeout: 180_000,
43+
},
44+
],
45+
});

packages/auth-server/project.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@
9393
"command": "firebase hosting:channel:deploy --only zksync-auth-server-staging --project zksync-auth-server-staging"
9494
},
9595
"dependsOn": ["build"]
96+
},
97+
"e2e:guardian": {
98+
"executor": "nx:run-commands",
99+
"options": {
100+
"cwd": "packages/auth-server",
101+
"command": "PW_TEST_HTML_REPORT_OPEN=never pnpm exec playwright test guardian.spec.ts --config playwright.config.ts"
102+
},
103+
"dependsOn": ["build:local"]
96104
}
97105
}
98106
}

packages/auth-server/stores/local-node.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"rpcUrl": "http://localhost:8545",
33
"chainId": 1337,
44
"deployer": "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720",
5-
"eoaValidator": "0xEc5AB17Cc35221cdF54EaEb0868eA82d4D75D9Bf",
6-
"sessionValidator": "0xd512108c249cC5ec5370491AD916Be31bb88Dad2",
7-
"webauthnValidator": "0xadF4aCF92F0A1398d50402Db551feb92b1125DAb",
8-
"guardianExecutor": "0x0efdDbB35e9BBc8c762E5B4a0f627210b6c9A721",
9-
"accountImplementation": "0xd7400e73bA36388c71C850aC96288E390bd22Ebe",
10-
"beacon": "0xbe38809914b552f295cD3e8dF2e77b3DA69cBC8b",
11-
"factory": "0xb11632A56608Bad85562FaE6f1AF269d1fE9e8e6",
12-
"testPaymaster": "0x287E8b17ce85B451a906EA8A179212e5a24680A3",
13-
"mockPaymaster": "0x287E8b17ce85B451a906EA8A179212e5a24680A3",
5+
"eoaValidator": "0xAbD153e1B30a097BF4c879a5A697f3871f0588dF",
6+
"sessionValidator": "0xe6813478658C365eEea08bA153C94Ac9A8Bf0127",
7+
"webauthnValidator": "0xCA5DC003586daBB4D1B6b3deA4BF87505d2ba095",
8+
"guardianExecutor": "0xdf51f895F96B36cc570f44b94E5E06eDaaf21363",
9+
"accountImplementation": "0x47CbC0c32636ff246d9c6eBD7bc97460037d024c",
10+
"beacon": "0x32F59763c4b7F385DFC1DBB07742DaD4eeEccdb2",
11+
"factory": "0xB4129cEBD85bDEcdD775f539Ec8387619a0f1FAC",
12+
"testPaymaster": "0x8b9264B8cEfC4037Ab3Fa29B14cA37a45a6Ae4c2",
13+
"mockPaymaster": "0x8b9264B8cEfC4037Ab3Fa29B14cA37a45a6Ae4c2",
1414
"entryPoint": "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
1515
"bundlerUrl": "http://localhost:4337"
1616
}

0 commit comments

Comments
 (0)