Skip to content

Fixes #28736 Fixed context center uplod file test fix#28627

Open
Rohit0301 wants to merge 11 commits into
mainfrom
context-center-upload-file-test
Open

Fixes #28736 Fixed context center uplod file test fix#28627
Rohit0301 wants to merge 11 commits into
mainfrom
context-center-upload-file-test

Conversation

@Rohit0301
Copy link
Copy Markdown
Contributor

@Rohit0301 Rohit0301 commented Jun 2, 2026

Describe your changes:

Added some debug lines in the context center spec, to find the root cause of test failure on AUT

Screenshot 2026-06-02 at 3 48 46 PM

Fixes 28736

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 reliability:
    • Added input-data-testid to FileUploadDropZone and UploadDocumentModal to enable stable selection of file inputs.
    • Updated ContextCenter.spec.ts to use file-upload-input instead of non-deterministic selectors.
  • Diagnostic instrumentation:
    • Added granular debug logs and browser-to-node event bridge in ContextCenter.spec.ts to capture file input state and change event data for troubleshooting test failures.
  • Test data management:
    • Updated file upload tests to dynamically generate and clean up a physical temporary file during execution.

This will update automatically on new commits.

@Rohit0301 Rohit0301 self-assigned this Jun 2, 2026
@Rohit0301 Rohit0301 requested review from a team, chirag-madlani and karanh37 as code owners June 2, 2026 10:21
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 63%
63.35% (67156/106004) 44.26% (36938/83442) 46.67% (11113/23807)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

🟡 Playwright Results — all passed (18 flaky)

✅ 4260 passed · ❌ 0 failed · 🟡 18 flaky · ⏭️ 88 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 300 0 1 4
🟡 Shard 2 801 0 3 9
🟡 Shard 3 808 0 3 8
🟡 Shard 4 843 0 4 12
🟡 Shard 5 720 0 1 47
🟡 Shard 6 788 0 6 8
🟡 18 flaky test(s) (passed on retry)
  • Flow/Tour.spec.ts › Tour should work from help section (shard 1, 1 retry)
  • Features/DataProductPersonaCustomization.spec.ts › Data Product - customize tab label should only render if it's customized by user (shard 2, 1 retry)
  • Features/Glossary/GlossaryWorkflow.spec.ts › should start term as Draft when glossary has reviewers (shard 2, 1 retry)
  • Features/Glossary/MUIGlossaryMutualExclusivity.spec.ts › MUI-ME-R01: Children of ME parent should render Radio buttons (shard 2, 1 retry)
  • Features/RTL.spec.ts › Verify Following widget functionality (shard 3, 1 retry)
  • Features/Table.spec.ts › Table pagination with sorting should works (shard 3, 1 retry)
  • Features/UserProfileOnlineStatus.spec.ts › Should not show online status for inactive users (shard 3, 1 retry)
  • Flow/PersonaFlow.spec.ts › Set default persona for team should work properly (shard 4, 1 retry)
  • Pages/CustomProperties.spec.ts › Markdown (shard 4, 1 retry)
  • Pages/CustomProperties.spec.ts › Date Time (shard 4, 1 retry)
  • Pages/CustomProperties.spec.ts › Hyperlink (shard 4, 1 retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 5, 1 retry)
  • Pages/Glossary.spec.ts › Drag and Drop Glossary Term (shard 6, 1 retry)
  • Pages/Lineage/DataAssetLineage.spec.ts › verify create lineage for entity - Spreadsheet (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage service type filter selection (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/ODCSImportExport.spec.ts › Multi-object ODCS contract - object selector shows all schema objects (shard 6, 1 retry)
  • Pages/UserDetails.spec.ts › Admin user can get all the roles hierarchy and edit roles (shard 6, 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

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Jun 5, 2026

Code Review ⚠️ Changes requested 2 resolved / 3 findings

Updates file upload components to improve Playwright test reliability, but leaves significant debugging instrumentation and introduces improper production styling for file inputs.

⚠️ Bug: Shared file-upload input changed from hidden to sr-only for a test fix

📄 openmetadata-ui-core-components/src/main/resources/ui/src/components/application/file-upload/file-upload.tsx:243-253

To make the Playwright test pass, the production shared core component swaps the hidden <input type="file"> from the hidden attribute to className="tw:peer tw:sr-only" (file-upload.tsx:243-245). This is a behavioral change to a component used across the whole app: hidden removes the element from layout and accessibility tree entirely, whereas sr-only keeps it in the layout (visually clipped, still focusable/announced to screen readers and tab order). For a setInputFiles call Playwright only needs the input attached, so the hidden attribute should not have blocked the original test — meaning the real test failure cause may be elsewhere, and this component change may be unnecessary. If the change is intended, verify it does not introduce a stray focus stop / duplicated screen-reader announcement (the visible label/button already triggers the input via inputRef.current?.click()), and attach UI verification. Consider keeping hidden (or tw:hidden) unless sr-only is specifically required.

✅ 2 resolved
Quality: Debug instrumentation left in committed Playwright test

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ContextCenter.spec.ts:1040-1054
The most recent commit ("added debugging lines to check the aut issue") leaves a large amount of throwaway debugging code in ContextCenter.spec.ts: multiple console.log('[upload-test] ...') statements, an attribute-snapshot evaluate, and a page.exposeFunction('__uploadTestChangeEvent', ...) browser→node bridge with a manual change listener (lines ~1040-1101). None of this is needed to assert the upload behavior — the only functional assertions are setInputFiles + the toBeVisible() checks. This noise pollutes CI logs, slows the test, and adds maintenance burden. Remove the console logging, the inputAttrs snapshot, the exposeFunction bridge, and the extra change-event evaluate before merging, keeping only setInputFiles(uploadFilePath) and the visibility assertions.

Bug: exposeFunction re-registration guard is ineffective

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ContextCenter.spec.ts:1062-1075
The guard if (!(page as unknown as Record<string, unknown>)[bridgeFn]) checks for a property named __uploadTestChangeEvent on the Playwright Page object, but page.exposeFunction registers the function on the browser window, not on the page object. The property checked is never set, so the guard is always truthy-negative and provides no protection: on a test retry that reuses the same page context, exposeFunction will throw "Function already registered". Since this whole bridge should be removed (see the debug-instrumentation finding), the cleanest fix is deletion; otherwise the guard would need to query the browser context (e.g. via a window flag set inside exposeFunction).

🤖 Prompt for agents
Code Review: Updates file upload components to improve Playwright test reliability, but leaves significant debugging instrumentation and introduces improper production styling for file inputs.

1. ⚠️ Bug: Shared file-upload input changed from hidden to sr-only for a test fix
   Files: openmetadata-ui-core-components/src/main/resources/ui/src/components/application/file-upload/file-upload.tsx:243-253

   To make the Playwright test pass, the production shared core component swaps the hidden `<input type="file">` from the `hidden` attribute to `className="tw:peer tw:sr-only"` (file-upload.tsx:243-245). This is a behavioral change to a component used across the whole app: `hidden` removes the element from layout and accessibility tree entirely, whereas `sr-only` keeps it in the layout (visually clipped, still focusable/announced to screen readers and tab order). For a `setInputFiles` call Playwright only needs the input `attached`, so the `hidden` attribute should not have blocked the original test — meaning the real test failure cause may be elsewhere, and this component change may be unnecessary. If the change is intended, verify it does not introduce a stray focus stop / duplicated screen-reader announcement (the visible label/button already triggers the input via `inputRef.current?.click()`), and attach UI verification. Consider keeping `hidden` (or `tw:hidden`) unless `sr-only` is specifically required.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 5, 2026

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix context center upload document playwright

2 participants