test(ui): de-flake Data Quality toast assertions against cross-worker toast leakage - #31576
test(ui): de-flake Data Quality toast assertions against cross-worker toast leakage#31576ShaileshParmar11 wants to merge 2 commits into
Conversation
… toast leakage
Toasts render as a stacking queue where every entry carries
data-testid="alert-bar", and the backend fans async-delete/job notifications
out to *every* socket of the logged-in user (WebSocketManager.sendToOne).
Playwright runs fullyParallel with all workers on the same admin storage
state, so one worker's cleanup pops a '"pw-xxx" deleted successfully!' toast
into another worker's page.
That broke DataQuality.spec.ts "Table test case": an unfiltered
getByTestId('alert-bar').waitFor({state:'detached'}) hit a strict mode
violation on both attempts, each time against a different foreign entity.
- add waitForToastToDisappear() and expectNoErrorToast() to playwright
utils/common.ts, both scoped so background toasts cannot interfere
- expose the toast variant as data-variant so tests can assert on error
toasts specifically instead of "no toast at all"
- DataQuality: wait only for the toast the step produced
- FailedTestCaseSampleData: assert no *error* toast for the 404 empty state
- IncidentManagerAfterSoftDelete/AfterOwnerChange: their /deleted|owners/i
filters matched the background delete notification; scope to error variant
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
✅ Playwright Results — workflow succeededValidated commit ✅ 582 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 49m 12s ⏱️ Max setup 3m 0s · max shard execution 15m 42s · max shard-job elapsed before upload 19m 47s · reporting 4s 🌐 214.33 requests/attempt · 2.82 app boots/UI scenario · 10.83% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
Code Review ✅ ApprovedDe-flakes Data Quality Playwright toast assertions against cross-worker toast leakage by adding data-variant attributes and scoping test helpers. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
🚦 Removed from the merge queue —
|
Describe your changes:
No linked issue — this is a CI de-flake, same as #31528 / #31533 / #31541.
I worked on de-flaking the Data Quality Playwright toast assertions, because
Data Quality › Table test casefailed on both attempts in nightly run31867675570with astrict-mode violation, and the same root cause is latent in three sibling specs.
What was actually happening
data-testid="alert-bar"(
openmetadata-ui-core-components/.../application/toast/toast.tsx), so two visible toasts isnormal product behaviour, not a bug.
AsyncDeleteProvider.handleDeleteEntityWebsocketResponseshows"{{entity}}" deleted successfully!on thedeleteEntityChannel, and the backend delivers itthrough
WebSocketManager.sendToOne(userId, …), which loops over all sockets of that user.fullyParallelwith every worker onplaywright/.auth/admin.json— one adminuser, so another worker's cleanup pops a toast into this test's page.
DataQuality.spec.ts:323then waited on an unfilteredpage.getByTestId('alert-bar'), whichstrict-mode-violates the moment a second toast exists:
A different foreign entity on each retry — the signature of cross-worker interference, not a
product regression.
What this PR changes
playwright/utils/common.ts, both immune to background toasts:waitForToastToDisappear(page, message)— filters by message before waiting for detach.expectNoErrorToast(page, message?)— asserts on error-variant toasts only.toast.tsxnow emitsdata-variant={variant}. There was no DOM hook for the toast variant(it only reached the DOM as an icon colour class), so "no error toast" could not be expressed
without also catching every background success notification. One additive attribute, no styling
or behaviour change.
DataQuality.spec.tswaits only for the toast the step itself produced.FailedTestCaseSampleData.spec.tsasserts no error toast for the 404 empty state, instead ofexpect(alert-bar).not.toBeVisible()which any foreign toast would fail.IncidentManagerAfterSoftDelete/IncidentManagerAfterOwnerChangewere already scoped to thetoast container, but their
/Unrecognized field|deleted/iand/…|owners/ifilters match thebackground
"pw-xxx" deleted successfully!notification. Now scoped to the error variant, sothey still catch the Jackson regression they were written for and nothing else.
TableLevelTests.spec.tsandColumnLevelTests.spec.tswere checked and need no change — theynever touch toasts.
Type of change:
High-level design:
N/A — small change.
Tests:
Use cases covered
Data Quality › Table test casesurvives an unrelated toast (async delete / export jobnotification from a parallel worker) landing mid-step.
failed test case without a sample gets a 404 and shows no error toaststill fails if the 404surfaces as an error toast, but no longer fails on a background success toast.
Unrecognized fielderror toast, and nolonger fail on
"<entity>" deleted successfully!.Unit tests
Not applicable — no product logic changed. The single source change is a
data-*attribute usedas a test hook; there is no core-components unit test for
toast.tsxto update.Backend integration tests
Not applicable — no backend API changes.
Ingestion integration tests
Not applicable — no ingestion changes.
Playwright (UI) tests
This PR is the Playwright change. Files updated:
playwright/utils/common.ts(+waitForToastToDisappear, +expectNoErrorToast)playwright/e2e/Features/DataQuality/DataQuality.spec.tsplaywright/e2e/Features/DataQuality/IncidentManagerAfterSoftDelete.spec.tsplaywright/e2e/Features/DataQuality/IncidentManagerAfterOwnerChange.spec.tsplaywright/e2e/Features/FailedTestCaseSampleData.spec.tsManual testing performed
The failure was diagnosed from the nightly report rather than reproduced locally — the race needs
several parallel workers plus ingestion. Verification run locally:
npx eslint <5 changed playwright files>→ 0 errors, 0 warnings (only the 2 pre-existingjustified
no-wait-for-timeoutsuppressions incommon.ts).organize-imports-cli→eslint --fix→prettier --write(the exactUI Checkstylesequence) on the same files → no further diff.
prettier --checkontoast.tsxwith the core-components config → clean.tsc --noEmit -p playwright/tsconfig.json→ 163 pre-existing errors across 47 other files,none in any file this PR touches.
The specs themselves were not executed locally; they need a live stack with ingestion. Asking for
a nightly/CI run on this branch to confirm.
UI screen recording / screenshots:
Not applicable — no user-visible UI change.
data-variantis an inert test attribute; rendering,styling and behaviour are unchanged.
Checklist:
Fixes <issue-number>: <short explanation>— N/A, CI de-flake with no issue,following Fix Playwright custom property and lineage flakes #31528 / test(ui): de-flake ports lineage graph and Domains Rbac Playwright tests #31533 / Chore(UI): Ensure the runner selection to avoid flaky behaviour #31541.
Fixes #<issue-number>above — N/A, same reason.doc comment explaining why the scoping is required.
🤖 Generated with Claude Code