test: failing test for WebKit (#20088)

The test fails if the `content-disposition` header does not have
an "attachment" value.

#20089
This commit is contained in:
Andrey Lushnikov 2023-01-17 20:15:35 -08:00 committed by GitHub
parent 3fd0530076
commit b7e30a8bf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -678,6 +678,25 @@ it('should save to user-specified path', async ({ browser, server, mode }, testI
await page.close();
});
it('should download even if there is no "attachment" value', 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');
// Do not set the "attachment" value.
res.setHeader('Content-Disposition', 'filename=foo.txt');
res.end(`Hello world`);
});
const page = await browser.newPage();
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
await Promise.all([
page.waitForEvent('download'),
page.click('a')
]);
await page.close();
});
async function assertDownloadToPDF(download: Download, filePath: string) {
expect(download.suggestedFilename()).toBe(path.basename(filePath));
const stream = await download.createReadStream();