Skip to content

Fixed bulk import spec - #30746

Merged
Rohit0301 merged 1 commit into
1.13from
fix-bulk-import-aut-issue
Jul 31, 2026
Merged

Rohit0301 merged 1 commit into
1.13from
fix-bulk-import-aut-issue

Conversation

@Rohit0301

@Rohit0301 Rohit0301 commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

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

High-level design:

N/A — small change.

Tests:

Use cases covered

Unit tests

Backend integration tests

Ingestion integration tests

Playwright (UI) tests

Manual testing performed

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • 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.
  • For UI changes: I attached a screen recording and/or screenshots above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

Summary by Gitar

  • Test improvements:
    • Added mockClipboardApi helper in entity.ts to reliably mock navigator.clipboard for headless CI grid testing
    • Wrapped bulk import test steps in try/finally block to ensure robust cleanup of test entities on failure
    • Refactored BulkImport.spec.ts keyboard navigation to use deterministic Shift+Click for cell/column range selections

This will update automatically on new commits.

Greptile Summary

This PR attempts to stabilize the bulk-import range-selection Playwright test.

  • Adds an in-memory navigator.clipboard implementation for grid copy and paste.
  • Replaces one keyboard range-selection sequence with Shift+click.
  • Ensures database entities and API context are cleaned up through finally.

Confidence Score: 4/5

The retained Shift+Arrow sequence should be fixed before merging because it leaves the bulk-import test vulnerable to the same intermittent failure this PR addresses.

One range-selection step still dispatches keyboard events that both react-data-grid and the application process, so its selected range and subsequent clipboard assertions remain nondeterministic.

Files Needing Attention: openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/BulkImport.spec.ts

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/BulkImport.spec.ts Stabilizes clipboard use and cleanup, but retains the same Shift+Arrow event race in the range copy-paste step.
openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts Adds a page-init clipboard mock implementing the readText and writeText methods used by the bulk-import grid.

Reviews (1): Last reviewed commit: "Fixed bulk import spec" | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

@Rohit0301 Rohit0301 self-assigned this Jul 31, 2026
@Rohit0301
Rohit0301 requested a review from a team as a code owner July 31, 2026 07:45
@Rohit0301 Rohit0301 added the safe to test Add this label to run secure Github workflows on PRs label Jul 31, 2026
@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 added the UI UI specific issues label Jul 31, 2026
@gitar-bot

gitar-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Refactors BulkImport.spec.ts to use deterministic Shift+Click range selections and adds a mockClipboardApi helper to reliably support headless CI grid testing. No issues found.

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

Comment on lines +1304 to +1305
await page.keyboard.press('ArrowUp');
await page.keyboard.down('Shift');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Retained Shift-arrow selection race

When the range copy-paste step runs, these Shift+ArrowRight events are handled by both react-data-grid navigation and the application's bubbling keyboard handler, producing a nondeterministic selected range and intermittent clipboard assertion failures. Replace this sequence as was done in the earlier range-selection step.

Rohit0301 added a commit that referenced this pull request Jul 31, 2026
…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

❌ UI Checkstyle Failed

❌ Playwright - ESLint + Prettier + Organise Imports

One or more Playwright test files have linting or formatting issues.

Affected files
  • openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/BulkImport.spec.ts

❌ Antd + Less Deprecation Guard

A new antd import or new .less file was added. Use UntitledUI + Tailwind for new work.

Affected files

