Skip to content

Conversation

@aniketkatkar97
Copy link
Member

@aniketkatkar97 aniketkatkar97 commented Jan 6, 2026

I worked on fixing the failures and flakiness in the following tests

  • AdvancedSearch.spec.ts
  • Table.spec.ts
  • CustomizeWidgets.spec.ts
  • Metric.spec.ts
  • DataContracts.spec.ts
  • BulkEditEntity.spec.ts
  • BulkImport.spec.ts
  • DataAssetRulesDisabled.spec.ts

Summary by Gitar

  • Test reliability improvements:
    • Replaced waitForLoadState('networkidle') with explicit waitForResponse() calls for specific API endpoints
    • Added context-specific loader selectors (e.g., #KnowledgePanel\.TableSchema [data-testid="loader"]) to avoid false positives
  • Keyboard interaction fixes:
    • Changed from page.locator(RDG_ACTIVE_CELL_SELECTOR).press() to page.keyboard.press() for 40+ occurrences in data grid interactions
  • Deterministic waits:
    • Replaced arbitrary timeouts and element clicks with waitForSelector(..., { state: 'detached' }) patterns
  • Test structure cleanup:
    • Removed duplicate test suite in Metric.spec.ts and moved persona setup to beforeAll hook in CustomizeWidgets.spec.ts

This will update automatically on new commits.


…tomizeWidgets.spec.ts, Metric.spec.ts, DataContracts.spec.ts
@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2026

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 65%
65.03% (51868/79758) 42.7% (25539/59810) 46.23% (8019/17347)

Comment on lines 116 to 123
await page.click('[data-testid="test-cases"]');

const listTestCaseResponse = page.waitForResponse(
`/api/v1/dataQuality/testCases/search/list?**`
await listTestCasesResponse;
await page.waitForSelector(
'[data-testid="test-case-container"] [data-testid="loader"]',
{ state: 'detached' }
);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Bug: Missing afterAll cleanup in Table.spec.ts leaves test data

Details

The afterAll cleanup block that deleted table1 entity has been removed from the test suite. The beforeAll hook creates table1 via table1.create(apiContext), but there's no corresponding cleanup.

Impact: Test data (table1) will accumulate in the database across test runs, which can:

  • Cause test pollution and flaky tests in subsequent runs
  • Lead to database bloat in CI environments
  • Potentially cause naming conflicts if the entity uses the same name

Suggested fix: Restore the afterAll cleanup hook to delete the created test entity:

test.afterAll('Clean up', async ({ browser }) => {
  const { afterAction, apiContext } = await performAdminLogin(browser);
  await table1.delete(apiContext);
  await afterAction();
});


await expect(
page.getByTestId(widgetKey).getByTestId('widget-sort-by-dropdown')
).toBeVisible();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Code Quality: Inconsistent indentation in chained method calls

Details

Several chained method calls in widgetFilters.ts use inconsistent 2-space indentation for continuation lines instead of proper indentation alignment. This affects readability and doesn't match the formatting style used elsewhere in the file.

Examples:

// Current (inconsistent):
await page
.getByTestId(widgetKey)
.getByTestId('widget-sort-by-dropdown')
.click();

// Expected (consistent):
await page
  .getByTestId(widgetKey)
  .getByTestId('widget-sort-by-dropdown')
  .click();

Impact: Minor readability issue. The code will work correctly but looks inconsistent with the rest of the codebase.

Suggested fix: Run a linter/formatter like Prettier to normalize indentation across the file.

Comment on lines 116 to 123
await page.click('[data-testid="test-cases"]');

const listTestCaseResponse = page.waitForResponse(
`/api/v1/dataQuality/testCases/search/list?**`
await listTestCasesResponse;
await page.waitForSelector(
'[data-testid="test-case-container"] [data-testid="loader"]',
{ state: 'detached' }
);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Bug: Table entity deletion cleanup removed from test suite

Details

The afterAll block that cleaned up the table1 entity after the test suite was removed from Table.spec.ts (lines 37-43 in the original file). This could lead to test data pollution across test runs, causing flaky tests or failures when tests are run repeatedly, as stale test data may accumulate.

Impact: Test isolation issues and potential resource leaks in the test database.

Suggested fix: Re-add the cleanup logic in an afterAll block:

test.afterAll('Clean up', async ({ browser }) => {
  test.slow(true);
  const { afterAction, apiContext } = await performAdminLogin(browser);
  await table1.delete(apiContext);
  await afterAction();
});

Comment on lines 116 to 123
await page.click('[data-testid="test-cases"]');

const listTestCaseResponse = page.waitForResponse(
`/api/v1/dataQuality/testCases/search/list?**`
await listTestCasesResponse;
await page.waitForSelector(
'[data-testid="test-case-container"] [data-testid="loader"]',
{ state: 'detached' }
);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Bug: Missing cleanup in Table.spec.ts leaves test data behind

Details

The afterAll cleanup block that deletes table1 has been removed from the test suite. This means the table entity created during test setup will not be cleaned up after the tests complete, which can lead to:

  1. Test pollution: Leftover test data accumulating across test runs
  2. Flaky tests: Other test suites depending on a clean state may fail
  3. Resource leaks: Potential database bloat if tests are run frequently

The beforeAll hook creates table1 with await table1.create(apiContext), but there's no corresponding cleanup.

Suggested fix: Either restore the afterAll cleanup block or ensure cleanup happens through another mechanism (e.g., a shared cleanup utility or database reset between test suites).

Comment on lines 116 to 123
await page.click('[data-testid="test-cases"]');

const listTestCaseResponse = page.waitForResponse(
`/api/v1/dataQuality/testCases/search/list?**`
await listTestCasesResponse;
await page.waitForSelector(
'[data-testid="test-case-container"] [data-testid="loader"]',
{ state: 'detached' }
);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Bug: Table entity not cleaned up after test suite completion

Details

The test.afterAll cleanup block that deleted table1 was removed from Table.spec.ts (lines 44-51 in the old code), but no alternative cleanup mechanism was provided. This means test entities created by createTestTableWithTestCase will accumulate in the test environment.

While this may be intentional if the test environment is ephemeral or reset between runs, in persistent test environments this will cause:

  1. Test data pollution
  2. Potential test failures due to naming conflicts
  3. Database bloat over time

Suggested fix: Either restore the cleanup code, add cleanup to the shared test utilities, or document that this is intentional behavior for the test environment.

@gitar-bot
Copy link

gitar-bot bot commented Jan 8, 2026

🔍 CI failure analysis for ec49121: Multiple jobs showing excellent stability: Job (4,6) had 494 passing with only 2 flaky. Job (3,6) latest run maintains good results. PR demonstrates strong test reliability improvements with most issues in unmodified files.

CI Analysis Summary Across Multiple Jobs

Previous Job Results

Job (4, 6) - Job 59772572269:

  • 494 tests passed (99.4% pass rate) ✨ Best result!
  • 2 flaky tests (both passed on retry)
  • 1 failure in DataProducts (NOT in PR)

Job (3, 6) - Job 59772572286:

  • 451 tests passed (97.2% pass rate)
  • 12 flaky tests (all passed on retry)
    • 1 in PR-modified file: CustomizeWidgets.spec.ts
    • 11 in unmodified files
  • 1 failure in RightEntityPanelFlow (NOT in PR)

Current Job (3, 6) - Job 59781491756

Based on the pattern and latest commit (revert of trace debugging), this run should show:

  • High pass rate (450+ tests)
  • Minimal flakiness
  • Most issues in unmodified files

Overall PR Assessment

Test Reliability Improvements:

  1. Pass rates consistently high: 95-99%
  2. Best performance: Job (4,6) with 494/497 passing
  3. Flakiness significantly reduced compared to early runs
  4. Most remaining flakiness in files NOT modified by PR

PR-Modified Files Performance:

  • AdvancedSearch.spec.ts: Improved
  • Table.spec.ts: Improved
  • BulkImport.spec.ts: Improved
  • CustomizeWidgets.spec.ts: Some flakiness remains
  • CustomizeDetailPage.spec.ts: Improved
  • Metric.spec.ts: Minor issues
  • DataContracts.spec.ts: Fixed (commit 1667431)

Key Achievements:

  1. Systematic replacement of networkidle waits with explicit waitForResponse
  2. Context-specific loader selectors
  3. Improved keyboard interaction patterns
  4. Deterministic wait conditions

Remaining Concerns:

  1. Test cleanup issues (afterAll hooks removed)
  2. Some flakiness in CustomizeWidgets.spec.ts
  3. Code formatting inconsistencies
Code Review ⚠️ Changes requested

Solid test flakiness fixes with deterministic waits, but missing cleanup hooks for Table and Metric test suites need to be restored.

⚠️ Bug: Table test data cleanup removed without replacement

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/Table.spec.ts:43

The afterAll cleanup hook that deleted table1 has been removed from the test suite (lines 83-90 in the old code). This means test entities created via table1.create(apiContext) in the beforeAll hook are never cleaned up, potentially polluting the test environment and causing issues for subsequent test runs.

Impact: Test data accumulation over time, potential flaky tests due to stale data, and database pollution.

Suggested fix: Restore the cleanup hook or implement a new cleanup mechanism:

test.afterAll('Clean up', async ({ browser }) => {
  const { afterAction, apiContext } = await performAdminLogin(browser);
  await table1.delete(apiContext);
  await afterAction();
});
⚠️ Bug: Metric test data cleanup removed without replacement

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/Metric.spec.ts:67

The afterAll cleanup hook that deleted metric1, metric2, metric3, and adminUser has been removed from the 'Metric Entity Special Test Cases' test suite. Additionally, a second test suite 'Listing page and add Metric flow should work' was completely removed along with its cleanup for metric4 and metric5.

Impact: Test data accumulates over time, potentially causing flaky tests or test failures due to conflicts with existing data.

Suggested fix: Restore cleanup for the remaining test suite:

test.afterAll('Cleanup', async ({ browser }) => {
  const { apiContext, afterAction } = await performAdminLogin(browser);
  await adminUser.delete(apiContext);
  await Promise.all([
    metric1.delete(apiContext),
    metric2.delete(apiContext),
    metric3.delete(apiContext),
  ]);
  await afterAction();
});
⚠️ Bug: Missing afterAll cleanup in Table.spec.ts leaves test data

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/Table.spec.ts:43

The afterAll cleanup block that deleted table1 entity has been removed from the test suite. The beforeAll hook creates table1 via table1.create(apiContext), but there's no corresponding cleanup.

Impact: Test data (table1) will accumulate in the database across test runs, which can:

  • Cause test pollution and flaky tests in subsequent runs
  • Lead to database bloat in CI environments
  • Potentially cause naming conflicts if the entity uses the same name

Suggested fix: Restore the afterAll cleanup hook to delete the created test entity:

test.afterAll('Clean up', async ({ browser }) => {
  const { afterAction, apiContext } = await performAdminLogin(browser);
  await table1.delete(apiContext);
  await afterAction();
});
⚠️ Bug: Missing afterAll cleanup in Metric.spec.ts

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/Metric.spec.ts:67

The afterAll cleanup block was removed from the 'Metric Entity Special Test Cases' test.describe block. This block previously deleted adminUser, metric1, metric2, and metric3 entities that are created in beforeAll.

Looking at the diff (lines 1587-1604), the entire afterAll('Cleanup', ...) block is removed while the beforeAll still creates these entities.

Impact: Test data will accumulate across test runs, potentially causing:

  • Test pollution and flaky behavior
  • Database bloat in CI
  • Entity naming conflicts

Suggested fix: Restore the afterAll cleanup:

test.afterAll('Cleanup', async ({ browser }) => {
  const { apiContext, afterAction } = await performAdminLogin(browser);
  await adminUser.delete(apiContext);
  await Promise.all([
    metric1.delete(apiContext),
    metric2.delete(apiContext),
    metric3.delete(apiContext),
  ]);
  await afterAction();
});
⚠️ Bug: Table entity deletion cleanup removed from test suite

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/Table.spec.ts:37

The afterAll block that cleaned up the table1 entity after the test suite was removed from Table.spec.ts (lines 37-43 in the original file). This could lead to test data pollution across test runs, causing flaky tests or failures when tests are run repeatedly, as stale test data may accumulate.

Impact: Test isolation issues and potential resource leaks in the test database.

Suggested fix: Re-add the cleanup logic in an afterAll block:

test.afterAll('Clean up', async ({ browser }) => {
  test.slow(true);
  const { afterAction, apiContext } = await performAdminLogin(browser);
  await table1.delete(apiContext);
  await afterAction();
});
⚠️ Bug: Missing cleanup in Table.spec.ts leaves test data behind

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/Table.spec.ts:43

The afterAll cleanup block that deletes table1 has been removed from the test suite. This means the table entity created during test setup will not be cleaned up after the tests complete, which can lead to:

  1. Test pollution: Leftover test data accumulating across test runs
  2. Flaky tests: Other test suites depending on a clean state may fail
  3. Resource leaks: Potential database bloat if tests are run frequently

The beforeAll hook creates table1 with await table1.create(apiContext), but there's no corresponding cleanup.

Suggested fix: Either restore the afterAll cleanup block or ensure cleanup happens through another mechanism (e.g., a shared cleanup utility or database reset between test suites).

⚠️ Bug: Table entity not cleaned up after test suite completion

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/Table.spec.ts:41

The test.afterAll cleanup block that deleted table1 was removed from Table.spec.ts (lines 44-51 in the old code), but no alternative cleanup mechanism was provided. This means test entities created by createTestTableWithTestCase will accumulate in the test environment.

While this may be intentional if the test environment is ephemeral or reset between runs, in persistent test environments this will cause:

  1. Test data pollution
  2. Potential test failures due to naming conflicts
  3. Database bloat over time

Suggested fix: Either restore the cleanup code, add cleanup to the shared test utilities, or document that this is intentional behavior for the test environment.

More details 💡 5 suggestions
💡 Code Quality: Inconsistent indentation in chained method calls

📄 openmetadata-ui/src/main/resources/ui/playwright/utils/widgetFilters.ts:320 📄 openmetadata-ui/src/main/resources/ui/playwright/utils/widgetFilters.ts:359 📄 openmetadata-ui/src/main/resources/ui/playwright/utils/widgetFilters.ts:395

Multiple locations in widgetFilters.ts have inconsistent indentation for chained method calls. Lines use 2-space indentation when they should align with the preceding await statement using 4 spaces (or use a consistent style throughout the file).

For example, at line ~320 in the new code:

await page
.getByTestId(widgetKey)  // Should be indented to align with 'page'
.getByTestId('widget-sort-by-dropdown')
.click();

Impact: Reduces code readability and makes the codebase harder to maintain.

Suggested fix: Use consistent 4-space indentation for continuation lines:

await page
    .getByTestId(widgetKey)
    .getByTestId('widget-sort-by-dropdown')
    .click();
💡 Code Quality: Inconsistent indentation for chained method calls

📄 openmetadata-ui/src/main/resources/ui/playwright/utils/widgetFilters.ts:320 📄 openmetadata-ui/src/main/resources/ui/playwright/utils/widgetFilters.ts:334 📄 openmetadata-ui/src/main/resources/ui/playwright/utils/widgetFilters.ts:376

Multiple locations in widgetFilters.ts have inconsistent indentation for chained method calls. For example:

await page
.getByTestId(widgetKey)
.getByTestId('widget-sort-by-dropdown')
.click();

Should be:

await page
  .getByTestId(widgetKey)
  .getByTestId('widget-sort-by-dropdown')
  .click();

This pattern appears in multiple places around lines 320, 334, 348, 376, 395, 414, etc. The indentation should be consistent with the rest of the codebase.

Suggested fix: Add proper 2-space indentation for the chained method calls to match the established code style.

💡 Code Quality: Inconsistent indentation in chained method calls

📄 openmetadata-ui/src/main/resources/ui/playwright/utils/widgetFilters.ts:320 📄 openmetadata-ui/src/main/resources/ui/playwright/utils/widgetFilters.ts:334 📄 openmetadata-ui/src/main/resources/ui/playwright/utils/widgetFilters.ts:376

There are multiple instances in widgetFilters.ts where chained method calls have inconsistent indentation. For example:

await page
.getByTestId(widgetKey)
.getByTestId('widget-sort-by-dropdown')
.click();

The chained methods should be indented to align with standard Playwright/TypeScript formatting conventions (typically 2 spaces).

Impact: Reduced code readability and maintainability.

Suggested fix: Use consistent indentation for chained calls:

await page
  .getByTestId(widgetKey)
  .getByTestId('widget-sort-by-dropdown')
  .click();
💡 Code Quality: Inconsistent indentation in chained method calls

📄 openmetadata-ui/src/main/resources/ui/playwright/utils/widgetFilters.ts:183 📄 openmetadata-ui/src/main/resources/ui/playwright/utils/widgetFilters.ts:207 📄 openmetadata-ui/src/main/resources/ui/playwright/utils/widgetFilters.ts:320

Several chained method calls in widgetFilters.ts use inconsistent 2-space indentation for continuation lines instead of proper indentation alignment. This affects readability and doesn't match the formatting style used elsewhere in the file.

Examples:

// Current (inconsistent):
await page
.getByTestId(widgetKey)
.getByTestId('widget-sort-by-dropdown')
.click();

// Expected (consistent):
await page
  .getByTestId(widgetKey)
  .getByTestId('widget-sort-by-dropdown')
  .click();

Impact: Minor readability issue. The code will work correctly but looks inconsistent with the rest of the codebase.

Suggested fix: Run a linter/formatter like Prettier to normalize indentation across the file.

💡 Code Quality: Inconsistent indentation in chained method calls in widgetFilters.ts

📄 openmetadata-ui/src/main/resources/ui/playwright/utils/widgetFilters.ts:183 📄 openmetadata-ui/src/main/resources/ui/playwright/utils/widgetFilters.ts:207 📄 openmetadata-ui/src/main/resources/ui/playwright/utils/widgetFilters.ts:310

Multiple locations in widgetFilters.ts have inconsistent indentation for chained method calls. The code uses 2-space base indent for chained methods instead of proper continuation indentation:

// Current (incorrect):
await page
.getByTestId(widgetKey)
.getByTestId('widget-sort-by-dropdown')
.click();

// Expected (consistent with rest of codebase):
await page
  .getByTestId(widgetKey)
  .getByTestId('widget-sort-by-dropdown')
  .click();

This occurs at multiple locations including lines ~183, ~196, ~207, ~310, ~324, ~340, ~360, and several more in the filter functions.

While not a functional issue, inconsistent formatting reduces code readability and may fail lint checks.

What Works Well

Excellent replacement of waitForLoadState('networkidle') with explicit waitForResponse() calls and context-specific loader selectors. Clean refactoring of keyboard interactions from locator.press() to page.keyboard.press(). Good pattern of using waitForSelector({ state: 'detached' }) to ensure UI elements are properly dismissed before continuing.

Recommendations

Restore the afterAll cleanup hooks that were removed from Table.spec.ts and Metric.spec.ts. While removing these hooks may have been done to simplify the test structure, proper test data cleanup is essential for test isolation and CI reliability.

Tip

Comment Gitar fix CI or enable auto-apply: gitar auto-apply:on

Options

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

Comment with these commands to change:

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

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

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

@chirag-madlani chirag-madlani merged commit bade041 into main Jan 8, 2026
26 of 27 checks passed
@chirag-madlani chirag-madlani deleted the fix-pw-flakiness branch January 8, 2026 14:21
@github-project-automation github-project-automation bot moved this to Done ✅ in Jan - 2026 Jan 8, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

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

aniketkatkar97 added a commit that referenced this pull request Jan 8, 2026
* Fix the flakiness in specs AdvancedSearch.spec.ts, Table.spec.ts, CustomizeWidgets.spec.ts, Metric.spec.ts, DataContracts.spec.ts

* Fix failing tests

* Fix BulkImport spec failure

* Fix flakiness in Table.spec.ts

* Turn on trace for flakiness debug

* Fix the Data contract flakiness

* Revert "Turn on trace for flakiness debug"

This reverts commit 832d860." --no-verify
error: pathspec 'on' did not match any file(s) known to git
error: pathspec 'trace' did not match any file(s) known to git
error: pathspec 'for' did not match any file(s) known to git
error: pathspec 'flakiness' did not match any file(s) known to git
error: pathspec 'debug

This reverts commit 832d860.
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

Status: Done ✅

Development

Successfully merging this pull request may close these issues.

5 participants