Skip to content

test(clipboard): check that the headless clipboard is isolated from the operating system - #42039

Open
dcrousso wants to merge 1 commit into
microsoft:mainfrom
dcrousso:test-clipboard-isolation
Open

test(clipboard): check that the headless clipboard is isolated from the operating system#42039
dcrousso wants to merge 1 commit into
microsoft:mainfrom
dcrousso:test-clipboard-isolation

Conversation

@dcrousso

Copy link
Copy Markdown
Contributor

every headless browser keeps the clipboard to itself instead of sharing the clipboard of the operating system, which headless WebKit on macOS started doing in build 2334

add a test that launches two headless browsers and expects each to only read back what it wrote through navigator.clipboard, which would not hold if they both used the clipboard of the operating system

fixes #13097

@dcrousso
dcrousso requested review from pavelfeldman and yury-s July 29, 2026 21:12
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Hi, I'm the Playwright bot and I took a first look at the CI failures here.

🔴 The one failure is this PR's own new test

[webkit-library] › library/permissions.spec.ts:222 › should isolate the headless clipboard from the operating system fails on webkit-ubuntu-22.04-node20. That's the test this PR adds, so the failure is caused by this PR by definition — it can't be a pre-existing flake. Everything else in the report is flaky/unrelated, so the PR needs a look before it's green.

Details

Caused by this PR

  • [webkit-library] › library/permissions.spec.ts:222 › should isolate the headless clipboard from the operating system — the new test added in this diff. It runs on WebKit-Linux (webkit-ubuntu-22.04-node20) and fails there. The test already carries it.fixme(browserName === 'webkit' && isWindows && channel !== 'webkit-wsl', 'WinCairo uses the clipboard of the operating system.'), i.e. it acknowledges WebKit shares the OS clipboard on one platform — but WebKitGTK on Linux isn't gated, and that's the bot that's red. Looks like the isolation assumption doesn't hold on WebKit-Linux either. Worth checking whether Linux WebKit needs the same fixme (or a different guard) rather than assuming isolation across every WebKit build.

Pre-existing flake / infra

  • The 3 tests the report lists as flaky — library/popup.spec.ts:260, library/video.spec.ts:495, library/video.spec.ts:736, all Chromium — passed on retry and are unrelated to a clipboard-permissions test. Nothing to triage there.

Triaged by the Playwright bot - agent run

…he operating system

every headless browser keeps the clipboard to itself instead of sharing the clipboard of the operating system, which headless WebKit on macOS started doing in build `2334`

add a test that launches two headless browsers and expects each to only read back what it wrote through `navigator.clipboard`, which would not hold if they both used the clipboard of the operating system
@dcrousso
dcrousso force-pushed the test-clipboard-isolation branch from 653eef2 to 995be21 Compare July 29, 2026 22:01
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

7815 passed, 1272 skipped


Merge workflow run.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

5 flaky ⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/har-websocket.spec.ts:231 › should embed websocket messages `@chromium-ubuntu-22.04-node22`
⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-event-request.spec.ts:181 › should return response body when Cross-Origin-Opener-Policy is set `@firefox-ubuntu-22.04-node20`

51055 passed, 1189 skipped


Merge workflow run.

it('should isolate the headless clipboard from the operating system', {
annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/13097' },
}, async ({ browserType, server, browserName, isMac, isFrozenWebkit }) => {
it.fixme(browserName === 'webkit' && !isMac, 'Headless WebKit cannot read the clipboard outside of macOS.');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Making a note on this one, should work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

btw although navigator.clipboard is enabled on playwright WebKit windows it will always fail as it's not actually implemented under the hood so this was kinda already the case (i.e. you'd have to use things like ⌘C/⌘V or document.execCommand("copy"))

im currently working on fixing that :)

@dcrousso
dcrousso requested a review from pavelfeldman July 30, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] clipboard isolation

2 participants