Complete the code to check if the file download link exists.
cy.get('a.download-link').[1]()
The should('exist') assertion checks if the download link is present on the page.
Complete the code to trigger the file download by clicking the link.
cy.get('a.download-link').[1]()
The click() command triggers the download by clicking the link.
Fix the error in the code to verify the downloaded file exists in the downloads folder.
cy.readFile('cypress/downloads/[1]').should('exist')
The file name must match the actual downloaded file name with extension, here downloadedFile.pdf.
Fill both blanks to check the downloaded file size is greater than zero.
cy.readFile('cypress/downloads/[1]').then((file) => { expect(file.length).[2](0) })
to.equal instead of to.be.greaterThan will fail if file length is not exactly zero.The file name must be correct and the assertion to.be.greaterThan(0) checks the file is not empty.
Fill all three blanks to verify the downloaded file content includes the expected text.
cy.readFile('cypress/downloads/[1]').should('[2]', 'Sample Text').then((content) => { expect(content).to.[3]('Sample Text') })
to.include instead of to.contain causes assertion error.The file name must be correct, the should('include', 'Sample Text') checks the content includes the text, and expect(content).to.contain('Sample Text') asserts it.