In this tutorial cypress tutorial for beginners, We are going to learn how to download a file in cypress and create our first script to test to download a file and check that file is download to folder successfully.
Contents
- Cypress Download File
- Top 5 Websites for Remote QA/ Software Tester Job
- How to Use the GET and SET keywords In KARATE API Automation?
- How Much Selenium I Should Know To Get a Job?
- Karate Configuration : Working with Karate Config.js || Karate API Testing Tutorial
- 4 Mindset Principles That Will Help You Thrive In 2021 as QA/ Software Tester.
- How to Test GraphQL Query with Karate API?
Cypress Download File
First make sure you install the node module of the Download file cypress from the link above.
Install the Node module
npm install cypress-downloadfile
Now You have to write the following code plugin files in plugin index.js folder.
require('cypress-downloadfile/lib/downloadFileCommand')
#Add the following lines to cypress/plugins/index.js.
const {downloadFile} = require('cypress-downloadfile/lib/addPlugin')
module.exports = (on, config) => {
on('task', {downloadFile})
}
Now You can use this below code to download the file.
cy.downloadFile('https://library.concordia.ca/help/technology/recovering_saved_files.pdf','mydownloads','demo.pdf')
-----------------------------------------------------
👪 Join our Community - http://bit.ly/learntesting2019
✅ Automation Community - https://thetestingacademy.com
🐦Follow us on Twitter - https://twitter.com/itstechmode
📖 Like us on Facebook - https://www.facebook.com/scrolltest
🎤 Listen to our Podcast - https://anchor.fm/thetestingacademy
------------------------------------------------------