Skip to content

Conversation

@pettinarip
Copy link
Member

@pettinarip pettinarip commented May 30, 2025

Summary

This PR adds E2E testing infrastructure with Playwright and Chromatic:

  • Playwright E2E tests for Home and Find Wallet pages (desktop + mobile)
  • Page Object Model refactor for maintainable test architecture
  • Global tests for search functionality and error handling
  • Chromatic integration for visual regression testing
  • Complete testing documentation and developer guide
  • GitHub Actions CI workflow integration
  • Component updates with data-testid attributes for reliable testing

@netlify
Copy link

netlify bot commented May 30, 2025

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 4ce2caf
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/6874cf168174130008d75138
😎 Deploy Preview https://deploy-preview-15550--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 50 (🟢 up 2 from production)
Accessibility: 96 (🟢 up 2 from production)
Best Practices: 91 (🔴 down 1 from production)
SEO: 99 (no change from production)
PWA: 59 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added dependencies 📦 Changes related to project dependencies tooling 🔧 Changes related to tooling of the project labels May 30, 2025
@github-actions github-actions bot added the config ⚙️ Changes to configuration files label Jun 3, 2025
@pettinarip pettinarip force-pushed the e2e-tests branch 2 times, most recently from 79dd2a5 to 3b5d3fb Compare June 5, 2025 17:33
@gitguardian
Copy link

gitguardian bot commented Jun 5, 2025

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@Aldekein
Copy link
Member

Aldekein commented Jun 6, 2025

I've read https://www.chromatic.com/docs/faq/find-project-token/ but still not sure is this a secret revealed in code:

projectToken: chpt_7691c1ff8d1f07d

@pettinarip
Copy link
Member Author

I've read https://www.chromatic.com/docs/faq/find-project-token/ but still not sure is this a secret revealed in code:

projectToken: chpt_7691c1ff8d1f07d

Hey @Aldekein this is a testing token and low risk one. Will reset it once we are done.

@pettinarip pettinarip force-pushed the e2e-tests branch 2 times, most recently from d0b55b5 to fc09ae2 Compare June 6, 2025 16:04
@pettinarip pettinarip changed the title e2e tests playwright e2e tests playwright & chromatic Jun 9, 2025
@pettinarip pettinarip force-pushed the e2e-tests branch 2 times, most recently from 323358f to 4b16f78 Compare June 9, 2025 16:17
@pettinarip pettinarip marked this pull request as ready for review June 9, 2025 16:17
push:
branches: [master, staging, e2e-tests] # TODO: remove e2e-tests (testing branch)
pull_request:
branches: [master, staging, e2e-tests] # TODO: remove e2e-tests (testing branch)
Copy link
Member Author

Choose a reason for hiding this comment

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

TODO before merging

@wackerow
Copy link
Member

Hey @pettinarip was looking through action logs https://github.com/ethereum/ethereum-org-website/actions/runs/15740734598/job/44365122681 and looks like there are a bunch of errors during the "Run E2E Tests on Netlify URL" step of the playwright action .

Error:   4) [Mobile Safari] › tests/e2e/home.spec.ts:27:7 › Home Page › main navigation - desktop ─────────
    Test timeout of 30000ms exceeded while running "beforeEach" hook.

All looking similar to that... the chromatic action appears to handle things fine; do you know if we need to worry about those?

@pettinarip
Copy link
Member Author

Hey @pettinarip was looking through action logs https://github.com/ethereum/ethereum-org-website/actions/runs/15740734598/job/44365122681 and looks like there are a bunch of errors during the "Run E2E Tests on Netlify URL" step of the playwright action .

Error:   4) [Mobile Safari] › tests/e2e/home.spec.ts:27:7 › Home Page › main navigation - desktop ─────────
    Test timeout of 30000ms exceeded while running "beforeEach" hook.

All looking similar to that... the chromatic action appears to handle things fine; do you know if we need to worry about those?

Yeah, I've seen those errors before too. My understanding is that tests like this fail for other reasons like network issues, long responses, etc. In those cases, Playwright retries the same test. If it fails again (or reaches your retry limit), it will throw an error. If it succeeds on retry, it passes the test but tags it as "flaky". You can see the summary at the bottom of the logs:

[74/72] (retries) [Mobile Safari] › tests/e2e/home.spec.ts:35:7 › Home Page › navigation menu - mobile
[75/72] (retries) [Mobile Safari] › tests/e2e/whitepaper.spec.ts:11:7 › Whitepaper Page › whitepaper PDF link has correct href
[76/72] (retries) [Mobile Safari] › tests/e2e/whitepaper.spec.ts:19:7 › Whitepaper Page › whitepaper PDF is accessible and served as PDF
  4 flaky
    [webkit] › tests/e2e/global.spec.ts:68:9 › Global › Internationalization › switches to Chinese ─
    [webkit] › tests/e2e/global.spec.ts:90:9 › Global › RTL Support › home page RTL visual snapshot 
    [webkit] › tests/e2e/global.spec.ts:96:9 › Global › RTL Support › nav flips logo and search button when switching to RTL via language picker 
    [Mobile Safari] › tests/e2e/home.spec.ts:27:7 › Home Page › main navigation - desktop ──────────
  7 skipped
  61 passed (6.3m)

I wouldn't worry too much since they seem pretty random (depends on external things). I assume we will have flaky tests in future runs.

Having said that, I'll try to make the tests more robust and see if we can reduce the amount of flaky tests.

Copy link
Member

@wackerow wackerow left a comment

Choose a reason for hiding this comment

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

image

Nice! @pettinarip this is looking great.. just gave it a run locally and overall the setup seems to be working well... it did report a handful of "failed" tests here, none "flaky", so posted a screenshot, but not sure that would need to block this.

@pettinarip
Copy link
Member Author

Nice! @pettinarip this is looking great.. just gave it a run locally and overall the setup seems to be working well... it did report a handful of "failed" tests here, none "flaky", so posted a screenshot, but not sure that would need to block this.

uhmm would like to understand what is going on there. Could you paste the error messages for those tests? I assume that you were running pnpm dev in a different terminal. Happy to chat/test this async to make it easier.

@wackerow
Copy link
Member

wackerow commented Jul 3, 2025

@pettinarip They appear to be time-outs:

Error: Timed out 10000ms waiting for expect(locator).toBeVisible()

And yes, pnpm dev, not a production build, so that's probably causing the latency. I'll try again today with a production build

@wackerow
Copy link
Member

wackerow commented Jul 3, 2025

@pettinarip Okay so my issues appear related to env vars, not just being dev and timing out because it's slower. For example I had NEXT_PUBLIC_BUILD_LOCALES=en set, which broke the languages switching and RTL checks which require access to Chinese and Arabic.

image

Search may be related to Algolia keys? Added a set that I had, but they may be old, since it's still not working; I normally don't have that enabled locally. Without those keys any page will crash if I try to access the search modal locally, so maybe that's a legit test failure?

Commented out NEXT_PUBLIC_BUILD_LOCALES and ran pnpm dev with pnpm test:e2e in another terminal and the only problems were the above search issues.

@pettinarip
Copy link
Member Author

@pettinarip Okay so my issues appear related to env vars, not just being dev and timing out because it's slower. For example I had NEXT_PUBLIC_BUILD_LOCALES=en set, which broke the languages switching and RTL checks which require access to Chinese and Arabic.

Search may be related to Algolia keys? Added a set that I had, but they may be old, since it's still not working; I normally don't have that enabled locally. Without those keys any page will crash if I try to access the search modal locally, so maybe that's a legit test failure?

Commented out NEXT_PUBLIC_BUILD_LOCALES and ran pnpm dev with pnpm test:e2e in another terminal and the only problems were the above search issues.

Yes. To clarify, given that these are e2e tests, you should run the dev mode as similar as production as possible. This means that you would need to build all languages and have api keys for all the 3rd party services since we are testing those integrations as well.

@pettinarip pettinarip merged commit 2b4b6ec into dev Jul 14, 2025
11 checks passed
@pettinarip pettinarip deleted the e2e-tests branch July 14, 2025 10:26
This was referenced Jul 16, 2025
@agualis
Copy link

agualis commented Jul 21, 2025

Hey @pettinarip Once the playwright setup is merged, I can add tests for the rainbow kit wallet connection flows in the start page. Would that be interesting?

Ofc! yeah, thanks for bringing that up. It would be good to test the /start page. I'll let you know when it's been merged. I'm currently doing a code refactor but it should be merged this week.

Hey @pettinarip, just created this PR to address this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config ⚙️ Changes to configuration files dependencies 📦 Changes related to project dependencies documentation 📖 Change or add documentation tooling 🔧 Changes related to tooling of the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants