Skip to content

test(e2e): make expandLineageSection wait on state instead of proxies - #31062

Merged
ShaileshParmar11 merged 1 commit into
2.0from
fix/ports-lineage-expand-helper
Aug 5, 2026
Merged

ShaileshParmar11 merged 1 commit into
2.0from
fix/ports-lineage-expand-helper

Conversation

@ShaileshParmar11

Copy link
Copy Markdown
Contributor

Problem

Two tests in InputOutputPorts.spec.ts have been flaky in 16 of the last 16 AUT 2.0 nightly runs:

  • Section 7: Fullscreen Mode › Toggle fullscreen mode
  • Section 4: Removing Ports › Remove last port shows empty state

Both fail the first attempt on a 60s timeout and pass on retry, so they are permanently in the flaky column and never block a run.

Root cause

expandLineageSection had three defects, all variants of waiting on a proxy rather than the actual state:

  1. Unconditional toggle. The accordion header is a toggle, but the helper clicked it on every call — despite its own doc comment saying "Only expands if currently collapsed". Calling it on an already-expanded section collapses it, and because no /portsView request follows a collapse, the subsequent waitForResponse hangs until the test timeout.

  2. Ambiguous response matcher. url.includes('/portsView') cannot distinguish the lineage fetch from the port-count probe — both hit the same endpoint. The wait could therefore resolve on the counts response while the lineage request was still in flight. The count probe always carries pagination params, so excluding inputLimit= targets the lineage call specifically.

  3. Vacuous loader wait. toHaveCount(0) on [data-testid="loader"] passes when React has not yet mounted the loader, letting callers act on a panel that is still loading. The helper now also waits for a terminal state — ports-lineage-view or .ports-lineage-view-empty.

Regression test

Added Lineage stays expanded when expandLineageSection runs twice. Against the old helper it fails with the same signature as the flaky tests:

Test timeout of 60000ms exceeded.
Error: page.waitForResponse: Target page, context or browser has been closed
   at ../utils/domain.ts:1693

With the fix it passes.

Verification

Check Result
New regression test, before fix failed — 60s timeout, same signature
New regression test, after fix passed
Full InputOutputPorts.spec.ts 44/44 passed
--repeat-each=20 on both flaky tests + new test 60/60 passed

All callers of expandLineageSection live in InputOutputPorts.spec.ts, so the blast radius is one file.

Note on what this proves. Both flaky tests already passed 10/10 locally before this change — the trigger only appears under CI load. Local green therefore demonstrates no regression, not that the CI flake is gone. The idempotency defect (1) is conclusively fixed and covered by a test; confirmation for the flake itself should come from the next few 2.0 nightlies.

Not included

Investigation also surfaced a separate backend issue: /portsView sources data from findToWithOffset + Entity.getEntities(..., NON_DELETED) but total from a separate countFindTo, and silently drops unresolvable records without adjusting total. Soft-deleting an asset that is a port reproduces it deterministically — the UI then shows "Input Ports (1)" beside "assign assets to this Data Product". That is a real user-facing bug but it would not have stabilised these tests, so it belongs in its own change.

🤖 Generated with Claude Code

`Input Output Ports > Section 7 > Toggle fullscreen mode` and
`Section 4 > Remove last port shows empty state` have been flaky in 16 of
the last 16 AUT 2.0 nightly runs, each failing the first attempt on a 60s
timeout and passing on retry.

expandLineageSection had three defects:

1. Unconditional toggle. The accordion header is a toggle, but the helper
   clicked it on every call despite its doc saying "only expands if
   currently collapsed". Calling it on an already-expanded section
   collapsed it, and since no /portsView request follows a collapse the
   subsequent waitForResponse hung until the test timeout.

2. Ambiguous response matcher. `url.includes('/portsView')` cannot
   distinguish the lineage fetch from the port-count probe — both hit the
   same endpoint — so the wait could resolve on the counts response while
   the lineage request was still in flight. The count probe always carries
   pagination params, so excluding `inputLimit=` targets the lineage call.

3. Vacuous loader wait. `toHaveCount(0)` on [data-testid="loader"] passes
   when React has not yet mounted the loader, letting callers act on a
   panel that is still loading. Now also waits for a terminal state:
   ports-lineage-view, or .ports-lineage-view-empty.

Adds a regression test that fails against the old helper with the same
signature as the flaky tests (60s timeout in waitForResponse) and passes
with the fix.

Verified: full InputOutputPorts.spec.ts 44/44; --repeat-each=20 across the
two flaky tests plus the new one, 60/60.

Co-Authored-By: Claude Opus 5 <[email protected]>
@ShaileshParmar11
ShaileshParmar11 requested a review from a team as a code owner August 5, 2026 17:54
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

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.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Aug 5, 2026
@ShaileshParmar11
ShaileshParmar11 merged commit 769b7ba into 2.0 Aug 5, 2026
57 of 58 checks passed
@ShaileshParmar11
ShaileshParmar11 deleted the fix/ports-lineage-expand-helper branch August 5, 2026 17:55
@gitar-bot

gitar-bot Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

Robustness improvements to the expandLineageSection e2e test helper by adding idempotency checks, precise response matching, and terminal state waits to resolve nightly test flakiness. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

❌ UI Checkstyle Failed

❌ Antd + Less Deprecation Guard

A new antd import or new .less file was added. Use UntitledUI + Tailwind for new work.

Affected files

at Function._resolveFilename (node:internal/modules/cjs/loader:1401:15)
at defaultResolveImpl (node:internal/modules/cjs/loader:1057:19)
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1062:22)
at Function._load (node:internal/modules/cjs/loader:1211:37)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
at node:internal/main/run_main_module:36:49 {


Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

ShaileshParmar11 added a commit that referenced this pull request Aug 6, 2026
…ession test

The regression test added in #31062 asserted that `ports-lineage-view` and
`toggle-fullscreen-btn` were visible after calling expandLineageSection
twice. Both render only when the port data resolves, which is subject to a
CI-only readiness race on the asset association — so the test itself was
flaky in the AUT 2.0 nightlies (both Postgres and MySQL) on its first run:

    Error: expect(locator).toBeVisible() failed
    Locator: getByTestId('ports-lineage-view')
    Error: element(s) not found

The test covers idempotency of the helper, not whether the lineage graph
renders. Assert the accordion's own `aria-expanded` state instead: that is
the actual invariant and it carries no data dependency.

This does not weaken the regression coverage. Against the old helper the
second call collapsed the section and the following waitForResponse hung
until the 60s test timeout, so the test still fails before reaching any
assertion.

Same nightlies confirm the primary fixes landed: "Toggle fullscreen mode"
and "should not show navigation blocker after saving changes" both passed
on the first attempt after being flaky in 16 of the previous 16 runs.

Co-Authored-By: Claude Opus 5 <[email protected]>
ShaileshParmar11 added a commit that referenced this pull request Aug 6, 2026
Removes the test added in #31062. Coverage is not lost:
"Section 6: Collapse/Expand Behavior > Lineage section collapse/expand"
already exercises this accordion through the same helper — asserting it
starts collapsed, expands via expandLineageSection, and collapses again.

The only thing the removed test added was calling expandLineageSection
twice in a row. No call site does that: all 15 callers invoke it once,
immediately after navigateToPortsTab on a freshly loaded page where the
section is collapsed. It was guarding a path nothing takes.

It was also a net negative for suite stability. It asserted that
ports-lineage-view and toggle-fullscreen-btn were visible, both of which
render only once port data resolves — so it inherited the CI-only readiness
race on the asset association and was itself flaky in both AUT 2.0
nightlies on its first run:

    Error: expect(locator).toBeVisible() failed
    Locator: getByTestId('ports-lineage-view')
    Error: element(s) not found

The helper's idempotency guard stays in place; it is three self-documenting
lines and does not need an end-to-end test standing behind it. The fix that
mattered is validated directly by the previously flaky tests going green:
"Toggle fullscreen mode" and "should not show navigation blocker after
saving changes" both passed on the first attempt in runs 31060529978 (PG)
and 31060526260 (MySQL), after being flaky in 16 of the previous 16 runs.

Co-Authored-By: Claude Opus 5 <[email protected]>
ShaileshParmar11 added a commit that referenced this pull request Aug 6, 2026
`Input Output Ports > Section 7 > Toggle fullscreen mode` and
`Section 4 > Remove last port shows empty state` were flaky in 9 of 9 Main
V2 nightly runs (16/16 on 2.0), failing the first attempt on a 60s timeout
and passing on retry.

expandLineageSection had three defects:

1. Unconditional toggle. The accordion header is a toggle, but the helper
   clicked it on every call despite its doc saying "only expands if
   currently collapsed". Calling it on an already-expanded section
   collapsed it, and since no /portsView request follows a collapse the
   subsequent waitForResponse hung until the test timeout.

2. Ambiguous response matcher. `url.includes('/portsView')` cannot
   distinguish the lineage fetch from the port-count probe — both hit the
   same endpoint — so the wait could resolve on the counts response while
   the lineage request was still in flight. The count probe always carries
   pagination params, so excluding `inputLimit=` targets the lineage call.

3. Vacuous loader wait. `toHaveCount(0)` on [data-testid="loader"] passes
   when React has not yet mounted the loader, letting callers act on a
   panel that is still loading. Now also waits for a terminal state:
   ports-lineage-view, or .ports-lineage-view-empty.

Validated on 2.0 (#31062): both tests passed on the first attempt in the
AUT nightlies 31060529978 (Postgres) and 31060526260 (MySQL).

Co-Authored-By: Claude Opus 5 <[email protected]>
ShaileshParmar11 added a commit that referenced this pull request Aug 6, 2026
Removes the test added in #31062. Coverage is not lost:
"Section 6: Collapse/Expand Behavior > Lineage section collapse/expand"
already exercises this accordion through the same helper — asserting it
starts collapsed, expands via expandLineageSection, and collapses again.

The only thing the removed test added was calling expandLineageSection
twice in a row. No call site does that: all 15 callers invoke it once,
immediately after navigateToPortsTab on a freshly loaded page where the
section is collapsed. It was guarding a path nothing takes.

It was also a net negative for suite stability. It asserted that
ports-lineage-view and toggle-fullscreen-btn were visible, both of which
render only once port data resolves — so it inherited the CI-only readiness
race on the asset association and was itself flaky in both AUT 2.0
nightlies on its first run:

    Error: expect(locator).toBeVisible() failed
    Locator: getByTestId('ports-lineage-view')
    Error: element(s) not found

The helper's idempotency guard stays in place; it is three self-documenting
lines and does not need an end-to-end test standing behind it. The fix that
mattered is validated directly by the previously flaky tests going green:
"Toggle fullscreen mode" and "should not show navigation blocker after
saving changes" both passed on the first attempt in runs 31060529978 (PG)
and 31060526260 (MySQL), after being flaky in 16 of the previous 16 runs.

Co-authored-by: Claude Opus 5 <[email protected]>
anuj-kumary pushed a commit to anuj-kumary/OpenMetadata that referenced this pull request Aug 7, 2026
…1063)

* test(e2e): make expandLineageSection wait on state instead of proxies

`Input Output Ports > Section 7 > Toggle fullscreen mode` and
`Section 4 > Remove last port shows empty state` were flaky in 9 of 9 Main
V2 nightly runs (16/16 on 2.0), failing the first attempt on a 60s timeout
and passing on retry.

expandLineageSection had three defects:

1. Unconditional toggle. The accordion header is a toggle, but the helper
   clicked it on every call despite its doc saying "only expands if
   currently collapsed". Calling it on an already-expanded section
   collapsed it, and since no /portsView request follows a collapse the
   subsequent waitForResponse hung until the test timeout.

2. Ambiguous response matcher. `url.includes('/portsView')` cannot
   distinguish the lineage fetch from the port-count probe — both hit the
   same endpoint — so the wait could resolve on the counts response while
   the lineage request was still in flight. The count probe always carries
   pagination params, so excluding `inputLimit=` targets the lineage call.

3. Vacuous loader wait. `toHaveCount(0)` on [data-testid="loader"] passes
   when React has not yet mounted the loader, letting callers act on a
   panel that is still loading. Now also waits for a terminal state:
   ports-lineage-view, or .ports-lineage-view-empty.

Validated on 2.0 (open-metadata#31062): both tests passed on the first attempt in the
AUT nightlies 31060529978 (Postgres) and 31060526260 (MySQL).

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): match docStore update in navigation blocker save test

`Navigation Blocker Tests > should not show navigation blocker after
saving changes` was flaky in 9 of 9 Main V2 nightly runs (16/16 on 2.0,
20/34 on 1.13).

The tests in this file share one persona and run sequentially
(describe.configure mode: 'default'). An earlier test already saves a
layout for that persona, so by the time this test saves, the request is an
UPDATE (PUT /api/v1/docStore/{id}) rather than a create.

The wait was `waitForResponse('/api/v1/docStore')`. A bare string is an
exact URL match, so it never matches the update and the await hangs until
the test timeout. This was the only exact docStore matcher left in the
suite. Note '*' does not cross a '/', so the sibling's 'api/v1/docStore*'
works only because its own save is a create — matching the update needs
'**'.

On retry Playwright starts a fresh worker, beforeAll creates a new persona,
and the save becomes a create again — which is why the test always passed
on the second attempt and never on the first.

Also relaxes the toast assertion to accept "created" or "updated": this
test covers navigation-blocker behaviour, not create-vs-update semantics.

Validated on 2.0 (open-metadata#31064): passed on the first attempt in the AUT nightlies
31060529978 (Postgres) and 31060526260 (MySQL).

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): navigate to the app before driving the global search box

`PlatformLineage > Verify domain platform view` and `> Verify platform view
switching` are flaky in both AUT 2.0 nightlies (15/16 and 13/16), failing in
beforeEach with a 30s waitForResponse timeout and a fill still waiting for
getByTestId('searchBox').

The page fixture hands tests a browser.newPage(), which sits on about:blank.
PlatformLineage's beforeEach relies on TableClass.visitEntityPage to
navigate, but that only navigates on its direct-navigation branch; when the
table FQN is empty it falls through to visitEntityPage(), which drives the
global search box on a page that has none.

visitEntityPage now probes for the search box and navigates to /my-data when
it is absent. Probing rather than checking page.url(): a URL test only says
whether this is a web page, not whether it renders the global header, so an
http(s) URL without the header would hang identically. No-op for callers
already on an app page.

Reproduced deterministically for both preconditions — about:blank, and a
real http URL with no header — each failing with the CI signature before the
fix and recovering after. PlatformLineage.spec.ts: 4/4.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): re-press arrow keys RDG drops while the grid is settling

`Bulk Import Export > Range selection` is flaky in both AUT 2.0 nightlies
(11/16), failing with expect(locator).toBeFocused() — Received: inactive.

The failed attempt's snapshot shows focus never moved at all: the column
header is not active while the origin gridcell still is. react-data-grid
drops the key press outright while settling after a click or re-render, so
its keydown handler never runs. Waiting longer cannot help because no
further press is ever sent.

move() now re-presses until focus lands, checking the destination first so a
press that did register is never doubled. Both helpers are declared inside
the test body, so the change is scoped to this test.

Reproduced at 3 failures in 5 runs before the fix; 5/5 passing after.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): stop a slow search response aborting waitForSearchResult's poll

`Entity.spec.ts > ... > Domain Propagation` is flaky in both AUT 2.0
nightlies (8/16), failing with a 15s waitForResponse timeout raised from
inside utils/common.ts:862.

waitForSearchResult wraps its work in expect.poll with a 45s budget, but each
iteration registers a waitForResponse with its own hard 15s timeout.
expect.poll does not swallow exceptions from the callback, so a single slow
search rejects and aborts the whole poll rather than counting as 'not ready
yet' — the 45s budget can fail after one 15s iteration. The failure stack
shows exactly that.

The response wait only exists to let the search settle; the poll decides
success. Attaching .catch(() => null) makes a slow response a non-event.

Entity.spec.ts 'Domain Propagation': 19/19 passing.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): reload when a port row is missing from the ports list

`Input Output Ports > Section 4 > Remove last port shows empty state` is
flaky in 16 of the last 16 AUT 2.0 nightlies, on both engines, failing with a
60s timeout waiting for getByTestId('port-actions-<id>').

The failed attempt's snapshot shows the contradiction directly: the heading
reads 'Input Ports (1)' while the list group is empty.
DataProductRepository.getPaginatedPorts reads rows via findToWithOffset +
Entity.getEntities(..., NON_DELETED) but the total via a separate
countFindTo, and drops records whose entity cannot be resolved without
adjusting the total — so it can answer with no rows next to a non-zero total.

PortsListView fetches only on mount, so that empty result is held until the
component remounts. Waiting longer can never recover it, which is why the
click burned the full budget; a reload can, which is why the retry passes.

waitForPortRow polls for the row and reloads when absent, restoring the ports
tab if the reload lands elsewhere. It is a no-op when the row is already
present, so the normal path is unchanged.

Reproduced deterministically with page.route: rewriting only the first
/inputPorts response to data:[] with total:1 leaves the list permanently
empty; waitForPortRow then reloads and finds the row in 7.8s.

InputOutputPorts.spec.ts: 43/43 (workers=2).

The backend inconsistency is deliberately left alone — reporting a count the
payload cannot support is worth fixing on its own, but it is a separate
change and would not by itself make the row appear.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): poll the glossary row count instead of sampling it once

`Large Glossary Performance Tests > should search and filter glossary terms`
is flaky in 6 of the last 16 AUT 2.0 nightlies, failing with:

    expect(received).toBeGreaterThanOrEqual(expected)
    Expected: >= 50
    Received: 17

After clearing the search box the test awaited the listing response and then
read locator.count() exactly once, with no retry budget. waitForResponse only
proves the bytes arrived; GlossaryTermTab still has to apply the store update
and re-render the rows, which happens in a later microtask. The single sample
therefore returns the stale search results.

17 is not a partial render — it is precisely what 'Term_5' matches (Term_5,
Term_50..59, and six child terms), and the same 17 appears in two independent
failing runs. The failure-time page snapshot shows all 50 rows present and the
search box already cleared: the state the assertion wanted had arrived, just
after it looked.

The search branch of this same test already waits for loaders (line 198) and
does not flake; the clear branch omitted it. In one failing run that loader
wait took 906ms — the clear branch granted the same work 2ms.

Polls the rendered row count rather than asserting an exact one: the tab
auto-fetches another page when rows do not fill the viewport, so toHaveCount
would trade this flake for a different one.

LargeGlossaryPerformance 'should search and filter glossary terms': 3/3 local.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): wait for virtualised filter options instead of probing once

The four '... in right panel' tests in CustomProperties.spec.ts are flaky
across the AUT 2.0 nightlies, failing in Before Hooks with:

    Unable to find global search filter option "API Endpoint" for endpoint
    "apiEndpoints" after 5 scroll attempts
       at playwright/utils/entityPanel.ts:50

The global-search entity filter is a virtualised antd Select: rc-virtual-list
keeps only the ~11 rows around the current offset in the DOM, so every option
below Container — Stored Procedure, Data Product, API Endpoint, API Collection,
Metric — does not exist until scrolled into range.

findOptionByScrolling scrolled and then immediately called isVisible(), the one
Playwright API that does not auto-wait, so all five attempts completed in about
200ms while racing React's commit of the new window. On losing that race it
threw, and because the caller runs it inside an expect.poll, the throw aborted a
90s budget after 224ms rather than retrying.

The correlation is decisive: every flaking right-panel test across sixteen runs
is for an entity whose filter sits at index 11 or beyond, and there are no
flakes at all for the entities inside the initial window, despite those tests
running identically.

Now waits for the option with a retrying waitFor, advances a whole viewport per
step, detects the end of the list from a clamped scrollTop rather than a fixed
count, and returns false instead of throwing so the enclosing poll can retry.
Two specs already solve this interaction the same way (ExploreQuickFilters,
MetricSearch) and neither flakes.

CustomProperties '... in right panel': 72/72 local.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): scope the moved-document assertion to its target folder

`Context Center - Documents Page > scrolling the bulk "Move" dropdown loads
the next page` is flaky in 4 of the last 16 AUT 2.0 nightlies:

    expect(locator).toHaveText(expected) failed
    Locator: ... filter({ hasText: 'folder-pagination-bulk-move-<uuid>.txt' })
             .getByTestId('document-folder-name')
    Error: element(s) not found

The scroll under test worked and the move itself succeeded (200,
numberOfRowsPassed 1, ids matched). What failed was the lookup after the
reload.

That reload refetches page 1 of the root document list, which the backend
serves ORDER BY updatedAt DESC LIMIT 15. Workers share this backend, so
uploads landing in the window between the move and the reload occupy all 15
slots with newer rows and evict the moved file — and since the test never
scrolls, it is then on no page the test loads.

The failure snapshot shows exactly 15 rows against 44 total files, every one
of them under a second old, with the target absent; the sidebar shows two
copies of the spec's fixture folder, i.e. a second worker running the same
beforeAll. 2x(1+20)+2 = 44 exactly.

The per-file Move test in this same file makes the same assertion and does not
flake — it asserts in place without re-navigating. Rather than drop the reload
(it is what proves the move persisted), scope the list to the target folder,
where the row is the only hit and pagination cannot displace it.

ContextCenterDocument.spec.ts: full file green locally.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): assert the team-persona invariant, not global default state

`Team persona setting flow > Set default persona for team should work
properly` is flaky in 6 of the last 16 AUT 2.0 nightlies:

    expect(locator).toContainText(expected) failed
    Expected substring: "No default persona"
    Received string:    "PW Persona 469e8e9f"

The chip renders user.defaultPersona, and the backend resolves an unset user
default to the SYSTEM default persona (UserRepository.getDefaultPersona). That
is global state this test does not own: the sibling describe in this same file
sets and clears a system default, and under fullyParallel the two run
concurrently.

Across seven failing runs every received value is a system-default persona,
and each failure overlaps the sibling in time while the passing retry always
starts after the sibling finishes. The received names match the sibling's own
fixtures (PW Persona <hex>, persona <hex>).

The environment also ships a pre-seeded "Onboarding System Default
Experience" persona, which appears as the received value in three of those
runs — so the "No default persona" placeholder only ever showed because the
sibling incidentally cleared it. The assertion was depending on another test's
side effect.

Asserts what this test actually owns: the team's persona is not auto-applied.
Adds a visibility check first so the negative assertion cannot pass against a
chip that never rendered.

Not verified locally: this spec fails earlier on this machine at line 560
(search response 404, a missing local index) before reaching the changed step.
The change is downstream of that failure, so it is unaffected by it, but only a
nightly can confirm the flake is gone.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): settle the alerts table before deciding to paginate

`Table alert` (and its siblings) are flaky in 5 of the last 16 AUT 2.0
nightlies, exhausting the 180s budget:

    Test timeout of 180000ms exceeded.
    Error: locator.click: Target page, context or browser has been closed
      waiting for locator('[id="<uuid>"], [data-row-key="<uuid>"]')...

findPageWithAlert sampled two probes with different waiting semantics against
the same unsettled table: isHidden() returns immediately without waiting, while
isEnabled() waits for attachment. The alerts page renders no
[data-testid="loader"], so the preceding waitForAllLoadersToDisappear passes
vacuously, and the table body renders zero rows while a fetch is in flight.

So isHidden() reported a false "row not on this page" against an unpainted
table, isEnabled() resolved later once Next had rendered and was enabled, and
the helper paginated past the alert. The walk is forward-only and returns
silently on failure, so the caller then waited out the entire budget for a row
that was on an earlier page.

The failure snapshot confirms the overshoot directly: Page 2 of 2, Next
disabled, target absent, and the seven rendered rows are the fixture alerts in
ascending name order — while the target's generated name sorts ahead of all of
them, i.e. it was row 1 of page 1.

Waits for the body to paint before sampling either probe, checks the row
before the button, and throws with the alert name instead of returning
silently. This also removes the same latent hang from deleteAlert and
visitEditAlertPage, which share the helper.

Step arithmetic confirms this was never slowness: 180000 - 12712 = 167288ms,
matching the hanging step almost exactly.

ObservabilityAlerts.spec.ts: 8/8 local.

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>
k-anshul pushed a commit to k-anshul/OpenMetadata that referenced this pull request Aug 12, 2026
…1063)

* test(e2e): make expandLineageSection wait on state instead of proxies

`Input Output Ports > Section 7 > Toggle fullscreen mode` and
`Section 4 > Remove last port shows empty state` were flaky in 9 of 9 Main
V2 nightly runs (16/16 on 2.0), failing the first attempt on a 60s timeout
and passing on retry.

expandLineageSection had three defects:

1. Unconditional toggle. The accordion header is a toggle, but the helper
   clicked it on every call despite its doc saying "only expands if
   currently collapsed". Calling it on an already-expanded section
   collapsed it, and since no /portsView request follows a collapse the
   subsequent waitForResponse hung until the test timeout.

2. Ambiguous response matcher. `url.includes('/portsView')` cannot
   distinguish the lineage fetch from the port-count probe — both hit the
   same endpoint — so the wait could resolve on the counts response while
   the lineage request was still in flight. The count probe always carries
   pagination params, so excluding `inputLimit=` targets the lineage call.

3. Vacuous loader wait. `toHaveCount(0)` on [data-testid="loader"] passes
   when React has not yet mounted the loader, letting callers act on a
   panel that is still loading. Now also waits for a terminal state:
   ports-lineage-view, or .ports-lineage-view-empty.

Validated on 2.0 (open-metadata#31062): both tests passed on the first attempt in the
AUT nightlies 31060529978 (Postgres) and 31060526260 (MySQL).

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): match docStore update in navigation blocker save test

`Navigation Blocker Tests > should not show navigation blocker after
saving changes` was flaky in 9 of 9 Main V2 nightly runs (16/16 on 2.0,
20/34 on 1.13).

The tests in this file share one persona and run sequentially
(describe.configure mode: 'default'). An earlier test already saves a
layout for that persona, so by the time this test saves, the request is an
UPDATE (PUT /api/v1/docStore/{id}) rather than a create.

The wait was `waitForResponse('/api/v1/docStore')`. A bare string is an
exact URL match, so it never matches the update and the await hangs until
the test timeout. This was the only exact docStore matcher left in the
suite. Note '*' does not cross a '/', so the sibling's 'api/v1/docStore*'
works only because its own save is a create — matching the update needs
'**'.

On retry Playwright starts a fresh worker, beforeAll creates a new persona,
and the save becomes a create again — which is why the test always passed
on the second attempt and never on the first.

Also relaxes the toast assertion to accept "created" or "updated": this
test covers navigation-blocker behaviour, not create-vs-update semantics.

Validated on 2.0 (open-metadata#31064): passed on the first attempt in the AUT nightlies
31060529978 (Postgres) and 31060526260 (MySQL).

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): navigate to the app before driving the global search box

`PlatformLineage > Verify domain platform view` and `> Verify platform view
switching` are flaky in both AUT 2.0 nightlies (15/16 and 13/16), failing in
beforeEach with a 30s waitForResponse timeout and a fill still waiting for
getByTestId('searchBox').

The page fixture hands tests a browser.newPage(), which sits on about:blank.
PlatformLineage's beforeEach relies on TableClass.visitEntityPage to
navigate, but that only navigates on its direct-navigation branch; when the
table FQN is empty it falls through to visitEntityPage(), which drives the
global search box on a page that has none.

visitEntityPage now probes for the search box and navigates to /my-data when
it is absent. Probing rather than checking page.url(): a URL test only says
whether this is a web page, not whether it renders the global header, so an
http(s) URL without the header would hang identically. No-op for callers
already on an app page.

Reproduced deterministically for both preconditions — about:blank, and a
real http URL with no header — each failing with the CI signature before the
fix and recovering after. PlatformLineage.spec.ts: 4/4.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): re-press arrow keys RDG drops while the grid is settling

`Bulk Import Export > Range selection` is flaky in both AUT 2.0 nightlies
(11/16), failing with expect(locator).toBeFocused() — Received: inactive.

The failed attempt's snapshot shows focus never moved at all: the column
header is not active while the origin gridcell still is. react-data-grid
drops the key press outright while settling after a click or re-render, so
its keydown handler never runs. Waiting longer cannot help because no
further press is ever sent.

move() now re-presses until focus lands, checking the destination first so a
press that did register is never doubled. Both helpers are declared inside
the test body, so the change is scoped to this test.

Reproduced at 3 failures in 5 runs before the fix; 5/5 passing after.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): stop a slow search response aborting waitForSearchResult's poll

`Entity.spec.ts > ... > Domain Propagation` is flaky in both AUT 2.0
nightlies (8/16), failing with a 15s waitForResponse timeout raised from
inside utils/common.ts:862.

waitForSearchResult wraps its work in expect.poll with a 45s budget, but each
iteration registers a waitForResponse with its own hard 15s timeout.
expect.poll does not swallow exceptions from the callback, so a single slow
search rejects and aborts the whole poll rather than counting as 'not ready
yet' — the 45s budget can fail after one 15s iteration. The failure stack
shows exactly that.

The response wait only exists to let the search settle; the poll decides
success. Attaching .catch(() => null) makes a slow response a non-event.

Entity.spec.ts 'Domain Propagation': 19/19 passing.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): reload when a port row is missing from the ports list

`Input Output Ports > Section 4 > Remove last port shows empty state` is
flaky in 16 of the last 16 AUT 2.0 nightlies, on both engines, failing with a
60s timeout waiting for getByTestId('port-actions-<id>').

The failed attempt's snapshot shows the contradiction directly: the heading
reads 'Input Ports (1)' while the list group is empty.
DataProductRepository.getPaginatedPorts reads rows via findToWithOffset +
Entity.getEntities(..., NON_DELETED) but the total via a separate
countFindTo, and drops records whose entity cannot be resolved without
adjusting the total — so it can answer with no rows next to a non-zero total.

PortsListView fetches only on mount, so that empty result is held until the
component remounts. Waiting longer can never recover it, which is why the
click burned the full budget; a reload can, which is why the retry passes.

waitForPortRow polls for the row and reloads when absent, restoring the ports
tab if the reload lands elsewhere. It is a no-op when the row is already
present, so the normal path is unchanged.

Reproduced deterministically with page.route: rewriting only the first
/inputPorts response to data:[] with total:1 leaves the list permanently
empty; waitForPortRow then reloads and finds the row in 7.8s.

InputOutputPorts.spec.ts: 43/43 (workers=2).

The backend inconsistency is deliberately left alone — reporting a count the
payload cannot support is worth fixing on its own, but it is a separate
change and would not by itself make the row appear.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): poll the glossary row count instead of sampling it once

`Large Glossary Performance Tests > should search and filter glossary terms`
is flaky in 6 of the last 16 AUT 2.0 nightlies, failing with:

    expect(received).toBeGreaterThanOrEqual(expected)
    Expected: >= 50
    Received: 17

After clearing the search box the test awaited the listing response and then
read locator.count() exactly once, with no retry budget. waitForResponse only
proves the bytes arrived; GlossaryTermTab still has to apply the store update
and re-render the rows, which happens in a later microtask. The single sample
therefore returns the stale search results.

17 is not a partial render — it is precisely what 'Term_5' matches (Term_5,
Term_50..59, and six child terms), and the same 17 appears in two independent
failing runs. The failure-time page snapshot shows all 50 rows present and the
search box already cleared: the state the assertion wanted had arrived, just
after it looked.

The search branch of this same test already waits for loaders (line 198) and
does not flake; the clear branch omitted it. In one failing run that loader
wait took 906ms — the clear branch granted the same work 2ms.

Polls the rendered row count rather than asserting an exact one: the tab
auto-fetches another page when rows do not fill the viewport, so toHaveCount
would trade this flake for a different one.

LargeGlossaryPerformance 'should search and filter glossary terms': 3/3 local.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): wait for virtualised filter options instead of probing once

The four '... in right panel' tests in CustomProperties.spec.ts are flaky
across the AUT 2.0 nightlies, failing in Before Hooks with:

    Unable to find global search filter option "API Endpoint" for endpoint
    "apiEndpoints" after 5 scroll attempts
       at playwright/utils/entityPanel.ts:50

The global-search entity filter is a virtualised antd Select: rc-virtual-list
keeps only the ~11 rows around the current offset in the DOM, so every option
below Container — Stored Procedure, Data Product, API Endpoint, API Collection,
Metric — does not exist until scrolled into range.

findOptionByScrolling scrolled and then immediately called isVisible(), the one
Playwright API that does not auto-wait, so all five attempts completed in about
200ms while racing React's commit of the new window. On losing that race it
threw, and because the caller runs it inside an expect.poll, the throw aborted a
90s budget after 224ms rather than retrying.

The correlation is decisive: every flaking right-panel test across sixteen runs
is for an entity whose filter sits at index 11 or beyond, and there are no
flakes at all for the entities inside the initial window, despite those tests
running identically.

Now waits for the option with a retrying waitFor, advances a whole viewport per
step, detects the end of the list from a clamped scrollTop rather than a fixed
count, and returns false instead of throwing so the enclosing poll can retry.
Two specs already solve this interaction the same way (ExploreQuickFilters,
MetricSearch) and neither flakes.

CustomProperties '... in right panel': 72/72 local.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): scope the moved-document assertion to its target folder

`Context Center - Documents Page > scrolling the bulk "Move" dropdown loads
the next page` is flaky in 4 of the last 16 AUT 2.0 nightlies:

    expect(locator).toHaveText(expected) failed
    Locator: ... filter({ hasText: 'folder-pagination-bulk-move-<uuid>.txt' })
             .getByTestId('document-folder-name')
    Error: element(s) not found

The scroll under test worked and the move itself succeeded (200,
numberOfRowsPassed 1, ids matched). What failed was the lookup after the
reload.

That reload refetches page 1 of the root document list, which the backend
serves ORDER BY updatedAt DESC LIMIT 15. Workers share this backend, so
uploads landing in the window between the move and the reload occupy all 15
slots with newer rows and evict the moved file — and since the test never
scrolls, it is then on no page the test loads.

The failure snapshot shows exactly 15 rows against 44 total files, every one
of them under a second old, with the target absent; the sidebar shows two
copies of the spec's fixture folder, i.e. a second worker running the same
beforeAll. 2x(1+20)+2 = 44 exactly.

The per-file Move test in this same file makes the same assertion and does not
flake — it asserts in place without re-navigating. Rather than drop the reload
(it is what proves the move persisted), scope the list to the target folder,
where the row is the only hit and pagination cannot displace it.

ContextCenterDocument.spec.ts: full file green locally.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): assert the team-persona invariant, not global default state

`Team persona setting flow > Set default persona for team should work
properly` is flaky in 6 of the last 16 AUT 2.0 nightlies:

    expect(locator).toContainText(expected) failed
    Expected substring: "No default persona"
    Received string:    "PW Persona 469e8e9f"

The chip renders user.defaultPersona, and the backend resolves an unset user
default to the SYSTEM default persona (UserRepository.getDefaultPersona). That
is global state this test does not own: the sibling describe in this same file
sets and clears a system default, and under fullyParallel the two run
concurrently.

Across seven failing runs every received value is a system-default persona,
and each failure overlaps the sibling in time while the passing retry always
starts after the sibling finishes. The received names match the sibling's own
fixtures (PW Persona <hex>, persona <hex>).

The environment also ships a pre-seeded "Onboarding System Default
Experience" persona, which appears as the received value in three of those
runs — so the "No default persona" placeholder only ever showed because the
sibling incidentally cleared it. The assertion was depending on another test's
side effect.

Asserts what this test actually owns: the team's persona is not auto-applied.
Adds a visibility check first so the negative assertion cannot pass against a
chip that never rendered.

Not verified locally: this spec fails earlier on this machine at line 560
(search response 404, a missing local index) before reaching the changed step.
The change is downstream of that failure, so it is unaffected by it, but only a
nightly can confirm the flake is gone.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): settle the alerts table before deciding to paginate

`Table alert` (and its siblings) are flaky in 5 of the last 16 AUT 2.0
nightlies, exhausting the 180s budget:

    Test timeout of 180000ms exceeded.
    Error: locator.click: Target page, context or browser has been closed
      waiting for locator('[id="<uuid>"], [data-row-key="<uuid>"]')...

findPageWithAlert sampled two probes with different waiting semantics against
the same unsettled table: isHidden() returns immediately without waiting, while
isEnabled() waits for attachment. The alerts page renders no
[data-testid="loader"], so the preceding waitForAllLoadersToDisappear passes
vacuously, and the table body renders zero rows while a fetch is in flight.

So isHidden() reported a false "row not on this page" against an unpainted
table, isEnabled() resolved later once Next had rendered and was enabled, and
the helper paginated past the alert. The walk is forward-only and returns
silently on failure, so the caller then waited out the entire budget for a row
that was on an earlier page.

The failure snapshot confirms the overshoot directly: Page 2 of 2, Next
disabled, target absent, and the seven rendered rows are the fixture alerts in
ascending name order — while the target's generated name sorts ahead of all of
them, i.e. it was row 1 of page 1.

Waits for the body to paint before sampling either probe, checks the row
before the button, and throws with the alert name instead of returning
silently. This also removes the same latent hang from deleteAlert and
visitEditAlertPage, which share the helper.

Step arithmetic confirms this was never slowness: 180000 - 12712 = 167288ms,
matching the hanging step almost exactly.

ObservabilityAlerts.spec.ts: 8/8 local.

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant