A. Wrong assertion method; should use 'exist' instead of 'contain'
B. Incorrect file path in readFile command
C. Missing chaining or waiting for download to complete before reading file
D. cy.downloadFile does not exist in Cypress
Solution
Step 1: Check command sequence and chaining
The download and readFile commands run separately without waiting for download to finish.
Step 2: Identify the need for chaining or waiting
Without chaining or waiting, readFile may run before download completes, causing test failure.
Final Answer:
Missing chaining or waiting for download to complete before reading file -> Option C
Quick Check:
Wait for download before readFile = C [OK]
Hint: Chain commands or wait to ensure download finishes before reading [OK]
Common Mistakes:
Running readFile immediately without waiting
Assuming cy.downloadFile is not a valid command
Using wrong assertion method for content check
5. You want to verify that a downloaded CSV file contains the header 'ID, Name, Email' and is not empty. Which Cypress test code correctly achieves this?