Skip to content

Commit

Permalink
Add failing tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rwoll committed Apr 22, 2020
1 parent b7afbf8 commit 97ae1d5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
15 changes: 14 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"progress": "^2.0.3",
"proxy-from-env": "^1.1.0",
"rimraf": "^3.0.2",
"test": "^0.6.0",
"ws": "^6.1.0"
},
"devDependencies": {
Expand Down
14 changes: 14 additions & 0 deletions test/download.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ describe('Download', function() {
expect(fs.readFileSync(path).toString()).toBe('Hello world');
await page.close();
});
fit(`should report download path within page.on('download', …) handler`, async({browser, server}) => {
const page = await browser.newPage({ acceptDownloads: true });
const onDownloadPathPath = new Promise((res, rej) => {
setTimeout(() => { rej('failed to find path quickly'); }, 1000);

page.on('download', dl => {
dl.path().then(res);
});
});
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
await page.click('a');
const path = await onDownloadPathPath;
expect(fs.readFileSync(path).toString()).toBe('Hello world');
})
it.skip(FFOX).fail(CHROMIUM || WEBKIT)('should report alt-click downloads', async({browser, server}) => {
// Firefox does not download on alt-click by default.
// Our WebKit embedder does not download on alt-click, although Safari does.
Expand Down

0 comments on commit 97ae1d5

Please sign in to comment.