-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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: Retain fileName when working with aliased fixtures and files #19820
Conversation
Thanks for taking the time to open a PR!
|
}) | ||
}) | ||
|
||
it('allows users to override the inferred filenames and mimetypes', () => { |
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 would make a really great example in the docs! (I don't know if you were going to do that or not)
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 fairly similar to one of the existing examples:
For the docs examples, I tried to break them up a bit more, demonstrate one feature at a time; one example shows how to use an alias, another how to use a path, another haw to override fileName and mimeType. I could do one big "all the features at once" example though, if that seems like it would be helpful.
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.
I don't really have any examples around 'how to work with file inputs (eg, input.files[1].name, input.files[0].type) though, which might be what you're referring to? It wouldn't be bad to have - that's not Cypress functionality, it's just how browsers work, but no reason not to include a couple of example lines to help people get started.
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.
I actually really liked the combination of things, including doing a multiple-select with files specified inline, especially with one of those being an alias with overrides. It seemed like the "perfect storm" of API interactions :D
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.
I wasn't even thinking about the DOM API side of things, just the .selectFile()
API here.
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.
I'm not super familiar with the underpinnings, but the tests LGTM
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 |
@@ -78,6 +79,9 @@ export default (Commands, Cypress, cy) => { | |||
contents = Buffer.from(contents) | |||
} | |||
|
|||
// Add the filename as a symbol, in case we need it later (such as when storing an alias) | |||
state('current').attributes.fileName = basename(filePath) |
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.
The Command class has a getter/setter for attributes that you could use: https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cypress/command.ts#L15
The attributes property is initialized by the constructor though, so I don't think it's absolutely necessary.
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.
Changed over.
f63807b
Only change since three green checks were minor formatting changes, all tests still passed. |
* develop: fix: correct reference branch / commitSha in performance-reporter (#19941) test: Honeycomb system-test reporter (#19855) fix(deps): update dependency engine.io to v5.2.1 [security] feat: Retain fileName when working with aliased fixtures and files (#19820) Update release-process.md Update release-process.md Update release-process.md Update release-process.md Update release-process.md Update release-process.md Phrasing Updating release guide with findings from 9.3.0 release snafu add link to the video how to report Cypress bug
* 10.0-release: (25 commits) fix(unify): improve dev server config ergonomics (#19957) feat: add spec pattern modal (#19801) fix: Windows e2e project scaffolding issues (#19938) feat: update @cypress/schematic to use proper e2e config for 10.0.0 (#19827) fix: correctly migrate projects with custom integration folder (#19929) fix: component spec creation with spec pattern (#19862) fix: missed committing yarn.lock after merge conflict fix: correct reference branch / commitSha in performance-reporter (#19941) feat: update navbar UI per Figma (#19926) fix: seed examples files when no e2e directory is created (#19768) chore: remove windy lightBlue warning test: component test updates (#19925) feat: Focus browser from select browser screen and on dashboard login (#19842) test: Honeycomb system-test reporter (#19855) fix(deps): update dependency engine.io to v5.2.1 [security] feat: Retain fileName when working with aliased fixtures and files (#19820) Update release-process.md Update release-process.md Update release-process.md Update release-process.md ...
.selectFile
command does not work from an aliased fixture #19803User facing changelog
selectFile()
now retains the filename of files ready from disk when working with aliases.Additional details
The input will have a filename of 'example.json', with the mimeType inferred from that. The filename and mimetype can still be specified manually.
How has the user experience changed?
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?