parent
2d1c736091
commit
1e9668f8bd
|
|
@ -705,6 +705,16 @@ it('should convert navigation to a resource with unsupported mime type into down
|
||||||
await page.close();
|
await page.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should download links with data url', async ({ page, isWindows, browserName }) => {
|
||||||
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/21892' });
|
||||||
|
it.fixme(browserName === 'webkit' && isWindows);
|
||||||
|
await page.setContent('<a download="SomeFile.txt" href="data:text/plain;charset=utf8;,hello world">Download!</a>');
|
||||||
|
const donwloadPromise = page.waitForEvent('download');
|
||||||
|
await page.getByText('Download').click();
|
||||||
|
const download = await donwloadPromise;
|
||||||
|
expect(download.suggestedFilename()).toBe('SomeFile.txt');
|
||||||
|
});
|
||||||
|
|
||||||
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…
Reference in a new issue