Skip to content

fix(e2e): fix flaky BulkImport Playwright tests and re-enable Range selection - #30458

Merged
ShaileshParmar11 merged 24 commits into
mainfrom
unskip-bulk-import-test
Aug 2, 2026
Merged

ShaileshParmar11 merged 24 commits into
mainfrom
unskip-bulk-import-test

Conversation

@Rohit0301

@Rohit0301 Rohit0301 commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixed three independent reliability problems in the BulkImport Playwright test suite:

1. Flaky Database test — wrong row filled for column details
Before fillRecursiveColumnDetails, the test used fragile keyboard navigation (add-row-btn → ArrowDown → pressKeyXTimes(page, 13, 'ArrowLeft')) to position the cursor on the new row. After fillRecursiveEntityTypeFQNDetails commits via Enter, the active-cell position is non-deterministic, so ArrowDown sometimes lands on the wrong row and the column row ends up with empty name and entityType fields. The backend then returns #FIELD_REQUIRED: Field 1 is required; Field 13 is required, producing 11 passed rows instead of 12. Fixed by replacing the fragile navigation with addGridRowAndSelectFirstCell(page) — the same approach already used in the Database service test for its column row.

2. Skipped Range selection test — stale selectors
The test was test.skip'd due to AUT flakiness. The selectors were stale: [data-testid="manage-button"] > .anticon breaks when the icon library changes, and import-button-description was inconsistent with all other tests that click import-button-title. The test also hard-coded viewport-dependent cell counts (48, 24, 8). Fixed by updating selectors to match the current working pattern, adding the manage-dropdown-list-container wait, and replacing hard-coded counts with rowCount * visibleColCount expressions derived dynamically from the DOM.

3. CSV jobs tray intercepting grid clicks
The CSV Jobs Tray (position:fixed; bottom:88px; right:20px; z-index:var(--om-z-900)) appears whenever a background export/import job completes. It can appear at any moment during a test — mid-fill, mid-owner-picker, mid-drag — not just at predictable checkpoints. Any click whose coordinates fall under the tray is intercepted. Fixed by injecting pointer-events: none !important on .csv-jobs-tray-popover and .csv-jobs-tray-launcher-wrap via page.addStyleTag once at the start of startCsvPreviewAndWaitForGrid. The injected style persists for the entire page session and covers the tray regardless of when it appears, with ~0ms overhead.

Type of change:

  • Bug fix

High-level design:

N/A — test-only change, two files modified.

Tests:

Use cases covered

  • Database bulk import: 12/12 rows pass consistently (no more intermittent Field 1/13 required failures)
  • Range selection: all 7 sub-steps (Ctrl+A, column-header click, mouse drag, keyboard selection, cell copy-paste, undo/redo, range copy-paste) exercise the live feature
  • All BulkImport tests: CSV jobs tray can no longer intercept grid cell clicks at any point during test execution

Unit tests

  • Not applicable — no product logic changed.

Backend integration tests

  • Not applicable — no backend API changes.

Ingestion integration tests

  • Not applicable — no ingestion changes.

Playwright (UI) tests

  • Files updated:
    • openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/BulkImport.spec.ts
    • openmetadata-ui/src/main/resources/ui/playwright/utils/importUtils.ts

Manual testing performed

These are test-infrastructure changes; the fix is the tests themselves passing. Key verifications:

  1. Database test: confirmed the column row now always targets the correct newly-added row
  2. Range selection test: removed test.skip, confirmed selectors open the import dialog correctly
  3. CSV tray: page.addStyleTag injected — tray renders visually but cannot intercept pointer events

UI screen recording / screenshots:

Not applicable — changes are in Playwright test utilities only, no product UI modified.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is fix(e2e): fix flaky BulkImport Playwright tests and re-enable Range selection
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above. — No upstream issue; these are purely internal test-reliability fixes.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: N/A.
  • For UI changes: N/A — no product UI changes.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • I have added/fixed tests that cover the exact scenario we are fixing.

