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: cy.selectFile() #19332
feat: cy.selectFile() #19332
Conversation
Thanks for taking the time to open a PR!
|
Moving to draft temporarily while I get the tests passing. Documentation / code wise, I don't expect much to change here, just have to fix a couple things that came up from merging in 10.0-release. |
Test summaryRun details
View run in Cypress Dashboard ➡️ Flakiness
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
Ok, tests fixed (only remaining failure is flake in the 10.0-release branch, nothing to do with this PR). |
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.
Integration tests look to cover multiple use cases as well as most error states. Docs looks ready to go and the system test on 3rd party integrations looks really nice. I also found the code fairly easy to follow and a lot of the provided comments really helped shed clarity on some areas. Great work 🎉 !
packages/driver/cypress/integration/commands/actions/attachFile_spec.js
Outdated
Show resolved
Hide resolved
packages/driver/cypress/integration/commands/actions/attachFile_spec.js
Outdated
Show resolved
Hide resolved
packages/driver/cypress/integration/commands/actions/attachFile_spec.js
Outdated
Show resolved
Hide resolved
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.
Looks good! Guessing the net_stubbing_spec
is currently a little flaky. I had some issues getting the tests to pass consistently locally, but if I am wrong about that lmk! Changes here look unrelated.
cli/types/cypress.d.ts
Outdated
* Attach a file to the given <input> element, or drag and drop a file over any subject. | ||
* | ||
* @param {FileReference} files - The file(s) to attach or drag onto this element. | ||
* @see https://on.cypress.io/selectFile |
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.
Has this on link been created on Services? I think this is also meant to be all lowercaps to reroute correctly.
* @see https://on.cypress.io/selectFile | |
* @see https://on.cypress.io/selectfile |
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.
It hasn't been added yet - I'll open a PR to do that, thanks for the reminder.
I'm lowercasing the link for consistency, but worth noting that URLs are almost universally case insensitive on all modern systems. This isn't given in any spec, and it's not universally true, but in most cases it is.
https://docs.cypReSS.io/api/cOmMaNdS/wItHiN
(let's never actually do this, just an interesting note)
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.
https://github.com/cypress-io/cypress-services/pull/4174 has been merged in.
packages/driver/cypress/integration/commands/actions/selectFile_spec.js
Outdated
Show resolved
Hide resolved
packages/driver/cypress/integration/commands/actions/selectFile_spec.js
Outdated
Show resolved
Hide resolved
packages/driver/cypress/integration/commands/actions/selectFile_spec.js
Outdated
Show resolved
Hide resolved
packages/driver/cypress/integration/commands/actions/selectFile_spec.js
Outdated
Show resolved
Hide resolved
Only test failure is unrelated, an issue with circleci and pulling dockerhub images. I think we're about ready to merge into 10.0-release, so that I can start on the backport into develop? |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
User facing changelog
Adds native support for
.selectFile()
, allowing interaction with file input elements as well as simulating a user drag-dropping files over the document.The API is similar to cypress-file-upload, and we have provided a migration guide for previous users of that plugin.
For full details, see the
.selectFile()
documentation.Additional details
The documentation and migration guide contain extensive information about all the options and features of this new command.
PR Tasks
cypress-documentation
? cy.selectFile docs cypress-documentation#4241type definitions
?cypress.schema.json
?