Company
Date Published
Author
The Cypress
Word count
425
Language
English
Hacker News points
None

Summary

Cypress has introduced the .selectFile() command, which simplifies the process of selecting and uploading files using HTML5 input elements by simulating file drag-and-drop actions and selecting files in a form element. This new command replaces the cypress-file-upload community plugin, offering users the ability to handle single or multiple file uploads, as well as dynamically created files, with the help of the Cypress.Buffer utility for binary data manipulation. The .selectFile() command can simulate dragging files over elements or the document itself, while Cypress.Buffer provides an API akin to Node.js's Buffer class for reading files as buffers. Users are encouraged to migrate to this new command, and a detailed Migration guide has been provided to assist in updating existing tests. The Cypress team invites feedback and engagement from the community on GitHub and Discord to further enhance testing experiences.