Skip to content

Conversation

@rin-st
Copy link
Member

@rin-st rin-st commented Sep 3, 2025

E2e tests for user registration + gh action.

Testing wallet: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266


To initialize playwright run in your nextjs folder (only first time)

yarn next:playwright-install

Build wallet cache. It couldn't install metamask extension (11.9.1) with latest versions of playwright/synpress so I used older versions, which use a bit older chromium and MM works fine with it

yarn next:cache-synpress

docs: https://docs.synpress.io/docs/setup-playwright


To run tests locally

yarn next:test
from root folder or yarn next:test-ui if you want to see and analyze how it looks

There's one bug though, when running yarn next:test you can meet the error Error: Cache for 08a20e3c7fc77e6ae298 does not exist. Create it first!. In that case you need to rename your cache folder name to that "does not exist" cache packages/nextjs/.cache-synpress/<cache-folder>. In my case it's 532f685e346606c2a803 to 08a20e3c7fc77e6ae298

Since the testing user is registered, to make the test work again you need to run remove user from db or run yarn db:seed

fixes: #313

@vercel
Copy link

vercel bot commented Sep 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
speedrunethereum-v2 Ready Ready Preview Comment Oct 21, 2025 9:17am

💡 Enable Vercel Agent with $100 free credit for automated AI reviews

@technophile-04
Copy link
Member

Working great! And seems like good first setup, Thanks so much rinat!! Just added a couple of comments

And regarding:

There's one bug though, when running yarn next:test you can meet the error Error: Cache for 08a20e3c7fc77e6ae298 does not exist. Create it first!. In that case you need to rename your cache folder name to that "does not exist" cache packages/nextjs/.cache-synpress/. In my case it's 532f685e346606c2a803 to 08a20e3c7fc77e6ae298

Tried diving deep into synpress and playwright and seems like synpress has some internal issues. Related to synpress-io/synpress#1103 and also found this repo by cyfrin where they suggest same thing https://github.com/Cyfrin/ts-tsender-ui-cu#e2e

Also it would be nice we add a test section in REAMDE with the following details and commands to run 🙌

@rin-st
Copy link
Member Author

rin-st commented Oct 6, 2025

Thanks! Added fixes and testing section to readme 33bd897

Copy link
Member

@technophile-04 technophile-04 left a comment

Choose a reason for hiding this comment

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

Thanks @rin-st!! Added a couple of small comments for README, but this seems almost ready to be merged like the structure looks good!

Some next steps might be:

  • Keeping an eye on synpress cache dir issue
  • Writing some more test for different workflows

Also like for some reason, while running test locally it stopeed working for me, it just get stuck at :

Image

And playwright is not able to input password in metamask popup extension, can you please try once?

Also another things which we can ignore is, we get this in CI:

Image

https://github.com/BuidlGuidl/SpeedRunEthereum-v2/actions/runs/18523813613/job/52789765905?pr=316

nothing to worry about, since test runs and passes as well! Just mentioning 🙌

@rin-st
Copy link
Member Author

rin-st commented Oct 15, 2025

And playwright is not able to input password in metamask popup extension, can you please try once?

For me it works as expected

Also another things which we can ignore is, we get this in CI:

There was a typo in NEXTAUTH vars, fixed! b652ffc

So currently we only have an issue with zerion api key, but I think we can skip it for now

Run xvfb-run yarn next:test
  xvfb-run yarn next:test
  shell: /usr/bin/bash -e {0}
  env:
    CI: true
    NODE_ENV: test
    POSTGRES_URL: ***localhost:5432/postgres
    NEXTAUTH_SECRET: 1234567890
    NEXTAUTH_URL: http://localhost:3000
    ZERION_API_KEY: test_api_key_for_ci
    PLAYWRIGHT_TEST_BASE_URL: http://localhost:3000

Running 1 test using 1 worker

[WebServer] Error checking side quest contractDeployed for user 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266: Error: Failed to fetch transactions from Zerion: Unauthorized
[WebServer]     at d (.next/server/app/api/users/[address]/update-onchain-data/route.js:1:669)
[WebServer]     at async Object.check (.next/server/app/api/users/[address]/update-onchain-data/route.js:1:1316)
[WebServer]     at async e (.next/server/app/api/users/[address]/update-onchain-data/route.js:1:10724)
[WebServer]     at async h (.next/server/app/api/users/[address]/update-onchain-data/route.js:1:11309)
[WebServer]     at async (.next/server/app/api/users/register/route.js:1:4173)
[WebServer] Error fetching side quests snapshot: Error: Failed to fetch transactions from Zerion: Unauthorized
[WebServer]     at d (.next/server/app/api/users/[address]/update-onchain-data/route.js:1:669)
[WebServer]     at async Object.check (.next/server/app/api/users/[address]/update-onchain-data/route.js:1:1316)
[WebServer]     at async e (.next/server/app/api/users/[address]/update-onchain-data/route.js:1:10724)
[WebServer]     at async h (.next/server/app/api/users/[address]/update-onchain-data/route.js:1:11309)
[WebServer]     at async (.next/server/app/api/users/register/route.js:1:4173)
[WebServer] Error in background processing for user 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266: Error: Failed to fetch transactions from Zerion: Unauthorized
[WebServer]     at d (.next/server/app/api/users/[address]/update-onchain-data/route.js:1:669)
[WebServer]     at async Object.check (.next/server/app/api/users/[address]/update-onchain-data/route.js:1:1316)
[WebServer]     at async e (.next/server/app/api/users/[address]/update-onchain-data/route.js:1:10724)
[WebServer]     at async h (.next/server/app/api/users/[address]/update-onchain-data/route.js:1:11309)
[WebServer]     at async (.next/server/app/api/users/register/route.js:1:4173)
  ✓  1 [chromium] › 01_user_onboarding.spec.ts:10:3 › User Onboarding Flow › Should complete full user onboarding flow: connect wallet, register user, and verify address display (19.9s)
Warning: packages/nextjs/[chromium] › 01_user_onboarding.spec.ts took 19.9s
Notice:   1 passed (25.7s)

  Slow test file: [chromium] › 01_user_onboarding.spec.ts (19.9s)
  Consider splitting slow test files to speed up parallel execution
  1 passed (25.7s)

@technophile-04
Copy link
Member

technophile-04 commented Oct 20, 2025

Ohh thanks @rin-st!! I just tried locally again and lol it started working for me as well (myabe I re-downloaded the playwright browser).

Also another last thing sorry 😅, I was talking with Carlos, and he observed it takes a lot of time for CI to run :

image

Maybe there is a better way to cache this Playwright browser install? Maybe we find something here?

microsoft/playwright#7249

Also here in their setup it took only 55 sec:
https://playwright.dev/docs/ci-intro#opening-the-workflows

@rin-st
Copy link
Member Author

rin-st commented Oct 20, 2025

Good point, added cache step 1c4be91

image

Action:
https://github.com/BuidlGuidl/SpeedRunEthereum-v2/actions/runs/18653348316/job/53177104497

Also as an option we can install only chromium browser since we disabled tests for others. But I think it's not necessary right now

Copy link
Member

@technophile-04 technophile-04 left a comment

Choose a reason for hiding this comment

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

microsoft/playwright#7249 (comment)

Like here they said, it not recommended to cache the browser...Shall we try with just Chromium and see how long it takes? (ideally, maybe we should run for diff types of browser) But I think we can go more robust in the future 🙌

If it still takes a very long time for only Chromium, then we could go with the cache. What do you think?

But this is already looking great! Thanks Rinat!!

@rin-st
Copy link
Member Author

rin-st commented Oct 21, 2025

Updated! Tried two times and lol it took only 7 and 10 sec

Copy link
Member

@technophile-04 technophile-04 left a comment

Choose a reason for hiding this comment

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

Updated! Tried two times and lol it took only 7 and 10 sec

NOICEE this is what we wanted! This is looking great! TYSM Rinat 🙏

@carletex
Copy link
Member

love this, thank you all! Let me play with it a bit before merging (maybe next week)

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.

Gh action for testing

4 participants