diff --git a/test/assets/download-blob.html b/test/assets/download-blob.html
new file mode 100644
index 0000000000000..02a08893b50bf
--- /dev/null
+++ b/test/assets/download-blob.html
@@ -0,0 +1,29 @@
+
+
+
+ Blob Download Example
+
+
+
+ Download
+
+
diff --git a/test/download.spec.js b/test/download.spec.js
index 995b3c59610fd..f160ec6a949b0 100644
--- a/test/download.spec.js
+++ b/test/download.spec.js
@@ -70,16 +70,29 @@ describe('Download', function() {
expect(fs.readFileSync(path).toString()).toBe('Hello world');
await page.close();
});
- it(`should report download path within page.on('download', …) handler`, async({browser, server}) => {
+ it(`should report download path within page.on('download', …) handler for Files`, async({browser, server}) => {
const page = await browser.newPage({ acceptDownloads: true });
- const onDownloadPathPath = new Promise((res) => {
+ const onDownloadPath = new Promise((res) => {
page.on('download', dl => {
dl.path().then(res);
});
});
await page.setContent(`download`);
await page.click('a');
- const path = await onDownloadPathPath;
+ const path = await onDownloadPath;
+ expect(fs.readFileSync(path).toString()).toBe('Hello world');
+ await page.close();
+ })
+ it.fail(FFOX || WEBKIT)(`should report download path within page.on('download', …) handler for Blobs`, async({browser, server}) => {
+ const page = await browser.newPage({ acceptDownloads: true });
+ const onDownloadPath = new Promise((res) => {
+ page.on('download', dl => {
+ dl.path().then(res);
+ });
+ });
+ await page.goto(server.PREFIX + '/download-blob.html');
+ await page.click('a');
+ const path = await onDownloadPath;
expect(fs.readFileSync(path).toString()).toBe('Hello world');
await page.close();
})