Repository navigation
tooling(oxlint): add eslint-plugin-playwright for e2e - #761
Merged
Merged
Conversation
Wire eslint-plugin-playwright@2.12.2 as an oxlint JS plugin scoped to apps/web tests/e2e. Enable the plugin's recommended ruleset as errors, plus prefer-native-locators and require-to-pass-timeout. Leave no-force-option on (ComfyUI turned it off for canvas workarounds we don't have). Replace waitForSelector with a web-first footer assertion, drop the conditional 404 throw, and put hooks in recommended order. Co-authored-by: adriangoh <adriangoh@open.gov.sg>
|
Cursor Agent can help with this pull request. Just |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Dependabot's playwright group should track @playwright/* only; lint plugin versions are not coupled to the browser driver catalog. Co-authored-by: adriangoh <adriangoh@open.gov.sg>
playwright.ts is shared config like e18e.ts, not the acme plugin. typecheck already covers it. Co-authored-by: adriangoh <adriangoh@open.gov.sg>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Runtime validation remains outstanding because Docker/testcontainers were unavailable, leaving the changed Playwright smoke locators and fixture cleanup ordering untested.
No open issues 🎉
1 file not reviewed
pnpm-lock.yaml: Generated file
What changed in this PR
Adds eslint-plugin-playwright to the Oxlint configuration for Playwright end-to-end tests, updates workspace dependencies, and refactors existing E2E code to satisfy the new rules.
Changes:
- Adds and configures the Playwright plugin with recommended rules and selected locator and timeout rules.
- Scopes Playwright linting to
apps/web/tests/e2e/**and updates workspace dependency metadata. - Replaces brittle smoke-test waits and conditional logic with native locators and web-first assertions.
- Reorders E2E fixture hooks to follow Playwright conventions.
| File | Description |
|---|---|
| tooling/oxlint/playwright.ts | Defines the Playwright JS plugin and configured E2E rule set. |
| tooling/oxlint/package.json | Exports the Playwright configuration and adds its development dependency. |
| pnpm-workspace.yaml | Adds the Playwright plugin version to the workspace dependency catalog. |
| pnpm-lock.yaml | Records the Playwright plugin dependency graph and related lockfile updates. |
| apps/web/tests/e2e/smoke.e2e.ts | Updates smoke tests to use native locators, web-first assertions, and valid test titles. |
| apps/web/tests/e2e/app-fixture.ts | Reorders Playwright lifecycle hooks to satisfy the configured hook-order rules. |
| apps/web/package.json | Adds the Playwright plugin dependency for the web workspace. |
| apps/web/oxlint.config.ts | Scopes Playwright linting to the web app's E2E test files. |
Review effort: Lite
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
eslint-plugin-playwright@2.12.2as an oxlint JS plugin, scoped to Playwright e2e (apps/web/tests/e2e/**) only. Ultracite has no Playwright preset, so this follows the same JS-plugin pattern as e18e / react-doctor.Compared overlay: ComfyUI_frontend#11136.
Recommended (as errors)
The plugin's
recommendedconfig is 37playwright/*rules. Several ship as warn; this kit promotes all of them to error, plus recommended'sno-empty-pattern: offwhich was already on the e2e override for Playwright fixtures.missing-playwright-await,no-focused-test,no-networkidle,no-standalone-expect,no-unnecessary-assertions,no-unsafe-references,no-unused-locators,no-wait-for-navigation,prefer-web-first-assertions,valid-describe-callback,valid-expect,valid-expect-in-promise,valid-test-tags,valid-titleconsistent-spacing-between-blocks,expect-expect,max-nested-describe,no-conditional-expect,no-conditional-in-test,no-duplicate-hooks,no-duplicate-slow,no-element-handle,no-eval,no-force-option,no-identical-title,no-nested-step,no-page-pause,no-skipped-test,no-useless-await,no-useless-not,no-wait-for-selector,no-wait-for-timeout,prefer-hooks-in-order,prefer-hooks-on-top,prefer-locator,prefer-to-have-count,prefer-to-have-lengthExtras vs ComfyUI
prefer-native-locatorspage.waitForSelector(\text=${APP_NAME}`); the native equivalent isgetByRole('contentinfo').getByText(...). Same rule would catchpage.locator('[role="button"]')on the landing CTA instead ofgetByRole('button', { name: 'Explore StarterApp' })`.require-to-pass-timeouttoPass()defaults to timeout 0 and retries until the test timeout. Current e2e does not use it, but auth / eventual-UI tests will. Forcing{ timeout }fails fast instead of hanging CI. Cheap: only fires when you writetoPass().no-force-option: off{ force: true }left for a follow-up){ force: true }. Turning it off would hide a real smell (force-clicking a hidden React Aria overlay).Vitest anti-slop / unit-test overrides are unchanged.
jsPluginslives on thetests/e2e/**override, so Vitest files do not load Playwright rules (probed: a__tests__file withwaitForSelector+locator('[role="button"]')produced onlyvitest/prefer-importing-vitest-globals, noplaywright/*).E2E fixes
apps/web/tests/e2e/smoke.e2e.tswaitForSelector(\text=${APP_NAME}`)→expect(page.getByRole('contentinfo').getByText(APP_NAME)).toBeVisible()(no-wait-for-selector+expect-expect+ native locators). Footer is the env-driven app name; the header link is hardcoded"Starter Kit"`.if (res === null) throw(no-conditional-in-test) in favor ofexpect(response).not.toBeNull()thenexpect(response?.status()).toBe(404).'test 404'→'unknown route returns 404'(valid-titlerejects atestprefix).test as e2eTest→testso the plugin recognizes the test identifier.apps/web/tests/e2e/app-fixture.ts:beforeAll/afterEach/afterAll(prefer-hooks-in-order). Behavior unchanged.No dummy assertions, no fake timeouts, no
{ force: true }. No newoxlint-disablecomments.Commands run
pnpm --filter @acme/oxlint-config lint(now includesplaywright.ts)pnpm --filter @acme/oxlint-config typecheckpnpm --filter @acme/web lint(0 warnings / 0 errors)pnpm --filter @acme/web typecheckpnpm lint— 16/16, 0 warnings / 0 errorspnpm lint:ws(sherif) — cleanpnpm --filter @acme/logging test:ci— 2/2 passedNot run: Playwright e2e (
pnpm --filter @acme/web e2e) — needs Docker/testcontainers on this VM. Apps/web unit tests likewise.Remaining suppressions
None added. Pre-existing e2e override still offs
no-empty-pattern(Playwright fixtures) andreact-hooks/rules-of-hooks.tests/e2e/setup/db-setup.tsstill haseslint/no-await-in-loopfor sequential migrations.