-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
chore(bidi): implement setInputFiles #34757
Conversation
const fromContext = toBidiExecutionContext(handle._context); | ||
const shared = await fromContext.rawCallFunction('x => x', { handle: handle._objectId }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is confusing, let's introduce proper layer and naming so that we could follow what handle
, _objectId
, etc mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do in a follow-up.
Test results for "tests 1"7 flaky38547 passed, 793 skipped Merge workflow run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Thanks a lot for implementing this API. It was one that causes a lot of test failures. Lets see how many additional tests are going to pass now.
@@ -530,11 +530,21 @@ export class BidiPage implements PageDelegate { | |||
} | |||
|
|||
async setInputFiles(handle: dom.ElementHandle<HTMLInputElement>, files: types.FilePayload[]): Promise<void> { | |||
throw new Error('Method not implemented.'); | |||
throw new Error('Setting FilePayloads is not supported in Bidi.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yury-s, can you please explain when this is used? First I thought that you can fake files for upload by specifying a virtual file path and the file contents but it looks like (when checking some examples in the docs) it's ok to just set the file name. So what exactly would be required here from BiDi?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an overload in Playwright API that allows to set file payload as a tuple of (name, buffer, mime-type). This is similar to setting File()
objects to the input. We could implement the overload by storing to a temp file in bidi, but given that mime-type would be decided by the browser based on the file name it's not 1-to-1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we can implement this one in user land, similar to juggler #34785
This PR implements
setInputFiles
with file paths. The one that takes in-memoryFilePayloads
is not supported as Bidi protocol doesn't have corresponding command.