Cypress Tutorial For Beginners : Part 4 ( Cypress Download File )

Cypress Tutorial For Beginners - Download File

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

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
------------------------------------------------------

Day 58 of 100: Typing Fixtures β€” test.extend Decoded

Day 58 of 100: Typing Fixtures β€” test.extend Decoded

Day 57 of 100: Mapped and Conditional Types β€” Reading Playwright’s Types

Day 57 of 100: Mapped and Conditional Types β€” Reading Playwright’s Types

Day 56 of 100: ESLint for Test Code β€” Rules That Prevent Flakiness

Day 56 of 100: ESLint for Test Code β€” Rules That Prevent Flakiness

Day 55 of 100: Decorators β€” Recognize Them, Rarely Need Them

Day 55 of 100: Decorators β€” Recognize Them, Rarely Need Them

Day 54 of 100: Typed Error Handling β€” unknown Catches and Error Classes

Day 54 of 100: Typed Error Handling β€” unknown Catches and Error Classes

Day 53 of 100: Typed Async β€” Promise, Awaited, and the Retry Helper

Day 53 of 100: Typed Async β€” Promise, Awaited, and the Retry Helper

Similar Posts