Repository navigation
test(glossary): make selectActiveGlossary selector robust - #27566
Conversation
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]>
There was a problem hiding this comment.
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
selectActiveGlossarylookups to the glossary left panel and require an exactmenuitemname match. - Update
createGlossaryTermsto select by rendered label (displayName ?? name). - Update several
Glossary.spec.tscall sites to passdisplayNameinstead ofname.
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. |
🟡 Playwright Results — all passed (25 flaky)✅ 3686 passed · ❌ 0 failed · 🟡 25 flaky · ⏭️ 89 skipped
🟡 25 flaky test(s) (passed on retry)
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]>
Code Review ✅ ApprovedRefactors the selectActiveGlossary selector to improve robustness against null states. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|
|
Failed to cherry-pick changes to the 1.12.6 branch. |
…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]>
… 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]>



Summary
selectActiveGlossaryto[data-testid="glossary-left-panel"]and require an exactnamematch 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 thePW %prefix.displayName ?? name).createGlossaryTermsand the sixGlossary.spec.tscallers that were passingglossary.data.nameto passglossary.data.displayName— the menu label isgetEntityName(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 Listinghas been failing on 1.12.6. Trace shows the page lands on the wrong (pre-existing) glossary beforevalidateGlossaryTerm, then the row-key check times out at 5s. Root cause is the unscoped, non-exact menuitem lookup inselectActiveGlossarycombined with callers passing the wrong identifier. The same flow exists onmain, so fixing both here.Test plan
npx playwright test e2e/Pages/Glossary.spec.tsnpx playwright test e2e/Pages/GlossaryImportExport.spec.ts e2e/Pages/GlossaryFormValidation.spec.ts e2e/Features/Glossary/GlossaryRemoveOperations.spec.ts(otherselectActiveGlossarycallers — they already passdisplayName, just verifying the stricter helper doesn't regress them)🤖 Generated with Claude Code