Commit Graph

1655 Commits

Author SHA1 Message Date
Jack Franklin
262da92bbb
chore(test): re-enable Firefox testing on CI (#5608) 2020-04-08 12:18:29 +02:00
Jack Franklin
83d9d530ca
chore: update CI to run Travis + Linux + Chromium (#5583)
Our CI build has been incredibly flaky across all three of our current CIs:

* Appveyor: Chromium + Windows
* Travis: Firefox + Linux, Chromium + Linux
* Cirrus: Chromium + Linux, Chromium + Mac

Legitimate issues and errors have been missed because it's expected that the CI is red and therefore it's not seen as an issue when a PR's build fails.

We should have a build that covers the full combo of browsers and operating systems but it's more important to have a consistent, reliable green build where failures are genuine. So this commit strips our CI back to Chromium on Linux on Travis, and nothing more. Once this is stable we will expand out into more operating systems and bring back Firefox, too.
2020-04-08 11:38:07 +02:00
Joshua H
21c2d31523
docs(api): update another emulateMediaType example (#5607) 2020-04-08 11:33:34 +02:00
Joshua H
fefa8ca8a2
docs(api): update emulateMediaType example (#5606) 2020-04-08 10:17:49 +02:00
Mathias Bynens
bbdaf92116
docs(README): remove unused badges 2020-04-08 10:16:45 +02:00
Jack Franklin
efe561e112
chore: fix DocLint method diffing (#5594)
Our logic around missing methods wasn't quite right; if there is no set of missing methods for a class it _is_ an error and we still need to report it, we don't want to `continue`.
2020-04-06 12:36:28 +02:00
Jack Franklin
841c2a5fc0
chore: fix emulateMedia tests (#5593)
See the large code comment in the diff for a full explanation but we can't rely on the functions being referentially equivalent so instead we test the behaviour in duplicate tests across the deprecated method and the new method.
2020-04-06 12:25:09 +02:00
Jack Franklin
8fa034bf2f
chore: remove flakiness dashboard (#5592)
We're not using it at all so might as well cut down on code in the codebase.
2020-04-06 11:55:15 +02:00
Jack Franklin
4ee2c43f06
chore: fix Page.emulateMedia doclint failure (#5584)
This is expected as we now alias `emulateMedia` in `index.js` which isn't a file checked by DocLint. We alias there to avoid having the function overriden by the `asyncInstallHooks` code.

This commit updates doclint to know about methods that we expect it will find are missing and in that case just skip over them. We should only do this for methods where we plan to deprecate them or we have to define them in an odd way to work around some problem (and if that's the case long term we should fix that problem so we can define them as normal).

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-04-06 10:38:05 +02:00
Jack Franklin
a99a3cf757
chore: skip failing cookie tests in Firefox (#5575)
They fail because cookies in Firefox return a `sameSite` key which the tests don't expect.

This is a solution that at least gets the Travis Firefox build (hopefully!) green again. Longer term it'd be great to allow the assertion to change based on the browser, rather than skip these tests entirely.
2020-04-06 10:34:45 +02:00
Jack Franklin
88446df724
chore: fix missed src/ vs lib/ documentation (#5591)
Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-04-06 10:32:42 +02:00
Bello Gbadebo
b3b0dc5025
docs: replace invalid device descriptors link (#5589)
Fixes #5588.
2020-04-06 08:50:13 +02:00
Tim Gates
99ecdbad0a
docs: fix simple typo (#5585)
There is a small typo in test/utils.js, utils/flakiness-dashboard/FlakinessDashboard.js.

Should read `existence` rather than `existance`.
2020-04-06 08:49:15 +02:00
Maja Frydrychowicz
7f7887ed11
docs(puppeteer-firefox): add deprecation warning to README (#5502) 2020-04-03 13:23:30 +02:00
Jack Franklin
6522e4f524
chore: Use expect for assertions (#5581)
Rather than use our own custom expect library, we can use expect from npm [1], which has an API almost identical to the one Puppeteer has, but with more options, better diffing, and is used by many in the community as it's the default assertions library that comes with Jest.

It's also thoroughly documented [2].

[1]: https://www.npmjs.com/package/expect
[2]: https://jestjs.io/docs/en/expect
2020-04-03 13:22:55 +02:00
Jack Franklin
4c41421dd9
chore: run Chromium on Node.js 12 on Travis (#5582) 2020-04-03 13:22:02 +02:00
Konstantin Vyatkin
f43468452a
chore: fix link to source files in documentation (#5576)
Look like it was overlooked while moving source files.
2020-04-03 12:02:24 +02:00
Jack Franklin
2b52b860cd
chore: remove travis-autodeploy (#5580)
We don't want to automatically publish these and this hasn't been running / working for a while anyway.
2020-04-03 12:01:54 +02:00
Jack Franklin
7a2a41f208
chore: move code to src/ and emit with TypeScript (#5568)
This updates our `tsconfig.json` so it emits our JavaScript files as
well as type checking them. We compile into `./lib` which we then ship
in our npm package. The source code has moved from `./lib` into `./src`.

Because the `src/` directory is exclusively JS files, this change is a
no-op in terms of code functionality but is the first step towards being
able to replace `src/X.js` with `src/X.ts` in a way that allows us to
migrate incrementally.

The `lib` directory is gitignored, and the `src` directory is
npmignored. On `npm publish` we will now run `npm run tsc` in order to
generate the outputted code.
2020-04-02 16:25:19 +02:00
Maja Frydrychowicz
c82b5560f0
docs: connect works with any supported browser (#5572) 2020-04-02 10:35:47 +02:00
Jack Franklin
d678013368
chore: upgrade TypeScript to 3.8 (#5566)
Easy upgrade this one! No changes that affect us so this change simply bumps TS in `package.json`.
2020-04-01 11:34:50 +02:00
Christian Bromann
3dff24ad35
chore: upgrade eslint to v6.8.0 (#5563) 2020-03-31 18:43:06 +02:00
Jack Franklin
4b0fd8bc30
chore: upgrade to TypeScript 3.7 (#5562)
TypeScript seems to struggle to understand `Promise.all` when the items in the array return different types. If we were authoring in TS we could fix this with TS generics (`Promise.all<OurTypeHere>(...)`) but for now we can typecast the result. We'll fix this properly when we author in TS.
2020-03-31 18:42:32 +02:00
Jack Franklin
29b626aa94
chore: upgrade TypeScript to 3.6 (#5559)
Continues the work to get up to TS 3.8 (latest release at time of writing).

This version of TS introduced built in definitions for web workers that include an `interface Worker` so TS gets confused when it sees us reference a `Worker`. I have renamed the imports to `PuppeteerWorker` as I couldn't figure out a way to tell TS to not load in the worker types; longer term we might consider renaming `Worker` to `PuppeteerWorker` (or an alternative) but that would be a breaking change that we don't need right now.

The other fix is similar; TypeScript doesn't differentiate between the built-in `WebSocket` type and the `ws` library. Renaming the import solves this too.
2020-03-31 15:46:54 +02:00
Jack Franklin
5e8d79bf98
chore: upgrade to TypeScript 3.5 (#5556)
TS 3.5 got much stricter on writing changes to objects with varied types [1] so we have to do a bit of typecasting work to convince TS about the types of keys and values that we are setting.

Longer term we should think about a better data structure that avoids us having to jump through some hoops but for now I think this is a reasonable step to get us onto 3.5.

Same story regarding bindings on `window`: the easiest fix is to cast `window` to `any` for the code that adds to it. I'm sure we can come up with a more type-safe way of doing this in the future.

[1]: https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#fixes-to-unsound-writes-to-indexed-access-types
2020-03-31 10:48:09 +02:00
Andrey Lushnikov
b9240b1664
chore: bump rimraf to v3.0.2 (#5431)
`rimraf` version 3.0.2 doesn't throw any more when used
in Jest environment.

Fixes #5425
2020-03-12 22:17:47 +01:00
Philipp Hagemeister
067662c677
Emit change event on uploadFile calls (#5389)
In puppeteer 1.20.0, the following code emitted an alert:
```
const puppeteer = require('puppeteer');

(async () => {
	const browser = await puppeteer.launch({args: ['--no-sandbox'], headless: false});
	const page = (await browser.pages())[0];

	await page.setContent(`
		<input type=file>
		<script>
		document.querySelector('input').addEventListener('change', () => {
			alert('Uploaded a file');
		});
		</script>
		`);
	const input = await page.waitForSelector('input[type="file"]');
	await input.uploadFile(__filename);
})();
```

A bisection yielded 6091a34a36 as the commit that broke this.

Emitting the change event as well seems to fix the problem.
2020-03-12 17:26:03 +01:00
Yuki Takizawa
a3d1536a6b
Bugfix: Docker build failure (#5400)
The recommended Dockerfile uses node:10-slim image as a base,
but the base image does not contain wget command anymore.
(About the reason, see https://github.com/nodejs/docker-node/issues/1185)
So fixed the problem.
2020-03-12 17:01:39 +01:00
Maja Frydrychowicz
33f1967072
(feat) Add option to fetch Firefox Nightly (#5467)
* (feat) Add option to fetch Firefox Nightly

Add Firefox support to BrowserFetcher and the install script.
By default, the latest Firefox Nightly is downloaded
directly from archive.mozilla.org (dmg, tar.bz2 and zip)

This also required changes that impact `puppeteer.launch()`
and `puppeteer.executablePath()`

Fixes #5151

* Update docs/api.md

Co-Authored-By: Mathias Bynens <mathias@qiwi.be>

* Clean up revision promise

* Improve error handling in revision check

* Remove matchAll

* Use explicit octal mode

* Update .gitignore

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-03-10 21:59:03 +01:00
Changhao Han
807fbbdc20
chore: drop Node.js v8 support (#5365)
* chore: update relevant Node.js versions from 8 to 10

* chore: remove node6 and node8 folders from puppeteer-firefox ci

* fix: loosen definition for proc.stdio

* fix: update typescript version used in npm run test-types
2020-03-10 21:55:32 +01:00
Maja Frydrychowicz
0b1a9ceee2
chore: Replace Juggler with Firefox Nightly in CI (#5395)
Fixes #5150.
2020-02-20 13:57:15 +01:00
WuerfelDev
0b1777e73c
docs(api) Fix url (#5367)
A little slash had been missing since eddb23b521
2020-02-06 22:54:48 +01:00
Changhao Han
5ffcde2b7b
chore: bump version to v2.1.1.-post (#5390) 2020-02-06 16:28:15 +01:00
Changhao Han
46386eb866
chore: mark version v2.1.1 (#5388) 2020-02-05 14:36:04 +01:00
Pavel Feldman
9923e56b3e
fix(filechooser): quick fix for the headful file chooser (#5369)
Fixes #5363
2020-01-31 08:43:34 +01:00
Tim van der Lippe
1a1ef83e8d
Add FAQ entry on cross-browser support (#5360)
Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-01-29 15:52:20 +01:00
Grzegorz (Greg) Ziółkowski
0d243b7a0f feat: make it possible to run install.js script with puppeteer-core (#5325)
Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-01-28 13:08:13 +01:00
Feu
c283fea6c5 docs(api): add example to page.$$eval (#5200)
This makes it more clear that the callback receives an actual array of nodes instead of just a NodeList.

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-01-27 16:19:33 +01:00
Mathias Bynens
b45f8e4703
chore: bump version to v2.1.0-post (#5349) 2020-01-27 16:00:07 +01:00
Mathias Bynens
a30cf05e3a chore: mark version v2.1.0 (#5347)
This changes the Chromium revision to r722234 (Chrome 80.0.3987.0),
since that's the most recent version in the Chromium 80 range for
which a download exists for all supported platforms.
2020-01-27 15:48:40 +01:00
Mathias Bynens
013a86cf28
feat(chromium): roll Chromium to r722269 (#5289)
This corresponds to Chromium 80.0.3987.0.

This roll includes:

- Implement support for the new ARIA `generic` role
  https://chromium-review.googlesource.com/c/chromium/src/+/1872305
- Expose button's children to accessibility tree
  https://chromium-review.googlesource.com/c/chromium/src/+/1845810
- Remove `Page.handleFileChooser` from CDP
  https://chromium-review.googlesource.com/c/chromium/src/+/1935410
2020-01-27 14:44:53 +01:00
Mathias Bynens
14b2369650
chore: mark puppeteer-firefox version v0.5.1 (#5294) 2020-01-09 16:07:21 +01:00
Mathias Bynens
3a49cfc9f8
chore: move to GitHub hosting for Juggler binaries (#5293) 2020-01-09 15:24:57 +01:00
Lawrence Chou
c7af7ded66 docs(readme): update link for ndb (#5272) 2020-01-08 12:26:22 +01:00
den
5e63254e62 chore: fix typo in test name (#5217) 2019-12-11 15:41:41 +01:00
Danny Guo
80b5c44d89 chore: upgrade https-proxy-agent (#5243)
https-proxy-agent requires agent-base, which currently monkey-patches the core `https` Node module, causing problems in unrelated code. The latest version of https-proxy-agent uses the latest version of agent-base which no longer does this monkey patching.
2019-12-11 15:40:22 +01:00
Mathias Bynens
6091a34a36
fix: prepare jsHandle.uploadFile for CDP Page.handleFileChooser removal (#5196)
* fix: prepare jsHandle.uploadFile for CDP Page.handleFileChooser removal

https://chromium-review.googlesource.com/c/chromium/src/+/1935410
removes Page.handleFileChooser from the CDP.

* fix: improve binary file support

UTF-8-decoding the input file could fail for binary files, and so we
now read the raw file buffer and base64-encode it. To base64-decode it
within the page context, we use the Fetch API in combination with a
data URL. This requires knowing the proper MIME type for the input
file, which we now figure out using the new mime-types dependency.
2019-12-03 09:18:18 +01:00
Mathias Bynens
8b49dc62a6
fix: don’t disable BlinkGenPropertyTrees anymore (#5159)
Ref. #5080.
2019-11-27 12:58:09 +01:00
Darío Kondratiuk
f0bf645c47 test: reduce flakiness for accessibility tests with autofocus (#5116) 2019-11-27 10:36:17 +01:00
Erik Kotsiuba
6cc98a7b63 docs(troubleshooting): recommend using args for heroku (#5197)
Co-Authored-By: Mathias Bynens <mathias@qiwi.be>
2019-11-27 10:01:39 +01:00