Commit Graph

506 Commits

Author SHA1 Message Date
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