mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
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:
parent
3fd0530076
commit
b7e30a8bf6
@ -678,6 +678,25 @@ it('should save to user-specified path', async ({ browser, server, mode }, testI
|
|||||||
await page.close();
|
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) {
|
async function assertDownloadToPDF(download: Download, filePath: string) {
|
||||||
expect(download.suggestedFilename()).toBe(path.basename(filePath));
|
expect(download.suggestedFilename()).toBe(path.basename(filePath));
|
||||||
const stream = await download.createReadStream();
|
const stream = await download.createReadStream();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user