mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: navigation to resource with unknown mime type (#20313)
https://github.com/microsoft/playwright/issues/20089
This commit is contained in:
parent
aedcecb3db
commit
2c52d5be59
@ -697,6 +697,21 @@ it('should download even if there is no "attachment" value', async ({ browser, s
|
||||
await page.close();
|
||||
});
|
||||
|
||||
it('should convert navigation to a resource with unsupported mime type into download', async ({ browser, server, mode, browserName }, testInfo) => {
|
||||
it.fixme(browserName === 'webkit');
|
||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/19939' });
|
||||
server.setRoute('/download', (req, res) => {
|
||||
res.setHeader('Content-Type', 'application/octet-stream');
|
||||
res.end(`Hello world`);
|
||||
});
|
||||
const page = await browser.newPage();
|
||||
await Promise.all([
|
||||
page.waitForEvent('download'),
|
||||
page.goto(`${server.PREFIX}/download`).catch(() => {})
|
||||
]);
|
||||
await page.close();
|
||||
});
|
||||
|
||||
async function assertDownloadToPDF(download: Download, filePath: string) {
|
||||
expect(download.suggestedFilename()).toBe(path.basename(filePath));
|
||||
const stream = await download.createReadStream();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user