Skip to content

Glossary E2E: verify the description with a web-first assertion so it survives the lazy-loaded editor #31384

Closed

Description

@siddhant1

Goal

Make the glossary E2E suite give a trustworthy signal about glossary descriptions, so a green Playwright run means the description actually rendered — and a red one means something is genuinely broken.

Current behaviour

verifyGlossaryDetails reads the description with a single, non-retrying DOM read:

// playwright/utils/glossary.ts
const viewerContainerText = await page.textContent('[data-testid="viewer-container"]');

expect(viewerContainerText).toContain(glossaryDetails.description);

page.textContent() resolves as soon as the element is attached and reads its text exactly once. The description is rendered by RichTextEditorPreviewNew, whose BlockEditor is withSuspenseFallback(lazy(() => import(...))) with the default null fallback — so viewer-container is attached with a literally empty subtree until that chunk resolves (and its content state starts as '', set later in a useEffect).

The helper therefore reads "" whenever the lazy chunk hasn't landed yet, and fails with:

expect(received).toContain(expected) // indexOf
Expected substring: "Glossary terms that describe general conceptual terms. …"
Received string:    ""

Two things make this easy to miss:

  • waitForAllLoadersToDisappear gives false confidence — it waits for [data-testid="loader"], and this Suspense fallback renders no loader at all.
  • The failure looks like missing data, but the data is fine. The screenshot Playwright captures after the assertion fails shows the description rendered correctly.

Impact

Across 10 Postgres Playwright runs on 11–12 Aug, Glossary.spec.ts › "Approve and reject glossary term from Glossary Listing" ran 9 times: 4 flaky + 1 hard failure + 4 clean — a 56% first-attempt failure rate. The hard failure (run 31566736080) blocked the merge queue for an unrelated PR.

The same helper backs two sibling tests in the same file ("Glossary & terms creation for reviewer as user" / "as team"), which fail with the identical signature.

Proposed change

Use a web-first assertion so the check retries until the lazily-mounted editor renders — matching the pattern already used everywhere else in the suite (e.g. playwright/utils/tag.ts):

await expect(page.getByTestId('viewer-container')).toContainText(
  glossaryDetails.description
);

Notes

page.textContent() + toContain appears in 4 other places in the Playwright tree (utils/entity.ts, utils/user.ts, support/entity/ingestion/RedshiftWithDBTIngestionClass.ts, e2e/Features/QueryEntity.spec.ts). Those aren't currently failing, so they're left alone here — worth a follow-up sweep under #31035.

Activity

  1. added a commit that references this issue on Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Done ✅

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions