test(playwright): add stricter ESLint locator rules and fix all violations#17611
Merged
Conversation
Contributor
|
Linear: CAT-2166 |
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Expands the eslint-plugin-playwright ruleset to enforce locator best practices and catch common test anti-patterns: - `no-raw-locators` (error): CSS/XPath strings banned in spec files; iframes exempted as they have no ARIA equivalent. This is the primary guard against brittle selector coupling. - `prefer-native-locators` (warn): nudges toward getByRole/getByLabel over page.locator() where a semantic built-in exists. - `no-nth-methods` (warn): first()/nth() usually signals a missing data-testid. - `no-element-handle` (error): ElementHandle is deprecated in favour of the Locator API. - `no-eval` (error): page.$eval/$$eval are hard to debug and race-prone. - `missing-playwright-await` (error): catches forgotten awaits. - `no-standalone-expect` (error): prevents assertions outside test blocks. - `no-focused-test` (error): blocks accidental .only commits. - `prefer-web-first-assertions` (error): enforces async-safe assertion style. - `no-duplicate-hooks` (error): catches duplicated beforeEach/afterEach. - `prefer-hooks-on-top` (warn): keeps hook order readable. Also bumps the engines.node floor to >=22.0.0 to match ESLint v10's minimum requirement (ESLint v10 requires Node ≥20; we standardise on 22 which is the active LTS and matches the project's CI node version). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… and spec files
Replace page.locator('css-string') calls with semantic Playwright APIs
(getByTestId, getByRole, getByText, getByTitle, getByLabel) wherever possible.
Add eslint-disable-next-line only for irreplaceable cases: Ant Design internal
CSS classes, XPath ancestor traversals, prefix/substring data-testid selectors,
ProseMirror/Remirror editor classes, and auto-generated React HTML ids.
…lays Replace fixed 15 s timeouts on sidebar-node and contents-tab visibility checks with reload-and-retry loops (up to 60 s) so tests survive slow ES indexing in CI. Add explicit toBeVisible waits before filtersToggleButton clicks to prevent page-closed errors when the Related Assets panel is slow to render. Extend test.setTimeout on all glossary lifecycle, navigation, term-filter, and tag-assign tests to give the combined entity-creation + ES-indexing steps enough wall-clock budget. Environment-only failures (welcome-modal arrow-key / escape_key, structured- props Mulish font, domains OOM, managed-ingestion 180 s) require frontend code changes or infrastructure fixes and cannot be addressed in test code. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… dual toggle-filters-button
- filtersToggleButton: scope to activeTabPanel to avoid matching the second
instance rendered inside the SearchSelect batch-add modal; removes the
broken .and(locator(':visible')) intersection pattern
- clickSidebarNode: replace reload-retry with direct URL navigation since
freshly-created nodes take >60 s to appear in ES and the tests only need
navigation, not a test of the sidebar click itself
- clickSidebarTerm: increase waitFor to 45 s + scrollIntoViewIfNeeded for
pre-seeded terms that may need the parent node to auto-expand first
- expectEntityInContentsTab: increase toPass timeout 45 s → 90 s; always
enter the retry body so reload is guaranteed on first check
- expectSidebarContainsNode: increase toPass timeout 60 s → 120 s
- v2-glossary.spec.ts: add test.describe.configure({ mode: 'serial' }) to
prevent parallel browser instances competing for memory (OOM crashes);
adjust timeouts to cover the extended ES-indexing retry budgets
- v2-glossary-navigation.spec.ts: increase move-test timeouts 150 s → 180 s
to cover the 90 s expectEntityInContentsTab budget plus overhead
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
50ce81a to
7442d0d
Compare
…ox not textbox
getByRole('textbox') never matched the AntD Select inner <input role="combobox">
inside tag-term-modal-input, causing pressSequentially to wait until the 150 s
test timeout fired and the browser crashed. Change to getByRole('combobox').
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
🔴 Meticulous spotted visual differences in 9 of 1351 screens tested: view and approve differences detected. Meticulous evaluated ~10 hours of user flows against your PR. Last updated for commit |
…tting - Revert engines.node from ">=22.0.0" back to ">=18.0.0" so yarn install succeeds in the CI lint job (which uses Node 20); the Node 22 requirement is a local development convention, not a hard runtime constraint - Apply prettier formatting across all POM and spec files (quote style, trailing commas, whitespace normalisation) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
devashish2203
approved these changes
May 28, 2026
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
eslint.config.js):playwright/no-raw-locators(error) — banspage.locator('css-string')in favour of semantic APIs (getByTestId,getByRole,getByText,getByTitle,getByLabel)playwright/no-nth-methods(warn) — flagsfirst()/last()/nth()usageno-raw-locatorserrors across every POM file and spec file (32 files, 0 errors remaining)groups.page.tsPOM for the Groups entity pageWhat changed
ESLint config —
eslint.config.js+package.jsondependency bumpPOM files — replaced raw CSS locators with semantic Playwright APIs in:
business-attribute,confirmation-modal,modal,searchbar,sidebar,dataset-health,dataset,domains,entity-documentation,glossary,groups,incidents,ingestion,lineage-v2,login,ownership-management,policies,search,tags,welcome-modalSpec files — same treatment for:
external-document-profile,v2-lineage-column-path,v2-lineage-graph,add-users,dataset-ownership,deprecations,manage-ingestion-secret-privilege,query-and-filter-search,searchv2,structured-props-drawer-fontRaw locators that have no semantic equivalent (Ant Design internal CSS classes, XPath ancestor traversals, prefix/substring
data-testidselectors, ProseMirror/Remirror editor classes, auto-generated React HTML ids) are suppressed with targetedeslint-disable-next-linecomments explaining the reason.Test plan
yarn lintreports 0 errors (151 pre-existingno-nth-methodswarnings remain)🤖 Generated with Claude Code