Created
June 11, 2024 00:18
-
-
Save reboottime/4cb5ffa2fdf1ab9ee091e8d691a06460 to your computer and use it in GitHub Desktop.
playwright test downloading file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test('Downloads report', async ({ page }) => { | |
const downloadPromise = page.waitForEvent('download'); | |
await page.getByRole('button', { name: 'Download Report' }).click(); | |
const download = await downloadPromise; | |
const expectedFileName = report.name + '.pdf'; | |
expect(download.suggestedFilename()).toBe(expectedFileName); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment