Skip to content

adding e2e tests for basenames registration flow #2489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 1, 2025

Conversation

Aushveen
Copy link
Collaborator

@Aushveen Aushveen commented Jun 26, 2025

This is a E2E test using the newly released npm package @coinbase/onchaintestkit

This tests the registration flow, specifically:

  1. A successful registration
  2. A failed one if the user rejects the transaction
  3. A basic wallet connect test
  4. A failed one if user wallet lacks funds

This is built with playwright, anvil ETH nodes, and foundry

Copy link

vercel bot commented Jun 26, 2025

@Aushveen is attempting to deploy a commit to the Coinbase Team on Vercel.

A member of the Team first needs to authorize it.

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Jun 26, 2025

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@Aushveen Aushveen force-pushed the BaseWeb/RegistrationFlow/E2ETests branch from 1f77c99 to cf6083e Compare June 26, 2025 22:00
@Aushveen Aushveen force-pushed the BaseWeb/RegistrationFlow/E2ETests branch from cf6083e to 6e8fd7a Compare June 27, 2025 15:47
@Aushveen Aushveen force-pushed the BaseWeb/RegistrationFlow/E2ETests branch 2 times, most recently from 7c12e05 to 2715d2e Compare June 27, 2025 16:37
@Aushveen Aushveen force-pushed the BaseWeb/RegistrationFlow/E2ETests branch from 2715d2e to 23b5df9 Compare June 27, 2025 17:34
@Aushveen Aushveen force-pushed the BaseWeb/RegistrationFlow/E2ETests branch 15 times, most recently from d0e1863 to 324f177 Compare June 28, 2025 03:12
@cb-heimdall
Copy link
Collaborator

Review Error for timothywangdev-cb @ 2025-06-30 18:44:13 UTC
User must have write permissions to review

@timothywangdev-cb
Copy link

LGTM

Comment on lines +6 to +8
if (!metamask) {
throw new Error('Metamask is not defined');
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does every test we write need this? Is there a way we can make onchaintestkit perform this check for us?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is required. Since OCTK only provides the components for the tests, it’s not possible to do it directly. Users have to create their wallet through wallet manager

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be an issue anyways since when you import test from testFixture, it has the metamask set up there.

Comment on lines +3 to +7
on:
push:
branches: [master]
pull_request:
branches: [master]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this make it required to pass before we can merge?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that's the goal right. It is an e2e test to make sure the registry flow works as intended. If anything changes, such as the UI components, then the E2E tests should be changed accordingly.


---

## Running the tests locally
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could there also be instructions on how to run this with headless mode disabled so that you can see the test running?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved, check lines below

Comment on lines 80 to 81
Aushveen Vimalathas
:no_bell: Today at 10:51 AM
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Aushveen Vimalathas
:no_bell: Today at 10:51 AM

Comment on lines 86 to 108
Error: Timed out waiting 60000ms from config.webServer.
```

Try re-running the E2E workflow a couple more times
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What causes this to happen?

Copy link
Collaborator Author

@Aushveen Aushveen Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it happens in the workflows, loading the web browser/ui in the workflow takes a super long time. I will double this value

// Complete registration
await initiateRegistration(mainPage);
await page.waitForLoadState('networkidle');
await handleTransaction(metamask);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check that the balance of the test account was decremented by the expected cost?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not at the moment, we could add a method though that will get the balance of the wallet in the future upgrades to onchaintestkit

The way the approve transaction works is that it only gets approved if the wallet has sufficient funds.

@Aushveen Aushveen force-pushed the BaseWeb/RegistrationFlow/E2ETests branch 4 times, most recently from 3871f74 to 82de660 Compare July 1, 2025 01:03
@Aushveen Aushveen force-pushed the BaseWeb/RegistrationFlow/E2ETests branch from 9238fa5 to b83c422 Compare July 1, 2025 01:27
@Aushveen Aushveen force-pushed the BaseWeb/RegistrationFlow/E2ETests branch from 34d20ea to d0feaa3 Compare July 1, 2025 02:14
@Aushveen Aushveen force-pushed the BaseWeb/RegistrationFlow/E2ETests branch from 9381e16 to ecf4f3c Compare July 1, 2025 03:07
@Aushveen Aushveen force-pushed the BaseWeb/RegistrationFlow/E2ETests branch from 4661202 to 9b203b9 Compare July 1, 2025 03:59
@Aushveen Aushveen force-pushed the BaseWeb/RegistrationFlow/E2ETests branch from 9b203b9 to 4a1fd11 Compare July 1, 2025 04:24
Comment on lines 45 to 47
if (process.env.E2E_TEST !== 'true') {
logger.error('error getting proofs for baseEthHolders', error);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to prevent needing to do this? It would be very easy to forget to add this check when writing future API routes.

Maybe the check can be added in the error function itself? https://github.com/base/web/blob/master/apps/web/src/utils/logger.ts#L80

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Copy link

vercel bot commented Jul 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
base-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 1, 2025 6:27pm

@Aushveen Aushveen merged commit f9d3ea3 into base:master Jul 1, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants