You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(playwright): make a timed-out test say where it hung - #33217
61% of merge-queue flakes (75 of 121 sampled first-attempt failures across 15 runs) carry exactly one error:
Test timeout of 60000ms exceeded.
No file, no line, no locator, no snippet. results.json — the artifact the merge-queue tooling reads — serialises a timed-out result with steps: [], so the only way to find what actually hung is to download a multi-megabyte blob artifact and parse report.jsonl by hand. Nobody does, which is why these get retried instead of fixed.
The change
Two things, previously split across a stack of PRs and now landed together.
1. Timed-out tests say where they hung.
The information exists in-process on TestResult.steps; it is lost at the reporter boundary. TimeoutDiagnosticsReporter finds the innermost step still in flight and prepends its title, source location and call log, so the same failure now reads:
Timed out in step: Click getByTestId('request-description') (54962ms)
at e2e/Pages/Example.spec.ts:77
Call log:
- waiting for getByTestId('request-description')
Test timeout of 60000ms exceeded.
It must be listed before json/blob/html; the config comment records why.
Four things that were actively misleading a reader of those reports:
authenticateAdminPage raced two waitFor calls. The loser cannot be cancelled, so it stayed pending and reported itself as a ~58s waiting for locator('input[name="email"]') failure — the first and longest error in every unrelated timeout. Polls for the landing state instead.
waitForResponse resolves on any response, 404 included.visitEntityPageByFqn and the Database/DatabaseSchema/ApiCollection navigations now assert the status they synchronised on, so a missing entity fails there instead of 55s later at an unrelated locator.
tokenStorage could hang forever.getFromIndexedDB resolved from onupgradeneeded without creating the object store; onsuccess then threw NotFoundErrorinside the event handler, which neither rejects the promise nor is caught by the surrounding try/catch. saveToIndexedDB had the same shape on the write side. Both now check objectStoreNames before opening a transaction.
ignoreClosedTarget matched only one of two wordings.route.fetch() hands back an APIResponse owned by the context; reading it after the context is gone throws Response has been disposed, not has been closed.
PW_TRACE is plumbed through so a targeted rerun can trace the failing attempt — trace: 'on-first-retry' records the retry, which is the attempt that passed, so the one that failed has never had a trace.
2. Sign-in goes through a fixture, not the form.
UserClass.login() drives nine UI interactions — navigate to /signin, wait, fill, Tab, fill, click, await the response, await the redirect, dismiss the getting-started modal, collapse the sidebar — on the critical path of ~290 tests that are not about signing in. Every one is a step that can time out.
signInViaApi establishes the same session with one POST to the same /api/v1/auth/login, writing the token where the app reads it. Both paths run the identical completeSignIn, so they differ in how the session was established and nothing else.
support/fixtures/isolatedUser.ts adds isolatedUserPage (one account per worker) and freshUserPage (one per test). Both create and delete the account through Playwright's fixture teardown, which removes the beforeAll/afterAll bookkeeping that is the merge queue's number-one flake: beforeAll runs once per group dispatched to a worker, not once per worker, so an array it pushes into ends up holding deleted accounts.
Seeding writes into a route-stubbed blank document rather than booting the app just to obtain a storage origin — worth ~1700 app boots a run.
prefer-role-page-fixture enforces it at error. The six remaining login() call sites carry a justified disable: Pages/Login.spec.ts, where the form is the subject, and Features/AppMode/**, where the route the app lands on after sign-in is the assertion and signInViaApi would mask it by finishing on /my-data.
Verification
e2e/Features/TokenStorage.spec.ts fails without the IndexedDB fix (it hangs to the timeout) and passes in ~1.2s with it. Its last case is a negative control: it asserts a state captured withoutindexedDB: true does not carry the token, so the suite cannot pass by silently exercising the localStorage fallback.
Run against http://127.0.0.1:30085/ — the base URL the AUT nightly uses — all 5 cases pass. Against a plain-http non-loopback origin the secure-context case fails deliberately, by design, rather than degrading to the fallback in silence.
This PR cannot be merged until the following are addressed on its linked issue:
No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.
Maintainers can bypass this check by adding the skip-pr-checks label.
This PR touched specs or UI source that changed the source→spec routing map. I regenerated .github/playwright/impact-map.generated.json and pushed the diff to this branch.
What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing getByTestId strings. Hand-authored routing in impact-map.json always wins on conflict.
What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit:
python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit # or a separate commit
* `http://something.test/` passes while exercising nothing but the fallback —
The reason will be displayed to describe this comment to others. Learn more.
Good catch to check — it doesn't break in AUT, and I verified it rather than reasoned about it.
Why it holds. AUT runs Playwright against http://127.0.0.1:30085/ — automate-upgrade-tests/scripts/kind/run-playwright.sh:18 sets base_url, passed through as PLAYWRIGHT_TEST_BASE_URL at line 104. Loopback is a secure context, so 'serviceWorker' in navigator is true and IndexedDB is genuinely the path under test.
Proven both ways. The spec stubs every request, so it needs no backend and runs in ~1s:
PLAYWRIGHT_TEST_BASE_URL
result
http://127.0.0.1:30085/ (AUT's actual URL)
secure-context case fails: hasServiceWorker: false
So the only way this file fails is a plain-http non-loopback origin, which AUT is not. That failure is deliberate: without the first case, such an origin would silently exercise the localStorage fallback and the whole file would pass while testing nothing. The last case is the matching negative control — it asserts a state captured withoutindexedDB: true does not carry the token.
Confirmed on real AUT runs. Three full AUT kind / both 1.12.14 ➡ flake/2-timeout-diagnostics runs (36543476432, 36561720357, 36580399048). TokenStorage.spec.ts does not appear in the failures of any of them, in either the MySQL or PostgreSQL lane. Failure counts landed at 18 / 22 / 21 against 19 for the ➡ main run, and of the 9 tests failing in all three of ours, 8 also fail on the ➡ main run that carries none of this branch's code.
Leaving this thread open for you to close, since it's your question — happy to add anything that would make it a clearer yes.
61% of merge-queue flakes (75 of 121 sampled first-attempt failures across 15
runs) carry exactly one error:
Test timeout of 60000ms exceeded.
No file, no line, no locator, no snippet. `results.json` — the artifact the
merge-queue tooling reads — serialises a timed-out result with `steps: []`, so
the only way to find what actually hung is to download a multi-megabyte blob
artifact and parse `report.jsonl` by hand. Nobody does, which is why these get
retried instead of fixed.
The information exists in-process on `TestResult.steps`; it is lost at the
reporter boundary. `TimeoutDiagnosticsReporter` finds the innermost step still in
flight and prepends its title, source location and Playwright call log to the
error, so the same failure now reads:
Timed out in step: Click getByTestId('request-description') (54962ms)
at e2e/Pages/Example.spec.ts:77
Call log:
- waiting for getByTestId('request-description')
It must be listed before json/blob/html, which the config comment records.
Also here, four things that were actively misleading a reader of those reports:
- `authenticateAdminPage` raced two `waitFor` calls. The loser cannot be
cancelled, so it stayed pending and reported itself as a ~58s
`waiting for locator('#email')` failure — the first and longest error in every
unrelated timeout. Poll for the landing state instead.
This supersedes the `Promise.any` hunk from #33412, which reached the same
symptom from the other side: `any()` consumes the loser's late rejection, but
the losing `waitFor` still runs to its full timeout against a page that may
have navigated or closed, and if neither element ever appears the failure is
an `AggregateError` with no indication of what was being waited for. A poll
ends when it returns, and names both states it gave up on.
- `waitForResponse` resolves on any response, 404 included. `visitEntityPageByFqn`
and the Database/DatabaseSchema/ApiCollection navigations now assert the status
they synchronised on, so a missing entity fails there instead of 55s later.
- `tokenStorage.getFromIndexedDB` resolved from `onupgradeneeded` without creating
the object store; `onsuccess` then threw NotFoundError *inside the event
handler*, which neither rejects the promise nor is caught by the surrounding
try/catch. getToken/setToken hung until the test timed out on any context where
the store did not exist yet. Guarded, with a regression spec that fails in 47.6s
without the fix and passes in 2.1s with it.
- `ignoreClosedTarget` matched "has been closed", but `route.fetch()` hands back
an APIResponse owned by the context and reading it after the context is gone
throws "Response has been disposed". A page that closed while its boot config
was in flight failed the test through that handler. Match both.
`PW_TRACE` is plumbed through so a targeted rerun can trace the *failing*
attempt: `trace: 'on-first-retry'` records the retry, which is the attempt that
passed, so the one that failed has never had a trace.
* refactor(playwright): one place that builds a signed-in page
`e2e/fixtures/pages.ts` and `support/fixtures/userPages.ts` were near-identical
copies of the same role-page fixtures, and had already drifted — one had
`viewOnlyPage`, the other did not. `userPages.ts` now owns every role page and
all the construction logic; `pages.ts` adds only the `page` -> `adminPage` alias,
which is the one behaviour that genuinely differs between them.
Adds the missing sanctioned path for a test that needs its *own* account, which
is why specs kept hand-rolling one. `support/fixtures/isolatedUser.ts` exposes
`isolatedUserPage` (one account per worker, fresh page per test) and
`freshUserPage` (a new account per test). Both create and delete the account in
fixture teardown, so the beforeAll + array + afterAll shape that produces the
merge queue's number-one flake cannot be written by accident.
Adds `UserClass.signIn()`, which establishes the same session as `login()` with
one POST instead of nine UI interactions. `login()` drives the form: navigate to
/signin, wait, fill, Tab, fill, click, await the response, await the redirect,
dismiss the getting-started dialog, collapse the sidebar. The suite does that
~290 times and none of it is what the tests are testing. Both paths funnel
through the same `completeSignIn()` — conditional reads off, dialog dismissed,
sidebar collapsed — so they differ in how the session was established and nothing
else. That matters: the sidebar collapse changes page geometry, so a sign-in path
that skipped it would move every locator in the spec.
The mechanism is assembled from pieces already load-bearing here: the login
request is the one `createAdminApiContext` makes (base64 password, matching the
UI's `btoa`), and `setToken` is the exact inverse of the `getToken` that
`auth.setup.ts` reads back after a real sign-in. `signInViaApi` asserts the app
shell rendered, so a session the app refuses fails there, naming the user,
instead of timing out somewhere unrelated.
`auth.setup.ts` and `performUserLogin` now take that path. Setup drops from 50.4s
to 25.6s and still writes all eight storage states. `RoleFixtureSessions.spec.ts`
asserts each of those eight yields a signed-in page — the contract every lane
depends on, which previously failed far from its cause when broken.
* fix(playwright): keep the OM_SESSION cookie when signing in via the API
`signInViaApi` posted the login from a standalone `request.newContext()`. The
server sets `OM_SESSION` on that response, so the cookie landed on a throwaway
context and never reached the browser — every storage state `auth.setup.ts`
wrote carried `i18next`, `__session` and `versionFetchTime`, but no session
cookie.
The app does not notice, because it authenticates from the token in IndexedDB.
That is exactly what made this invisible locally: every spec passed, including
the eight-role fixture check. CI does notice — `PW_PRESEEDED_STATE` rotates the
cached auth state through
`.github/scripts/rotate_playwright_auth_state.py`, which replaces that cookie
and raises
ValueError: Playwright auth state has no OM_SESSION cookie
before a single test runs. It took out 34 of 37 shards in "Setup Openmetadata
Test Environment".
Post through `page.context().request` instead, which shares its cookie jar with
the browser, so `Set-Cookie` is kept.
Route every capture in `auth.setup.ts` through `saveStorageState`, which refuses
to write a state without the cookie. A sign-in path that drops it now fails at
the point that produced it, naming the cause, instead of surfacing as a shard
that dies in environment setup.
Verified from a wiped `playwright/.auth`: all eight states carry OM_SESSION,
setup runs in 26.5s, and RoleFixtureSessions passes 8/8.
* refactor(playwright): sign in through a fixture, not the form (#33219)
* refactor(playwright): sign in through a fixture, not the form
Migrates every spec off `UserClass.login()` and promotes
`openmetadata-playwright/prefer-role-page-fixture` to `error` with no
suppressions.
275 call sites across 83 files become `signIn()`. Both paths funnel through the
same `completeSignIn()`, so the rewrite changes how the session was established
and nothing else — which the type checker confirms: a receiver that was not a
`UserClass` would not compile, and the playwright tsc count is unchanged.
Nine specs keep `login()` because the sign-in flow is what they test —
`Pages/Login.spec.ts`, `Features/OnlineUsers.spec.ts`, `Flow/Tour.spec.ts` and
the `Features/AppMode` specs. Each call carries a justified disable naming its
reason, rather than a blanket entry in a baseline file.
`performUserLogin` is no longer flagged: it signs in through the API and owns its
page, context and teardown, so it is a sanctioned path. The rule targets
*authenticating as* a bespoke user, not *creating* one — `new UserClass()` for an
owner, reviewer or assignee is ordinary test data and is untouched.
`eslint-suppressions.json` is byte-identical to main. The rule was written to be
enforceable only once the corpus was clean, which is what this change makes true.
Validated against a live server: ~320 tests across the migrated specs, the role
fixtures, and the eight storage states, with no failure attributable to the
migration.
* perf(playwright): stop booting the app just to get a storage origin
`signInViaApi` navigated to `/` before writing the token, because IndexedDB and
localStorage are origin-scoped and there is nowhere to write until the page owns
a document on the app's origin. That navigation boots the whole SPA — bundle,
bootstrap requests, render — and is then thrown away by the navigation to
/my-data two lines later.
CI measured the cost once every spec started signing in this way. App boots per
UI scenario, which had been flat at 2.23 across three consecutive main runs and
stayed at 2.23 and 2.24 on the two PRs beneath this one, went to 2.59 here:
12445 boots for 4814 scenarios, roughly 1700 boots spent on nothing.
Storage is scoped to the origin, not to the app, so a route-stubbed blank
document on that origin gives `suppressWelcomeScreen` and `setToken` the same
access for one intercepted request and no boot. The route is a page route, so it
takes precedence over any `**/*` context route a fixture installed, and it is
removed in a `finally` before the one real navigation.
`TokenStorage.spec` gains a case for this, from a cold context rather than the
already-navigated page the describe-level beforeEach provides — deleting the
primer navigation makes it fail on `'serviceWorker' in navigator`, which is the
regression it exists to catch.
* fix(playwright): justify the sign-in disables by what they actually assert
Review on #33219 caught the rule doc claiming something untrue: that the only
justified disables are "the nine specs testing the sign-in flow itself". Nine
files carry a disable, but only `Pages/Login.spec.ts` is testing the form. The
rest were waved through on "the session must be established the way a user
establishes it", which is not a reason — `signIn()` posts to the same
`/api/v1/auth/login`, so every server-side effect of signing in is identical.
Audited all twenty. What actually distinguishes them is narrower and checkable:
`signInViaApi` finishes on `/my-data`, so a spec that asserts *where the app
lands* after sign-in cannot use it. `AppModeAiPersonaLandsAtRoot` asserts the
path is exactly `/` — "no trailing segment, no /my-data" — and the AppMode suite
records `framenavigated` to compare the route sequence. Those thirteen stay, now
saying that instead.
Four did not survive the audit and are migrated:
- `Flow/Tour.spec.ts` claimed only a form sign-in renders the welcome banner.
The banner is gated on the `loggedInUsers` seed, and `signIn()` takes the same
`suppressWelcomeScreen: false` opt-out the call already passed.
- `Features/OnlineUsers.spec.ts` (x2) claimed presence is registered by the
sign-in flow. It is registered by the login POST, which `signIn()` issues, and
the next line navigates explicitly so the landing route is irrelevant.
Twenty disables across nine files become sixteen across seven.
* fix(playwright): accept the AI shell as a signed-in session
`signInViaApi` waited for `left-sidebar` to decide the injected session had been
accepted. A user whose persona resolves to AI mounts the AI route tree instead,
whose sidebar is `ask-sidebar` — so for that user the helper timed out after 30s
and reported that the app "did not pick it up from app_state.primary; check
utils/tokenStorage.ts", pointing at the one component that was working.
Found while proving the AppMode disables are load-bearing: migrating
`AppModeAiPersonaLandsAtRoot` to `signIn()` fails, but not for the reason the
disable claims — it never reaches the landing-URL assertion because sign-in
itself reports failure first.
Either shell now counts. The AppMode disables stay: `signInViaApi` still
finishes on /my-data, which is exactly what that spec asserts it is not.
Two AI-mode specs that landed upstream meanwhile (`AiAlertPermissions`,
`ObservabilityPermissions`) move to `signIn()` here rather than in the
migration commit, because this fix is what lets them: both sign in a user
under AI mode, so both would have hit the `left-sidebar` wait. The comment in
`ObservabilityPermissions` warning that the AI-mode sign-in page "doesn't
expose the email input the login helper looks for" describes a hazard that
only exists for the form; it goes away with the form.
Verified against a local server on :8585 — auth.setup (8 sign-ins),
RoleFixtureSessions, Tour, OnlineUsers, AppModeAiPersonaLandsAtRoot and
TokenStorage all pass.
…stic
Three defects found reviewing this PR against its own thesis — that a failing
test should say where it hung.
`saveToIndexedDB` never got the guard `getFromIndexedDB` did. `onupgradeneeded`
only fires when the version changes, so a database already at version 1 without
the store reaches `onsuccess` with nothing to write to, and `db.transaction`
throws NotFoundError *inside the handler* — neither rejecting the promise nor
reaching the caller's try/catch. That is the same never-settling hang this PR
removes from the read path, and `setOidcToken` reads then writes, so the new
read guard hands control straight to it. `SwTokenStorageUtils.deleteFromIndexedDb`
opens the database with no version at all, which is exactly how that state gets
created; its `indexedDB.databases()` feature-detect keeps it off the Chromium
path, so this is latent rather than live. Reject with a message that names the
missing store instead.
`describeDomainVisibility` built its API context above the try. `getApiContext`
reads the token via `page.evaluate`, which throws once the page is gone — and a
closed page is precisely what the diagnostic exists to explain. The throw
escaped and replaced the assertion failure the caller was reporting, so the
helper ate the error it was written for. Built inside the try now, with the
teardown made optional since it may not exist yet.
The `prefer-role-page-fixture` JSDoc still claimed the rule "runs at `warn`"
with "~290 existing call sites". It is set to `error` in eslint.config.mjs and
documented as `error` in .claude/rules/frontend-playwright.md; the migration
left six files carrying a justified disable. The comment was the last trace of
the pre-migration state.
Sixteen `eslint-disable-next-line prefer-role-page-fixture` comments across
seven files, all carrying one of two justifications. A reviewer asking "why is
this rule disabled?" had to read the comment to find out, and nothing stopped
the next person pasting the same comment for a third, worse reason.
`signInThroughForm(page, user)` replaces them. It is one function in
utils/formSignIn.ts, the single module added to the rule's implementation-path
exemption list, so the call needs no suppression and the exemption lives in one
auditable place. The call site now names the intent instead of silencing a rule.
Both legitimate cases survive unchanged, and the second is not a matter of
taste: `signInViaApi` finishes with `page.goto('/my-data')`, so for a spec that
asserts where the app lands it does not merely take a different route, it
manufactures the answer. `AppModeAiPersonaLandsAtRoot` records every
`framenavigated` pathname and asserts `/my-data` is never among them — `signIn()`
would fail it by construction. `Auth/Login.spec.ts` is the other: the form is
what it asserts, so signing in around it would leave it asserting nothing.
The rule's own message now points at the helper rather than at "disable this
rule with a reason", so the next person is steered somewhere auditable.
`CustomizeDetailPage`'s `glossaryTermUserPage` fixture arrived on main calling
`login()`, which drives the sign-in form. Its sibling `userPage`, two lines
above, already uses `signIn()` — same file, same shape, same purpose.
Migrated for consistency and to keep `prefer-role-page-fixture` at error with no
suppressions. One POST instead of nine UI interactions, and the fixture is no
longer the odd one out in its own object literal.
Copilot caught a real regression in this PR, and it explains the
`PersonaAppLayout` failures I had wrongly attributed to main.
`signInViaApi` ended with an unconditional `page.goto('/my-data')`. That is
fine for the ~290 call sites that only need a session, but `performUserLogin`
was switched to `signIn()` in this PR, and the form path it replaced never
chose a destination — it posts to /signin and lets the app route, so a user
whose persona configures a different default lands there. Hard-navigating to
/my-data overwrote that resolution, so `PersonaAppLayout`'s
`await expect(page).toHaveURL(GLOSSARY_URL)` immediately after
`performUserLogin` could only ever fail.
`signInViaApi` now takes an optional `landingPath`, defaulting to `/my-data`
so every existing caller is byte-identical in behaviour. `performUserLogin`
passes `/` and lets the app resolve the landing page, which is what the form
did.
Also from the same review, four places where the docs described a world that
this PR had already changed:
- the handbook's example called `signInUserViaApi`, which does not exist —
the export is `UserClass.signIn()`;
- the handbook still described nine files keeping `login()` behind justified
disables, when they now call `signInThroughForm` and no disable remains;
- `auth.setup.ts` and `utils/user.ts` told readers to drive `UserClass.login()`
directly, which is now a lint error;
- `userPages.ts` called the rule `(warn)` when it is configured at `error`.
step.error does not mean the step was still in flight at timeout; a failed Playwright operation can be caught by test code, remain recorded as an errored completed step, and the test can later hang elsewhere. Searching every historical errored step by depth/duration can therefore prepend a stale location—the exact kind of misleading diagnosis this reporter is meant to remove. Filter candidates to steps whose end coincides with the timed-out result (which requires passing the result timing into this selection), and cover a caught failure followed by a timeout.
Diagnostic poll can exhaust the test timeout before reporting
The added diagnostic is unlikely to execute in normal tests: this poll can consume 60 seconds, while the global test timeout is also 60 seconds (playwright.config.ts:584) and callers perform work before reaching it. The test timeout will usually abort the helper before expect.poll rejects into this catch, leaving the same bare timeout. Reserve a meaningful portion of the test budget for the catch/API diagnostics (or use the remaining test timeout explicitly).
This rejection is swallowed by setAppState's existing catch at lines 187–193, so setToken() still resolves successfully when a version-1 database exists without this store. API sign-in then waits up to 30 seconds for a shell and reports a generic session failure instead of the new actionable error. Propagate this write failure (and add the existing-empty-database regression case), rather than silently discarding it.
The rule only ever rejected `.login(...)`. A spec that does `new UserClass()`
+ `signIn()` and keeps its own `beforeAll`/`afterAll` bookkeeping — the
lifecycle pattern this work calls the merge queue's main flake source — passes
it clean. So the name promised a fixture policy the implementation never
enforced, and the handbook repeated the promise.
Renamed to `no-form-sign-in`, which is what it checks. The description and
message now say the same thing, and the message marks the fixture advice as
advice: whether a bespoke account is warranted is a judgement about the test,
not something a rule can decide.
Nothing about enforcement changes — same visitor, same exemption paths, same
`error` severity, same zero suppressions and zero disables. Renamed in the rule
module, its tests, eslint.config.mjs, the generated handbook table, the two
fixture/helper docs that named it, and .claude/rules, so no reference to the old
name survives.
Found by Copilot on this PR; it was right that the name overclaimed.
The rename touched eslint-rules/*.mjs, but the formatting pass I ran covered
only playwright/**/*.ts — so the rule test file went out with lines prettier
wanted rewrapped, and UI Checkstyle's git-clean gate caught it.
Code Review👍 Approved with suggestions0 closed / 1 findings
🟡 Medium risk · Playwright authentication, storage, and fixture changes reshape suite execution.
Adds diagnostic context to timed-out Playwright tests by capturing the innermost pending step, plus fixes four sources of misleading or hanging failures: authenticateAdminPage race condition, waitForResponse accepting 404s, IndexedDB store initialization hang, and response disposal error matching. Consider restoring exact-text matching for owner options to avoid strict-mode violations when one owner name is a substring of another.
💡 Edge Case: exact match dropped for substring hasText on owner options
removeOwnersFromList and addMultiOwner previously matched owners with getByRole('listitem', { name: ownerName, exact: true }). The replacement .locator('[data-testid="owner-option"]').filter({ hasText: ownerName }) uses case-insensitive substring matching, so when one owner name is a substring of another visible option (e.g. "Test" vs "Test User") the locator resolves to multiple elements and .click() / .waitFor() throws a Playwright strict-mode violation. Since this PR's goal is to reduce flaky timeouts, restore uniqueness by matching the full text, e.g. .filter({ hasText: new RegExp(^${escapeRegExp(ownerName)}$) }) or an exact-text option.
🤖 Prompt for agents
Code Review: Adds diagnostic context to timed-out Playwright tests by capturing the innermost pending step, plus fixes four sources of misleading or hanging failures: `authenticateAdminPage` race condition, `waitForResponse` accepting 404s, IndexedDB store initialization hang, and response disposal error matching. Consider restoring exact-text matching for owner options to avoid strict-mode violations when one owner name is a substring of another.
1. 💡 Edge Case: exact match dropped for substring hasText on owner options
Files: openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts:441-447, openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts:585-588
`removeOwnersFromList` and `addMultiOwner` previously matched owners with `getByRole('listitem', { name: ownerName, exact: true })`. The replacement `.locator('[data-testid="owner-option"]').filter({ hasText: ownerName })` uses case-insensitive substring matching, so when one owner name is a substring of another visible option (e.g. "Test" vs "Test User") the locator resolves to multiple elements and `.click()` / `.waitFor()` throws a Playwright strict-mode violation. Since this PR's goal is to reduce flaky timeouts, restore uniqueness by matching the full text, e.g. `.filter({ hasText: new RegExp(`^${escapeRegExp(ownerName)}$`) })` or an exact-text option.
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
safe to testAdd this label to run secure Github workflows on PRsUIUI specific issues
5 participants
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.
The problem
61% of merge-queue flakes (75 of 121 sampled first-attempt failures across 15 runs) carry exactly one error:
No file, no line, no locator, no snippet.
results.json— the artifact the merge-queue tooling reads — serialises a timed-out result withsteps: [], so the only way to find what actually hung is to download a multi-megabyte blob artifact and parsereport.jsonlby hand. Nobody does, which is why these get retried instead of fixed.The change
Two things, previously split across a stack of PRs and now landed together.
1. Timed-out tests say where they hung.
The information exists in-process on
TestResult.steps; it is lost at the reporter boundary.TimeoutDiagnosticsReporterfinds the innermost step still in flight and prepends its title, source location and call log, so the same failure now reads:It must be listed before
json/blob/html; the config comment records why.Four things that were actively misleading a reader of those reports:
authenticateAdminPageraced twowaitForcalls. The loser cannot be cancelled, so it stayed pending and reported itself as a ~58swaiting for locator('input[name="email"]')failure — the first and longest error in every unrelated timeout. Polls for the landing state instead.waitForResponseresolves on any response, 404 included.visitEntityPageByFqnand the Database/DatabaseSchema/ApiCollection navigations now assert the status they synchronised on, so a missing entity fails there instead of 55s later at an unrelated locator.tokenStoragecould hang forever.getFromIndexedDBresolved fromonupgradeneededwithout creating the object store;onsuccessthen threwNotFoundErrorinside the event handler, which neither rejects the promise nor is caught by the surrounding try/catch.saveToIndexedDBhad the same shape on the write side. Both now checkobjectStoreNamesbefore opening a transaction.ignoreClosedTargetmatched only one of two wordings.route.fetch()hands back an APIResponse owned by the context; reading it after the context is gone throwsResponse has been disposed, nothas been closed.PW_TRACEis plumbed through so a targeted rerun can trace the failing attempt —trace: 'on-first-retry'records the retry, which is the attempt that passed, so the one that failed has never had a trace.2. Sign-in goes through a fixture, not the form.
UserClass.login()drives nine UI interactions — navigate to/signin, wait, fill, Tab, fill, click, await the response, await the redirect, dismiss the getting-started modal, collapse the sidebar — on the critical path of ~290 tests that are not about signing in. Every one is a step that can time out.signInViaApiestablishes the same session with one POST to the same/api/v1/auth/login, writing the token where the app reads it. Both paths run the identicalcompleteSignIn, so they differ in how the session was established and nothing else.support/fixtures/isolatedUser.tsaddsisolatedUserPage(one account per worker) andfreshUserPage(one per test). Both create and delete the account through Playwright's fixture teardown, which removes thebeforeAll/afterAllbookkeeping that is the merge queue's number-one flake:beforeAllruns once per group dispatched to a worker, not once per worker, so an array it pushes into ends up holding deleted accounts.prefer-role-page-fixtureenforces it aterror. The six remaininglogin()call sites carry a justified disable:Pages/Login.spec.ts, where the form is the subject, andFeatures/AppMode/**, where the route the app lands on after sign-in is the assertion andsignInViaApiwould mask it by finishing on/my-data.Verification
e2e/Features/TokenStorage.spec.tsfails without the IndexedDB fix (it hangs to the timeout) and passes in ~1.2s with it. Its last case is a negative control: it asserts a state captured withoutindexedDB: truedoes not carry the token, so the suite cannot pass by silently exercising the localStorage fallback.http://127.0.0.1:30085/— the base URL the AUT nightly uses — all 5 cases pass. Against a plain-http non-loopback origin the secure-context case fails deliberately, by design, rather than degrading to the fallback in silence.yarn lint:playwright: 0 errors.yarn test:eslint-rules: 161/161.tsc: 162 errors in 53 files, identical tomainand with the same error-code histogram — no new type debt.jsonreporter, and confirmed to leave passing and assertion-failing results untouched.