Skip to content

Commit fbc52e7

Browse files
committed
Add failing tests
The fail with: ``` NON-TEST ERROR #1: UNHANDLED PROMISE REJECTION Error: Pass { acceptDownloads: true } when you are creating your browser context. ``` which shows the issue we were running into.
1 parent b7afbf8 commit fbc52e7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/download.spec.js

+14
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,20 @@ describe('Download', function() {
7070
expect(fs.readFileSync(path).toString()).toBe('Hello world');
7171
await page.close();
7272
});
73+
fit(`should report download path within page.on('download', …) handler`, async({browser, server}) => {
74+
const page = await browser.newPage({ acceptDownloads: true });
75+
const onDownloadPathPath = new Promise((res, rej) => {
76+
setTimeout(() => { rej('failed to find path quickly'); }, 1000);
77+
78+
page.on('download', dl => {
79+
dl.path().then(res);
80+
});
81+
});
82+
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
83+
await page.click('a');
84+
const path = await onDownloadPathPath;
85+
expect(fs.readFileSync(path).toString()).toBe('Hello world');
86+
})
7387
it.skip(FFOX).fail(CHROMIUM || WEBKIT)('should report alt-click downloads', async({browser, server}) => {
7488
// Firefox does not download on alt-click by default.
7589
// Our WebKit embedder does not download on alt-click, although Safari does.

0 commit comments

Comments
 (0)