Repository navigation
test(playwright): read copied links from the app instead of the OS clipboard - #37187
Conversation
…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.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
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 VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
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:
TableSharding.spec› persists metadata grouping enabled=true/falsec38fdf104cbtags both tests@ingestion, which moves them to the Airflow-backedIngestionproject.Entity.spec› Topic › Description Add, Update and Remove for child entities (flaky)<p>, but compact schema rows sometimes render plain text.c38fdf104cbasserts ongetByTestId('description').Topic.spec› Copy field link should have valid URL formatRoot cause for Topic copy link. The test read the copied link back as
''on every attempt.copyAndGetClipboardTextforce-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 meansnavigator.clipboard.writeTextrejected and theexecCommand('copy')fallback also failed, so there was nothing to paste. It surfaced after #35438 rebuiltCopyLinkButtononButtonUtilityat 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:navigator.clipboardon 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.force, so Playwright's actionability checks retry until the button actually receives the click.expect.pollon the captured value.No product code changes. Every caller only uses the returned string; none pastes from the OS clipboard afterwards.
Type of change:
High-level design:
N/A — small change.
Tests:
Use cases covered
Unit tests
Backend integration tests
Ingestion integration tests
Playwright (UI) tests
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-setupnot run, only the authsetup),--repeat-each=10 --retries=0 --workers=3:Features/Topic.spec.ts(all 4 tests, including Copy field link should have valid URL format)Pages/Entity.spec.ts› Topic › Description Add, Update and Remove for child entitiesTableSharding› 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): thechromiumproject lists only the 3 non-ingestion TableSharding tests, and theIngestionproject lists bothpersists metadata grouping enabled=true/false @ingestion.Lint:
eslintandprettier --checkonplaywright/utils/entity.tsare clean.Manual testing performed
vite preview, proxying to a local OpenMetadata backend on :8585.UI screen recording:
Not applicable — test-only change (Playwright helper), no UI behaviour change.
Checklist:
Fixes <issue-number>: <short explanation>(no issue; fixes a CI run failure)Fixes #<issue-number>above.🤖 Generated with Claude Code