Skip to content

test: fix user activation file chooser tests on Electron, Android and the frozen clock - #43408

Merged
Yury Semikhatsky (yury-s) merged 3 commits into
mainfrom
fix-test-filechooser-activation
Oct 15, 2026
Merged

Yury Semikhatsky (yury-s) merged 3 commits into
mainfrom
fix-test-filechooser-activation

Conversation

@yury-s

@yury-s Yury Semikhatsky (yury-s) commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Summary

  • should consume user activation when opening file chooser: Chromium 148 in Electron 42 and Chrome on the Android emulator open a second file chooser instead of consuming the activation, so the test is a fixme there.
  • should not open file chooser without user activation: under the frozen clock the 0ms timer fires after page.waitForFunction has started polling, and polling evaluates with a user gesture that grants activation. The test now waits for a console message instead of polling.

Both tests were added in #43380 and have failed on every main run since, e.g. https://github.com/microsoft/playwright/actions/runs/38660724131.

Chromium 148 in Electron 42 and Chrome on the Android emulator open a
second file chooser instead of consuming the user activation. Under the
frozen clock, page timers are fired from evaluate calls that carry user
activation, so input.click() and showPicker() succeed without a gesture.

Failing runs:
https://github.com/microsoft/playwright/actions/runs/38660724131
https://github.com/microsoft/playwright/actions/runs/38660427709
https://github.com/microsoft/playwright/actions/runs/38658323573
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Comment thread tests/page/page-filechooser.spec.ts Outdated

test('should not open file chooser without user activation', async ({ page, server, browserName }) => {
test.fixme(browserName === 'webkit', 'WebKit opens the file chooser from input.click() without user activation');
test.skip(process.env.PW_CLOCK === 'frozen', 'The fake clock fires page timers from evaluate calls, which carry user activation');

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.

I don't think this comment is right.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You're right, the comment blamed the wrong thing. Under the frozen clock the 0ms timer fires ~100ms after load, after waitForFunction has started polling, and polling evaluates with a user gesture that grants activation. Changed the test to wait for a console message instead of polling, so the skip is gone.

… test

Under the frozen clock the 0ms timer fires after page.waitForFunction has
started polling, and polling evaluates with a user gesture that grants
activation. Waiting for a console message avoids evaluating in the page,
so the test no longer needs a skip for that configuration.
@yury-s Yury Semikhatsky (yury-s) changed the title test: skip user activation file chooser tests where the engine differs test: fix user activation file chooser tests on Electron, Android and the frozen clock Oct 15, 2026
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

5154 passed, 614 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

3 flaky ⚠️ [chromium-library] › library/chromium/chromium.spec.ts:179 › serviceWorker(), and fromServiceWorker() work `@chromium-playwright-x64-ubuntu24-64-core-node22`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-playwright-x64-ubuntu24-64-core-node22`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-playwright-x64-ubuntu24-64-core-node22`

21780 passed, 525 skipped


Merge workflow run.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 2"

33 flaky ⚠️ [chromium-library] › library/video.spec.ts:762 › screencast › should work with video+trace `@frozen-time-library-chromium-linux`
⚠️ [chromium-library] › library/webmcp.spec.ts:238 › should call same-name tools in their own frame `@frozen-time-library-chromium-linux`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:436 › should produce network events, routing, and annotations for Service Worker (advanced) `@tracing-chromium`
⚠️ [chromium-page] › page/page-screenshot.spec.ts:509 › page screenshot › should take fullPage screenshots during navigation `@tracing-chromium`
⚠️ [chromium-library] › library/browsercontext-user-agent.spec.ts:110 › should work for navigator.userAgentData and sec-ch-ua headers `@msedge-dev-windows-latest`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:436 › should produce network events, routing, and annotations for Service Worker (advanced) `@chrome-ubuntu-22.04`
⚠️ [chromium-library] › library/beforeunload.spec.ts:20 › should close browser with beforeunload page `@chromium-macos-15-large`
⚠️ [chromium-library] › library/browsercontext-basic.spec.ts:36 › should be able to click across browser contexts `@chromium-macos-15-large`
⚠️ [chromium-library] › library/tracing.spec.ts:565 › should produce screencast frames crop `@chromium-macos-15-large`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:179 › serviceWorker(), and fromServiceWorker() work `@chromium-macos-15-xlarge`
⚠️ [chromium-library] › library/chromium/oopif.spec.ts:179 › should take screenshot `@chromium-macos-15-xlarge`
⚠️ [chromium-library] › library/trace-viewer.spec.ts:1937 › should not leak recorders `@chromium-macos-15-xlarge`
⚠️ [chromium-library] › library/beforeunload.spec.ts:130 › should support dismissing the dialog multiple times `@chromium-ubuntu-22.04-node26`
⚠️ [chromium-library] › library/chromium/connect-over-cdp.spec.ts:427 › should keep URL parameters when adding json/version `@chromium-ubuntu-22.04-node26`
⚠️ [chromium-library] › library/chromium/connect-over-cdp.spec.ts:439 › should append /json/version with a slash if there isnt one `@chromium-ubuntu-22.04-node26`
⚠️ [chromium-library] › library/chromium/connect-over-cdp.spec.ts:563 › should report an expected error when the endpoint URL JSON webSocketDebuggerUrl is undefined `@chromium-ubuntu-22.04-node26`
⚠️ [chromium-library] › library/video.spec.ts:762 › screencast › should work with video+trace `@chromium-ubuntu-22.04-node26`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:179 › serviceWorker(), and fromServiceWorker() work `@chrome-macos-latest`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:436 › should produce network events, routing, and annotations for Service Worker (advanced) `@chrome-macos-latest`
⚠️ [chromium-library] › library/screencast.spec.ts:28 › screencast.start delivers frames via onFrame callback `@chrome-macos-latest`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@tracing-firefox`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@tracing-firefox`
⚠️ [firefox-library] › library/video.spec.ts:725 › screencast › should capture full viewport on hidpi `@tracing-firefox`
⚠️ [firefox-page] › page/page-wait-for-function.spec.ts:43 › should poll on interval `@tracing-firefox`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-macos-15-large`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-macos-15-large`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-windows-latest`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-windows-latest`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-macos-15-xlarge`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-macos-15-xlarge`
⚠️ [firefox-library] › library/trace-viewer.spec.ts:1937 › should not leak recorders `@firefox-macos-15-xlarge`
⚠️ [webkit-library] › library/trace-viewer.spec.ts:1937 › should not leak recorders `@webkit-macos-15-xlarge`
⚠️ [webkit-library] › library/tracing.spec.ts:565 › should produce screencast frames scale `@webkit-macos-15-xlarge`

126650 passed, 4057 skipped


Merge workflow run.

@yury-s
Yury Semikhatsky (yury-s) merged commit 8d1d213 into main Oct 15, 2026
56 checks passed
@yury-s
Yury Semikhatsky (yury-s) deleted the fix-test-filechooser-activation branch October 15, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants