Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: add test for PDF download per navigation (#16687)
Max Schmitt553ecce4f9d3
diff --git a/tests/library/download.spec.ts b/tests/library/download.spec.tsindex 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, assawait 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(`+ <a href="/empty.pdf">open</a>+ `);+ 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');