-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
feat(test): add playwright tests #7749
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Lighthouse Results
|
|
Successful Playwright Tests: https://github.com/nodejs/nodejs.org/actions/runs/15032077849/job/42246679839?pr=7749 |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #7749 +/- ##
==========================================
+ Coverage 74.92% 75.30% +0.37%
==========================================
Files 97 96 -1
Lines 7860 7847 -13
Branches 198 192 -6
==========================================
+ Hits 5889 5909 +20
+ Misses 1970 1937 -33
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Marking as ready to review as this is ready to review–although feel free to suggest the addition of more tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces Playwright E2E tests to verify core website functionality including theme toggling, language selection, search, and navigation responsiveness. Key changes include the addition of a comprehensive test suite in apps/site/tests/e2e/general-behavior.spec.ts, a dedicated Playwright configuration file (apps/site/playwright.config.ts) for managing test execution, and workflow integration via a new GitHub Actions workflow for Playwright testing.
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/site/tests/e2e/general-behavior.spec.ts | Adds E2E tests for theme, language, search, and navigation checks. |
| apps/site/playwright.config.ts | Defines Playwright configuration for test settings and projects. |
| apps/site/package.json | Updates scripts and dependencies to include Playwright testing. |
| .github/workflows/playwright.yml | Introduces a GitHub Actions workflow to run Playwright tests. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
apps/site/tests/e2e/general-behavior.spec.ts:35
- Consider extracting the common getTheme function into a shared helper to avoid duplication across theme-related tests.
const getTheme = () => page.evaluate(() => document.documentElement.dataset.theme);
dario-piotrowicz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good! thanks for this! 🫶
I feel like setting the thing up is good enough to merge, other tests if needed can always be incrementally added 🙂 |
Is the test reports uploading correctly configured? 🤔 https://github.com/nodejs/nodejs.org/actions/runs/15032077849/job/42246679839?pr=7749#step:12:12 |
It looks like the |
AugustinMauroy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe upped contributing.md
|
a test would be to verify that when the language is changed, the texts actually update and match what's defined in the JSON (for example, in the navigation or the footer) (#7394). That's why the need for end-to-end testing arose. |
dario-piotrowicz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 😄
(as I mentioned I would not stress on having everything tested in this first PR)
ovflowd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
AugustinMauroy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WOW so cool to have that thanks Aviv !
|
LGTM |
Signed-off-by: Aviv Keller <[email protected]>
|
@dario-piotrowicz @bmuenzenmeyer You both made comments on the use of Test IDs vs Roles / Locators. I've made some changes, could you take a look and see if it's to your liking? |
Signed-off-by: Aviv Keller <[email protected]>
|
Thanks for the ping @avivkeller 🙂 The changes still look good to me, I mentioned test-ids as my personal preference and asked if people were on board with that, @bmuenzenmeyer seems to prefer the a11y approach which is quite common and established as well, and I am totally happy with that as well (although my personal preference remains test-ids1), so I am really happy with whatever you think it's best, I don't want by any means be a blocker here 🙂 PS: one small thing, if you decide to go one way or the other I would probably try to go all-in and not use test-ids sometimes and a11y locators others (see theme vs nav as Brian mentioned). Footnotes
|
|
@ovflowd Chromatic does support Playwright, but it takes some extra GitHub Actions logic, so I'd prefer to do it in a follow up, if you don't mind. Once we see this working on PRs, I'll open a follow-up to integrate this with the Chromatic workflow. |
|
I think i've resolved all concerns, so merge when ready :-) |
Description
This PR,
when complete,will add Playwright E2E tests to our workflows.general-behavior.spec.ts(The general behavior, such as navigation, search, theme, language, etc)Validation
Related Issues
Fixes #7395
Check List
pnpm formatto ensure the code follows the style guide.pnpm testto check if all tests are passing.pnpm buildto check if the website builds without errors.