at Function._resolveFilename (node:internal/modules/cjs/loader:1401:15)
at defaultResolveImpl (node:internal/modules/cjs/loader:1057:19)
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1062:22)
at Function._load (node:internal/modules/cjs/loader:1211:37)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
at node:internal/main/run_main_module:36:49 {


Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@Rohit0301
Rohit0301 merged commit 26fc78a into 1.13 Jul 31, 2026
55 of 104 checks passed
@Rohit0301
Rohit0301 deleted the fix-bulk-import-aut-issue branch July 31, 2026 10:00
Rohit0301 added a commit that referenced this pull request Aug 3, 2026
…election (#30458)

* Unskip the bulk import playwright test

* fix(e2e): unskip and fix BulkImport Playwright tests

- Database test: replace fragile ArrowDown + pressKeyXTimes(13) navigation
  before fillRecursiveColumnDetails with addGridRowAndSelectFirstCell, matching
  the pattern already used in the DatabaseService test; fixes intermittent
  "Field 1/13 required" failures where the column row was filled on the wrong row

- Range selection test: remove test.skip; fix stale manage-button selector
  (> .anticon removed, import-button-description → import-button-title, add
  manage-dropdown-list-container wait); replace hardcoded viewport-dependent
  cell counts (54, 48, 24) with dynamic expressions derived from rowCount and
  visibleColCount so the test survives column-width changes

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

* fix(e2e): unskip and fix BulkImport Playwright tests

- Database test: replace fragile ArrowDown + pressKeyXTimes(13) navigation
  before fillRecursiveColumnDetails with addGridRowAndSelectFirstCell, matching
  the pattern already used in the DatabaseService test; fixes intermittent
  "Field 1/13 required" failures where the column row was filled on the wrong row

- Range selection test: remove test.skip; fix stale manage-button selector
  (> .anticon removed, import-button-description → import-button-title, add
  manage-dropdown-list-container wait); replace hardcoded viewport-dependent
  cell counts (54, 48, 24) with dynamic expressions derived from rowCount and
  visibleColCount so the test survives column-width changes

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

* lint fix

* fix(e2e): dismiss CSV jobs tray before BulkImport grid interactions

The CSV jobs tray (position:fixed, bottom-right, high z-index) appears when
background export/import jobs complete and can overlap grid cells, causing
sporadic click-intercepted failures in BulkImport Playwright tests.

Add closeCsvJobsTrayIfVisible() in importUtils.ts that clicks the tray's
minimize button (.csv-jobs-tray-close) if the popover is open, then waits
for it to be hidden. Call it:
- at the end of performBulkDownload, after the export job triggers the tray
- at the end of startCsvPreviewAndWaitForGrid, before callers interact with cells

The 500ms visibility check makes it a no-op when the tray is absent.

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

* fix(e2e): use CSS injection to prevent CSV jobs tray click interception

Replace the point-in-time closeCsvJobsTrayIfVisible() approach with a
one-shot page.addStyleTag() call that injects pointer-events:none on
.csv-jobs-tray-popover and .csv-jobs-tray-launcher-wrap.

The tray is position:fixed at bottom-right and can appear at any moment
during a test (mid-fill, mid-owner-modal, mid-drag) as background jobs
complete — not just at the two previously guarded checkpoints. CSS injection
covers the entire page session regardless of when the tray appears, with
~0ms overhead vs a 500ms poll at each step.

Called once at the top of startCsvPreviewAndWaitForGrid, which is the
entry point for all BulkImport grid interactions.

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

* fix(e2e): click grid cell before Ctrl+A to prevent focus theft by CSV jobs tray

The CSV jobs tray appears when an export job completes and can steal
keyboard focus from the grid. CSS pointer-events:none blocks click
interception but not focus theft, so an explicit cell click is needed
to re-anchor grid focus before performing keyboard selections.

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

* lint fix

* fix(e2e): add delay to rapid Shift+Arrow presses in Range selection test

CI drops key presses when they fire too fast in sequence. The 5x
Shift+ArrowUp + 2x Shift+ArrowLeft block was landing one press short,
producing 6 range-selection cells instead of the expected 8. Adding
delay:50ms gives the grid time to process each event reliably.

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

* fix(e2e): add synchronization barriers to Range selection keyboard steps

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]>

* fix(e2e): apply all 10 robustness principles to Range selection test

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]>

* fix(e2e): wait for selection=0 before keyboard extend in rightDown/leftUp 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]>

* fix(e2e): remove flaky keyboard rightDown/leftUp selection step

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]>

* fix(e2e): wrap Range selection test body in try/finally for guaranteed 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]>

* lint fix

* fix(e2e): add mockClipboardApi and fix keyboard column selection flakiness

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]>

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
k-anshul pushed a commit to k-anshul/OpenMetadata that referenced this pull request Aug 12, 2026
…election (open-metadata#30458)

* Unskip the bulk import playwright test

* fix(e2e): unskip and fix BulkImport Playwright tests

- Database test: replace fragile ArrowDown + pressKeyXTimes(13) navigation
  before fillRecursiveColumnDetails with addGridRowAndSelectFirstCell, matching
  the pattern already used in the DatabaseService test; fixes intermittent
  "Field 1/13 required" failures where the column row was filled on the wrong row

- Range selection test: remove test.skip; fix stale manage-button selector
  (> .anticon removed, import-button-description → import-button-title, add
  manage-dropdown-list-container wait); replace hardcoded viewport-dependent
  cell counts (54, 48, 24) with dynamic expressions derived from rowCount and
  visibleColCount so the test survives column-width changes

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

* fix(e2e): unskip and fix BulkImport Playwright tests

- Database test: replace fragile ArrowDown + pressKeyXTimes(13) navigation
  before fillRecursiveColumnDetails with addGridRowAndSelectFirstCell, matching
  the pattern already used in the DatabaseService test; fixes intermittent
  "Field 1/13 required" failures where the column row was filled on the wrong row

- Range selection test: remove test.skip; fix stale manage-button selector
  (> .anticon removed, import-button-description → import-button-title, add
  manage-dropdown-list-container wait); replace hardcoded viewport-dependent
  cell counts (54, 48, 24) with dynamic expressions derived from rowCount and
  visibleColCount so the test survives column-width changes

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

* lint fix

* fix(e2e): dismiss CSV jobs tray before BulkImport grid interactions

The CSV jobs tray (position:fixed, bottom-right, high z-index) appears when
background export/import jobs complete and can overlap grid cells, causing
sporadic click-intercepted failures in BulkImport Playwright tests.

Add closeCsvJobsTrayIfVisible() in importUtils.ts that clicks the tray's
minimize button (.csv-jobs-tray-close) if the popover is open, then waits
for it to be hidden. Call it:
- at the end of performBulkDownload, after the export job triggers the tray
- at the end of startCsvPreviewAndWaitForGrid, before callers interact with cells

The 500ms visibility check makes it a no-op when the tray is absent.

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

* fix(e2e): use CSS injection to prevent CSV jobs tray click interception

Replace the point-in-time closeCsvJobsTrayIfVisible() approach with a
one-shot page.addStyleTag() call that injects pointer-events:none on
.csv-jobs-tray-popover and .csv-jobs-tray-launcher-wrap.

The tray is position:fixed at bottom-right and can appear at any moment
during a test (mid-fill, mid-owner-modal, mid-drag) as background jobs
complete — not just at the two previously guarded checkpoints. CSS injection
covers the entire page session regardless of when the tray appears, with
~0ms overhead vs a 500ms poll at each step.

Called once at the top of startCsvPreviewAndWaitForGrid, which is the
entry point for all BulkImport grid interactions.

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

* fix(e2e): click grid cell before Ctrl+A to prevent focus theft by CSV jobs tray

The CSV jobs tray appears when an export job completes and can steal
keyboard focus from the grid. CSS pointer-events:none blocks click
interception but not focus theft, so an explicit cell click is needed
to re-anchor grid focus before performing keyboard selections.

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

* lint fix

* fix(e2e): add delay to rapid Shift+Arrow presses in Range selection test

CI drops key presses when they fire too fast in sequence. The 5x
Shift+ArrowUp + 2x Shift+ArrowLeft block was landing one press short,
producing 6 range-selection cells instead of the expected 8. Adding
delay:50ms gives the grid time to process each event reliably.

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

* fix(e2e): add synchronization barriers to Range selection keyboard steps

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]>

* fix(e2e): apply all 10 robustness principles to Range selection test

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]>

* fix(e2e): wait for selection=0 before keyboard extend in rightDown/leftUp 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]>

* fix(e2e): remove flaky keyboard rightDown/leftUp selection step

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]>

* fix(e2e): wrap Range selection test body in try/finally for guaranteed 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]>

* lint fix

* fix(e2e): add mockClipboardApi and fix keyboard column selection flakiness

Two fixes ported from PR open-metadata#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]>

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
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.

2 participants