test(glossary): make selectActiveGlossary selector robust#27566
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) <noreply@anthropic.com>
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) <noreply@anthropic.com>
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) <noreply@anthropic.com> * 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) <noreply@anthropic.com> --------- Co-authored-by: Siddhant <siddhant@MacBook-Pro-621.local> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>



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