Skip to content

test(glossary): make selectActiveGlossary selector robust#27566

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

test(glossary): make selectActiveGlossary selector robust#27566
siddhant1 merged 3 commits intomainfrom
fix/playwright-select-active-glossary-robust

Conversation

@siddhant1
Copy link
Copy Markdown
Member

@siddhant1 siddhant1 commented Apr 21, 2026

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) <noreply@anthropic.com>
@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
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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.

Comment thread openmetadata-ui/src/main/resources/ui/playwright/utils/glossary.ts
@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
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

🟡 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) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 21, 2026 09:14
@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Apr 21, 2026

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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) <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>
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