Skip to content

test(glossary): make selectActiveGlossary selector robust - #27566

Merged
siddhant1 merged 3 commits into
mainfrom
fix/playwright-select-active-glossary-robust
Apr 21, 2026
Merged

siddhant1 merged 3 commits into
mainfrom
fix/playwright-select-active-glossary-robust

Conversation

@siddhant1

@siddhant1 siddhant1 commented Apr 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Scope selectActiveGlossary to [data-testid="glossary-left-panel"] and require an exact name match so the helper can no longer (a) match a menuitem in another dropdown (the Add-button glossary picker has the same role) or (b) silently mis-click via .first() when many glossaries share the PW % prefix.
  • Document the parameter as the rendered label (displayName ?? name).
  • Update createGlossaryTerms and the six Glossary.spec.ts callers that were passing glossary.data.name to pass glossary.data.displayName — the menu label is getEntityName(glossary) (= displayName ?? name), so passing the raw name never matches and the previous substring + .first() could mis-click.

Why

Glossary tests › Approve and reject glossary term from Glossary Listing has been failing on 1.12.6. Trace shows the page lands on the wrong (pre-existing) glossary before validateGlossaryTerm, then the row-key check times out at 5s. Root cause is the unscoped, non-exact menuitem lookup in selectActiveGlossary combined with callers passing the wrong identifier. The same flow exists on main, so fixing both here.

Test plan

  • npx playwright test e2e/Pages/Glossary.spec.ts
  • npx playwright test e2e/Pages/GlossaryImportExport.spec.ts e2e/Pages/GlossaryFormValidation.spec.ts e2e/Features/Glossary/GlossaryRemoveOperations.spec.ts (other selectActiveGlossary callers — they already pass displayName, just verifying the stricter helper doesn't regress them)

🤖 Generated with Claude Code

Scope the menuitem lookup to [data-testid="glossary-left-panel"] and
require an exact name match so the helper can no longer pick up an
element from another dropdown (e.g. the Add-button glossary picker) or
silently mis-click via .first() when many glossaries share the "PW % "
prefix. The label argument is documented as the rendered label
(displayName ?? name).

Update createGlossaryTerms and the six Glossary.spec.ts callers that
were passing glossary.data.name (which never matches the rendered
displayName) to pass the displayName instead. This is the underlying
cause of the flakiness in "Approve and reject glossary term from
Glossary Listing".

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@siddhant1
siddhant1 requested a review from a team as a code owner April 21, 2026 05:52
Copilot AI review requested due to automatic review settings April 21, 2026 05:52
@siddhant1 siddhant1 added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs To release Will cherry-pick this PR into the release branch labels Apr 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the Playwright glossary navigation helper to avoid mis-clicking similarly-named glossaries or matching unrelated menu items, stabilizing flaky glossary E2E flows.

Changes:

  • Scope selectActiveGlossary lookups to the glossary left panel and require an exact menuitem name match.
  • Update createGlossaryTerms to select by rendered label (displayName ?? name).
  • Update several Glossary.spec.ts call sites to pass displayName instead of name.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
openmetadata-ui/src/main/resources/ui/playwright/utils/glossary.ts Makes glossary selection deterministic by scoping to the left panel and enforcing exact label matching.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Glossary.spec.ts Aligns test calls with the UI-rendered glossary label so the stricter selector works reliably.

@github-actions

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 61%
61.95% (60279/97287) 41.99% (31619/75292) 45% (9496/21098)

@github-actions

github-actions Bot commented Apr 21, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (25 flaky)

✅ 3686 passed · ❌ 0 failed · 🟡 25 flaky · ⏭️ 89 skipped

Shard Passed Failed Flaky Skipped
✅ Shard 1 481 0 0 4
🟡 Shard 2 652 0 4 7
🟡 Shard 3 659 0 7 1
🟡 Shard 4 642 0 6 27
✅ Shard 5 611 0 0 42
🟡 Shard 6 641 0 8 8
🟡 25 flaky test(s) (passed on retry)
  • Features/BulkEditEntity.spec.ts › Glossary (shard 2, 1 retry)
  • Features/DataQuality/DataQuality.spec.ts › Column test case (shard 2, 1 retry)
  • Features/DomainTierCertificationVoting.spec.ts › DataProduct - Certification assign, update, and remove (shard 2, 1 retry)
  • Features/Glossary/GlossaryHierarchy.spec.ts › should cancel drag and drop operation (shard 2, 1 retry)
  • Features/IncidentManager.spec.ts › Complete Incident lifecycle with table owner (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 2 retries)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Features/RTL.spec.ts › Verify Following widget functionality (shard 3, 1 retry)
  • Pages/Customproperties-part2.spec.ts › entityReferenceList shows item count, scrollable list, no expand toggle (shard 4, 1 retry)
  • Pages/DataContracts.spec.ts › Create Data Contract and validate for DashboardDataModel (shard 4, 1 retry)
  • Pages/DataContracts.spec.ts › Create Data Contract and validate for Database Schema (shard 4, 1 retry)
  • Pages/DataContractsSemanticRules.spec.ts › Validate Owner Rule Not_In (shard 4, 1 retry)
  • Pages/DataContractsSemanticRules.spec.ts › Validate Description Rule Is_Set (shard 4, 1 retry)
  • Pages/DomainAdvanced.spec.ts › Data product version history shows changes (shard 4, 1 retry)
  • Pages/Glossary.spec.ts › Glossary Term Update in Glossary Page should persist tree (shard 6, 1 retry)
  • Pages/Lineage/DataAssetLineage.spec.ts › verify create lineage for entity - Search Index (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: searchIndex (shard 6, 1 retry)
  • Pages/Users.spec.ts › Permissions for table details page for Data Consumer (shard 6, 1 retry)
  • Pages/Users.spec.ts › Check permissions for Data Steward (shard 6, 1 retry)
  • Pages/Users.spec.ts › Should navigate to user profile from feed card avatar click (shard 6, 1 retry)
  • VersionPages/EntityVersionPages.spec.ts › Topic (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

…saries match strict sidebar lookup

The previous commit made selectActiveGlossary match the sidebar
menuitem by displayName with exact: true. That assumed every glossary
in a test had its displayName rendered in the sidebar. UI-created
glossaries (via the createGlossary helper) only filled the name field,
so the server had no displayName and the sidebar rendered the raw
name — the exact-match lookup then hung until the 180s test timeout.

Fill the display-name field in createGlossary, and look up the
menuitem in verifyGlossaryDetails by displayName as well. This aligns
UI-created glossaries with API-created ones and unblocks the three
tests that were failing on this PR:
  - Glossary & terms creation for reviewer as user
  - Glossary & terms creation for reviewer as team
  - Approve and reject glossary term from Glossary Listing

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings April 21, 2026 09:14
@gitar-bot

gitar-bot Bot commented Apr 21, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

Refactors the selectActiveGlossary selector to improve robustness against null states. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@sonarqubecloud

Copy link
Copy Markdown

@siddhant1
siddhant1 enabled auto-merge (squash) April 21, 2026 11:18
@siddhant1
siddhant1 merged commit dd73bd9 into main Apr 21, 2026
50 checks passed
@siddhant1
siddhant1 deleted the fix/playwright-select-active-glossary-robust branch April 21, 2026 11:19
@github-actions

Copy link
Copy Markdown
Contributor

Failed to cherry-pick changes to the 1.12.6 branch.
Please cherry-pick the changes manually.
You can find more details here.

jatinmasaram pushed a commit to jatinmasaram/OpenMetadata that referenced this pull request May 2, 2026
…ata#27566)

* test(glossary): make selectActiveGlossary selector robust

Scope the menuitem lookup to [data-testid="glossary-left-panel"] and
require an exact name match so the helper can no longer pick up an
element from another dropdown (e.g. the Add-button glossary picker) or
silently mis-click via .first() when many glossaries share the "PW % "
prefix. The label argument is documented as the rendered label
(displayName ?? name).

Update createGlossaryTerms and the six Glossary.spec.ts callers that
were passing glossary.data.name (which never matches the rendered
displayName) to pass the displayName instead. This is the underlying
cause of the flakiness in "Approve and reject glossary term from
Glossary Listing".

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* test(glossary): fill displayName in createGlossary so UI-created glossaries match strict sidebar lookup

The previous commit made selectActiveGlossary match the sidebar
menuitem by displayName with exact: true. That assumed every glossary
in a test had its displayName rendered in the sidebar. UI-created
glossaries (via the createGlossary helper) only filled the name field,
so the server had no displayName and the sidebar rendered the raw
name — the exact-match lookup then hung until the 180s test timeout.

Fill the display-name field in createGlossary, and look up the
menuitem in verifyGlossaryDetails by displayName as well. This aligns
UI-created glossaries with API-created ones and unblocks the three
tests that were failing on this PR:
  - Glossary & terms creation for reviewer as user
  - Glossary & terms creation for reviewer as team
  - Approve and reject glossary term from Glossary Listing

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Siddhant <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
siddhant1 added a commit that referenced this pull request Aug 4, 2026
… 4 that never ran (#30839)

* test(glossary): make selectActiveGlossary selector robust (#27566)

Backport of dd73bd9 to 1.13. Prerequisite for re-enabling
GlossaryNavigation's empty-state test, which 1.13 skips with the note
"selectActiveGlossary not selecting the correct glossary".

The old selector was `page.getByRole('menuitem', { name }).first()` — unscoped
and non-exact, so it matched any menuitem on the page whose accessible name
merely *contained* the target, and `.first()` then silently picked whichever
came first in the DOM. With two glossaries sharing a name prefix the test drove
the wrong one. Scope it to the `glossary-left-panel` sidebar, require an exact
label match, and wait for the item rather than racing the panel's render.

The label the sidebar renders is displayName, so the UI create helper now fills
display-name and the call sites pass displayName. Verified every
selectActiveGlossary call site on 1.13 already passes a displayName, so the
stricter match has no other call site to break.

(cherry picked from commit dd73bd9)

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

* test(e2e): re-enable domain-rename, glossary empty-state and header-permission specs on 1.13

Backports the un-skips from #30451 (64c33fc) and #30699 (507caf7), which
main and 2.0 have both carried since end of July. These four tests are the whole
1.13-only half of the nightly skip list — every other entry is skipped on all
three branches.

- EntityRenameConsolidation "Domain - rename then update description" and
  "Domain - multiple rename + update cycles": pure un-skip, no body change, same
  as main.
- GlossaryNavigation "should show empty state when glossary has no terms": the
  assertion targeted the "No Glossary Term found" row, which only a non-matching
  status filter renders — an empty glossary renders a placeholder instead. main
  asserts its EmptyPlaceholder testid; 1.13 still routes through ErrorPlaceHolder
  and picks NO_DATA over CREATE (glossaryTermStatus is null for a glossary, not
  Approved), so assert no-data-placeholder here. Depends on the preceding
  selectActiveGlossary backport.
- EntityPermissions "EditTier, EditOwners, EditCertification allowed but EditAll
  denied": the body contradicted its own title, asserting the edit buttons were
  visible. getPrioritizedEditPermission is byte-identical on 1.13 and main, so
  the corrected not.toBeVisible() assertions hold here too.

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

* test(glossary): drop four status-filter tests that were never implemented

These four arrived skipped in #25428 (`12d85f310f`), the same commit that created
the file, and have never executed once in five months. They are not regressions
and not flakes — they are a specification for behaviour the backend does not have.

Each carried its own reason inline from birth: "Requires backend to return nested
terms as flat results when filtered". That is accurate. The glossary term listing
sends `directChildrenOf` and `entityStatus` on the same request
(`glossaryAPI.ts` `getFirstLevelGlossaryTermsPaginated`), and the backend ANDs them
(`GlossaryTermResource` `.addQueryParam("directChildrenOf", …).addQueryParam("entityStatus", …)`),
so a nested term is eliminated by the hierarchy filter before its status is ever
considered. No status value can surface a grandchild as a flat result.

Confirmed by running them: on a real 1.13 stack all four fail at ~17.5s (the
locator timeout — the term genuinely never renders), while every sibling test that
asserts only root-level terms passes. `glossaryAPI.ts` and `GlossaryTermResource`
are byte-identical across 1.13, main and 2.0, so the outcome is the same everywhere.

Removed rather than left skipped: five bare `test.skip`s surface on every nightly
triage list as if they were failures, and cost review attention each time someone
asks why the glossary suite is red. If flat subtree filtering is built, these are
better rewritten against the real API than resurrected from a five-month-old skip.

No fixtures are orphaned — `basicChild`, `multiChild`, `deepTerms` and the rest are
still used by the surviving tests. Prettier and eslint clean.

Co-Authored-By: Claude <[email protected]>
(cherry picked from commit 4a7aa34)
(cherry picked from commit f099c7c)

* test(glossary): re-enable change filter while expanded on 1.13

Verified passing at 2.8s on a real 1.13 stack built from this branch.

Born skipped in #25428 claiming "re-filtering expanded state isn't fully
implemented" — that shipped since and nobody revisited the marker. It is the one
stale skip in this file, as opposed to the four genuinely backend-blocked ones
removed in the preceding commit.

It only surfaced on the nightly skip list as a separate entry because the file is
`test.describe.configure({ mode: 'serial' })`: when `filter by child status` fails,
Playwright reports every later test in the file as skipped without executing it.
With those four gone the cascade cannot occur, so this test now actually runs.

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

* style: fix indentation on the re-enabled EntityPermissions test

fb2837e landed `headerPermTest(` with five leading spaces instead of four,
which fails `prettier --check` and would block the UI Checkstyle job.

The assertion change in that commit is correct and identical to what this branch
already carried — verified passing on a real 1.13 stack (3.0s). Only the
indentation is corrected here.

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

* test(glossary): re-enable Term should stay approved on 1.13

Closes the last gap between this branch and #30843, so 1.13 lands the same
glossary state as main and 2.0 in a single merge — no post-merge cherry-pick of
#30843 onto 1.13 is needed, and none should be attempted: the other two pieces of
#30843 (the four removals and the change-filter re-enable) are already on this
branch and would conflict.

Measured passing on a real 1.13 stack (1.9m).

Caveat worth carrying into review: **#29931 is not on 1.13**. That PR fixed the
approve/reject condition scheme — duplicate edges and stuck resolves in the
approval workflow — which is the documented cause behind this test's original skip
("BE approval-workflow reverts it"). `APPROVE_CONDITION` and
`getExpectedResultForActiveTask` are both absent here, so 1.13 passes this test
without the root fix. On main it passed 3/3 (1.0m, 58.6s, 58.3s) with the fix; on
1.13 it has one measured pass without it, and the failure mode is a load-dependent
race that shows up under CI concurrency rather than on an idle machine.

If it flakes in nightlies, backport #29931 rather than re-skipping. Note that is
not a casual cherry-pick — it touches 21 files including
bootstrap/sql/migrations/native/2.0.0/{mysql,postgres}/schemaChanges.sql, and a
trial cherry-pick onto 1.13 conflicts in 14 of them.

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

---------

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

This branch was previously deployed

1 inactive deployment
test — cecf29ba Deployed Apr 21, 2026 by siddhant1 via playwright-ci-postgresql (5, 6) #43439
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 To release Will cherry-pick this PR into the release branch UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants