Skip to content

Conversation

@chirag-madlani
Copy link
Collaborator

This pull request refactors the RightEntityPanelFlow.spec.ts Playwright test to improve test isolation and reliability by creating and cleaning up the main test entity (adminTestEntity) within each test case, rather than sharing it across all tests. It also updates references to use the correct property for the entity name and introduces some minor utility improvements.

Test entity lifecycle management:

  • Changed adminTestEntity from a shared instance to being created in each test's beforeEach and deleted in afterEach, ensuring a clean environment for every test run. [1] [2] [3] [4]

Test reliability and correctness:

Utility improvements:

  • Added redirectToHomePage to the imports and used it in navigation steps to ensure the browser is in a consistent state before and after each test. [1] [2]

These changes make the test suite more robust, maintainable, and less prone to side effects from shared state.

Describe your changes:

Fixes

I worked on ... because ...

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.

@github-actions
Copy link
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 65%
65.8% (55633/84546) 44.84% (28707/64015) 47.68% (8740/18329)

@gitar-bot
Copy link

gitar-bot bot commented Jan 27, 2026

Code Review ✅ Approved 1 resolved / 1 findings

Well-structured test refactoring that improves isolation by creating fresh test entities per test. The hardcoded timeout from the previous review has been removed.

✅ 1 resolved
Quality: Hardcoded timeout is fragile for CI/CD environments

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/RightEntityPanelFlow.spec.ts:121
The await adminPage.waitForTimeout(1000) is a hardcoded delay that introduces fragility:

  1. Too short in slow CI environments: If the backend is under load or the CI runner is slow, 1 second may not be enough for entity propagation, leading to intermittent failures
  2. Too long in fast environments: Wastes test execution time when the entity is ready sooner

Suggested improvement: Consider using an explicit wait condition instead of a fixed timeout. For example:

// Wait for the entity to be searchable/navigable
await adminPage.waitForFunction(
  async (entityName) => {
    // Poll until entity appears in search or is accessible
    const response = await fetch(`/api/v1/tables/name/${entityName}`);
    return response.ok;
  },
  entity.name,
  { timeout: 5000 }
);

Or use Playwright's built-in retry mechanisms if the navigation itself handles retries. The PR context mentions this is for backend propagation, so if Playwright's auto-waiting on navigateToExploreAndSelectTable doesn't cover this case, consider wrapping the navigation in a retry block.

Impact: Low - the 1000ms timeout will likely work in most cases, but it's a known anti-pattern in E2E testing that can cause flakiness.

Rules ✅ All requirements met

Gitar Rules

Summary Enhancement: PR has comprehensive description with detailed technical context

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.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud
Copy link

@chirag-madlani chirag-madlani merged commit 34a7f5e into main Jan 27, 2026
28 of 31 checks passed
@chirag-madlani chirag-madlani deleted the fix-pw-right-panel branch January 27, 2026 11:27
@github-actions
Copy link
Contributor

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

chirag-madlani added a commit that referenced this pull request Jan 27, 2026
* fix(test): right entity panel spec failure

* fix token issue for table creation

* remove hardcoded timeout

(cherry picked from commit 34a7f5e)
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