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

fix: allow uploading large files on Android #27835

Closed

Conversation

mxschmitt
Copy link
Member

@github-actions
Copy link
Contributor

Test results for "tests 1"

1 failed
❌ [playwright-test] › runner.spec.ts:118:5 › should ignore subprocess creation error because of SIGINT

5 flaky ⚠️ [chromium] › page/page-event-request.spec.ts:101:3 › should report navigation requests and responses handled by service worker
⚠️ [firefox] › library/tracing.spec.ts:239:5 › should not include trace resources from the previous chunks
⚠️ [chromium] › library/tracing.spec.ts:239:5 › should not include trace resources from the previous chunks
⚠️ [playwright-test] › ui-mode-test-ct.spec.ts:184:5 › should watch component
⚠️ [webkit] › library/browsercontext-reuse.spec.ts:50:1 › should reset serviceworker

25329 passed, 600 skipped
✔️✔️✔️

Merge workflow run.

browser._interceptSetInputFilePaths = async (page, files) => {
const newLocalFiles = [];
for (const file of files) {
const localFileName = `/data/local/tmp/pw/${path.basename(file)}`;
Copy link
Member

Choose a reason for hiding this comment

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

this may clash with other file names

@@ -343,6 +345,35 @@ export class AndroidDevice extends SdkObject {
validateBrowserContextOptions(options, browserOptions);

const browser = await CRBrowser.connect(this.attribution.playwright, androidBrowser, browserOptions);
{
const androidArtifacts = new Set<string>();
browser._interceptSetInputFilePaths = async (page, files) => {
Copy link
Member

Choose a reason for hiding this comment

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

This is quite a hack. I'd rather get createTempFile to create files on the android device, wdyt?

@@ -333,6 +333,8 @@ export class CRPage implements PageDelegate {
}

async setInputFilePaths(progress: Progress, handle: dom.ElementHandle<HTMLInputElement>, files: string[]): Promise<void> {
if (this._browserContext._browser._interceptSetInputFilePaths)
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather revert the change that fixed lastModified, this becomes too hairy. Maybe we can move convertInputFiles logic to the server and let it properly handle the android case?

@mxschmitt mxschmitt closed this Oct 31, 2023
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.

2 participants