Commit Graph

1096 Commits

Author SHA1 Message Date
Mathias Bynens
a63f53c938
fix: add favicon test asset (#6868)
The favicon was taken from https://github.com/mathiasbynens/small.

Issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1682076
2021-02-11 11:54:45 +00:00
Jack Franklin
bdaba7829d
fix: jsonValue() type is generic (#6865)
During the migration to TS we changed `jsonValue` so it returned
`<Record<string, unknown>>`. This is only true if all the JSON values it
returns are objects; but it could return an array, a string, a number,
etc. Therefore we make the type generic, setting the default to
`unknown`, so the user has control over the type.
2021-02-11 09:50:15 +00:00
Jan Scheffler
4e8d074c2f
fix(domworld): reset bindings when context changes (#6766) (#6836) 2021-02-08 18:56:04 +00: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
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
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
Jan Scheffler
5ea76e9333
feat: add page.emulateNetworkConditions (#6759) 2021-01-21 10:00:57 +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
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
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
Jack Franklin
659193a4f5
chore: mark launcher spec as failing on Windows (#6574)
We've pushed this date back a lot, let's make it permanent until we have
more time to investigate.
2020-11-03 10:11:29 +00:00
Peter Thaleikis
3bb417b14b
chore: fix typo in test (#6566) 2020-11-01 09:43:07 +01:00
Johan Bay
729cdfe98a
chore: mark version v5.4.0 (#6542) 2020-10-23 16:28:38 +02:00
Jack Franklin
e655bb6ca2
chore(agnostification): split up root Puppeteer class (#6504)
The `Puppeteer` class had two concerns:

* connect to an existing browser
* launch a new browser

The first of those concerns is needed in all environments, but the
second is only needed in Node.
https://github.com/puppeteer/puppeteer/pull/6484 landing enabled us to
pull the `Puppeteer` class apart into two:

1. `Puppeteer` which hosts the behaviour for connecting to existing
   browsers.
2. `PuppeteerNode`, which extends `Puppeteer` and also adds the ability
   to launch a new browser.

This is a non-breaking change, because Node users will still get an
instance of a class with all the methods they expect, but it'll be a
`PuppeteerNode` rather than `Puppeteer`. I don't expect this to cause
people any issues.

We also now have new files that are effectively the entry points for
Puppeteer:

* `node.ts`: the main entry point for Puppeteer on Node.
* `web.ts`: the main entry point for Puppeteer on the web.
* `node-puppeteer-core.ts`: for those using puppeteer-core (which only
  exists in Node, not on the web).
2020-10-13 16:19:26 +01:00
Ralf Vogler
f3086d7c97
fix(launcher): support relative userDataDir on headless Windows (#6506)
Launching headless with a relative `userDataDir` hangs on Windows. Fix by calling `path.resolve` (idempotent) to add an absolute path instead in `defaultArgs`.

Issues: #3453
2020-10-13 12:59:58 +02:00
Johan Bay
8fabe32800
feat(queryhandler): add built-in pierce handler (#6509)
Adds a handler 'pierce' that pierces shadow roots while querying.
2020-10-13 11:05:47 +02:00
Jack Franklin
f04bec5a15
chore: update eslint & eslint plugins (#6487)
Updates ESLint, the TypeScript ESLint plugins, and updates code where
the rules have changed.
2020-10-12 10:30:35 +01:00
Jack Franklin
4846b8723c
chore(agnostification): split up launcher class (#6484)
The `Launcher` class was serving two purposes:

1. Launch browsers
2. Connect to browsers

Number 1) only needs to be done in Node land, but 2) is agnostic; in a
browser version of Puppeteer we'll need the ability to connect over a
websocket to send commands back and forth.

As part of the agnostification work we needed to split the `Launcher` up
so that the connection part can be made agnostic. Additionally, I
removed dependencies on `https`, `http` and `URL` from Node, instead
leaning on fetch (via `node-fetch` if in Node land) and the browser
`URL` API (which was added to Node in Node 10).
2020-10-12 10:08:57 +01:00
Johan Bay
3afe1935da
feat(a11y-query): extend aria handler with waitFor (#6472)
This commit adds waitFor to the built-in aria handler (#6307).
2020-10-07 10:49:11 +02:00
Johan Bay
950ae334ca
feat(a11y-query): aria query handler sans waitfor (#6459)
This commit adds a new built-in handler for querying by accessible name and role (#6307).
Support for waitForSelector will be added in a follow-up commit.
2020-10-05 08:25:55 +02:00
Maja Frydrychowicz
41ef3eec90
fix: update preferences in default Firefox profile (#6465) 2020-10-05 07:17:21 +02:00
Johan Bay
49f25e2412
feat(chromium) roll Chromium to r809590 (#6458)
This corresponds to Chromium 87.0.4272.0
This roll includes:
- Reland "idle-detection: Implement requestPermission() method"
  (crrev.com/c/2417779)
2020-10-01 08:24:47 +02:00
Maja Frydrychowicz
4cdbebe1ac
chore: disable firefox windows launcher test until Nov (#6451) 2020-09-29 16:04:07 +01:00
Jack Franklin
caa9a1cafa
chore(agnostic): Remove use of util.promisify (#6446)
In `src/common` we now use `fs.promises.X` which we can dynamically
`import`. In a browser environment this code will never run because it's
gated on `isNode` (in a future PR we will add tree-shaking to the bundle
step such that this code is eliminated). By using `import`, we ensure
TypeScript still can track types and give good type information.

In `src/node` we continue to use `util.promisify` but that's not a
concern as that code explicitly is never run in the browser.
2020-09-28 10:35:35 +01:00
Yang Guo
96f3d439f5
feat(console): expose stack trace for console messages (#6445) 2020-09-25 15:27:13 +02:00
Johan Bay
72fe86fe6a
feat(a11y-query): introduce internal handlers (#6437)
This commit changes the internal representation of query handlers to contain Puppeteer-level code instead of page functions.
The interface `CustomQueryHandler` is introduced for user-defined query handlers. When a `CustomQueryHandler` is registered using  `registerCustomQueryHandler` a corresponding Puppeteer-level handler is created through `makeQueryHandler` by wrapping the page functions as appropriate.
The internal query handlers (defined by the interface `QueryHandler`) contain two new functions: `waitFor` and `queryAllArray`.
- `waitFor` allows page-based handlers to make use of the `WaitTask`-backed implementation in `DOMWorld`, whereas purely Puppeteer-based handlers can define an alternative approach instead.
- `queryAllArray` is similar to `queryAll` but with a slightly different interface; it returns a `JSHandle` to an array with the results as opposed to an array of `ElementHandle`. It is used by `$$eval`. 

After this change, we can introduce built-in query handlers that are not executed in the page context (#6307).
2020-09-23 16:02:22 +02:00
Johan Bay
b1c3efaa34
feat(a11y-query): split waitFor logic for selectors and xpath (#6426)
The logic for waitForXPath and waitForSelector is currently very tightly coupled. This commit tries to untangle that relationship. This is the first step towards introducing built-in query handlers that are not executed in the page context (#6307).
2020-09-21 15:47:33 +02:00
campersau
083ea41e94
test(frame): correct terminology in URL fragment test (#6416)
Bug: #6398
2020-09-14 13:42:32 +02:00
Maksim Sadym
17960e5d8d
feat(page): emulate idle state (#6410)
* https://bugs.chromium.org/p/chromium/issues/detail?id=1090802
* added `page.emulateIdleState(...)` allowing emulate or remove emulation of the idle state;
* added test `emulate idle` -> `remove emulation` -> `emulate idle` -> `remove emulation`;
* added launch argument `--enable-blink-features=IdleDetection` to turn IdleDetection on.
2020-09-14 11:31:23 +02:00
Mathias Bynens
e22ca4c7c4
chore: extend Firefox launch test deadline by a month (#6403)
Ref. #5673.
2020-09-08 15:08:23 +02:00
Bryan Maloyer
b6bbfd0ede
fix: ensure frame.url() includes the query string (#6398)
Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-09-08 10:49:44 +02:00
Maja Frydrychowicz
054d782c82
fix(Launcher): use wait-for-process Firefox option (#6315) 2020-08-10 10:23:17 +02:00
Christian Bromann
9bc063b5ef
chore: assert location value of ConsoleMessage in tests (#6282) 2020-07-29 12:13:50 +01:00
Jack Franklin
21552f8fe7
feat: page.waitForTimeout (#6268) 2020-07-28 10:37:49 +02:00
Christian Bromann
8c1a5866c5
fix: handle promise for reading protocol stream of trace (#6270) 2020-07-23 16:21:15 +02:00
Johan Bay
e89e264a16
feat(chromium): roll Chromium to r782078 (#6250)
This corresponds to Chromium 85.0.4182.0.

This roll includes: 
- Enable SameSiteByDefaultCookies and CookiesWithoutSameSiteMustBeSecure
   https://crrev.com/c/2231445
- [FlexNG] Enable FlexNG by default
   https://crrev.com/c/2216595

Closes #6151.
2020-07-20 17:17:06 +02:00
Johan Bay
313774c553
feat: change QueryHandler to contain QueryOne and QueryAll methods (#6218)
Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-07-17 07:29:42 +02:00
Jack Franklin
f1a6b8d66d
chore: vendor Mitt & update project structure (#6209)
* chore: vendor Mitt into src/common/third-party

As discussed in #6203 we need to vendor our common dependencies in so
that when we ship an ESM build all imports point to file paths and do
not rely on Node resolution (e.g. a browser does not understand `import
mitt from 'mitt'`).
2020-07-14 16:57:29 +01:00
Jack Franklin
ffec2475d0
chore: enforce file extensions on imports (#6202)
* chore: enforce file extensions on imports

To make our output agnostic it should include file extensions in the
output, as per the ESM spec. It's a bit odd for Node packages but makes
it easier to publish a browser build.
2020-07-13 10:22:26 +01:00
Changhao Han
790c277f0e
feat(chromium): roll Chromium to r768783 (#6201)
* feat(chromium): roll Chromium to r768783

* fix: update unit test for crrev:2135046

* chore: update devtools-protocol revision

Co-authored-by: Changhao Han <changhaohan@chromium.org>
2020-07-10 15:32:44 +02:00
Jack Franklin
9b3005c105
feat(types): improve page.evaluate types (#6193) 2020-07-10 11:52:13 +01:00
Jack Franklin
f666be3f5f
chore: remove src/api.ts (#6191)
Now the async hooks helper is gone api.ts was only used by the coverage
tools and by doclint.

DocLint is nearing the end of its lifespan with the TSDoc work, so I
focused on how best to define a list of modules for the coverage
tooling. They define an object of classes, and the path to that module.
They need the full path because we also check if the module exports any
events that need to be emitted - the coverage tool asserts that the
emitting of those events is also tested.

It's not _great_ that DocLint relies on a constant defined in the
coverage utils, but it should only be this way for a short period of
time and no one is actively working on DocLint (bar the effort to remove
it) so I don't think this is worth worrying about.

This change also broke the DocLint tests; based on the fact that DocLint is on its way out it doesn't feel worth fixing the tests, so this commit also removes them.
2020-07-10 10:07:28 +01:00
Jack Franklin
12434663e2
chore: remove installAsyncStackHooks helper (#6186)
* chore: remove `installAsyncStackHooks` helper

This code was written when browsers/Node didn't support errors in async
functions very well. They now do a much better job of this, so we can
lose the additonal complexity from our codebase and leave it to the host
environment :)

* lazy launcher is private

* remove async stack test
2020-07-09 11:38:25 +01:00
Christian Bromann
e67a860eb0
feat: add Mouse#wheel (#6141) 2020-07-06 09:27:17 +02:00
Jack Franklin
5049b83186
feat(types): add types for page.$$eval (#6139)
* feat(types): add types for `page.$$eval`

* Add new-docs for $$eval

* fix example

* linting
2020-07-03 15:23:51 +01:00
Jack Franklin
6474edb9ba
feat(types): add types for $eval (#6135)
This pulls in the types (based on the DefinitelyTyped repo) for
`page.$eval` (and the `$eval` method on other classes). The `$eval`
method is quite hard to type due to the way we wrap and unwrap
ElementHandles that are passed to / returned from the `pageFunction`
that users provide.

Longer term we can improve the types by providing type overloads as
DefinitelyTyped does but I've deferred that for now (see the `TODO` in
the code for more details).
2020-07-02 10:09:34 +01:00
Jack Franklin
8370ec88ae
feat(types): add (and fix) evaluateHandle types (#6130)
This change started as a small change to pull types from DefinitelyTyped over to
Puppeteer for the `evaluateHandle` function but instead ended up also fixing
what looks to be a long standing issue with our existing documentation.

`evaluateHandle` can in fact return an `ElementHandle` rather than a `JSHandle`.
Note that `ElementHandle` extends `JSHandle` so whilst the docs are technically
correct (all ElementHandles are JSHandles) it's confusing because JSHandles
don't have methods like `click` on them, but ElementHandles do.

if you return something that is an HTML element:

```
const button = page.evaluateHandle(() => document.querySelector('button'));
// this is an ElementHandle, not a JSHandle
```

Therefore I've updated the original docs and added a large explanation to the
TSDoc for `page.evaluateHandle`.

In TypeScript land we'll assume the function will return a `JSHandle` but you
can tell TS otherwise via the generic argument, which can only be `JSHandle`
(the default) or `ElementHandle`:

```
const button = page.evaluateHandle<ElementHandle>(() => document.querySelector('button'));
```
2020-07-01 12:44:08 +01:00
Jack Franklin
3c0dc45e47
chore: update Windows skipped tests. (#6133)
The headful one I'm permanently skipping as I don't know what the issue is and I can't debug without getting my hands on a Windows machine. If anyone has one or is able to help, that'd be great!

The other I'm deferring another month and will ping the FF folks :)
2020-07-01 11:28:13 +01:00
Jack Franklin
a4d12a2b21 chore: remove helper.promisify (#6100)
It was just re-exporting the built-in Node module so let's just import
from that directly.
2020-06-25 13:01:46 +02:00
Jack Franklin
785551997f chore: tidy up TODO from TS tests migration (#6090)
Deleting `Node` errors in strict mode; we don't need to have this test
any more.
2020-06-25 13:01:36 +02:00
Jack Franklin
37f6032003
feat(api): remove emulateMedia method (#6084)
It has been deprecated for a while. In the next breaking release let's remove it.

BREAKING CHANGE: swap to `emulateMediaType` instead.
2020-06-23 16:27:37 +01:00
Jack Franklin
381b0f833c
chore: declare toBeGolden to TypeScript (#6080)
Which means we can avoid all the ts-expect-errors on any `toBeGolden`
calls.
2020-06-23 15:02:09 +01:00
Jack Franklin
70a900e93b
chore: fix ESLint violation and lessen rule strictness (#6081) 2020-06-23 12:55:42 +01:00
Jack Franklin
28797dee41
chore: migrate tests to TypeScript (#6075)
This CL migrates all the tests to TypeScript. The main benefits of this is that we start consuming our TypeScript definitions and therefore find errors in them. The act of migrating found some bugs in our definitions and now we can be sure to avoid them going forwards.

You'll notice the addition of some `TODO`s in the code; I didn't want this CL to get any bigger than it already is but I intend to follow those up once this lands. It's mostly figuring out how to extend the `expect` types with our `toBeGolden` helpers and some other slight confusions with types that the tests exposed.

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-06-23 07:18:46 +02:00
Jack Franklin
e7b91a7f41
chore: enforce a max line length on comments (#6055) 2020-06-19 15:39:03 +01:00
Jack Franklin
7a4170fe6e
chore: remove top level errors and DeviceDescriptors (#6043)
As far as I can tell these became irrelevant as of v1.15 which added
`puppeteer.errors` and `puppeteer.devices [1]. This is a breaking change
but one that's easily mitigated. We've said that we don't consider
changes to our folder/file structure a breaking change, but we can't
really do that if we have these two top level files that we've
documented.

[1]: e3abb0aa32 (diff-522b24108d7446af4c59873472a90444)
2020-06-19 15:15:13 +02:00
Jack Franklin
759b28080a
chore: upgrade to Mocha v8 (#5997)
* chore: upgrade to Mocha v8

Mocha v8 has some nice improvements and also unlocks the potential
to have parallel test runs which may speed up CI.
2020-06-18 16:26:30 +01:00
Jack Franklin
9522f80116
chore: create common directory (#6042)
These files will be used by both the web and node versions of Puppeteer.
Another name for this might be "core" but I don't want to cause
confusion with the puppeteer-core package that we publish at the moment.
2020-06-18 15:53:23 +01:00
Tim van der Lippe
03ab1c1b9c
fix: improve Ctrl + C support (#6011)
Fix child process killing when the parent process SIGINTs.

If you `ctrl + c` the Puppeteer parent process, we would sometimes not properly handle killing of the child processes. This would then leave child processes behind, with running Chromium instances. This in turn could block Puppeteer from launching again and results in
cryptic errors.

Instead of using the generic `process.kill` with the process id (which for some reason is negative the pid, which I don't get), we can kill the child process directly by calling `proc.kill`.

Fixes #5729.
Fixes #4796.
Fixes #4963.
Fixes #4333.
Fixes #1825.
2020-06-15 15:02:00 +02:00
Jack Franklin
b659969a38
chore: migrate away from Node's EventEmitter (#5979) 2020-06-15 11:52:19 +01:00
Maja Frydrychowicz
3d56a9e76f chore: add test configuration options for running tests against multiple products (#5964)
* chore: remove "Extracting..." log message

Fixes #5741.

* test: support extra Launcher options and skips

The extra Launcher options and skipping conditions enable
unit tests to be run more easily by third-parties, e.g.
browser vendors that are interested in Puppeteer support.

Extra Launcher options were previously removed as part of
switching away from the custom test harness.

* test: enable more tests for Firefox
2020-06-12 15:56:11 +02:00
Jack Franklin
8a099a0c2c
docs: replace @return with @returns (#6006)
The former is not understood by TSDoc.
2020-06-12 12:38:24 +02:00
Henrik Skupin
9c656d417e
chore: remove prefers-color-scheme: no-preference (#5990)
The 'no-preference' value has been removed from the spec per resolution in [1]. The appropriate web-platform-tests [2] have already been updated.

[1] https://github.com/w3c/csswg-drafts/issues/3857#issuecomment-634779976
[2] https://github.com/web-platform-tests/wpt/pull/24024
2020-06-09 23:17:07 +02:00
Jack Franklin
81e32481e9
chore: Defer Windows FF tests for longer (#5954)
We deferred this initially because our Windows CI built wasn't stable
and so debugging this was hard. It's now much more stable so let's push
this back a month but at the same time I'll reach out to the Moz folks
as it should be easier to debug reliably now CI is stable on Windows.
2020-06-01 11:12:25 +01:00
Mathias Bynens
7eab7f8dd9
feat(api): add page.emulateVisionDeficiency(type) (#5901)
Design doc: https://goo.gle/devtools-cvd
2020-05-26 17:14:20 +02:00
Jack Franklin
24ac11e76e
chore: fix undefined rm in mocha-utils (#5920)
Closes #5916.
2020-05-26 16:37:39 +02:00
Henrik Skupin
6cfe142af1
Don't use expect within Promises (#5466) (#5473)
* Don't use expect within Promises (#5466)

If a call to expect fails within a Promise it will not
be resolved, and causing the test to crash.

The patch aligns the code similar to what is used by all
the other tests.
2020-05-26 09:22:11 +01:00
Jack Franklin
d8e0557d18
chore: update Travis to run latest macOS and fix HTTPS test (#5903)
* chore: fix invalid SSL assertion on Catalina

The error Chrome gives with an invalid cert changes between older Mac
versions and Catalina as detailed here:
https://support.google.com/chrome/thread/18125056?hl=en.

This PR changes Travis to run Catalina (and we think most devs run up to
date OS versions) so this fix ensures the test behaviour is consistent
locally and on Travis.

For those on older Mac versions I've left a comment by the tests to
hopefully save them debugging!

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-05-21 15:36:59 +01:00
Jack Franklin
9a08d31319
chore: error if coverage couldn't find the given class (#5863)
The coverage utils depend on `src/api.ts` being up to date and pointing to the right modules. If they aren't, you would get a cryptic error on CI:

```
1) "before all" hook in "{root}":
   TypeError: Cannot read property 'prototype' of undefined
    at traceAPICoverage (test/coverage-utils.js:40:54)
    at Context.before (test/coverage-utils.js:103:7)
2) "after all" hook in "{root}":
   TypeError: Cannot read property 'stop' of undefined
    at Context.after (test/mocha-utils.js:168:22)
```

This change logs a clearer error that highlights the missing class and exits, so it's much easier to realise what's gone wrong.

Ideally the  coverage wouldn't need a hardcoded list of sources, but until then this will help spot this error in the future.
2020-05-20 11:00:29 +02:00
Islam ElHakmi
caaf4d2086
fix: support async functions as an argument for waitForFunction (#5682) 2020-05-19 09:09:31 +02:00
Michal TOMA
a17bd89fb9 feat: add securityDetails.subjectAlternativeNames() #5628 (#5881)
Co-authored-by: Michal TOMA <michaltoma2205@gmail.com>
Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>

Fixes #5625. Closes #5628.
2020-05-18 12:59:57 +02:00
Alex Rudenko
e8232890a4
feat(chromium): roll Chromium to r756035 (#5879)
This corresponds to Chromium 83.0.4103.0.

This roll includes:

- Enable SameSiteByDefaultCookies and CookiesWithoutSameSiteMustBeSecure https://crrev.com/c/2122809
2020-05-18 11:06:42 +02:00
Jack Franklin
3e76554fcb
chore: fix async dialog specs when they fail (#5859)
When this test was failing, it would cause no future tests to run. This
was because the `expect` call within the `page.on` callback would throw
an error, and that would trigger a unhandled promise rejection that
caused the test framework to stop.

The fundamental issue here is making `expect` calls within callbacks.
They are brittle due to the fact that they throw, and the test framework
won't catch it, but also because you have no guarantee that they will
run. If the callback is never executed you dont' know about it.

Although it's slightly more code, using a stub is the way to do this.
Not only can we assert that the stub was called, we can make synchronous
`expect` calls that Mocha will pick up properly if they fail.

Before this change, running the tests (and making it fail on purpose)
would cause all test execution to stop:

```
> puppeteer@3.0.4-post unit /Users/jacktfranklin/src/puppeteer
> mocha --config mocha-config/puppeteer-unit-tests.js

  .(node:69580) UnhandledPromiseRejectionWarning: Error: expect(received).toBe(expected) // Object.is equality

Expected: "yes."
Received: ""
    at Page.<anonymous> (/Users/jacktfranklin/src/puppeteer/test/dialog.spec.js:42:37)
    [snip]
(node:69580) UnhandledPromiseRejectionWarning: Unhandled promise rejection ... [snip]
```

But with this change, the rest of the tests run:

```
> puppeteer@3.0.4-post unit /Users/jacktfranklin/src/puppeteer
> mocha --config mocha-config/puppeteer-unit-tests.js

  Page.Events.Dialog
    ✓ should fire
    1) should allow accepting prompts
    ✓ should dismiss the prompt

  2 passing (2s)
  1 failing

  1) Page.Events.Dialog
       should allow accepting prompts:
     Error: expect(received).toBe(expected) // Object.is equality

Expected: "yes."
Received: ""
      at Context.<anonymous> (test/dialog.spec.js:53:35)
      at processTicksAndRejections (internal/process/task_queues.js:94:5)
```

This is much better because one failing test now doesn't stop the rest
of the test suite.

This probably isn't the only instance of this in the codebase so I
propose as we encounter them we fix them usng this commit as the
template.
2020-05-14 11:34:22 +02:00
Mathias Bynens
b2552e4f7d
chore: restore page.setUserAgent test (#5868)
Ref. #5781.
2020-05-14 10:24:30 +01:00
Christian Bromann
b510c354c7
chore: fetch Firefox from JSON source instead of RegExp (#5864)
Fetch Firefox from https://product-details.mozilla.org/1.0/firefox_versions.json.

Fixes #5742.
2020-05-13 15:48:39 +02:00
Jack Franklin
f5d2597bac
chore: add running TSC to test README (#5852) 2020-05-13 09:20:33 +01:00
Jack Franklin
b38bb4334f
Warn when given unsupported product name. (#5845)
* Warn when given unsupported product name.

Fixes #5844.

This change means when a user launches Puppeteer with a product name
that is not supported (which at the time of this commit means it's not
`firefox` or `chrome) we will warn them about it.

Decided on just a warning vs an error because the current behaviour is
that we fallback to launching Chrome and I don't think this warrants a
breaking change.
2020-05-12 10:30:24 +01:00
Jack Franklin
4fdb1e3cab
chore: add Prettier (#5825) 2020-05-07 12:54:55 +02:00
Jack Franklin
890c215142
chore: migrate src/Puppeteer to TypeScript (#5789)
* chore: migrate src/Puppeteer to TypeScript.

* fix api js
2020-05-05 09:36:44 +01:00
Jack Franklin
5518bac291
chore: update how we track coverage during unit tests (#5779)
* chore: update how we track coverage during unit tests

The old method of tracking coverage was causing issues. If a test failed
on CI, that test's failure would be lost because the test failing would
in turn cause the coverage to fail, but the `process.exit(1)` in the
coverage code caused Mocha to not output anything useful.

Instead the coverage checker now:

* tracks the coverage in memory in a Map (this hasn't changed)
* after all tests, writes that to disk in test/coverage.json (which is
gitignored)
* we then run a single Mocha test that asserts every method was called.

This means if the test run fails, the build will fail and give the error
about that test run, and that output won't be lost when the coverage
then fails too.

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-04-30 13:00:41 +01:00
Paul Lewis
4a47867a24
feat: add support for string-based custom queries (#5753) 2020-04-30 12:45:52 +01:00
Jack Franklin
3116bb9c2d
chore: log product + binary on unit test runs (#5785)
This way it's super clear which product and binary you're testing against.
2020-04-30 13:03:16 +02:00
Mathias Bynens
862eea850e
chore: disable flaky setUserAgent test in Firefox (#5780) 2020-04-30 12:10:28 +02:00
Jack Franklin
8a5008e30b
chore: migrate src/FrameManager to TypeScript (#5773) 2020-04-29 13:28:16 +02:00
Jack Franklin
1ccfbcb684
chore: enforce naming of errors in catch blocks (#5763) 2020-04-28 15:16:28 +02:00
Jack Franklin
06d62c0165
chore: migrate src/Browser to TS (#5761) 2020-04-28 14:26:37 +02:00
Paul Lewis
79e82e5b65
fix: make uploadFile throw for non-existent files (#5733) 2020-04-24 13:36:46 +02:00
Jack Franklin
8509f4660e
chore: migrate src/Accessibility to TypeScript (#5726) 2020-04-23 15:35:03 +01:00
Jack Franklin
e3922ea1f3
chore: enforce consistent spacing around object curlys (#5700)
The codebase was incredibly inconsistent with the use of spacing around
curly braces, e.g.:

```
// this?
const a = {b: 1}
// or?
const a = { b: 1 }
```

This extended into import statements also. Google's styleguide is no
spacing, so we're going with that.
2020-04-21 10:40:04 +01:00
Jack Franklin
c4fe4e46c2
chore(ci): re-enable tests on Windows (#5637)
* chore: Add Windows to Travis

This commit runs the unit tests on Windows.

There are two tests failing on Windows that we skip.

I spoke to Mathias B and we agreed to
defer debugging this for now in favour of getting tests running on
Windows. But we didn't want to ignore it forever, hence giving the test
a date at which it will start to fail.
2020-04-17 14:27:50 +01:00
Paul Lewis
532ae573d2
fix(JSHandle): Fixes file upload (#5655)
This PR returns to using `DOM.setFileInputFiles`, but with some additional fixes and checks for events and multiple files.
2020-04-16 16:22:52 +01:00
Changhao Han
3387aab37f feat(chromium): roll Chromium to r737027 (#5644)
This corresponds to Chromium 81.0.4044.0.

This roll includes:

- [DevTools] Add Cookie Priority support to CDP
  https://chromium-review.googlesource.com/c/chromium/src/+/1959029
- Reject cookies with empty names and values
  https://chromium-review.googlesource.com/c/chromium/src/+/1982549
2020-04-16 09:54:00 +02:00
Maja Frydrychowicz
35989a78ba
fix: set revision based on PUPPETEER_PRODUCT (#5643) 2020-04-15 13:30:42 +02:00
Jack Franklin
0bcc5a7ad8
chore: migrate remaining tests to Mocha (#5616)
This commit updates all the non-Puppeteer unit tests to run using Mocha and then deletes the custom test runner framework from this repository. The documentation has also been updated.
2020-04-09 20:12:32 +02:00
Jack Franklin
17cd8703f9
chore: migrate unit tests to Mocha (#5600)
Rather than maintain our own test runner we should instead lean on the community and use Mocha which is very popular and also our test runner of choice in DevTools too.

Note that this commit doesn't remove the TestRunner source as it's still used for other unit tests, but they will be updated in a future PR and then we can remove the TestRunner.

The main bulk of this PR is updating the tests as the old TestRunner passed in contextual data via the `it` function callback whereas Mocha does not, so we introduce some helpers for the tests to make it easier.
2020-04-09 07:56:25 +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
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
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
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
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
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
Maja Frydrychowicz
0b1a9ceee2
chore: Replace Juggler with Firefox Nightly in CI (#5395)
Fixes #5150.
2020-02-20 13:57:15 +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
den
5e63254e62 chore: fix typo in test name (#5217) 2019-12-11 15:41:41 +01:00
Darío Kondratiuk
f0bf645c47 test: reduce flakiness for accessibility tests with autofocus (#5116) 2019-11-27 10:36:17 +01:00
Mathias Bynens
eddb23b521
chore: update URLs (#5185) 2019-11-26 13:12:25 +01:00
Maja Frydrychowicz
c5a72e9887 feat(launcher): add option to run Puppeteer with different browsers (#5137)
* feat: Set which browser to launch via PUPPETEER_PRODUCT

This change introduces a PUPPETEER_PRODUCT environment
variable as a first step toward using Puppeteer with
many different browsers. Setting PUPPETEER_PRODUCT=firefox, for
example, enables Firefox-specific Launcher settings.

The state is also exposed as `puppeteer.product` in the API
to support adding other product-specific behaviour as needed.

The bulk of the change is a refactoring in Launcher
to decouple generic browser start-up from product-specific
configuration.

Respecting the puppeteer-core restriction for PUPPETEER_
environment variables, lazily instantiate the Launcher
based on a `product` Puppeteer.launch option, if available.

* test: Distinguish Juggler unit tests from Firefox

The funit script is renamed to fjunit (j for Juggler, which is
used only by the experimental puppeteer-firefox package.

In contrast, the funit script now refers to running Puppeteer
unit tests against the main puppeteer package with Firefox.
To do so with Firefox Nightly, run:

`BINARY=path/to/firefox npm run funit`

A number of changes in this patch make it easier to run
Puppeteer unit tests in Mozilla's CI.
2019-11-26 10:23:19 +01:00
Mathias Bynens
360c1b4c7d
test: add page.screenshot viewport clipping test (#5079) 2019-10-24 14:05:13 +02:00
Mathias Bynens
1248a19135
feat(api): add page.emulateTimezone(timezoneId) (#4949)
This enables dynamically changing the timezone of the page.
2019-10-23 15:49:39 +02:00
Mathias Bynens
a86363fda6
feat(api): add page.emulateMedia{Type,Features} (#5012) 2019-10-23 13:55:00 +02:00
Mathias Bynens
81d2600236 feat(chromium): roll Chromium to r705776 (#5058)
This corresponds to Chromium 79.0.3942.0.

This roll includes:

- Support CSS media feature emulation in CDP
  https://chromium-review.googlesource.com/c/chromium/src/+/1821608
- Implement timezone ID verification
  https://chromium-review.googlesource.com/c/chromium/src/+/1822557
- Allow aria-hidden objects into the browser-side ax tree
  https://chromium-review.googlesource.com/c/chromium/src/+/1760862
- Remove pre-BlinkGenPropertyTrees codepaths (affects screenshot clipping)
  https://chromium-review.googlesource.com/c/chromium/src/+/1752244
- Terminate some asynchronous waiting commands on cross-process navigation
  https://chromium-review.googlesource.com/c/chromium/src/+/1766001/21#message-a6a61261b97ffca6ecb180c0a2303b538f7a6476

Per upstream Chromium changes, `page.screenshot` now clips elements to the viewport. This matches the clipping behavior of elements in inner scrollers (i.e., document and overflow scroll clipping now work the same).
2019-10-23 11:41:44 +02:00
Mathias Bynens
11ff374ca3
chore: drop Node.js v6 support (#5045)
Node.js v6 was end-of-life'd in April, 2019, with AWS Lambda prohibiting updaets to the Node.js v6 runtime since June 30, 2019.

This makes it quite safe for us to remove the Node 6 support from the repository.
2019-10-16 17:00:20 +02:00
Mathias Bynens
f504c042c0 test: mark Page.close test as failing in Firefox (#4929) 2019-09-12 14:29:40 -07:00
Yury Semikhatsky
e0c8d46af1 fix: abort page.waitForRequest/Response when page closes (#4865)
We'd like to pass an abortion signal inside Helper.waitForEvent in order to interrupt it when browser/page closes. Several approaches have been considered:

1. Pass CDPSession instance as a another parameter to the helper method and listen to Disconnected event on it. It would introduce undesired dependency on the session object.
2. Listen to the CDPSession closure at the call sites (e.g. waitForRequest) and pass an abortion promise which would be fulfilled when such event is fired. The listeners would have to be removed from the session on successful completion of waitForEvent so we'd have to pass some kind of DisposablePromise which would be disposed during cleanup. Such parameter looked somewhat hairy.
3. Create DisconnectPromise on CDPSession. One potential risk with that is all chained promises would hang around until the event is fired which might inadvertently cause memory leaks. On the other hand, adding such promise to Promise.race will remove dependency as soon as the race is finished. So this is the approach we're taking with one tweak: the promise is created locally inside Page. 

Ideally the disconnectPromise would throw when the session is closed but it may lead to uncaught promise errors if all chained promises are resolved, to avoid that the promise is resolved with an Error and Helper.waitForEvent throws it later.

Fix #4733
2019-08-21 10:26:48 -07:00
Yury Semikhatsky
498492d4a3 test: add a test for errors inside promise (#4838)
The bug was fixed upstream in V8 and rolled into chromium at r686227.
This adds a test.

Fix #4651
2019-08-15 12:03:48 -07:00
Andrey Lushnikov
417981aafa
fix(firefox): fix cookies in default browser context (#4850)
This patch adds tests and fixes the nodejs part of the problem.
The issue will be fixed once we roll a new version of Firefox.

References #4470
2019-08-15 11:52:02 -07:00
Andrey Lushnikov
b6b29502eb
feat(chromium): roll Chromium to r686378 (#4841)
This roll includes:
- https://crrev.com/685152 - [DevTools] Do not debug worker shadow pages
- https://crrev.com/683391 - [CSP] Check inline script CSP in prepare-a-script
- https://chromium-review.googlesource.com/c/v8/v8/+/1707331 - Ignore returnByValue when serializing caught value in promise rejections.
2019-08-14 21:43:18 -07:00
Andrey Lushnikov
01b888049e
test(firefox): disable BigInt tests for Firefox (#4849)
Juggler doesn't yet support BigInt transferring.
2019-08-14 17:49:42 -07:00
Andrey Lushnikov
f595bc0b67
test: fix tests to work on node6 (#4851)
Our magical node6 transpiler can't handle object spreads :(

Drive-by: use "includes" instead of "startsWith" for devtools URL
since I remember that it used to be "chrome-devtools://", and somehow
I saw it as "devtools://" somewhere.
2019-08-14 17:49:12 -07:00
Andrey Lushnikov
0e0a67916d
feat(chromium): roll Chromium to r682225 (#4844)
This roll includes:
- https://crrev.com/681997 - Turn on default SiteInstance by default.

The SiteInstance by default was breaking "devtools: true" option, so
there's a new feature we disable now by default.

This keeps pressuring us towards OOPIF support since that's an
inevitable future.
2019-08-14 15:25:55 -07:00
Andrey Lushnikov
d687c81cd5
chore(flakiness-dashboard): skip API Coverage for realz (#4843) 2019-08-13 16:23:41 -07:00
Andrey Lushnikov
763e3901d9
chore(flaky): save build result (#4819) 2019-08-08 20:53:12 -07:00
Andrey Lushnikov
f753ec6b04
chore(testrunner): distinguish between TERMINATED and CRASHED (#4821)
`testRunner.run()` might have 4 different outcomes:
- `ok` - all non-skipped tests passed
- `failed` - some tests failed or timed out
- `terminated` - process received SIGHUP/SIGINT while testrunner was running tests. This happens on CI's under certain circumstances, e.g. when
  VM is getting re-scheduled.
- `crashed` - testrunner terminated test execution due to either `UnhandledPromiseRejection` or
  some of the hooks (`beforeEach/afterEach/beforeAll/afterAll`) failures.

As an implication, there are 2 new test results: `terminated` and `crashed`.
All possible test results are:
- `ok` - test worked just fine
- `skipped` - test was skipped with `xit`
- `timedout` - test timed out
- `failed` - test threw an exception while running
- `terminated` - testrunner got terminated while running this test
- `crashed` - some `beforeEach` / `afterEach` hook corresponding to this
test timed out of threw an exception.

This patch changes a few parts of the testrunner API:
- `testRunner.run()` now returns an object `{result: string,
terminationError?: Error, terminationMessage?: string}`
- the same object is dispatched via `testRunner.on('finished')` event
- `testRunner.on('terminated')` got removed
- tests now might have `crashed` and `terminated` results
- `testRunner.on('teststarted')` dispatched before running all related
`beforeEach` hooks, and `testRunner.on('testfinished')` dispatched after
running all related `afterEach` hooks.
2019-08-08 15:15:09 -07:00
Andrey Lushnikov
c047624b68
chore: generate testIds on CIs only (#4817) 2019-08-07 10:26:53 -07:00
Andrey Lushnikov
dcff850b6f
chore(flakiness): update flakiness format (#4808)
This patch:
- updates Flakiness Dashboard format to define version per-build
  and to pass COMMIT information
- drops the README.md generation - we'll move on to a designated flakiness
  dashboard viewer
2019-08-06 15:32:55 -07:00
Darío Kondratiuk
b9b6ca1825 fix(network): be able to remove headers using request.continue (#4797)
I think this was a regression caused here https://github.com/GoogleChrome/puppeteer/pull/4265/files#diff-d2ac7cb061b0c51644d0a5d6140e3a32R446

Fix #4743
2019-08-05 15:26:17 -07:00
Joel Einbinder
4acce550c4 fix(test): enable cross process viewport test (#4806) 2019-08-05 15:22:16 -07:00
Joel Einbinder
a95ec70635 chore(test): label coverage+debuger test with upstream bug (#4807)
Filed as https://crbug.com/990945
2019-08-05 15:22:01 -07:00
Joel Einbinder
f2056a8e25 fix(test): enable redirect inside sync XHR test (#4805)
The underlying bug appears to have been fixed. Test works.
2019-08-05 15:19:34 -07:00
Darío Kondratiuk
eb44e260a9 test: add page.bringToFront test (#4778)
Test `page.bringToFront` in headful.
2019-08-01 17:08:29 -07:00
Andrey Lushnikov
5c7c45f0aa
chore(coverage): fix coverage for events (#4787)
We used to track API Coverage for public events, but this was regressed in the refactoring that
introduced `//lib/Events.js`.

This patch:
- Brings back API Coverage for events
- Combines all coverage-generated tests into a single one. This way
we can generate less data for flakiness dashboard.
2019-08-01 16:09:50 -07:00
Andrey Lushnikov
e252dcf200
chore(flakiness): Flakiness Dashboard fixes (#4788)
- fix `FLAKINESS_DASHBOARD_BUILD_URL` to point to a task instead of a build
- do not pretty-print `dashboard.json` when serializing flakiness results
- filter out 'COVERAGE' test(s) so that they don't add up to `dashboard.json` payload. These are useless
- validate certain important options of flakiness dashboard
- more logging to STDOUT to actually say which repo and what branch is getting used
- enhance commit message with a build URL
- use a more compact format for JSON. For 100 runs of 700 tests it yields 21MB json instead of 23MB.
- bump default builds number to 100
2019-08-01 16:09:02 -07:00
Yury Semikhatsky
e2db16f898 fix(tests): make eval test resilient to error format (#4793)
Make eval test resilient to variations in error message format between browsers.This will make the test pass without alternations in WebKit as well as Crhrome and Firefox.
2019-08-01 14:18:35 -07:00
Andrey Lushnikov
932c8cbe9a
chore: introduce initial version of flakiness dashboard (#4781)
This patch introduces a dashboard that records test results and
uploads them to https://github.com/aslushnikov/puppeteer-flakiness-dashboard

Since many bots might push results in parallel, each bot pushes
results to its own git branch.

FlakinessDashboard also generates a simple README.md with a flakiness
summary. If this proves to be not enough, we can build a website that
fetches flakiness data and renders it nicely.
2019-07-31 22:23:50 -07:00
Yury Semikhatsky
1b4a0302fc fix(test): make sure selection is not empty before running copy command (#4772)
If current selection is empty document.execCommand('copy') may return false in some browsers (e.g. WebKit based ones).
2019-07-30 13:19:56 -07:00
Joel Einbinder
7a607469df fix(tests): background page tests should wait for the page (#4769) 2019-07-29 14:09:34 -07:00
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
Andrey Lushnikov
87a8d744e6
test: add a failing test that tries to click a fixed button in an iframe (#4130)
References #4110
2019-03-06 18:46:40 -08:00
Andrey Lushnikov
1623bef264
test: improve test coverage for Request.continue (#4096)
Drive-by: add clarification to docs/api.md regarding
chaning "URL".

References #4030
2019-03-05 14:57:15 -08:00
Joel Einbinder
f32d77e074 test: check if the executable path is an exact match (#4117)
References #4102
2019-03-04 23:46:14 -08:00
Joel Einbinder
ba5f94d2b0 test: disable flaky cookies test (#4112)
References #4111
2019-03-04 18:18:54 -08:00
Andrey Lushnikov
9db09fe7e9
test: add test to validate redirecting in request.respond (#4106) 2019-03-04 17:16:04 -08:00
Andrey Lushnikov
c68df320f8
test: add failing test for bad request interception (#4108)
References #3973
2019-03-04 17:09:23 -08:00
Joel Einbinder
a6d8ecce6f fix(firefox): keyboard tests (#4082) 2019-02-27 15:13:17 -08:00
Andrey Lushnikov
e8a49633d9
test: cleanup tests (#4078)
- move Connection test into CDPSession.spec.js
- remove a nasty test that was reaching into implementation details
2019-02-26 20:36:55 -08:00
Andrey Lushnikov
9ef23b1754
feat(firefox): implement cookies api (#4076)
This patch implements `page.setCookie()`, `page.deleteCookie()` and
`page.cookies()` and doubles the test coverage for cookies so that
we can feel safer on cross-browser compatibility.
2019-02-26 16:24:30 -08:00
Joel Einbinder
03d06f54d6 feat(firefox): page.accessibility.snapshot() (#4071) 2019-02-25 21:57:33 -08:00
Andrey Lushnikov
f21486fa1b
feat(firefox): implement Page.touchscreen (#4070) 2019-02-25 15:36:38 -08:00
Andrey Lushnikov
3541b894f5
test: split out all chromium-specific tests into chromiumonly.spec.js (#4068) 2019-02-25 12:51:06 -08:00
Andrey Lushnikov
77a4ea505e
test: split out fixture tests and make them work with FF (#4067)
Drive-By: give Puppeteer-Firefox its own copy of DeviceDescriptors.
2019-02-25 12:40:17 -08:00
Andrey Lushnikov
4ecbd91e4b
refactor(firefox): migrate onto ExecutionContext events (#4064)
Juggler now has Runtime domain that emits Execution Context events
"ExecutionContextCreated" and "ExecutionContextDestroyed".
2019-02-24 23:07:24 -08:00
Andrey Lushnikov
56dafd7424
feat: support Response.buffer(), Response.json() and Response.text() (#4063)
This patch:
- implements Response.buffer() and other methods
- splits out relevant tests into a separate test suites
- implements `testServer.enableGzip()` method to optionally gzip
  certain routes in tests
- adds tests to make sure `Response.text()` returns expected results
  for binary and compressed responses.
2019-02-24 19:31:35 -08:00
Andrey Lushnikov
3bea5d6017
feat(firefox): implement browserContext.overridePermissions (#4060) 2019-02-22 23:59:32 -08:00
Andrey Lushnikov
f1a14fec5b
feat(firefox): support elementHandle.uploadFile (#4058)
Fixes #3762
2019-02-22 17:22:46 -08:00
Andrey Lushnikov
1315dc8234
feat(firefox): support Page.emualteMedia (#4056) 2019-02-22 14:04:40 -08:00
Andrey Lushnikov
5c818368a5
feat(firefox): implement page.exposeFunction (#4052) 2019-02-22 00:04:25 -08:00
Andrey Lushnikov
7d39aca93c
test: split out test for "text" option of ElementHandle.press (#4051) 2019-02-21 15:56:53 -08:00
Andrey Lushnikov
ed984ac479
chore(firefox): kill original puppeteer-firefox tests (#4047)
When we started working on Puppeteer-Firefox, we forked original
Puppeteer testsuite.

This patch concludes the effort to merge testsuites back together.

Fixes #3889
2019-02-21 13:10:15 -08:00
Andrey Lushnikov
fbf91cca98
test(firefox): move AX tests to Chrome-only (#4042)
Let's not focus on AX for now for Firefox.
2019-02-21 10:07:13 -08:00
Andrey Lushnikov
a0fd2ce3fd
fix(firefox): enable more tests (#4037)
Further align Puppeteer-Firefox implementation with Puppeteer to
pass more tests.
2019-02-19 22:36:02 -08:00
Andrey Lushnikov
03c542a6c1
feat(firefox): implement missing launcher options (#4036)
This patch implements `puppeteer.defaultArgs()` and also missing
options, such as `ignoreDefaultArgs`.
2019-02-19 22:08:09 -08:00
Andrey Lushnikov
719ee5af3d
feat(firefox): support page.setExtraHTTPHeaders (#4035) 2019-02-19 15:22:12 -08:00
Andrey Lushnikov
c118b208fa
feat(firefox): basic request interception support (#4034)
This patch implements `page.setRequestInterception`, `page.continue`
and `page.abort` methods.
2019-02-19 14:51:56 -08:00
Andrey Lushnikov
3b180923a6
refactor(firefox): migrate onto Juggler flatten protocol (#4033)
Juggler now implements the same "flatten" protocol as CDP.
This patch:

* copies `Connection.js` from original Puppeteer (with a few renames, e.g. `CDPSesssion` -> `JugglerSession`).
* migrates code to support protocol-level sessions
2019-02-19 13:20:39 -08:00
Andrey Lushnikov
4a4793a5e1
feat(firefox): support Browser.target() (#4028)
Support browser target.

Drive-by: switch over to a more devtools'ish protocol:

- use `targetId` instead of `pageId` everywhere
- use target events instead of tab events
2019-02-17 10:23:48 -08:00
Andrey Lushnikov
ea482c4751
fix(firefox): properly cleanup networkmanager (#4024) 2019-02-15 23:34:01 -08:00
Andrey Lushnikov
9782f9c827
fix(firefox): add test to make sure remote browser can be closed (#4023) 2019-02-15 18:26:14 -08:00
Andrey Lushnikov
c35821a1a1
feat(firefox): switch over to WebSocket and support multiclient (#4022)
- switch transport from TCP to WS (yay!)
- implemenet `puppeter.connect()`, `browser.disconnect()`, `'disconnected'`
event and `browser.wsEndpoint()`
2019-02-15 17:57:48 -08:00
Andrey Lushnikov
e0d4a5d2ec
fix(firefox): track frame detachment in navigation watchdog (#4008) 2019-02-14 00:06:30 -08:00
Andrey Lushnikov
247733b879
fix(firefox): enable more firefox tests (#4007) 2019-02-13 23:59:38 -08:00
Andrey Lushnikov
e8f044c3be
fix(firefox): enable a bunch of evaluation tests (#4006) 2019-02-13 23:41:53 -08:00
Andrey Lushnikov
6350cf0892
fix(firefox): report more console messages (including warnings) (#4005) 2019-02-13 23:22:45 -08:00
Andrey Lushnikov
0b40d04b99
feat(firefox): support running beforeunload hooks when closing (#4003) 2019-02-13 22:16:12 -08:00
Andrey Lushnikov
e3b76b2beb
feat(firefox): support consoleMessage.location() (#4002) 2019-02-13 19:56:56 -08:00
Andrey Lushnikov
2275c3c0c8
fix(firefox): properly round clip when doing element screenshots (#4001)
Do clipping the same way we do it in Chromium.
2019-02-13 19:47:14 -08:00
Andrey Lushnikov
670d758dfe
feat(firefox): support "referer" option in Page.goto (#4000) 2019-02-13 13:49:05 -08:00
Andrey Lushnikov
fbf36438e8
feat(firefox): support Request.postData (#3999) 2019-02-13 13:11:50 -08:00
Andrey Lushnikov
13224a761e
feat(firefox): support Response.securityDetails() (#3997) 2019-02-13 11:56:51 -08:00
Andrey Lushnikov
57e7f12fbc
test: split out tests for security details (#3996)
This adds missing test coverage for security details and
re-generates our self-signed ceritificate to have meaningful
issuer and subject name.
2019-02-13 11:35:49 -08:00
Andrey Lushnikov
31ae1d6d15
feat(firefox) support Request.headers() & Response.headers() (#3993) 2019-02-13 00:55:56 -08:00
Andrey Lushnikov
89d0f1e1e7
feat(firefox): implement frame.goto / frame.waitForNavigation (#3992)
Some corner cases regarding iframes being detached during navigation
are not yet supported.
2019-02-12 20:10:53 -08:00
Andrey Lushnikov
f0fba56ea3
test: split out Response.fromCache/fromServiceWorker (#3990) 2019-02-12 19:59:54 -08:00
Andrey Lushnikov
1890dc04ba
feat(firefox): Page.waitForRequest/Page.waitForResponse (#3989)
Drive-by: refactor `Request.frame()` tests into a separate test suite.
2019-02-12 19:10:14 -08:00
Andrey Lushnikov
afb9355b15
feat(firefox): basic support for Network (#3988)
This patch introduces basic Request and Response events for
page. It also teaches navigation methods, e.g. `page.goto` to return
navigation response.
2019-02-12 17:38:48 -08:00
Joel Einbinder
fb9d4049d8 test(mouse): add failing for test for mobile + cross process navigation (#3951) 2019-02-11 14:00:06 -08:00
Andrey Lushnikov
b82cc150d1
feat(firefox): support Page.setJavascriptEnabled (#3970)
This patch implements:
- Page.setJavascriptEnabled
- Page.setCacheEnabled
2019-02-08 20:57:16 -08:00
Andrey Lushnikov
edb6f62824
feat(firefox): support page.setDefaultNavigationTimeout (#3969)
This patch supports:
- page.setDefaultNavigationTimeout
- page.setDefaultTimeout
2019-02-08 20:37:14 -08:00
Andrey Lushnikov
fc18a79e99
feat(firefox): support Page.setUserAgent method (#3968) 2019-02-08 19:53:27 -08:00
Andrey Lushnikov
1ce578b787
chore(test): remove the server.EMPTY_PAGE2 asset (#3967)
Firefox used to have a bug that prevented adding iframes with the
same URL as main frame. In this case, we used the EMPTY_PAGE2
so that it doesn't clash with top-level EMPTY_PAGE.

The bug seems to be fixed after we rolled onto a fresh Firefox;
there's no more need for this test asset.
2019-02-08 19:24:40 -08:00
Andrey Lushnikov
cfefd611b8
feat(firefox): support target.opener() and page.on('popup') (#3966) 2019-02-08 19:21:54 -08:00
Andrey Lushnikov
0cf6ab68e7
feat(firefox): support page.browserContext() (#3965) 2019-02-08 18:58:40 -08:00
Andrey Lushnikov
a9875359aa
feat(firefox): implement execution contexts (#3962) 2019-02-08 17:15:52 -08:00
Andrey Lushnikov
0bb657cb26
chore(test): remove --firefox-status flag from tests (#3956)
The [IsPuppeteerFirefoxReady?](https://aslushnikov.github.io/ispuppeteerfirefoxready/)
website now has its own script to compute test and api coverage.
2019-02-08 13:29:13 -08:00
Andrey Lushnikov
6b18e8cef5
feat(firefox): introduce async stacks for Puppeteer-Firefox (#3948)
This patch refactors Puppeteer-Firefox code to declare public
API in `/lib/api.js` and use it to setup async stack hooks
over the public API method calls.
2019-02-07 15:18:43 -08:00
Andrey Lushnikov
addd7f4c6a
chore(testrunner): introduce verbose mode (#3946) 2019-02-07 13:17:29 -08:00
Andrey Lushnikov
76eecde823
chore(test): remove stray console.log (#3943) 2019-02-07 08:14:05 -08:00
Andrey Lushnikov
609e763381
test(firefox): enable screenshot tests for Firefox (#3942)
References #3889
2019-02-07 07:59:14 -08:00
Andrey Lushnikov
49e8704ba8
test(firefox): enable more tests on Puppeteer-Firefox (#3937)
References #3889
2019-02-07 07:15:19 -08:00
Andrey Lushnikov
6887ad881a
chore: further unify Puppeteer-Firefox tests with Puppeteer (#3931)
This patch:
* unifies assets between tests
* enables a few puppeteer tests on Puppeteer-Firefox

Drive-by: beautify failing output of `expect.toEqual` matcher.

References #3889
2019-02-06 13:49:14 -08:00
Andrey Lushnikov
14fb3e38db
chore(firefox): mark all Puppeteer tests that are failing on FF (#3924)
This patch:
- introduces new testRunner methods `addTestDSL` and `addSuiteDSL`
  to add annotated test / suite.
- introduces new test/suite declaration methods: `it_fails_ffox` and
  `describe_fails_ffox`. These are equal to `it`/`describe` for chromium
  tests and to `xit`/`xdescribe` for firefox.
- marks all unsupported tests with `it_fails_ffox`
- adds a new command-line flag `'--firefox-status'` to `//test/test.js`.
  This flag dumps current amount of tests that are intentionally skipped
  for Firefox.

End goal: get rid of all `it_fails_ffox` and `describe_fails_ffox`
tests.

Drive-By: remove cookie tests  "afterEach" hook that was removing
cookies - it's not needed any more since every test is run in a
designated browser context.

References #3889
2019-02-05 22:32:41 -08:00
Andrey Lushnikov
86783c2495
chore(firefox): run all tests without "UnhandledPromiseRejection" error (#3922)
This aligns all Puppeteer tests so that they never throw the
"UnhandledPromiseRejection" when run with Puppeteer-Firefox.

With this patch, the `npm run funit` passes 275 of 460 Puppeteer tests.

References #3889.
2019-02-05 19:49:47 -08:00
Andrey Lushnikov
a210dd7ee2
chore(testrunner): show 5 slowest tests on CI (#3919)
Show top slowest tests on CI.

Drive-by: some facelifting for the test reporter.
2019-02-05 15:28:35 -08:00
Andrey Lushnikov
00bcecbf72
chore: increase test timeout to 20 seconds on Appveyour (#3918)
Looks like Appveyour is indeed slow; try giving it more time
to run tests.

Drive-by: support TIMEOUT env variable for Puppeteer tests.
2019-02-05 13:38:56 -08:00
Andrey Lushnikov
28087c291f
feat(firefox): support ElementHandle.contentFrame() (#3917) 2019-02-05 13:29:49 -08:00
Andrey Lushnikov
dd8bd6dcb1
test(firefox): support Puppeteer-Firefox specific env variables (#3907)
This patch:
- adds support to `FFOX` env variable for Puppeteer testsuite
- install Firefox preferences when running tests with custom firefox
  executable

References #3889
2019-02-05 13:17:02 -08:00
Andrey Lushnikov
69c434af75
test(firefox): further unify Puppeteer-Firefox and Puppeteer tests (#3894)
This patch:
- changes Puppeteer-Firefox plumbing of defaultBrowserOptions to align
  with the way we do it for Puppeteer.
- plumbs puppeeteer-dependent Errors and DeviceDescriptors down to every
  test.
- unifies a few tests between Puppeteer-Firefox and Puppeteer.

**Note:** in future, we should expose errors as `puppeteer.errors` and
device descriptors as `puppeteer.devices` to make it easy to pass around
Puppeteer/Puppeteer-Firefox instance.

References #3889.
2019-02-02 18:49:12 -07:00
Andrey Lushnikov
47fbb117f5
test(firefox): add more Puppeteer-Firefox tests to Puppeteer (#3892)
References #3889
2019-02-02 12:55:15 -07:00
Andrey Lushnikov
b5e53fdbf4
test(firefox): add puppeteer-firefox unique evaluation tests (#3891)
References #3889
2019-02-01 18:40:40 -08:00
Andrey Lushnikov
6bb0350b4d
test(firefox): introduce vendor-specific specs (#3890)
Certain Puppeteer methods do expose the inner browser - e.g.
`browser.version()` depends on the browser we run.

Split out these tests into a vendor-specific test suites.

References #3889
2019-02-01 17:55:12 -08:00
Andrey Lushnikov
84fe6014e9
chore(firefox): run Puppeteer-Firefox against Puppeteer tests (#3888)
Introduce a `npm run funit` script that runs puppeteer tests
against Puppeteer-Firefox.

Next steps:
- bring Puppeteer-Firefox unique tests to Puppeteer
- skip failing tests and run Puppeteer-Firefox on CI
- work through tests to pass them all with Puppeteer-Firefox
2019-02-01 17:04:19 -08:00
Andrey Lushnikov
a2f1e2774a
fix: ignore console messages from destroyed execution contexts (#3866)
Fix #3865
2019-01-30 16:19:02 -08:00
Andrey Lushnikov
a064a6341b
feat(page): introduce page.setDefaultTimeout (#3854)
Method `page.setDefaultTimeout` overrides default 30 seconds timeout
for all `page.waitFor*` methods, including navigation and waiting
for selectors.

Fix #3319.
2019-01-28 17:16:12 -08:00
Andrey Lushnikov
55432f88e9
fix(page): execute frame.waitFor{Selector,XPath} in secondary world (#3856)
This patch starts executing frame.waitForSelector and frame.waitForXPath
in secondary world. As a result, websites that mutate page global
context (e.g. removing global MutationObserver) don't break Puppeteer's
behavior.

Fixes #609
2019-01-28 12:24:27 -08:00
Andrey Lushnikov
2061dd4718
fix(page): teach waitForSelector to return null (#3846)
`page.waitForSelector` should return `null` if waiting for `hidden:
true` and there's no matching node in DOM.

Before this patch, `page.waitForSelector` would return some JSHandle
pointing to boolean value.
2019-01-28 14:24:53 -05:00
Andrey Lushnikov
62da2366c6
chore: introduce //lib/api.js (#3835)
Introduce `//lib/api.js` that declares a list of publicly exposed
classes.

The `//lib/api.js` list superceedes dynamic `helper.tracePublicAPI()` calls
and is used in the following places:
- [ASYNC STACKS]: generate "async stacks" for publicy exposed API in `//index.js`
- [COVERAGE]: move coverage support from `//lib/helper` to `//test/utils`
- [DOCLINT]: get rid of 'exluded classes' hardcoded list

This will help us to re-use our coverage and doclint infrastructure
for Puppeteer-Firefox.

Drive-By: it turns out we didn't run coverage for `SecurityDetails`
class, so we lack coverage for a few methods there. These are excluded
for now, sanity tests will be added in a follow-up.
2019-01-25 23:21:14 -05:00
Andrey Lushnikov
1a7995558f
chore(test): prepare tests to be run with Puppeteer-Firefox (#3833)
This patch aligns Puppeteer testing infrastructure with the approach
we use in Puppeteer-Firefox.

This patch:
- makes all tests accept Puppeteer object as a function argument
  rather than require it statically. This way we can pass either
  Puppeteer or Puppeteer-Firefox to drive tests.
- renames the `puppeteer.spec.js` into `launcher.spec.js`. The
  `puppeteer.spec.js` is now the entry point for all cross-browsers
  tests.
2019-01-24 01:04:42 -05:00
Andrey Lushnikov
fb710120e9
feat(page): use secondary world to drive clicks (#3828)
References #2671
2019-01-22 23:24:14 -05:00
Andrey Lushnikov
678b8e85ad
fix(page): use secondary DOMWorld to drive page.select() (#3809)
This patch starts creating secondary DOMWorld for every connected
page and switches `page.select()` to run inside the secondary world.

Fix #3327.
2019-01-22 17:55:33 -05:00
Linus Unnebäck
9fb89e1bbc test: Add test for waitForFunction with cross-process navigation (#3826) 2019-01-22 13:21:18 -05:00
Andrey Lushnikov
9fd4b67d0c
fix(requestinterception): filter out "intervention" header (#3814)
Fixes #3798
2019-01-20 00:02:13 -05:00
Andrey Lushnikov
489be90c75
test: move tracing tests to one-per-browser (#3781)
Tracing is working on a per-browser level, not per-page. In order
to paralellize these tests effectively and properly, each should run
a designated browser.
2019-01-15 16:39:30 -08:00
Joel Einbinder
91c4501cc6 test(coverage): add failing test for skipping all debugger statements (#3779) 2019-01-15 14:49:57 -08:00
Joel Einbinder
4e1e2fb701 fix(screenshot): round the clip dimensions (#3778) 2019-01-15 14:34:31 -08:00
Andrey Lushnikov
04fbbd7cf0
fix(network): relax request matching heuristic (#3775)
Drop requirement for matching "origin" and "content-type" headers
in requests and request interceptions. This way javascript redirects
that use form submission start working.

Fix #3684.
2019-01-15 11:37:53 -08:00
Andrey Lushnikov
9083c111ca
fix(frames): make sure evaluation does not hang in detached iframes (#3770)
Fix #3261
2019-01-14 17:23:53 -08:00
Brian Schiller
7fabf32172 feat(executioncontext): warn on nested js handle (#3591)
ExecutionContext.evaluateHandle accepts arguments that are either
serializable, or JSHandles. A potential confusion is that it *does not*
accept arguments that *contain* JSHandles.

This patch adds a log message warning when it encounters that situation.

Fixes #3562
2019-01-14 14:30:50 -08:00
Andrey Lushnikov
d346cb57b4
chore: cleanup puppeteer.connect({browserURL}) (#3766)
This patch:
- renames `browserUrl` into `browserURL`
- cleans up some code
- adds tests for error handling

References #3537
2019-01-14 14:30:03 -08:00
Łukasz Fiszer
15af75f9a2 feat(launcher): add browserUrl option to puppeteer.connect (#3558)
The `browserURL` option allows to connect to a browser that exposed it's remote debugging protocol on a known port.

Fixes #3537
2019-01-14 13:23:34 -08:00
Joel Einbinder
96adedf54f fix(screenshots): throw on 0x0 screenshots (#3756)
Fix #2672
2019-01-11 15:24:43 -08:00
Andrey Lushnikov
0505c81b52
test: add test for multiline waittask (#3753)
References #3723
2019-01-10 21:41:09 -08:00
Andrey Lushnikov
89fc2adff5
fix(page): consoleMessage.location() should work with workers (#3752)
This patch:
- refactors consoleMessage.location() implementation to
make it work for workers
- re-writes tests to avoid 5 second delay
2019-01-10 18:05:28 -08:00
Tom P
0c867631b0 feat(page): introduce consoleMessage.location() (#3365)
This patch adds a new consoleMessage.location() method that returns console message origins.

Fixes #3029
2019-01-10 16:51:13 -08:00
Andrey Lushnikov
16fc28bf06
test: make sure headful browser closes with beforeuload page (#3751)
This was fixed upstream at https://crrev.com/618425

Fixes #3673
2019-01-10 14:05:43 -08:00
Andrey Lushnikov
1899e7931c
feat: enable Network Service by default (#3738)
References #3471.
2019-01-09 15:47:08 -08:00
Andrey Lushnikov
3d82465f66
fix(page): fix repetitative setContent calls (#3666)
Fix #3665.
2018-12-13 13:33:42 -08:00
Andrey Lushnikov
8aaca4eb1e
feat(page): introduce "Popup" event (#3661)
This patch adds a new "popup" event for page.
"Popup" event is fired whenever page opens another page with
given opener.
2018-12-12 17:09:42 -08:00
Andrey Lushnikov
c90392bdf5
feat: introduce page.browserContext() (#3655) 2018-12-12 15:08:31 -08:00
Andrey Lushnikov
6656519560
test: split out dialog tests (#3586) 2018-11-20 20:18:57 -08:00
Andrey Lushnikov
309cbe625f
test: split out navigation tests (#3585) 2018-11-20 20:09:25 -08:00
Andrey Lushnikov
d61916b53e
test: split out evaluation tests (#3584) 2018-11-20 19:59:59 -08:00
Andrey Lushnikov
e83918987a
test: split input tests into keyboard, mouse and touchscreen (#3583) 2018-11-20 19:43:07 -08:00
Andrey Lushnikov
25f4f26851
test: extract clicking tests (#3582) 2018-11-20 19:34:57 -08:00
Andrey Lushnikov
a181bdde31
test: split out emulation tests (#3581) 2018-11-20 19:17:56 -08:00
Andrey Lushnikov
a5b1978190
test: split out waittask tests (#3580) 2018-11-20 18:57:28 -08:00
Andrey Lushnikov
e5830d1199
test: split queryselector tests into separate file (#3579) 2018-11-20 18:45:37 -08:00
Andrey Lushnikov
aa9fb82f14
test: split screenshot tests into separate file (#3578) 2018-11-20 18:32:42 -08:00
Andrey Lushnikov
927d0f443b
feat(page): support waitUntil option for page.setContent (#3557)
This patch teaches `page.setContent` to await resources in
the new document.

**NOTE**: This patch changes behavior: currently, `page.setContent`
awaits the `"domcontentloaded"` event; with this patch, we can now await
other lifecycle events, and switched default to the `"load"` event.

The change is justified since current behavior made `page.setContent`
unusable for its main designated usecases, pushing our client
to use [dataURL workaround](https://github.com/GoogleChrome/puppeteer/issues/728#issuecomment-334301491).

Fixes #728
2018-11-20 15:32:46 -08:00
Andrey Lushnikov
e2e43bc23d
fix(page): navigating 11 pages simultaneously should not throw warning (#3560)
NavigatorWatcher subscribes to Connection to get a `Disconnected` event,
causing us to hit the default max of 10 listeners constraint.

Technically we don't leak anything here and can safely bump
the maxListenersCount to Infinity.

However, we conveniently have `CDPSession`, and
can re-dispatch the event on it and keep the safety check in place.
2018-11-20 14:21:13 -08:00
Darío Kondratiuk
03d8746260 test(accessibility): Fix duplicated test (#3539) 2018-11-15 14:57:07 -08:00
Andrey Lushnikov
95a19c74bc
fix(page): dispatch errors into page (#3550)
Errors thrown on the node side of the `page.exposeFunction` callback
should be dispatched into the page.

Fixes #3549
2018-11-15 14:51:34 -08:00
Andrey Lushnikov
eb7bd9d7d3
test: setup sandbox on linux (#3530)
Drop all the `--no-sandbox` bits from tests and infrastructure. Instead, configure
Travis to enable user namespace clone.
2018-11-12 23:26:16 -08:00
Andrey Lushnikov
27ea226bbc
test: fix workers test (#3527) 2018-11-09 18:44:53 -08:00
Darío Kondratiuk
b9f2104f43 test(cookies): Remove duplicated test. (#3492)
We have the same test on line 130 https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/test/cookies.spec.js#L130
2018-11-04 11:48:31 -08:00
Andrey Lushnikov
6b65407ab6
test: unflake cookie test on windows (#3489) 2018-11-02 13:23:44 -07:00
Joel Einbinder
9ba3261571 feat(accessibility): snapshot the accessibility tree (#3470)
This adds `page.accessibility.snapshot()`. It serializes and returns the accessibility tree for the page. By default, uninteresting nodes are filtered out of the snapshot.

fixes #2033
2018-11-01 18:54:51 -07:00
Andrey Lushnikov
eca3c6bed2
test(cookies): cookies from headful now work in headless (#3481)
This patch enables cookie test. The actual upstream patch
that fixed the issue:
- https://crrev.com/599696 - Headless: support cookie encryption

Fixes #921.
2018-11-01 18:51:56 -07:00
Andrey Lushnikov
3596c5f7e2
fix(page.evaluate): better function serialization (#3480)
References #1665
2018-11-01 16:43:21 -07:00
Andrey Lushnikov
3dd5c28f90
fix(pipe): dispatch "disconnected" event when browser is terminated (#3472) 2018-10-31 16:31:29 -07:00
Zeev Rosental
81edbbb58e fix(clicking): handle negative area results in computeQuadArea (#3413)
This patch fixes a case in which computeQuadArea calculates the area size correctly, but returns the area as a negative number.
This occurs when DOM.getContentQuads returns quads in a specific order.

E.g. the array: [ { x: 463, y: 68.5 },{ x: 437, y: 68.5 },{ x: 437, y: 94.5 },{ x: 463, y: 94.5 } ] will receive area size of -676.
2018-10-25 11:41:37 -07:00
Joel Einbinder
d025d1f959 fix(csscoverage): don't prematurely disable the CSS domain (#3418)
CSS stylesheets can still be parsed and added events emitted during the CSS.stopRuleUsageTracking call. It needs to be awaited before calling CSS.disable, otherwise the text content of those style sheets will be unavailable.
2018-10-16 16:55:17 -07:00
Joel Einbinder
0fd3bfb986 test(CSSCoverage): failing test when a stylesheet was recently added (#3400)
If nobody forces a layout, CSS coverage is inconsistent. This causes some flakes on the bots. The test in this PR fails 90% of the time on my local machine.
2018-10-12 13:49:59 -07:00
Joel Einbinder
6ac66c3547 feat: browser.waitForTarget (#3356)
This adds `browser.waitForTarget` and `browserContext.waitForTarget`. It also fixes a flaky test that was incorrectly expecting targets to appear instantly.
2018-10-09 14:16:53 -07:00
Andrey Lushnikov
8becb31754
test: add failing test for page.select (#3346)
References #3327.
2018-10-04 10:41:38 -07:00
Łukasz Usarz
842fee860b fix(page): full page screenshot when defaultViewport is null (#3306)
Fixes #3104
2018-09-27 10:50:21 -07:00
Andrey Lushnikov
85aca8e1a5
chore(testserver): prepare test server (#3294) 2018-09-24 12:46:39 -07:00
Andrey Lushnikov
4e48dfc7a1
feat(launcher): add experimental "transport" option to pptr.connect (#3265)
This patch:
- adds experimental "transport" option to pptr.connect
- uses "transport" option to make sure Puppeteer-Web works with
  Target.exposeDevToolsProtocol

Drive-by: add `browser.target()` to access browser target.
2018-09-20 11:55:23 -07:00
Andrey Lushnikov
5acf953104
feat(frame): introduce Frame.goto and Frame.waitForNavigation (#3276)
This patch introduces API to manage frame navigations.
As a drive-by, the `response.frame()` method is added as a shortcut
for `response.request().frame()`.

Fixes #2918.
2018-09-20 11:31:19 -07:00
Andrey Lushnikov
0b9d8a6271
feat: async stacks for all "async" public methods (#3262)
This patch traces all public async methods and wraps them
in a helper method that tags the sync stack trace.

Later on, if the method call throws an exception, we add
a captured stack trace to the original stack trace with the "--ASYNC--"
heading.

An example of a stack trace:

```
Error: net::ERR_ABORTED at http://localhost:8907/empty.html
    at navigate (/Users/lushnikov/prog/puppeteer/lib/Page.js:622:37)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  -- ASYNC --
    at Page.<anonymous> (/Users/lushnikov/prog/puppeteer/lib/helper.js:147:27)
    at fit (/Users/lushnikov/prog/puppeteer/test/page.spec.js:546:18)
    at process._tickCallback (internal/process/next_tick.js:68:7)
```
2018-09-19 13:54:58 -07:00
Andrey Lushnikov
a1a211d9e7
chore: nicer stack highlight (#3259)
Highlight part of the stack that points to where the actual
test failure happened.
2018-09-17 23:22:53 +01:00
Andrey Lushnikov
d547b9d24a
fix(browser): browser closing/disconnecting should abort navigations (#3245)
Fixes #2721.
2018-09-14 19:44:54 +01:00
Łukasz Usarz
d929f7e213 fix: set JPG background to white when omitBackground option is used (#3240)
Fixes #3234
2018-09-14 11:03:33 +01:00
Andrey Lushnikov
c644a3bbd3
test: make sure zero-width screenshots don't hang (#3214)
References #2672.
2018-09-11 19:07:57 +01:00
Andrey Lushnikov
d54c7edeae
fix(page): Page.goto should properly handle historyAPI in beforeunload (#3198)
Fixes #2764.
2018-09-05 22:59:29 +01:00
Andrey Lushnikov
7f9e276733
feat(network): introduce Response.statusText() (#3193)
Fixes #317.
2018-09-05 21:03:24 +01:00
Andrey Lushnikov
1ba2b8540d
feat(network): introduce Response.remoteAddress() (#3192)
Closes #2171.
2018-09-04 20:39:59 +01:00
Andrey Lushnikov
22c0ce63ce
test: cleanup newly added test for navigation referer (#3179)
Make sure that referer that is passed as `page.goto` option doesn't
override subrequest referers.
2018-09-04 19:05:48 +01:00
Andrey Lushnikov
32c0363ade
feat(chromium): roll Chromium to r588429 (#3181)
This roll includes:
- https://crrev.com/588420 - DevTools: teach request interception to work with
  Security.setIgnoreCertificateErrors

Fixes #1159.
2018-09-04 10:04:27 +01:00
Ali Ahmad
464f3b4ca2 feat(page): Add 'referer' as a parameter to Page.goto() (#3128)
If referer is passed to the options object its value will be used as the referer instead of the value set by `Page.setExtraHTTPHeaders()`.

This is the correct way to set referer header: otherwise, the `referer` header will override all the document subrequests.

Fixes #3090.
2018-09-03 20:06:58 +01:00
Andrey Lushnikov
17029281a9
feat(page): Introduce page.setGeolocation method (#3160)
Fixes #1077
2018-08-31 18:04:12 +01:00
Andrey Lushnikov
50d6c2d3c6
feat(browsercontext): implement BrowserContext.overridePermissions (#3159)
Introduce an API to manage permissions per browser context:
- BrowserContext.overridePermissions(origin, permissions)
- BrowserContext.clearPermissionOverrides()

Fixes #846.
2018-08-30 23:36:09 +01:00
Andrey Lushnikov
df459ba6cd
feat(chromium): roll Chromium to r587164 (#3153)
This roll includes:
- https://crrev.com/584293 - DevTools: execute scripts in addScriptToEvaluateOnLoad in order
- https://crrev.com/585630 - DevTools: introduce Browser.grantPermissions
- https://crrev.com/587156 - Revert "[Base] Use background mode for ThreadPriority::BACKGROUND threads (behind feature) (reland)."

The "revert" patch fixes headless functionality on windows.

References #846.
Fixes #3106.
2018-08-30 01:02:53 +01:00
Andrey Lushnikov
ce64ae22f4
test: add test for request interception with 302 after POST (#3105)
References #3089
2018-08-17 10:51:27 -07:00
Andrey Lushnikov
be7626fa5e
fix: revert ExecutionContext reporting. (#3058)
It turned out that almost any usecase requires helper methods to access
DOM inside the ExecutionContext.

Instead of exposing execution contexts as-is, we should introduce
IsolatedWorld as a first-class citizen that will hold execution contexts
inside.
2018-08-09 18:14:21 -07:00
Andrey Lushnikov
204c7ec8c4
feat: introduce puppeteer/Errors (#3056)
This patch adds a new require, `puppeteer/Errors`, that
holds all the Puppeteer-specific error classes.

Currently, the only custom error class we use is `TimeoutError`. We'll
expand in future with `CrashError` and some others.

Fixes #1694.
2018-08-09 16:51:12 -07:00
Andrey Lushnikov
231a2be971
feat: expose frame's execution contexts (#3048)
This patch exposes frame's execution contexts, making it possible
to debug extension's content scripts.

This is a resurrected #2812.
2018-08-09 14:57:08 -07:00
Andrey Lushnikov
40466cb3a4
feat(launcher): ignoreDefaultArgs to accept array of options (#3049)
If `ignoreDefaultArgs` is given an array of options, than
these options will be excluded from the default command-line
flags.
2018-08-08 19:10:10 -07:00
Joel Einbinder
6825088644 feat(launcher): allow options to be passed into puppeteer.defaultArgs (#2950) 2018-08-07 13:22:04 -07:00
Joel Einbinder
25632133e2 feat: add option to specify the default viewport (#3005)
Fixes #1183.
2018-08-01 16:23:03 -07:00
Andrey Lushnikov
0c49bf5245
test: use new browser context for every page test (#3010)
This allows us:
- dogfood browser contexts the way we want them to be used
- simplifies the dance around service workers / cookies setting up and tier down.
2018-08-01 15:49:41 -07:00
Andrey Lushnikov
9c96a9283f
test: fix flakiness of certain extension tests (#3011) 2018-08-01 14:57:19 -07:00
Andrey Lushnikov
c018ff1555
feat(browsercontext): add BrowserContext.pages() method (#3003) 2018-07-31 13:24:29 -07:00
Joel Einbinder
3335d369d3 fix: typing emoji (#2824)
This changes sendCharacter to use document.execCommand instead of sending a `'char'` event from the protocol. This is more aligned with how input would come in from emoji keyboards, and removes the 3ish byte limit on characters that can be sent which prevented larger emoji from being rendered correctly.

Emoji will still fail to type correctly if typing them into an iframe that is in shadow dom.

fixes #1096
2018-07-31 11:22:26 -07:00
Andrey Lushnikov
1931cb479e
feat(Chromium): roll Chromium to r579032 (#2989)
This patch rolls Chromium to r579032. The patch includes:
- https://crrev.com/577366 - DevTools: report redirect responses only if response interception is enabled
- https://crrev.com/577212 - DevTools: intercept requests resulting from redirects
- https://crrev.com/578934 - DevTools: Add a protocol method to insertText

Interception Logic in DevTools protocol has changed regarding redirects;
this patch migrates interceptions to dispatch "request" events based on
requestWillBeSent event.
2018-07-30 19:09:10 -07:00
Andrey Lushnikov
5bcb7cf512
test: add test with request interception and cookies (#2988)
Fixes #2970.
2018-07-30 19:05:19 -07:00
Andrey Lushnikov
0c825de1f8
test: unflake page test that was causing us a lot of CI flakes (#2993) 2018-07-30 18:36:33 -07:00
Andrey Lushnikov
89f968b96a
test: try to fix CSS coverage flakes on win (#2992) 2018-07-30 18:36:21 -07:00
Andrey Lushnikov
4bbaa9d4f5
test: do not handle sigint for all the browsers launched in tests (#2990)
Puppeteer's default handler issues "process.exit(130)", causing
test runner to shut too early.

As a result, test runner doesn't show run summary.
2018-07-30 18:07:01 -07:00
Andrey Lushnikov
2c9599496a
test: make sure referer header is reported with request interception (#2986)
The referer header has been fixed some time ago.

References #469.
2018-07-30 18:05:27 -07:00
Andrey Lushnikov
392d3b94bd
Revert "chore(tests): redirect debugError to the output category of tests (#2969)" (#2987)
This reverts commit c5fe1dbdbb.
2018-07-30 16:41:39 -07:00