CONSOLE-5245: Install and configure eslint-plugin-playwright for e2e directory#16433
CONSOLE-5245: Install and configure eslint-plugin-playwright for e2e directory#16433fsgreco wants to merge 1 commit into
Conversation
|
@fsgreco: This pull request references CONSOLE-5245 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
📝 WalkthroughWalkthroughThis change refactors ESLint configuration for end-to-end tests by migrating from inline rule overrides to a dedicated Playwright-aware configuration setup. The Suggested reviewers
🚥 Pre-merge checks | ✅ 12✅ Passed checks (12 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/verified by @stefanonardo |
|
@stefanonardo: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
Cragsmann
left a comment
There was a problem hiding this comment.
Can you add please "testing-library/prefer-screen-queries": "off" it throws falls errors
2e66bb2 to
86afff2
Compare
Or exclude e2e from the testing-library override in testing-library-tests.js: |
no problem to add it, although just for curiosity are you running lint from a clean state? ( |
oh I get it why it happens now, yes I would go with this one indeed, so we have a better separation of concerns, right? |
…te dependencies Add eslint-plugin-playwright to eslint-plugin-console and create a dedicated .eslintrc.js for e2e/ to scope Playwright rules away from the rest of the frontend codebase. Setup files (auth, cluster, teardown) obtain overrides for rules that don't apply to non-assertion setup logic. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
86afff2 to
d86412c
Compare
|
@Cragsmann I've applied the solution suggested by @cajieh, the falls errors should be gone, can you confirm? |
|
/lgtm |
|
@stefanonardo: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/label px-approved |
|
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Cragsmann, fsgreco, logonoff, stefanonardo, vikram-raj The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@fsgreco: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/hold frontend job failure is legitimate |
Analysis:
CONSOLE-5245 — The e2e directory had no Playwright-specific ESLint rules. Playwright best practices (no force
clicks, no hardcoded waits, expect assertions) were not enforced.
Solution description:
eslint-plugin-playwrightineslint-plugin-consoleand register a newplaywrightconfige2e/.eslintrc.jsextendingplugin:console/playwright, replacing the override block previously in the root.eslintrc.jse2e/setup/**files where three rules produce false positives:expect-expect,no-skipped-test, andno-conditional-in-test— setupfiles handle auth/cluster config, not test assertions
base-page.tsfor two intentional rule violations (no-force-option,no-wait-for-timeout)Test setup:
Test cases:
yarn eslint e2e/runs with no errorse2e/only — no impact on the rest of the frontendAdditional info:
Follows the same pattern as the Cypress integration tests (
packages/integration-tests/.eslintrc), which have their own ESLint config scoped to their testenvironment, setup file add few overrides only for
setup/**/*.tsfiles only:playwright/expect-expect— setup files perform auth/config, not assertionsplaywright/no-skipped-test— conditional skips based on environment are intentional in setupplaywright/no-conditional-in-test— setup/teardown logic legitimately branches on cluster stateSummary by CodeRabbit