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

Add setInputFiles docs for browser module #1528

Merged
merged 5 commits into from
Mar 21, 2024
Merged

Conversation

ankur22
Copy link
Contributor

@ankur22 ankur22 commented Mar 20, 2024

What?

Add setInputFiles docs for browser module. The API is available in frame, page and elementHandle.

Checklist

  • I have used a meaningful title for the PR.
  • I have described the changes I've made in the "What?" section above.
  • I have performed a self-review of my changes.
  • I have run the npm start command locally and verified that the changes look good.
  • I have made my changes in the docs/sources/next folder of the documentation.

Related PR(s)/Issue(s)

grafana/xk6-browser#1097 & grafana/xk6-browser#1244

@ankur22 ankur22 marked this pull request as draft March 20, 2024 14:43
@ankur22 ankur22 removed the request for review from heitortsergent March 20, 2024 14:43
@ankur22 ankur22 marked this pull request as ready for review March 20, 2024 14:52
Copy link
Collaborator

@heitortsergent heitortsergent left a comment

Choose a reason for hiding this comment

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

Just some minor style nits, and a question about the example. 🙏

const eh = page.$('input[id="upload"]');

// The file is set to the input element with the id "upload".
eh.setInputFiles({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where would this file have to be for this example to work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The file is inline in the code i.e. it's all there in the object (name, mimetype and buffer). This new API doesn't work with the local filesystem at all. A user will need to work with the experimental FS module to do that.

Co-authored-by: Heitor Tashiro Sergent <heitortsergent@gmail.com>
@ankur22 ankur22 merged commit 5a9c9b9 into main Mar 21, 2024
5 checks passed
@ankur22 ankur22 deleted the add/k6-browser-setinputfiles branch March 21, 2024 17:24
@ankur22
Copy link
Contributor Author

ankur22 commented Mar 21, 2024

@heitortsergent i'm merging this into make the next release, but please add any more suggestions and I will add them to a new PR.

@heitortsergent
Copy link
Collaborator

@ankur22 I think it would be great if we had an example with a real use case, whether that's using the experimental fs module, or any other use case we think might be common.

What do you think? I could open a separate issue for it.

@ankur22
Copy link
Contributor Author

ankur22 commented Mar 25, 2024

@ankur22 I think it would be great if we had an example with a real use case, whether that's using the experimental fs module, or any other use case we think might be common.

That's a good idea, and I already have one ready to be added into the docs. I'll create a PR soon.

@heitortsergent
Copy link
Collaborator

@ankur22 thank you!! 🙇

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.

3 participants