abramenal / cypress-file-upload

File upload testing made easy
https://npm.im/cypress-file-upload
MIT License
496 stars 89 forks source link

Split command to 'attachFile' using 'cy.readFile' and 'attachFixture' using 'cy.fixture' #304

Closed ErikGrigoriev closed 2 years ago

ErikGrigoriev commented 3 years ago

Checklist:

Summary of changes

Added possibility to upload file instead of fixture. Split to 2 different commands. Renamed actual attachFile to attachFixture and reworked attachFile to use cy.readFile instead. Would force existing users to rename all their usages to attachFixture in order to use it as before, but according to new functionality this naming seems to be more precise.

Linked issues

Closes #232

Comment

Main reason for introducing this is bug this bug from cypress itself. Using fixture for upload failed in our project since we were creating files with same name for upload. And even though files were deleted and recreated between tests, cached data was used causing upload inconsistency.

ErikGrigoriev commented 3 years ago

@abramenal can you please review it?

ErikGrigoriev commented 2 years ago

@abramenal can you please check this?

abramenal commented 2 years ago

@all-contributors add @ErikGrigoriev for code

allcontributors[bot] commented 2 years ago

@abramenal

I've put up a pull request to add @ErikGrigoriev! :tada:

abramenal commented 2 years ago

@ErikGrigoriev one thing I am a bit unsure of is – whether to allow raw file contents to be passed. With this kind of separation it might make sense to create a separate command for that, so: