Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

Commit 82de660

Browse files
committed
adding failed test due to no funds
1 parent 6f7964f commit 82de660

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

.github/workflows/e2e-tests.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ jobs:
2828
- name: Set E2E env variables
2929
working-directory: apps/web
3030
run: |
31-
echo "E2E_TEST_SEED_PHRASE=test test test test test test test test test test test junk" > .env
31+
echo "NODE_ENV=development" > .env
32+
echo "E2E_TEST_SEED_PHRASE=test test test test test test test test test test test junk" >> .env
3233
echo "E2E_TEST_FORK_URL=https://mainnet.base.org" >> .env
3334
echo "E2E_TEST_FORK_BLOCK_NUMBER=31397553" >> .env
3435
echo "E2E_TEST=true" >> .env
@@ -54,4 +55,4 @@ jobs:
5455
run: yarn build
5556

5657
- name: Run E2E tests
57-
run: xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24" yarn test:e2e
58+
run: xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24" yarn test:e2e registration-failed.spec.ts
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { test } from '../testFixture';
2+
import { expect } from '@playwright/test';
3+
import { prepareBasenameFlow, handleTransaction } from '../appSession';
4+
import { initiateRegistration } from '../basenameHelpers';
5+
import { ActionApprovalType } from '@coinbase/onchaintestkit';
6+
7+
test.describe('Basename Registration', () => {
8+
test('should fail registration when wallet has insufficient funds', async ({
9+
page,
10+
metamask,
11+
node,
12+
}) => {
13+
// Validate prerequisites
14+
if (!metamask) {
15+
throw new Error('MetaMask is not defined');
16+
}
17+
18+
if (!node) {
19+
throw new Error('Node fixture is not defined');
20+
}
21+
22+
// Common preparation steps (wallet needs funds to connect)
23+
const { mainPage } = await prepareBasenameFlow(page, metamask);
24+
25+
// Get the first default wallet address from Anvil (0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266)
26+
const walletAddress = (await node.getAccounts())[0];
27+
console.log('[test] Using default Anvil wallet address:', walletAddress);
28+
29+
// NOW set wallet balance to 0 after connection is established
30+
await node.setBalance(walletAddress, 0n);
31+
console.log('[test] Set wallet balance to 0');
32+
33+
// Attempt registration with no funds
34+
await initiateRegistration(mainPage);
35+
await page.waitForLoadState('networkidle');
36+
37+
// Approve the transaction (it should fail due to insufficient funds)
38+
await handleTransaction(metamask, ActionApprovalType.APPROVE);
39+
await page.waitForLoadState('networkidle');
40+
41+
// Look for failure message
42+
await expect(page.getByText(/failed|rejected|insufficient/i)).toBeVisible({ timeout: 30000 });
43+
});
44+
});

apps/web/playwright.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ export default defineConfig({
3939

4040
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
4141
trace: 'on-first-retry',
42+
43+
// Set environment variables for the browser context
44+
launchOptions: {
45+
env: {
46+
...process.env,
47+
NODE_ENV: 'development',
48+
},
49+
},
4250
},
4351

4452
/* Increase default expect timeout */
@@ -90,7 +98,7 @@ export default defineConfig({
9098
webServer: {
9199
command: 'cd ../.. && yarn workspace @app/web dev',
92100
url: baseURL,
93-
timeout: 60 * 1000,
101+
timeout: 120 * 1000,
94102
reuseExistingServer: !process.env.CI,
95103
},
96104
});

0 commit comments

Comments
 (0)