Commit Graph

2054 Commits

Author SHA1 Message Date
Jack Franklin
6fec36d8ba
chore: don’t ship tsbuildinfo files in npm package (#6809)
This PR updates our `files` list to be more specific; rather than include everything from `lib`, we include just `.js`, `.d.ts`, and their equivalent sourcemaps. This prevents noisy meta-files like `.tsbuildinfo` sneaking into the package, which are no use to anyone.
2021-02-08 16:21:41 +00:00
David Barton
5f7b048080
docs(contributing): fix typo around test directory link (#6831)
Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2021-02-08 06:59:24 +00:00
David Barton
b047023eee
chore: clean up remaining Travis references (#6826)
Issue: #6726
2021-02-08 07:41:26 +01:00
Arjen Korevaar
3b13012d1f
chore: update proxy-from-env (#6660) 2021-02-05 09:20:40 +01:00
Mathias Bynens
d799e30090
chore: let actions/checkout determine the branch by itself (#6821)
Hopefully this ensures pull requests coming from forks still get CI checks.

Issue: #6818
2021-02-05 09:04:46 +01:00
Mathias Bynens
21daba9e28
docs(contributing): update example PR link (#6813) 2021-02-04 13:54:36 +00:00
Jack Franklin
6c61874797
fix(launcher): output correct error message for browser (#6815)
* fix(launcher): output correct error message for browser

When running `npm run release` today I got this error logged:

```
Error: Could not find browser revision 848005. Run "PUPPETEER_PRODUCT=firefox npm install" or "PUPPETEER_PRODUCT=firefox yarn install" to download a supported Firefox browser binary.
    at ChromeLauncher.launch (/Users/jacktfranklin/src/puppeteer/lib/cjs/puppeteer/node/Launcher.js:80:27)
```

The error is only partially correct; I did have the browser revision
missing, but I needed the Chromium browser, not Firefox. It turns out
the logic in `Launcher.ts` didn't take this into account; it mistakenly
had been hardcoded to always log out the error as if the Firefox binary
was missing.

This PR updates the message depending on the browser:

Chrome error:
> Error: Could not find expected browser (chrome) locally. Run npm
> install or yarn install to download the correct Chromium revision
> (848005).

Firefox error:
> Error: Could not find expected browser (firefox) locally. Run
> "PUPPETEER_PRODUCT=firefox npm install" or "PUPPETEER_PRODUCT=firefox
> yarn install" to download a supported Firefox browser binary.

* Update src/node/Launcher.ts

Co-authored-by: Mathias Bynens <mathias@qiwi.be>

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2021-02-04 11:59:01 +00:00
Jack Franklin
c936b18651
chore: bump version to 7.0.1-post (#6814) 2021-02-04 10:32:11 +00:00
Jack Franklin
eb0d604bf3
chore(release): mark v7.0.1 (#6812) 2021-02-04 10:07:37 +00:00
Jack Franklin
a7e3c2e09e
fix(typescript): ship .d.ts file in npm package (#6811)
In all my excitement about shipping types, we forgot to export the
actual `d.ts` file that makes it all happen... :(

I didn't pick this up locally because I was testing with `npm link`,
which does a symbolic link and therefore doesn't mirror the list of
files that make it into the published package.

To test this change, I made the change and ran `npm pack` to generate a
tar. I then created a new empty directory and did `npm init -y` followed
by `npm install path/to/puppeteer-7.tgz`.

I then initialised TypeScript, and wrote this:

```js
import puppeteer from 'puppeteer';

async function run() {
  const browser = await puppeteer.launch()
  const page = await browser.newPage()
  await page.goto('https://foo.com')
}
run();
```

As I typed I got autocompletions and if I were to make an error, I'd get
a TypeScript error.

There is follow up work to be done because this unfortunately does not
work if you use `require` rather than ES Modules. @AviVahl suggested a
change in https://github.com/puppeteer/puppeteer/issues/6807 but I
cannot get it to work, so I'd like to do more investigation here. In the
mean time, whatever the contents of `cjs-entry.d.ts`, we should
definitely be exporting it as part of the module, so this PR is still
good to land.
2021-02-04 09:45:46 +00:00
Jan Scheffler
9abd459b2a
chore: bump version to v7.0.0-post (#6808) 2021-02-03 15:54:54 +00:00
Jan Scheffler
edd8bcc619
chore(release): mark v7.0.0 (#6804) 2021-02-03 16:33:32 +01:00
Maksim Sadym
401d84e4a3
feat: use captureBeyondViewport in Page.captureScreenshot (#6805)
BREAKING CHANGE:
- `page.screenshot` makes a screenshot with the clip dimensions, not cutting it by the ViewPort size.
2021-02-03 14:30:46 +01:00
Maksim Sadym
890d5c2e57
feat(chromium): roll Chromium to r848005 (#6801)
This corresponds to Chromium 90.0.4403.0
This roll includes:
- Cut screenshot by ViewPort size, not position (crrev.com/c/2643792)

BREAKING CHANGE:
- `page.screenshot` cuts screenshot content by the ViewPort size, not ViewPort position.
2021-02-02 17:24:10 +01:00
Mathias Bynens
03db2cbf2f
chore: fix version number (#6803) 2021-02-02 12:32:13 +00:00
Jan Scheffler
20526b57b8
chore: bump version to v6.0.0-post (#6802) 2021-02-02 11:22:53 +00:00
Jan Scheffler
ef4767080a
chore(release): mark v6.0.0 (#6800) 2021-02-02 12:00:09 +01:00
Mathias Bynens
f7f122dc41
chore: drop Travis CI config (#6799)
Now that we’ve migrated to GitHub Actions and everything seems to work correctly, we can remove Travis CI without losing confidence.

Issue: #6726
2021-02-02 11:03:31 +01:00
Mathias Bynens
0a76cd0bd6 chore: drop README badge 2021-02-02 08:42:37 +01:00
Maksim Sadym
8f9fbdbae6 feat(chromium): roll Chromium to r843427 (#6797)
This corresponds to Chromium 89.0.4389.0.

This roll includes:

- Add `SameParty` attribute to cookies
  https://crrev.com/c/2598846
- Anchor `target=_blank` implies `rel=noopener`
  https://crrev.com/c/1630010
- Don’t expect ignored elements in the AXTree
  https://crrev.com/c/2505362

BREAKING CHANGE: The built-in `aria/` selector query handler doesn’t return ignored elements anymore.

Issue: #6758
2021-02-02 08:40:56 +01:00
Mathias Bynens
c49d10970f
chore(ci): use GitHub Actions to run unit tests on Windows and macOS (#6782)
Similar to our earlier Travis CI setup, we continue to run exhaustive checks on Linux, while also verifying the build + unit tests still work on other platforms.

Issue: #6726
2021-01-27 14:57:41 +01:00
Jan Scheffler
cac540be3a
fix(domworld): fix waitfor bindings (#6766) (#6775)
* fix(domworld): fix waitfor bindings (#6766)

Co-authored-by: Johan Bay <jobay@google.com>
2021-01-25 13:01:59 +01:00
Samuel Bodin
15bc900be0
docs: correct link for v5.0.0 (#6778) 2021-01-25 07:33:45 +01:00
Aravind.H.U
26fa363443 docs(troubleshooting): describe EC2 Amazon-Linux setup (#6771)
Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2021-01-22 09:25:58 +01:00
Jan Scheffler
5ea76e9333
feat: add page.emulateNetworkConditions (#6759) 2021-01-21 10:00:57 +01:00
Jack Franklin
ebd087a316
feat(types): expose typedefs to consumers (#6745)
This PR replaces https://github.com/puppeteer/puppeteer/pull/6289 with a simpler approach to types where we compile them all alongside the compiled code (so for every `foo.js` that is generated, we generate `foo.d.ts`).

By default that's not enough, as when you `import puppeteer from 'puppeteer'` in Node land you import `cjs-entry.js`, so we also create `cjs-entry.d.ts` which TypeScript will then pick up. This type file tells TypeScript that the thing that `cjs-entry.js` exposes is an instance of the `Puppeteer` class, which then hooks all the types up.

The previous PR (https://github.com/puppeteer/puppeteer/pull/6289) tried to merge all our typedefs into one big file via API Extractor, but this isn't really necessary a good experience for the developer.

One important consideration is that you _could_ consider this a breaking change. I'm not sure how likely it is, but it could cause problems for:

* Projects that didn't have any type info for Puppeteer and treated all its exports as `any` may now start having legitimate type failures.
* Projects that depend on the `@types/puppeteer` package may have issues if they now swap to use this one and the types aren't quite aligned.

In addition, once we do ship a release with this change in, it will mean that we have to treat any changes to any type definitions as release-note-worthy, and any breaking changes to type definitions will need to be treated as breaking code changes (nearly always a breaking type def means a breaking change anyway), but it's worth considering that once we expose these typedefs we should treat them as first class citizens of the project just like we would with the actual source code.

I also fully expect to have some bugs with our types, or have users create issues/PRs to change our types, but I think that's a good thing and it should settle down.

I've tested this locally by creating a new package, linking Puppeteer via `npm link puppeteer` and then checking that VSCode correctly shows me the right things when I use `Go to Definition` on something that comes from the Puppeteer source code.
2021-01-13 10:37:35 +01:00
Mathias Bynens
9dd1aa302d
chore: add GitHub Action workflow for main CI checks (#6739) 2021-01-12 11:48:33 +01:00
Alex Smith
9a8479a52a feat: support fetching and launching on Apple M1
Issue: #6495, #6634, #6641, #6614
2021-01-08 10:36:11 +01:00
Yoni Medoff
50b810dab7
feat: add iPhone 11 models to DeviceDescriptors (#6467) 2021-01-08 10:13:45 +01:00
Henrik Skupin
a732e7ac8f
chore: disable experimental Firefox cookie feature sameSite=Lax by default (#6690) 2021-01-08 10:11:41 +01:00
Vse Mozhe Buty
13bce296c3
docs(api): add info for .$x() methods (#6711)
Possibly connected issue: https://github.com/puppeteer/puppeteer/issues/6710
2021-01-05 08:22:46 +01:00
Vse Mozhe Buty
444c7e0e47
docs(api): fix some typos (#6712) 2020-12-31 06:30:27 +01:00
Paul Irish
d901696e0d
fix(launcher): rename TranslateUI to Translate to match Chrome (#6692) 2020-12-23 08:59:26 +01:00
Darío Kondratiuk
2e5c4885af
docs(api): fix GeolocationOptions link (#6670) 2020-12-22 14:46:50 +01:00
Vse Mozhe Buty
740c10c7fc
docs(api): fix some typos (#6672) 2020-12-22 13:34:44 +01:00
Maja Frydrychowicz
09fca442f7
chore: update test expectations per Mozilla’s sync-up with v5.5.0 (#6650)
This patch enables more tests for Firefox. These tests are enabled in Mozilla's CI for Firefox. The extra error handling here prevents hangs in the test harness in that environment.
2020-12-07 08:18:32 +01:00
edtam
a16cb8cef4
docs(api): fix description of mouse wheel options (#6643) 2020-12-02 15:41:11 +01:00
Henrik Skupin
6f73db8858
chore: force-disable Firefox Fission (Site Isolation mode) (#6642) 2020-12-02 09:56:26 +01:00
Mathias Bynens
53ce52e3b6
chore: automate release commits (#6628)
Issue: #6482
2020-11-30 10:29:38 +01:00
Peter Marshall
46e74ff3f5
test: use sourcemaps in unit tests (#6485)
Introduce the source-map-support package and require it for mocha running unit tests.

Turn on the sourceMap option for tsconfig.base.json so that the sourceMappingURL= line is emitted in the generated files.

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-11-26 14:51:17 +01:00
dmitrysteblyuk
fb859115c0
fix: do not use old utility world (#6528)
Don’t use the old utility world, as it is being destroyed later when browser reconnects to the page.

Issue: #6527
2020-11-26 12:43:42 +01:00
Dr
3bf5a55289
fix: update to https-proxy-agent@^5.0.0 to fix ERR_INVALID_PROTOCOL (#6555)
With `nodejs@15.0.1`, install puppeteer with `https_proxy` set causes an error like:

```
> puppeteer@5.4.1 install node_modules/puppeteer
> node install.js

ERROR: Failed to set up Chromium r809590! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
TypeError [ERR_INVALID_PROTOCOL]: Protocol "https:" not supported. Expected "http:"
    at new NodeError (node:internal/errors:258:15)
    at new ClientRequest (node:_http_client:155:11)
    at Object.request (node:https:313:10)
    at httpRequest (node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:488:17)
    at downloadFile (node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:357:21)
    at BrowserFetcher.download (node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:239:19)
    at async downloadBrowser (node_modules/puppeteer/lib/cjs/puppeteer/node/install.js:48:5) {
  code: 'ERR_INVALID_PROTOCOL'
}
```

The related issue is at https://github.com/TooTallNate/node-agent-base/pull/47, from package `agent-base` under `https-proxy-agent`

And the version bump is for `Refactor to TypeScript` is here: https://github.com/TooTallNate/node-https-proxy-agent/compare/4.0.0...5.0.0
2020-11-26 12:42:18 +01:00
Mathias Bynens
470124fb2b
chore: automate version bumps (#6627)
Issue: #6482
2020-11-26 11:38:24 +01:00
Michael Kebede
b57f3fcd53
feat: support promise as return value for page.waitForResponse predicate (#6624)
Co-authored-by: Joni <josalmi@google.com>
2020-11-25 11:35:47 +01:00
Greg Gorlen
3354aa7fa8
docs(api): fix misleading “seconds” for waitForTimeout (#6619) 2020-11-24 09:24:36 +01:00
Mathias Bynens
0473a2ae32
chore: bump version to v5.5.0-post (#6605) 2020-11-17 11:46:21 +01:00
Mathias Bynens
18143b3573
chore(release): mark v5.5.0 (#6604) 2020-11-16 14:38:50 +01:00
Yash Ladha
d8932ca187
chore: shorter node checker function (#6584)
`isNode` checks for the node version in which the process is running and it checks for the node key inside the versions. This is exactly the same as using `process.version` as they are set in the native code and `process.version` is just a shorthand for `process.versions.node`.
2020-11-05 07:49:58 +01:00
ghoussard
d606b8076f
docs(troubleshooting): update dumb-init version (#6585)
The latest released version of dumb-init is 1.2.2. Binary naming has changed: `dumb-init_x.x.x_amd64` became `dumb-init_x.x.x_x86_64`.
2020-11-05 07:49:20 +01:00
Yash Ladha
8690a77a2b
chore: remove redundant npm script for dependency-graph (#6583)
Remove the redundant rule for dependency graph as the `src/index.ts` is not required. This was introduced in 64c9c709, but the filestructure has changed from since then and it doesn't work as `src/index.ts` is replaced with `src/node.ts` and `src/web.ts` as per the use case.
2020-11-04 17:08:07 +01:00