diff --git a/tests/library/download.spec.ts b/tests/library/download.spec.ts index 596eccc2b7..216960187a 100644 --- a/tests/library/download.spec.ts +++ b/tests/library/download.spec.ts @@ -613,7 +613,7 @@ it('should be able to download a PDF file', async ({ browser, server, asset }) = await page.close(); }); -it('should be able to download a inline PDF file', async ({ browser, server, asset, browserName }) => { +it('should be able to download a inline PDF file via response interception', async ({ browser, server, asset, browserName }) => { it.fixme(browserName === 'webkit'); const page = await browser.newPage(); await page.goto(server.EMPTY_PAGE); @@ -638,6 +638,21 @@ it('should be able to download a inline PDF file', async ({ browser, server, ass await page.close(); }); +it('should be able to download a inline PDF file via navigation', async ({ browser, server, asset, browserName }) => { + it.fixme(browserName === 'chromium' || browserName === 'webkit'); + const page = await browser.newPage(); + await page.goto(server.EMPTY_PAGE); + await page.setContent(` + open + `); + const [download] = await Promise.all([ + page.waitForEvent('download'), + page.click('a'), + ]); + await assertDownloadToPDF(download, asset('empty.pdf')); + await page.close(); +}); + it('should save to user-specified path', async ({ browser, server, mode }, testInfo) => { server.setRoute('/download', (req, res) => { res.setHeader('Content-Type', 'application/octet-stream');