Commit Graph

658 Commits

Author SHA1 Message Date
Andrey Lushnikov
ea28cccfe0 feat(page): introduce file chooser interception (#4653)
This patch introduces a page.waitForFileChooser() method
that adds a watchdog to wait for file chooser dialogs.

This lets Puppeteer users to capture file chooser requests
and fulfill/cancel them if necessary.

Fixes #2946
2019-07-22 21:30:49 -07:00
Yury Semikhatsky
2abaac10aa fix(launcher): make dumpio and pipe options work together (#4727)
Don't ignore stdout and stderr when using pipe for remote debugging and dumpio is true. In that case puppeteer process connects to the stdout/stderr streams of the child process and it will not hang.
2019-07-18 16:42:11 -07:00
Andrey Lushnikov
835e8849fd
feat(testrunner): add new testrunner options (#4718)
This patch adds new TestRunner options:
- `disableTimeoutWhenInspectorIsEnabled` - disable test timeout if
  testrunner detects enabled inspector.
- `breakOnFailure` - if testrunner should terminate test running on
  first test failure
2019-07-17 10:32:37 -07:00
Andrey Lushnikov
ad1802188d
fix(launcher): disable component extensions (#4704)
Chrome has a set of component extensions - e.g. CryptoTokenExtension
that helps with 2FA.

These extensions are loaded regardless of the `--disable-extensions`
flag we already pass. To disable these extensions, we need to pass additional
`--disable-component-extensions-with-background-pages` flag.

Fix #4300
2019-07-15 17:54:42 -07:00
Yury Semikhatsky
a39d553511 fix(tests): Get TLS version from Node instead of hardcoding it (#4700) 2019-07-14 18:33:31 -07:00
Andrey Lushnikov
62733a20d7
fix(connection): bump websocket max received message size to 256Mb (#4571)
This is the max message size that DevTools can emit over the DevTools
protocol: https://cs.chromium.org/chromium/src/content/browser/devtools/devtools_http_handler.cc?type=cs&q=kSendBufferSizeForDevTools&sq=package:chromium&g=0&l=83

Test is failing on firefox since Firefox crashes when allocating 100Mb string.

Fix #4543
2019-06-14 01:05:09 -07:00
Andrey Lushnikov
8df0b3ec3b
fix(network): allow fulfilling requests with status code 422 (#4566)
Migration onto fetch domain (2265974ce5)
changed the way we generate status texts: instead of relying on build-in
list of statuses, we tried to rely upon the [Chromium implementation](https://cs.chromium.org/chromium/src/net/http/http_status_code_list.h?sq=package:chromium&g=0).

Puppeteer's list is much more exhaustive - let's keep it.

Fix #4454
2019-06-10 17:39:58 -07:00
Joel Einbinder
b2f94909a1 fix(eval): be able to throw protocol like errors (#4551) 2019-06-10 17:35:40 -07:00
Andrey Lushnikov
6a50888d34
fix(firefox): fix missing awaits in mouse.click (#4561)
This applies the same fix we used on the Chrome-side and adds a test.

Fix #4536
2019-06-10 16:53:38 -07:00
Andrey Lushnikov
90df69cf77
fix(page): do evaluations with one roundtrip (#4539)
This patch teaches page.evaluate to do 1 hop instead of 2 hops.
As a result, things such as `page.select` will not throw an
unfortunate exception when they schedule a navigation.

Fix #4537
2019-06-07 13:46:43 -07:00
Andrey Lushnikov
15804d111a
test: remove debug console.log (#4522) 2019-06-04 16:27:36 -07:00
Andrey Lushnikov
78d5106dd9
feat(chromium): roll Chromium to r665405 (#4516)
* feat(chromium): roll Chromium to r665405

This roll includes:
- https://crrev.com/665226 - DevTools: make interception respect cross-process frame boundaries

This fixes page loading with dynamic OOPIFs - test is added.

Fix #4442

* fix lint
2019-06-04 11:03:15 -07:00
Andrey Lushnikov
d221c02c13
test: add test to verify fetching of dataURL requests (#4233) 2019-05-31 17:11:55 -07:00
Andrey Lushnikov
015e330815
test: add oopif tests (#4495)
Reference #2548
2019-05-29 16:49:44 -07:00
Andrey Lushnikov
76b24e64e8
feat(chromium): roll Chromium to r662092 (#4462)
This roll includes:
- [inspector_protocol:8ec18cf](8ec18cf088) Support STRING16 in the template when converting CBOR map keys
to protocol::Value.
- [inspector_protocol:37518ac](37518ac421) fix parsing of the last ASCII character

This fixes protocol handling of UTF8 in both V8 and Chromium.

Fixes #4443.
2019-05-22 21:21:45 +03:00
Andreas Tolfsen
cbecfba0af test: convert license text file to LF line endings (#4438)
See #4320 (comment).

Should fix the checkout problems on Unix file systems.
2019-05-21 23:11:25 +03:00
Darío Kondratiuk
bad98baf70 fix(test): browser.disconnect should not be awaited (#4446)
browser.disconnect does not return a promise
2019-05-21 17:26:04 +03:00
Jake Causon
90a1032300 fix(network): stringify response headers for intercepted requests (#4436)
Stringifying the headers was the behaviour before v1.15

References #4379
2019-05-20 11:05:32 +03:00
Sergio M
60249e0bc2 fix: Page.setContent working with unicode strings (#4433)
Fix `page.setContent` with unicode strings that exceeds the range of a 8-bit byte.

This patch implements decoding part of the [MDN's solution #4 for the "unicode problem"](https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_4_%E2%80%93_escaping_the_string_before_encoding_it).

Since we rely on node.js buffer to encode into base64, we don't have troubles with base64 encoding, so it is left as-is.

Fixes #4424
2019-05-18 17:15:16 +03:00
Andrey Lushnikov
3f23bb022e
test: add failing evaluation test with utf8 (#4444)
References #4443
2019-05-18 14:05:28 +03:00
Andrey Lushnikov
8a1c2495c0
test: add SVG clicking test (#4432)
Someone had concerns that pptr's clicking doesn't work with SVG.

Make sure Puppeteer's clicking does.
2019-05-18 12:49:55 +03:00
Joel Einbinder
a3cb16308c feat: root option in page.accessibility.snapshot() (#4318)
Going from `AXNode` -> `ElementHandle` is turning out to be controversial.

This patch instead adds a way to go from `ElementHandle` -> `AXNode`. If the API looks good, I'll add it into Firefox as well.

References #3641
2019-05-09 23:39:42 -07:00
Andrey Lushnikov
b3027a6e16
test(page): make sure exposeFunction works with complex args (#4411) 2019-05-09 18:02:46 -07:00
Joel Einbinder
1516e0df21 feat(workers): create workers from service workers and shared workers (#4397)
This allows users to easily evaluate javascript inside service workers and shared workers by creating a Worker object for them.
2019-05-09 17:29:18 -07:00
Andrey Lushnikov
ef24c69c62
fix(tracing): start without options (#4388) 2019-05-09 17:15:33 -07:00
Tony Brix
511dcf9d32 feat(browser): Add browser.isConnected() (#4403)
Add `browser.isConnected()` to the public api to be able to tell when the browser is connected

fixes https://github.com/smooth-code/jest-puppeteer/pull/237#issuecomment-490260041
2019-05-09 16:24:52 -07:00
Andrey Lushnikov
13f73b5b3a
feat(chromium): roll Chromium to r656675 (#4389)
This roll includes:
- https://chromium-review.googlesource.com/c/v8/v8/+/1569425 - [debug] Introduce GetCreationContext to debug API

Fix #4263
2019-05-06 00:22:18 -07:00
Andrey Lushnikov
1de9906260
test: add cookie tests (#4365) 2019-04-30 00:35:41 -07:00
Andrey Lushnikov
27c9f754b1
fix(page): teach page.setContent to work with tricky content (#4366)
Fix #4364
2019-04-30 00:35:05 -07:00
Andrey Lushnikov
e2e6b88934
feat(chromium): roll Chromium to r654752 (#4358)
This roll includes:
- https://crrev.com/653809 - FrameLoader: ignore failing provisional loads entirely
- https://crrev.com/654750 - DevTools: make sure Network.requestWillBeSent is emitted on time for sync xhrs

The FrameLoader patch is the reason behind the test change. It's
actually desirable to fail frame navigation if the frame detaches - and
that's consistent with Firefox.

Fixes #4337
2019-04-28 20:19:01 -07:00
Andrey Lushnikov
f3db28c94b
test: add failing test for request interception with sync XHRs (#4350)
`Network.requestWillBeSent` is not issued for the redirect inside
sync XHRs.

References #4337.
2019-04-26 16:28:15 -07:00
Andrey Lushnikov
770411be9d
test: verify overriding postdata and method on navigation (#4317)
References #4309
2019-04-19 18:22:30 -07:00
Andrey Lushnikov
e3abb0aa32
feat(puppeteer): introduce puppeteer.errors and puppeteer.devices (#4312)
These getters are introduced as a more convenient substitute for
a `require('puppeteer/Errors')` and
`require('puppeteer/DeviceDescriptors')`.

This way we can make cross-browser story nicer - a single require
of `puppeteer` or `puppeteer-firefox` fully defines Puppeteer
environment.
2019-04-19 15:33:06 -07:00
Darío Kondratiuk
dde55b0257 test: Make intervention test Edge friendly (#4314)
All tests are green when running against [Microsoft Edge Insider](https://www.microsoftedgeinsider.com/en-us/), except this test.

Edge returns `https://to-be-replaced.invalid/feature/5718547946799104` instead of `https://www.chromestatus.com/feature/5718547946799104`

I think that checking for `feature/5718547946799104` is a small test and will do the job for both browsers.

```
$env:CHROME = "C:\Program Files (x86)\Microsoft\Edge Dev\Application\msedge.exe"; node
.\test.js
```
2019-04-19 11:29:29 -07:00
Andrey Lushnikov
0c4d53b293
test: add a test for queryObjects with navigation (#4303)
References #4263
2019-04-18 10:03:06 -07:00
Andrey Lushnikov
a8ffdad76e
feat(chromium): roll Chromium to r650583 (#4284)
This roll includes:
- https://crrev.com/650583 - DevTools: fix DOM.getContentQuads for a
  corner case

Fixes #4281.
2019-04-13 00:28:58 -07:00
Andrey Lushnikov
145e8680b1
test: add failing test for clicking certain elements (#4282)
References #4281
2019-04-13 00:10:48 -04:00
Andrey Lushnikov
8f8e77492d
test: split out request interception tests (#4278) 2019-04-11 21:33:01 -04:00
Andrey Lushnikov
5ee21d97e7
fix(page): intersect content quads with viewport (#4277)
In certain cases inline element children might be positioned
outside of viewport.

In this case, we should intersect all content quads with viewport
before we pick one to click into.

Fixes #4274.
2019-04-11 21:11:20 -04:00
Andrey Lushnikov
20988775bf
fix: gracefully handle multiple contexts for secondary DOM World (#4276)
In case of multiple sessions to the same target, there's a race between
sessions to create a secondary isolated world. As a result, we might
end up having 2 execution contexts created for the needs of the
secondary isolated world.

This patch starts handling this race gracefully: instead of crashing,
we can use either of the execution contexts and ignore the rest.

Notably, the same race condition might happen if page reloads itself
in-between the calls to `page.addEvaluateOnNewDocument` and
`page.createIsolatedWorld`.

Fixes #4197.
2019-04-11 16:26:18 -04:00
Andrey Lushnikov
19606a3b79
fix: cache disabling should stick when toggling request interception (#4260)
This patch:
- refactors `NetworkManager`/`FrameManager` so that they enable all the
relevant domains themselves. This is a preparation for OOPIF support and
migration onto fetch domain.
- moves `networkManager` ownership into `FrameManager`. This way it's clear who owns what.
- stops enabling Security domain: it saves quite some traffic over
websocket since it no longer sends annoying "SecurityStateChanged" events.
Instead, use `Security.setIgnoreCertificateErrors` method.
- consolidates network cache state in network manager. This even fixes a
bug with caching and request interception interop.
2019-04-10 00:42:42 -04:00
Joseph Arhar
fd0f58e9c2 fix: Use new requestId for interception request matching (#4248)
Fix #3471
2019-04-08 14:17:57 -07:00
Andrey Lushnikov
9d31068225
feat(chromium): roll Chromium to r648643 (#4256)
This roll includes:
- https://crrev.com/648335 -
[DevTools] Send DevTools request ID through URLLoader
- https://crrev.com/648360 -
[DevTools] Add renderer request ID to requestIntercepted

References #3471
2019-04-08 12:11:35 -07:00
Darío Kondratiuk
72866e9467 test: Change cookies unsecure test title (#4187)
I think we wanted to say "HTTP Website" there.
2019-03-20 11:36:27 -07:00
Andrey Lushnikov
60567575d2
test: make sure frames are reported from-inside shadow DOM (#4167)
References #4163.
2019-03-15 21:01:36 -07:00
Vse Mozhet Byt
854b1c0912 feat(executioncontext): support bigints transferring (#4016)
Refs: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-UnserializableValue
2019-03-15 10:20:48 -07:00
Andrey Lushnikov
3511a35fa4
test: fix fixtures test when run with env DUMPIO=1 (#4123)
The DUMPIO env variable is propagated to a spawned process
and results in unfortunate stdout.
2019-03-13 16:26:28 -07:00
Andrey Lushnikov
6474b3ffe0
test: ensure Page.setBypassCSP works with iFrames (#4155) 2019-03-11 17:56:32 -07:00
Andrey Lushnikov
42351c7fe5
feat(firefox): Implement header overrides in request interception (#4142)
This patch makes sure header overrides in request interception are
functioning as expected.

Drive-by: teach test server to use utf-8 charset header for text files.
2019-03-08 14:26:13 -08:00
Darío Kondratiuk
5d6535ca0c test: Fix should fire for fetches test (#4139)
The code in "should fire for fetches" was copy of "should fire for iframes"
I bet the test was supposed to use a fetch there.
2019-03-08 08:59:07 -08:00