Skip to content

test(ui): harden glossary import/export permission tests#28688

Open
siddhant1 wants to merge 1 commit into
mainfrom
sid/glossary-import-export-test-hardening
Open

test(ui): harden glossary import/export permission tests#28688
siddhant1 wants to merge 1 commit into
mainfrom
sid/glossary-import-export-test-hardening

Conversation

@siddhant1
Copy link
Copy Markdown
Member

What

Follow-up to #27488 (which restored the glossary Import/Export buttons when EditAll is granted via a conditional policy such as isOwner()). This strengthens the test coverage and isolation around that logic in GlossaryHeader.

Changes

  • Isolate shared mock state — add a beforeEach that resets mockGlossaryTermPermission and mockContext, so tests no longer depend on state leaking between them in source order.
  • Make the ChangeParentHierarchy tests self-contained — they previously passed only by inheriting leaked GLOSSARY_TERM + EditAll state from an earlier test; with the reset in place they now set their own context.
  • Cover the entity-level All operand — the permissions[Operation.All] branch of importExportPermissions was never exercised; the new test fails if that operand is removed, so it genuinely guards it.
  • Guard against over-granting — confirm a non-edit entity permission (Delete / ViewAll) does not surface Import/Export, while the manage menu still renders via Delete.

Test

jest GlossaryHeader.test.tsx11/11 passing. Also verified the new All-path test fails when permissions[Operation.All] is removed from the component, confirming it guards the intended branch.

Isolate the shared mock state with a beforeEach reset so tests no longer
depend on source ordering, and make the two ChangeParentHierarchy tests
set their own glossary-term context instead of relying on leaked state.
Add regression coverage for the entity-level All operand of
importExportPermissions and for the case where only a non-edit
permission (Delete/ViewAll) is granted.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 4, 2026 06:09
@siddhant1 siddhant1 requested a review from a team as a code owner June 4, 2026 06:09
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Jun 4, 2026

Reviewing your code

Code Review ✅ Approved

Hardens glossary import/export permission tests by isolating mock state and adding coverage for the entity-level All operand. 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

Strengthens Jest coverage and isolation for GlossaryHeader’s import/export visibility logic, especially around conditional policies and entity-level permission fallbacks.

Changes:

  • Adds a beforeEach to reinitialize shared permission/context mocks between tests.
  • Makes ChangeParentHierarchy tests explicitly set their own entity context.
  • Adds coverage for entity-level permissions[Operation.All] and ensures non-edit permissions don’t surface Import/Export.

@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 Jun 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 63%
63.34% (67170/106039) 44.21% (36895/83437) 46.51% (10987/23620)

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 4, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

🔴 Playwright Results — 2 failure(s), 16 flaky

✅ 4255 passed · ❌ 2 failed · 🟡 16 flaky · ⏭️ 88 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 298 0 1 4
🟡 Shard 2 801 0 2 9
🔴 Shard 3 798 1 5 8
🟡 Shard 4 853 0 1 12
🟡 Shard 5 719 0 1 47
🔴 Shard 6 786 1 6 8

Genuine Failures (failed on all attempts)

Flow/ExploreAggregationCountsMatching.spec.ts › should verify left panel counts and tab search results for normal search (shard 3)
Error: Tab "topic" search total hits should match the aggregation count

�[2mexpect(�[22m�[31mreceived�[39m�[2m).�[22mtoBe�[2m(�[22m�[32mexpected�[39m�[2m) // Object.is equality�[22m

Expected: �[32m4�[39m
Received: �[31m24�[39m
Pages/LogsViewer.spec.ts › Logs page shows breadcrumb, summary, and log viewer or empty state after opening from bundle suite pipeline tab (shard 6)
�[31mTest timeout of 360000ms exceeded.�[39m
🟡 16 flaky test(s) (passed on retry)
  • Flow/Tour.spec.ts › Tour should work from help section (shard 1, 2 retries)
  • Features/Glossary/GlossaryWorkflow.spec.ts › should display correct status badge color and icon (shard 2, 1 retry)
  • Features/Glossary/GlossaryWorkflow.spec.ts › should start term as Draft when glossary has reviewers (shard 2, 2 retries)
  • Features/IncidentManager.spec.ts › Complete Incident lifecycle with table owner (shard 3, 1 retry)
  • Features/KnowledgeCenterTextEditor.spec.ts › Rich Text Editor - Advanced Blocks (shard 3, 1 retry)
  • Features/RTL.spec.ts › Verify Following widget functionality (shard 3, 1 retry)
  • Features/Tasks/TaskNavigation.spec.ts › navigating to /table/TASK-XXXXX should show 404 (invalid URL pattern) (shard 3, 1 retry)
  • Features/Workflows/WorkflowOssRestrictions.spec.ts › workflow-name-input is disabled in OSS (shard 3, 1 retry)
  • Pages/DataContractsSemanticRules.spec.ts › Validate Description Rule Is_Not_Set (shard 4, 1 retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 5, 1 retry)
  • Features/AutoPilot.spec.ts › Agents created by AutoPilot should be deleted (shard 6, 1 retry)
  • Features/AutoPilot.spec.ts › Create Service and check the AutoPilot status (shard 6, 1 retry)
  • Pages/Glossary.spec.ts › Column dropdown drag-and-drop functionality for Glossary Terms table (shard 6, 1 retry)
  • Pages/Lineage/DataAssetLineage.spec.ts › Column lineage for topic -> topic (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify Impact Analysis service filter selection (shard 6, 1 retry)
  • Pages/ODCSImportExport.spec.ts › Multi-object ODCS contract - object selector shows all schema objects (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

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