Skip to content

Conversation

@harsh-vador
Copy link
Contributor

@harsh-vador harsh-vador commented Dec 26, 2025

Describe your changes:

What does this PR fix?

  • Fixes flaky test failures in RightEntityPanelFlow.spec.ts and improves overall Playwright test reliability by:
  • Adding HTTP status code validation to API response waits
  • Replacing unsafe conditional if (await element.isVisible()) patterns with explicit waits
  • Fixing test data isolation issues in beforeAll hooks
  • Improving robustness of utility functions

Related Issues:

  • Fixes test failures: "Admin - Overview Tab - Domains Section - Add and Update"
  • Fixes test failures: "Lineage Tab - No Lineage"
  • Fixes flaky: "Data Steward/Consumer - Overview Tab - Tier Section - Add and Update"
Screenshot 2025-12-26 at 1 12 24 PM

I worked on ... because ...


Summary by Gitar

  • Test reliability improvements:
    • Enhanced 11 API response waits with response.status() < 400 validation in utils/entity.ts and utils/entityPanel.ts
  • Race condition fixes:
    • Replaced 8 unsafe if (await element.isVisible()) patterns with explicit element.waitFor({ state: 'visible' }) calls
  • Test isolation fix:
    • Removed domain patching logic from beforeAll hook in RightEntityPanelFlow.spec.ts preventing test interference
  • Code cleanup:
    • Removed unused utility functions (clearAndAddGlossaryTerms, clearDataProducts) reducing complexity by 84 lines

This will update automatically on new commits.


Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

@harsh-vador harsh-vador requested a review from a team as a code owner December 26, 2025 07:55
@harsh-vador harsh-vador self-assigned this Dec 26, 2025
@harsh-vador harsh-vador 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 Dec 26, 2025
@harsh-vador harsh-vador changed the title Fix right panel flakiness ui: Fix right panel flakiness Dec 26, 2025
@github-actions
Copy link
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 64%
64.75% (51434/79432) 42.44% (25151/59260) 45.95% (7935/17270)

@gitar-bot
Copy link

gitar-bot bot commented Dec 26, 2025

Code Review 👍 Approved with suggestions

Solid test reliability improvements with robust response handling. One concern about removed functionality potentially affecting other callers.

⚠️ Edge Case: Removing clearExisting may break callers expecting to clear tags first

📄 openmetadata-ui/src/main/resources/ui/playwright/utils/entityPanel.ts:73-76

The editTags function signature was changed from editTags(page, tagName, clearExisting = false) to editTags(page, tagName), removing the ability to clear existing tags before adding new ones. Similarly, editGlossaryTerms had its clearExisting parameter removed, and helper functions clearAndAddGlossaryTerms and clearDataProducts were deleted entirely.

If any other tests or utilities outside this diff rely on these parameters or functions, they will fail at runtime. Please verify that:

  1. No callers pass a third argument to editTags or editGlossaryTerms
  2. No code imports/uses clearAndAddGlossaryTerms or clearDataProducts

If clearing functionality is still needed for some test scenarios, consider providing an alternative approach.

More details 💡 1 suggestion ✅ 2 resolved
💡 Code Quality: Redundant visibility check and assertion

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/RightEntityPanelFlow.spec.ts:44-51

The code at lines 44-51 first waits for the lineage section to be visible, then checks if noLineageText.isVisible(), and if true, immediately asserts expect(noLineageText).toBeVisible(). This is redundant - if isVisible() returned true, the expect assertion will always pass.

The original intent seems to be to optionally verify the "no lineage" text when it's present, but the current pattern doesn't add value. Consider either:

  1. Just using await noLineageText.isVisible() without the expect, or
  2. Restructuring to assert based on expected state (e.g., checking lineage data presence and then asserting the appropriate message)
Bug: editTags clearExisting may timeout when no tags exist

📄 openmetadata-ui/src/main/resources/ui/playwright/utils/entityPanel.ts:82-100
The editTags function with clearExisting=true now unconditionally waits for the clear button to be visible (line 84: await clearAllButton.waitFor({ state: 'visible'})). If there are no existing tags to clear, this element won't exist, causing the test to timeout rather than gracefully handling the case.

Impact: Tests calling editTags(page, tagName, true) on entities without existing tags will fail with a timeout error.

Suggested fix: Restore the conditional check, or use waitFor with a timeout and catch:

if (clearExisting) {
  const clearAllButton = page.locator('[data-testid="clear-all-button"]');
  const isVisible = await clearAllButton.isVisible().catch(() => false);
  if (isVisible) {
    await clearAllButton.click();
    // ... rest of clearing logic
  }
}
Bug: Redundant visibility check in lineage section test

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/RightEntityPanelFlow.spec.ts:487-496
The code waits for lineageSection to be visible, then checks noLineageText.isVisible(), and if visible, asserts expect(noLineageText).toBeVisible(). This results in an assertion that is always true when reached (since we just checked isVisible).

The original intent was likely to conditionally check when lineage data exists vs. when it doesn't. If the goal is to verify behavior when no lineage exists, consider removing the redundant assertion:

await lineageSection.waitFor({ state: 'visible' });
// "no lineage connections found" may or may not appear depending on entity state
const noLineageText = summaryPanel.locator('text=/no lineage connections found/i');
// Just let the test continue - no assertion needed if we're just checking section loads

Or if validation is important, use a more meaningful assertion pattern.

What Works Well

Good refactoring to use callback-based waitForResponse instead of glob patterns for more reliable matching. Adding response status assertions improves test reliability by failing fast on unexpected API errors.

Recommendations

Before merging, search the codebase for any usages of clearAndAddGlossaryTerms, clearDataProducts, or any callers passing the removed clearExisting parameter to editTags/editGlossaryTerms.

Rules 🎸 1 action taken

Gitar Rules

🎸 Summary Enhancement: Summary was added to PR description with technical details

2 rules not applicable. Show all rules by commenting gitar display:verbose.

Options

Auto-apply is off Gitar will not commit updates to this branch.
✅ Code review is on Gitar will review this change.
Display: compact Hiding non-applicable rules.

Comment with these commands to change:

Auto-apply ✅ Code review Compact
gitar auto-apply:on         
gitar code-review:off         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | This comment will update automatically (Docs)

@sonarqubecloud
Copy link

@harsh-vador harsh-vador enabled auto-merge (squash) December 26, 2025 13:54
@harsh-vador harsh-vador merged commit 1053894 into main Dec 26, 2025
24 checks passed
@harsh-vador harsh-vador deleted the fix-right-panel-flakiness branch December 26, 2025 15:01
@github-actions
Copy link
Contributor

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

harsh-vador added a commit that referenced this pull request Dec 28, 2025
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