Skip to content

test(playwright): read copied links from the app instead of the OS clipboard - #37187

Merged
Rohit0301 merged 1 commit into
mainfrom
Rohit0301/openmetadata-test-failure-fix
Nov 6, 2026
Merged

Rohit0301 merged 1 commit into
mainfrom
Rohit0301/openmetadata-test-failure-fix

Conversation

@Rohit0301

Copy link
Copy Markdown
Contributor

Describe your changes:

No linked issue: this fixes the PostgreSQL Playwright failures from run 41974141457 (main @ c1a0f00).

The run reported four Playwright failures. Two had already been fixed on main after that SHA, and one needed the fix in this PR:

Test Root cause Fix
TableSharding.spec › persists metadata grouping enabled=true/false Saving the pipeline in the UI also deploys it, and the chromium shards have no Airflow, so the deploy call always fails. Already on main: c38fdf104cb tags both tests @ingestion, which moves them to the Airflow-backed Ingestion project.
Entity.spec › Topic › Description Add, Update and Remove for child entities (flaky) The assertion required a Markdown <p>, but compact schema rows sometimes render plain text. Already on main: c38fdf104cb asserts on getByTestId('description').
Topic.spec › Copy field link should have valid URL format See below. This PR

Root cause for Topic copy link. The test read the copied link back as '' on every attempt. copyAndGetClipboardText force-clicked the copy button, slept 300ms, and pasted the real OS clipboard back. The CI trace shows the page re-rendering right after the click. The "Link copied" state never rendered, which means navigator.clipboard.writeText rejected and the execCommand('copy') fallback also failed, so there was nothing to paste. It surfaced after #35438 rebuilt CopyLinkButton on ButtonUtility at a larger size, which changed the layout and timing around this click.

Fix. The change is in the shared helper copyAndGetClipboardText (playwright/utils/entity.ts), which about 40 call sites in 9 specs use:

  • Install an in-memory navigator.clipboard on the live page, so the helper records the exact text the app writes. It doesn't reload, so the caller's page state is kept.
  • Click without force, so Playwright's actionability checks retry until the button actually receives the click.
  • Replace the 300ms sleep and the paste with expect.poll on the captured value.

No product code changes. Every caller only uses the returned string; none pastes from the OS clipboard afterwards.

Type of change:

  • Bug fix

High-level design:

N/A — small change.

Tests:

Use cases covered

  • Copying a schema-field link on the Topic page returns a valid field URL, and that URL opens the column detail panel.
  • Nested field links include the full hierarchical path.
  • The child-field description add/update/remove flow on Topic.

Unit tests

  • Not applicable (test helper only).

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Updated the shared helper playwright/utils/entity.ts (copyAndGetClipboardText).

Local runs: this branch's UI production build (yarn build + vite preview) against a local OpenMetadata backend, --project=chromium --no-deps (entity-data-setup not run, only the auth setup), --repeat-each=10 --retries=0 --workers=3:

Spec Tests Runs Result
Features/Topic.spec.ts (all 4 tests, including Copy field link should have valid URL format) 4 ×10 ✅ 40 passed (1.1m)
Pages/Entity.spec.ts › Topic › Description Add, Update and Remove for child entities 1 ×10 ✅ 10 passed (39.3s)
$ npx playwright test playwright/e2e/Features/Topic.spec.ts --project=chromium --no-deps --repeat-each=10 --retries=0 --workers=3
  40 passed (1.1m)

$ npx playwright test playwright/e2e/Pages/Entity.spec.ts --project=chromium --no-deps \
    -g "Topic Description Add, Update and Remove for child entities" --repeat-each=10 --retries=0 --workers=3
  10 passed (39.3s)

TableSharding › persists metadata grouping: not run locally, because the local backend has no pipeline orchestrator, so deploy can't succeed. That is the same reason it failed in CI. I checked the lane routing with --list (PW_DEDICATED_INGESTION=true): the chromium project lists only the 3 non-ingestion TableSharding tests, and the Ingestion project lists both persists metadata grouping enabled=true/false @ingestion.

Lint: eslint and prettier --check on playwright/utils/entity.ts are clean.

Manual testing performed

  1. Built this branch's UI and served it with vite preview, proxying to a local OpenMetadata backend on :8585.
  2. Ran the Playwright commands above.

UI screen recording:

Not applicable — test-only change (Playwright helper), no UI behaviour change.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation> (no issue; fixes a CI run failure)
  • 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.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

🤖 Generated with Claude Code

…ipboard

copyAndGetClipboardText force-clicked the copy button and pasted the OS
clipboard back after a fixed 300ms sleep. In headless CI the page re-renders
around the click, navigator.clipboard.writeText rejects and the execCommand
fallback fails, so the paste read '' (Topic.spec 'Copy field link should have
valid URL format' failed on every attempt after the CopyLinkButton moved to
ButtonUtility in #35438).

Capture what the app passes to navigator.clipboard on the live page, click
without force so actionability checks retry, and poll for the copied value.
@Rohit0301
Rohit0301 requested a review from a team as a code owner November 5, 2026 15:44
@Rohit0301
Rohit0301 requested a review from anuj-kumary November 5, 2026 15:44
@github-actions

github-actions Bot commented Nov 5, 2026

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 Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

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!

@gitar-bot

gitar-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Replacing OS clipboard reads with an in-page stub changes shared Playwright test behavior and could mask clipboard integration failures.

Test helper copyAndGetClipboardText now installs an in-memory navigator.clipboard on the live page and reads the captured value via expect.poll, replacing the OS clipboard paste and fixed 300ms sleep to fix the Topic copy-link Playwright failure. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

Compact
gitar display:verbose         

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

@Rohit0301 Rohit0301 added the safe to test Add this label to run secure Github workflows on PRs label Nov 5, 2026
@Rohit0301
Rohit0301 enabled auto-merge (squash) November 5, 2026 16:55
@Rohit0301
Rohit0301 merged commit 54e5b5f into main Nov 6, 2026
90 of 93 checks passed
@Rohit0301
Rohit0301 deleted the Rohit0301/openmetadata-test-failure-fix branch November 6, 2026 05:02
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