Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow folder uploads #31165

Merged
merged 10 commits into from
Jun 12, 2024
Merged

feat: allow folder uploads #31165

merged 10 commits into from
Jun 12, 2024

Conversation

mxschmitt
Copy link
Member

@mxschmitt mxschmitt commented Jun 5, 2024

Motivation: This adds support for input[webkitdirectory] folder uploads. For local mode, we just pass the directory to the browser, for "remote mode" we stream the files to the server and keeping the same parent directory name. This one is also used inside the browser in the webkitRelativePath field in the File type.

In Chromium headless, there is a bug, that folder uploads won't consider nested files / is this a blocker for the feature to land?
Firefox + WebKit implementation have been landed and look like they are working. Requires rolls, hence the tests are still not passing.

Feature request: #6854

This comment has been minimized.

@mxschmitt mxschmitt force-pushed the upload-folders branch 2 times, most recently from e2c518d to 4e79b5e Compare June 6, 2024 17:53

This comment has been minimized.

@mxschmitt mxschmitt marked this pull request as ready for review June 6, 2024 17:57

This comment has been minimized.

This comment has been minimized.

docs/src/api/class-locator.md Outdated Show resolved Hide resolved
packages/playwright-core/src/server/dom.ts Outdated Show resolved Hide resolved
packages/playwright-core/src/server/dom.ts Outdated Show resolved Hide resolved
packages/playwright-core/src/server/dom.ts Outdated Show resolved Hide resolved
packages/playwright-core/src/client/elementHandle.ts Outdated Show resolved Hide resolved
packages/playwright-core/src/client/elementHandle.ts Outdated Show resolved Hide resolved
packages/protocol/src/protocol.yml Outdated Show resolved Hide resolved
packages/protocol/src/protocol.yml Outdated Show resolved Hide resolved

This comment has been minimized.

This comment has been minimized.

@mxschmitt mxschmitt force-pushed the upload-folders branch 2 times, most recently from 047e30c to f87b89e Compare June 7, 2024 08:16

This comment has been minimized.

This comment has been minimized.

@mxschmitt mxschmitt force-pushed the upload-folders branch 2 times, most recently from a9038d0 to 2b12702 Compare June 7, 2024 12:59

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@mxschmitt mxschmitt added the CQ1 label Jun 11, 2024

This comment has been minimized.

@mxschmitt mxschmitt added CQ1 and removed CQ1 labels Jun 11, 2024

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

Test results for "tests others"

2 fatal errors, not part of any test
26 failed
❌ [chromium-library] › library/browsercontext-events.spec.ts:43:5 › console event should work in popup 2
❌ [chromium-library] › library/browsertype-launch.spec.ts:22:3 › should reject all promises when browser is closed
❌ [chromium-library] › library/chromium/css-coverage.spec.ts:128:3 › should work with a recently loaded stylesheet
❌ [chromium-library] › library/popup.spec.ts:129:3 › should use viewport size from window features
❌ [chromium-library] › library/popup.spec.ts:251:3 › should not throttle rAF in the opener page
❌ [chromium-library] › library/trace-viewer.spec.ts:84:1 › should show empty trace viewer
❌ [chromium-library] › library/tracing.spec.ts:412:14 › should produce screencast frames fit
❌ [chromium-library] › library/tracing.spec.ts:412:14 › should produce screencast frames crop
❌ [chromium-library] › library/tracing.spec.ts:412:14 › should produce screencast frames scale
❌ [chromium-library] › library/tracing.spec.ts:699:5 › should not flush console events
❌ [chromium-library] › library/tracing.spec.ts:742:5 › should flush console events on tracing stop
❌ [chromium-library] › library/video.spec.ts:165:5 › screencast › should work with old options
❌ [chromium-library] › library/video.spec.ts:189:5 › screencast › should capture static page
❌ [chromium-library] › library/video.spec.ts:257:5 › screencast › should delete video
❌ [chromium-library] › library/video.spec.ts:351:5 › screencast › should capture navigation
❌ [chromium-library] › library/video.spec.ts:382:5 › screencast › should capture css transformation
❌ [chromium-library] › library/video.spec.ts:412:5 › screencast › should work for popups
❌ [chromium-library] › library/video.spec.ts:446:5 › screencast › should scale frames down to the requested size
❌ [chromium-library] › library/video.spec.ts:495:5 › screencast › should use viewport scaled down to fit into 800x800 as default size
❌ [chromium-library] › library/video.spec.ts:514:5 › screencast › should be 800x450 by default
❌ [chromium-library] › library/video.spec.ts:531:5 › screencast › should be 800x600 with null viewport
❌ [chromium-library] › library/video.spec.ts:580:5 › screencast › should emulate an iphone
❌ [playwright-test] › reporter-html.spec.ts:296:5 › created › should include image diff when screenshot failed to generate due to animation
❌ [playwright-test] › ui-mode-test-output.spec.ts:157:5 › should stream console messages live
❌ [playwright-test] › ui-mode-test-setup.spec.ts:217:9 › web-mode: true › should run teardown with SIGINT
❌ [webview2] › page/page-request-intercept.spec.ts:178:1 › should intercept multipart/form-data request body

2 flaky ⚠️ [electron-page] › page/page-goto.spec.ts:285:3 › should not crash when navigating to bad SSL after a cross origin navigation
⚠️ [chromium-library] › library/browsercontext-viewport-mobile.spec.ts:177:5 › mobile viewport › should scroll when emulating a mobile viewport
1 interrupted ⚠️ [chromium-library] › library/inspector/pause.spec.ts:79:5 › pause › should resume from console

10436 passed, 353 skipped, 2318 did not run
✔️✔️✔️

Merge workflow run.

Copy link
Contributor

Test results for "tests 2"

7 failed
❌ [chromium-library] › library/emulation-focus.spec.ts:202:12 › should trigger hover state concurrently
❌ [firefox-library] › library/inspector/cli-codegen-2.spec.ts:493:7 › cli codegen › should --save-trace
❌ [webkit-page] › page/page-drag.spec.ts:70:5 › Drag and drop › should work inside iframe
❌ [webkit-page] › page/page-drag.spec.ts:246:5 › Drag and drop › should work if the drag event is captured but not canceled
❌ [webkit-page] › page/page-set-input-files.spec.ts:40:3 › should upload a folder
❌ [webkit-page] › page/page-set-input-files.spec.ts:40:3 › should upload a folder
❌ [webkit-page] › page/page-set-input-files.spec.ts:40:3 › should upload a folder

48 flaky ⚠️ [chromium-library] › library/emulation-focus.spec.ts:202:12 › should trigger hover state concurrently
⚠️ [chromium-page] › page/page-add-locator-handler.spec.ts:90:5 › should work with locator.hover()
⚠️ [chromium-page] › page/page-drag.spec.ts:330:5 › Drag and drop › should work with locators
⚠️ [chromium-library] › library/inspector/cli-codegen-1.spec.ts:106:7 › cli codegen › should make a positioned click on a canvas
⚠️ [chromium-page] › page/page-add-locator-handler.spec.ts:90:5 › should work with locator.hover()
⚠️ [chromium-page] › page/page-drag.spec.ts:330:5 › Drag and drop › should work with locators
⚠️ [chromium-library] › library/inspector/cli-codegen-1.spec.ts:56:7 › cli codegen › should ignore programmatic events
⚠️ [chromium-page] › page/locator-misc-1.spec.ts:28:3 › should hover when Node is removed
⚠️ [chromium-page] › page/page-add-locator-handler.spec.ts:90:5 › should work with locator.hover()
⚠️ [chromium-page] › page/page-drag.spec.ts:289:5 › Drag and drop › should work with the helper method
⚠️ [chromium-page] › page/page-mouse.spec.ts:166:3 › should trigger hover state
⚠️ [firefox-library] › library/tap.spec.ts:23:3 › should send all of the correct events @smoke
⚠️ [firefox-library] › library/video.spec.ts:165:5 › screencast › should work with old options
⚠️ [firefox-library] › library/permissions.spec.ts:103:5 › permissions › should trigger permission onchange
⚠️ [firefox-library] › library/video.spec.ts:165:5 › screencast › should work with old options
⚠️ [firefox-page] › page/elementhandle-misc.spec.ts:20:3 › should hover
⚠️ [firefox-page] › page/locator-misc-1.spec.ts:28:3 › should hover when Node is removed
⚠️ [firefox-page] › page/page-drag.spec.ts:25:5 › Drag and drop › should work @smoke
⚠️ [firefox-page] › page/page-mouse.spec.ts:186:3 › should trigger hover state on disabled button
⚠️ [firefox-library] › library/video.spec.ts:165:5 › screencast › should work with old options
⚠️ [firefox-library] › library/browsercontext-basic.spec.ts:34:3 › should be able to click across browser contexts
⚠️ [firefox-library] › library/browsercontext-pages.spec.ts:29:3 › page.context should return the correct instance
⚠️ [firefox-library] › library/capabilities.spec.ts:181:3 › should set CloseEvent.wasClean to false when the server terminates a WebSocket connection
⚠️ [firefox-library] › library/capabilities.spec.ts:244:3 › loading in HTMLImageElement.prototype
⚠️ [firefox-library] › library/download.spec.ts:217:5 › download event › should create subdirectories when saving to non-existent user-specified path
⚠️ [firefox-library] › library/hit-target.spec.ts:298:3 › should click an element inside closed shadow root
⚠️ [firefox-library] › library/tracing.spec.ts:292:5 › should overwrite existing file
⚠️ [firefox-page] › page/page-click.spec.ts:97:3 › should click the 1x1 div
⚠️ [firefox-page] › page/page-goto.spec.ts:81:3 › should work with Cross-Origin-Opener-Policy
⚠️ [firefox-page] › page/page-mouse.spec.ts:147:3 › should select the text with mouse
⚠️ [chromium-library] › library/browsercontext-viewport.spec.ts:143:12 › should drag with high dpi
⚠️ [chromium-library] › library/video.spec.ts:351:5 › screencast › should capture navigation
⚠️ [chromium-page] › page/locator-misc-1.spec.ts:28:3 › should hover when Node is removed
⚠️ [chromium-page] › page/page-drag.spec.ts:34:5 › Drag and drop › should send the right events
⚠️ [chromium-library] › library/inspector/cli-codegen-1.spec.ts:23:7 › cli codegen › should click
⚠️ [webkit-page] › page/page-add-locator-handler.spec.ts:90:5 › should work with locator.hover()
⚠️ [webkit-page] › page/page-drag.spec.ts:70:5 › Drag and drop › should work inside iframe
⚠️ [webkit-page] › page/page-drag.spec.ts:260:5 › Drag and drop › should be able to drag the mouse in a frame
⚠️ [webkit-page] › page/page-drag.spec.ts:289:5 › Drag and drop › should work with the helper method
⚠️ [webkit-page] › page/page-mouse.spec.ts:221:3 › should tween mouse movement
⚠️ [webkit-library] › library/inspector/cli-codegen-2.spec.ts:431:7 › cli codegen › should update hover model on action
⚠️ [webkit-page] › page/page-drag.spec.ts:246:5 › Drag and drop › should work if the drag event is captured but not canceled
⚠️ [webkit-library] › library/emulation-focus.spec.ts:202:12 › should trigger hover state concurrently
⚠️ [webkit-library] › library/browsercontext-viewport.spec.ts:143:12 › should drag with high dpi
⚠️ [webkit-library] › library/emulation-focus.spec.ts:202:12 › should trigger hover state concurrently
⚠️ [webkit-page] › page/page-drag.spec.ts:70:5 › Drag and drop › should work inside iframe
⚠️ [webkit-page] › page/page-drag.spec.ts💯5 › Drag and drop › should cancel on escape
⚠️ [webkit-page] › page/page-drag.spec.ts:272:5 › Drag and drop › should work if a frame is stalled

199829 passed, 8667 skipped
✔️✔️✔️

Merge workflow run.

This comment has been minimized.

This comment has been minimized.

Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
Signed-off-by: Max Schmitt <max@schmitt.mx>
@mxschmitt mxschmitt merged commit dcf4e4e into microsoft:main Jun 12, 2024
29 checks passed
Copy link
Contributor

Test results for "tests 1"

1 flaky ⚠️ [firefox-library] › library/tracing.spec.ts:412:14 › should produce screencast frames crop

28317 passed, 637 skipped
✔️✔️✔️

Merge workflow run.

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.

3 participants