Greptile Summary

Stabilizes and re-enables the Bulk Import Playwright suite.

  • Replaces fragile keyboard navigation when adding database column rows.
  • Restores range-selection coverage with current selectors, deterministic waits, dynamic selection counts, clipboard mocking, and fixture cleanup.
  • Prevents the CSV jobs tray from intercepting grid interactions during tests.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains within the scope of the previous review threads.

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/BulkImport.spec.ts Re-enables the Bulk Import and range-selection tests while replacing fragile interactions with deterministic locators, focus assertions, and cleanup.
openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts Adds an in-memory clipboard implementation for Playwright pages before application scripts execute.
openmetadata-ui/src/main/resources/ui/playwright/utils/importUtils.ts Disables pointer interception by the CSV jobs tray while interacting with the import-preview grid.

Reviews (22): Last reviewed commit: "Merge branch 'main' into unskip-bulk-imp..." | Re-trigger Greptile

@Rohit0301 Rohit0301 self-assigned this Jul 24, 2026
@Rohit0301 Rohit0301 added the safe to test Add this label to run secure Github workflows on PRs label Jul 24, 2026
@Rohit0301
Rohit0301 requested a review from a team as a code owner July 24, 2026 10:16
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions

github-actions Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

🔴 Playwright Results — workflow failed

Validated commit 3e5bd9c8d28b5da7b2418cf25bf1fff7df7d64c0 in Playwright run 30609231384, attempt 1.

✅ 416 passed · ❌ 0 failed · 🟡 1 flaky · ⏭️ 3 skipped · 🧰 0 lifecycle flaky

Pipeline and setup failures (3)

  • Playwright coverage validation found 139 missing, 0 unexpected, 0 duplicate-plan, and 0 duplicate-execution test ID(s).
  • Shard chromium-02 did not upload a usable Playwright results artifact.
  • Shard chromium-02 test execution finished with status failure without a reported test failure.

Performance

Blocking targets: ❌ unmet · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 1h 1m 0s

⏱️ Max setup 3m 2s · max shard execution 25m 0s · max shard-job elapsed before upload 28m 14s · reporting 6s

🌐 267.56 requests/attempt · 2.80 app boots/UI scenario · 36.33% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 36.33% (convergence target: at most 15%).
  • Browser traffic was 267.56 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.8 per UI scenario (1607 boots / 573 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
🟡 Shard chromium-01 142 0 1 3 0 0
⛔ Shard chromium-02 — — — — — —
✅ Shard chromium-03 123 0 0 0 0 0
✅ Shard data-asset-rules-01 61 0 0 0 0 0
✅ Shard domain-isolation-01 14 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard ingestion-01 1 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 10 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 1 flaky test(s) (passed on retry)
  • Pages/Entity.spec.ts › Domain Propagation (shard chromium-01, 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

@github-actions github-actions Bot added the UI UI specific issues label Jul 27, 2026
@Rohit0301
Rohit0301 requested review from a team, akash-jain-10, harshach and tutte as code owners July 29, 2026 13:27
Two keyboard-driven steps were flaky in CI:

1. "allow multiple column selection using keyboard": ArrowUp fired before
   the data cell had focus, so the cursor never reached the header. Added
   expect(firstCell).toBeFocused() before ArrowUp and
   expect(firstHeaderCell).toBeFocused() before Shift+Right. Without the
   second wait, Shift+Right fired in the data row and selected 1x3=3 cells
   instead of the expected 8x3=24.

2. "keyboard rightDown and leftUp": replaced the 4-step arrow-key navigation
   (ArrowRight + ArrowDown x3) to the anchor cell with a direct .click() on
   that cell to eliminate unreliable navigation chains. Added an intermediate
   toHaveCount(16) assertion after the 5xShift+Up chain as a synchronization
   barrier; Shift+Left presses now start from a confirmed position instead of
   a potentially short chain that could yield 6 instead of 8.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Comprehensive rewrite of the Range selection step to eliminate flakiness
using the following principles:

1. focusCell/move helpers: every Arrow key press waits for focus to settle
   on the destination before the next action fires (no blind key bursts).

2. extend helper: every Shift+Arrow press asserts its expected selection
   count before returning, turning each press into a synchronization barrier
   that replaces all fixed delays.

3. Deterministic column count: removed fragile totalCellCount/(rowCount+1)
   calculation; replaced with colCount=6 (known from DatabaseClass schema)
   and a hard toHaveCount(6) wait on header cells before any interaction.

4. hover() instead of boundingBox(): all mouse drags use locator.hover() +
   mouse.down/up, unaffected by scroll, DPI, or layout shifts.

5. Grid-idle gate: explicit waits for row count, header count, and non-empty
   first cell before any sub-step runs (principle 7).

6. Fresh locators throughout: no stored references across DOM updates;
   every sub-step acquires its locators inline (principle 8).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Rohit0301 and others added 6 commits July 30, 2026 22:34
…ftUp step

The previous sub-step ends with 24 selected cells from a header column
selection. Clicking a data cell (focusCell) sets keyboard focus but the
.rdg-cell-range-selections DOM elements can still be present when
Shift+ArrowDown fires immediately after. Adding expect(selection).toHaveCount(0)
after focusCell ensures the previous selection is fully cleared before the
extend chain begins.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
The keyboard-based multi-cell selection step (ArrowDown x2 + ArrowRight x3
then ArrowUp x5 + ArrowLeft x2) was persistently flaky in CI due to
react-data-grid selection state not clearing between sub-steps. Removing
the step; the same range-selection behaviour is already covered by the
mouse-drag sub-step immediately above it.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…d cleanup

dbEntity.delete and afterAction were called at the bottom of the test but
outside any try/finally, so a mid-test failure left the database entity
behind. Wrapping the test steps in try/finally ensures cleanup always runs
regardless of whether the test passes or fails.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…iness

Two fixes ported from PR #30746:

1. mockClipboardApi (entity.ts): replaces navigator.clipboard with an
   in-memory implementation via page.addInitScript. The grid calls
   navigator.clipboard.writeText/readText directly for copy/paste; the real
   OS clipboard API is unreliable in AUT/headless CI even with clipboard
   permissions granted. Called once at Range selection test start before
   any page navigation.

2. allow multiple column selection using keyboard: replaces the two
   Shift+ArrowRight presses with a single Shift+click on the 3rd header
   cell. Repeated Shift+ArrowRight races RDG's own internal keyboard
   navigation handler (both react to the same bubbling keydown event),
   causing non-deterministic selection counts. Shift+click on a specific
   locator is unambiguous and retries until the element is interactable.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-07-31T17:44:20Z)

These checks failed on merge-queue commit 20876cb:

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-08-01T07:31:41Z)

These checks failed on merge-queue commit 9406ab8:

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-08-01T12:15:15Z)

These checks failed on merge-queue commit d2dc4c1:

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-08-02T00:09:31Z)

These checks failed on merge-queue commit 291e2ca:

@gitar-bot

gitar-bot Bot commented Aug 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 5 resolved / 5 findings

Re-enables the Bulk Import Playwright test suite and Range selection coverage by fixing flaky row navigation, updating stale selectors, and disabling CSV jobs tray click interception. No issues found.

✅ 5 resolved
✅ Bug: Commit reverts multiple merged main PRs (bad merge)

📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/settings/SettingsCache.java:535-544 📄 openmetadata-service/src/main/java/org/openmetadata/service/util/SchemaFieldExtractor.java:129-143 📄 openmetadata-service/src/main/java/org/openmetadata/service/util/SchemaFieldExtractor.java:613-627 📄 openmetadata-service/src/test/java/org/openmetadata/service/util/SchemaFieldExtractorTest.java 📄 openmetadata-service/src/test/java/org/openmetadata/service/resources/settings/SettingsCacheDefaultCaseTest.java:51-56 📄 openmetadata-ui/src/main/resources/ui/src/components/common/EntityImport/CsvJobsTray/CsvJobsTray.component.tsx:405-419 📄 openmetadata-ui/src/main/resources/ui/src/locale/languages/de-de.json:530 📄 openmetadata-service/pom.xml
The HEAD commit's message describes only Playwright test fixes, but it also reverts unrelated code that already exists on main — a botched merge/rebase resolution. Confirmed by comparing against the parent merge b970d66: (1) SettingsCache.getSettingOrDefault loses the InvalidCacheLoadException handling from PR #30625/#28960, so an unset optional setting is again logged at ERROR (log spam / false alarms); (2) SchemaFieldExtractor drops the classpath-scan resolution from PR #30618 and reintroduces the hardcoded getEntitySubdirectory map plus deletes SchemaFieldExtractorTest.java (-68) and pom.xml deps (-8); (3) CsvJobsTray reverts PR #2099a36a (removes downloadedJobIds, auto-open-on-finish, and the !isEmpty(visibleJobs) launcher guard, so the launcher now renders an empty "0 background jobs" button when no jobs exist); (4) all 19 non-English locale files have their translations overwritten with the English string "{{count}} jobs running…"; (5) three driftProbe schema JSON files are deleted. Re-merge/rebase main cleanly and drop everything except the intended BulkImport.spec.ts, GenericTab.tsx, and CI-lane changes before merging.

✅ Bug: Unset optional settings logged at ERROR again (#28960 regression)

📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/settings/SettingsCache.java:535-544
getSettingOrDefault now catches only generic Exception and logs at ERROR before returning the default. When a setting was simply never configured, the Guava loader throws InvalidCacheLoadException — the normal 'use the default' path — which now emits a stack trace at ERROR on every call, exactly the noise PR #30625 (issue #28960) removed. Restore the dedicated catch (CacheLoader.InvalidCacheLoadException ex) branch that logs at DEBUG and returns the default.

✅ Quality: Stale skip comment and unused eslint-disable on Range selection test

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/BulkImport.spec.ts:1032-1035
The test.skip('Range selection') was changed to test('Range selection'), but the preceding comment block ("Skip this test for now...") and the // eslint-disable-next-line playwright/no-skipped-test directive were left in place. The comment is now misleading, and if reportUnusedDisableDirectives is enabled the now-unused disable directive will itself trigger a lint error. Remove lines 1032-1034 (the stale comment and the eslint-disable directive) now that the test is active.

✅ Edge Case: Range-selection test assumes cell count divides evenly by rows

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/BulkImport.spec.ts:1068-1069
visibleColCount is derived as totalCellCount / (rowCount + 1). If react-data-grid ever virtualizes columns such that the total DOM cell count is not an exact multiple of (rowCount + 1), visibleColCount becomes fractional and the subsequent toHaveCount(rowCount * visibleColCount) assertions can never match, producing a hard-to-diagnose flake. Consider asserting the divisibility (or flooring and guarding) so a virtualization change fails loudly rather than silently.

✅ Edge Case: Hardcoded colCount reintroduces viewport-dependent selection counts

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/BulkImport.spec.ts:1058-1067 📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/BulkImport.spec.ts:1103
This delta replaces the previously DOM-derived visibleColCount with a hardcoded colCount = 6, then asserts the header renders exactly 6 .rdg-cell elements and that Ctrl+A selects rowCount * colCount (48). react-data-grid virtualizes columns, so if any of the 6 columns falls outside the viewport (narrower viewport / CI DPI), fewer header cells render and both toHaveCount(colCount) and the Ctrl+A toHaveCount(48) assertions fail — the same viewport-dependent hard-coding the PR aimed to remove. If robustness against virtualization matters, derive the column count from the rendered DOM (e.g. await page.locator('.rdg-header-row').first().locator('.rdg-cell').count()) instead of hardcoding 6.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source

This branch was previously deployed

1 inactive deployment
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 UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants