mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-12 11:50:22 +03:00
test: add test for PDF download per navigation (#16687)
* test: add test for PDF download per click * Update download.spec.ts
This commit is contained in:
parent
c4e91bded1
commit
553ecce4f9
@ -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(`
|
||||
<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');
|
||||
|
Loading…
Reference in New Issue
Block a user