Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: download link with data url (#22312)
Yury Semikhatsky1e9668f8bd2b
diff --git a/tests/library/download.spec.ts b/tests/library/download.spec.tsindex 8bfe003142..d6193f3031 100644--- a/tests/library/download.spec.ts+++ b/tests/library/download.spec.ts@@ -705,6 +705,16 @@ it('should convert navigation to a resource with unsupported mime type into downawait 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) {expect(download.suggestedFilename()).toBe(path.basename(filePath));const stream = await download.createReadStream();