Mid-LevelTest Automation & Frameworks
How do you test file uploads and downloads in browser automation?
- file upload
- file download
- browser automation
Answer it first, then compare. Nothing here is saved or scored.
Model answer
Uploads: Use setInputFiles() in Playwright or Cypress attach_file. For drag-drop uploads, dispatch the drop event programmatically. Downloads: In Playwright, use page.waitForEvent("download"), then verify the file content. In Cypress, intercept the download URL and verify with cy.readFile. Verify both success UI and actual file content. Handle edge cases: large files, wrong file types, multiple files, cancelled uploads.
What interviewers listen for
- Test architecture instinctsYou can defend why your suite is shaped like a pyramid, a trophy, or a honeycomb.
- Locator disciplineYou rank selector strategies by stability and explain when to break the rule.
- Flaky test ownershipYou debug to a structural fix instead of retry-until-green.
- Parallelisation literacyYou know how your framework isolates state, fixtures, and database access across workers.