Commit Graph

452 Commits

Author SHA1 Message Date
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
Joel Einbinder
c5fe1dbdbb chore(tests): redirect debugError to the output category of tests (#2969)
I have seen some flaky test failures where it would be nice to have run the tests with `DEBUG=puppeteer:error`. Instead of always running tests like that, I am redirecting `debugError` to the output category of the test. This is the same thing that we do for Chromium's stderr.

As a drive-by, I added an additional `debugError` where we were usually a try..finally pattern.
2018-07-30 11:16:12 -07:00
Andy Fleming
3d12f1f279 feat(FrameManager): improve waiting for selector to be hidden error message (#2911)
Fixes #2854
2018-07-26 16:24:04 -07:00
Andrey Lushnikov
56368aa07a
fix(page): page.click should work with disabled javascript (#2907)
Unfortunately, disabling javascript in page prevents any microtasks
to be executed even from puppeteer-originating javascript. As a
result, the IntersectionObserver hack we use to conditionally
scroll into view doesn't work.

To workaround this, we start always scrolling before clicking if
page's javascript is disabled.

Fixes #2898
2018-07-18 18:51:18 -07:00
Andrey Lushnikov
66fa0d3d53
test: cleanup page.waitForRequest/page.waitForResponse tests (#2880)
This patch removes unnecessary regexp tests and unifies all tests
between each other.
2018-07-12 15:32:18 -07:00
Matthew Shirley
726c8dc046 feat(page): introduce waitForRequest and waitForResponse methods (#2776)
This patch introduces `page.waitForRequest` and `page.waitForResponse` helper methods.

Fixes #2362
2018-07-12 14:36:31 -07:00
Andrey Lushnikov
3ebbf125ff
fix(coverage): report anonymous scripts with debugger:// urls (#2875)
Chrome DevTools shows anonymous scripts with yellow background and names
them with `debugger://VM<scriptId>` prefix.

This patch starts reporting the same debugger:// urls for anonymous
scripts in puppeteer's JS coverage. This might simplify debugging, e.g.
using `debugger;` statement to reveal the script in DevTools and later
matching it against the one in the coverage.
2018-07-11 21:05:16 -07:00
Andrey Lushnikov
254bc80811
chore: cleanup ElementHandle.isIntersectingViewport (#2874)
This patch:
- simplifies test reusing the `offscreenbuttons.html` asset
- aligns IntersectionObserver usage with the one we have for
  `ElementHandle._scrollIntoViewIfNeeded`.
2018-07-11 21:04:36 -07:00
Pavel Pomerantsev
12bc1e1a62 feat(coverage): add an option to collect coverage of anonymous scripts (#2796)
This patch adds `reportAnonymousScripts` option to the `coverage.startJSCoverage` method. With this option, anonymous scripts are reported as well.

Fixes #2777
2018-07-11 18:38:34 -07:00
Bogdan Ponomarenko
96c558d544 feat(elementhandle): introduce elementHandle.isIntersectingViewport() method. (#2673)
This patch introduces  `elementHandle.isIntersectingViewport()` method returns
true if element is visible in the viewport.

Fixes #2629.
2018-07-11 17:51:04 -07:00
Yaniv Efraim
cfc0571c1a feat: better timeout stack trace (#2843)
fixes #2653
2018-07-05 02:39:09 +03:00
Andrey Lushnikov
5955affab0
fix(page.click): teach puppeteer click wrapped links (#2822)
This patch teaches Puppeteer to click elements that are
part of inline layout and that wrap on multiple lines.

Fixes #2798.
2018-06-29 12:03:02 -07:00
Andrey Lushnikov
871b204fd1
refactor: simplify EmulationManager (#2816)
EmualationManager used to be injecting touch hooks to properly
support touch emulation.

However, these are no longer necessary, since https://crbug.com/133915
is long fixed.
2018-06-28 18:48:44 -07:00
Andrey Lushnikov
c4acc63775
feat(chromium): roll Chromium to r571040 (#2814)
This roll includes:
- https://crrev.com/570566 - DevTools: teach DOM.getBoxModel to work with SVG nodes

Fixes #1247.
2018-06-28 13:22:52 -07:00
Andrey Lushnikov
d6741eca08
test: add test that verifies pptr works with SVG nodes (#2805)
References #1247
2018-06-26 18:03:00 -07:00
Andrey Lushnikov
f55d005cbe
fix(page): teach page.click() to click partially offscreen buttons (#2806)
Originally, we use `Element.scrollIntoViewIfNeeded` to make sure
button is on screen before trying to click it.

However, `Element.scrollIntoViewIfNeeded` doesn't work in certain
scenarios, e.g. when element is partially visible and horizontal
scrolling is required to make it fully visible.

This patch polyfills `element.scrollIntoViewIfNeeded` using
IntersectionObserver and `Element.scrollIntoView`.

Fixes #2804.
2018-06-26 18:00:55 -07:00
Andrey Lushnikov
6ca43cf761
docs(api.md): clarify docs about waitForNavigation (#2788) 2018-06-26 13:42:50 -07:00
Yaniv Efraim
aae73f5fd7 feat(worker): implement pageerror event from a worker (#2795)
Fixes #2761
2018-06-25 15:10:36 -07:00
Andrey Lushnikov
a460114945
test: fix appveyour flakiness (#2779)
Crashpad sometimes prevents us from removing a folder in tests.

References #2778.
2018-06-20 13:52:36 -07:00
Andrey Lushnikov
4178b989d2
test: add test that breaks subsequent page.goto (#2775)
References #2764.
2018-06-20 13:51:47 -07:00
Andrey Lushnikov
dcae6bcff4
feat(chromium): roll Chromium to r568432 (#2769)
This roll includes:
- https://crrev.com/568341 - DevTools: force-create execution contexts for mixed content iframes

Fixes #2709.
2018-06-19 13:46:08 -07:00
Andrey Lushnikov
37dbfc2608
test: fix random tests flakiness (#2770)
These tests were not awaiting `page.evaluate` command, so
page could have been closed before the command returned.
2018-06-19 10:35:13 -07:00
Andrey Lushnikov
af0bd15d88
test: split out ignoreHTTPSErrors tests (#2745)
We'll get more of these soon.
2018-06-14 16:48:14 -07:00
Andrey Lushnikov
c430138845
test: drop PDF tests (#2744)
We fully rely on upstream PDF functionality. Our PDF tests are inferior
to those upstream and inconvenient to write.
2018-06-14 16:42:10 -07:00
Joel Einbinder
73f9c48081 feat: nicer protocol error messages (#2742)
This patch:
- stops appending `undefined` to our protocol messages unnecessarily.
- rewrites `Cannot find execution context id` to `Execution context was destroyed, most likely because of a navigation.` when it occurs from a Puppeteer ExecutionContext. The error message is left alone if it occurs via a CDPSession.
2018-06-14 15:27:59 -07:00
Yaniv Efraim
9a650c818d feat(element-handle): remove throw in case of empty elementHandle (#2740)
Fixes #2708
2018-06-14 14:28:52 -07:00
Yaniv Efraim
38f112f395 feat(target): add support for target.page for 'backgroud_page' (#2600)
This patch teaches `target.page()` method to attach to extension background pages.

Fixes #2438
2018-06-14 13:58:51 -07:00
Andrey Lushnikov
ddfdaf97c5
fix(page): fix race condition in WaitTask (#2739)
This patch eliminates a common race condition with WaitTask, that
happens when predicate function gets resolved right before the execution
context gets destroyed.
This situation results in a "Cannot find context with specified id undefined"
exception.

Credits go to @jakub300 for his wonderful [investigation](https://github.com/GoogleChrome/puppeteer/issues/1325#issuecomment-395472092).

Fixes #1325.
2018-06-14 11:39:51 -07:00
Georgii Dolzhykov
9498b1057b fix(helpers): support thrown strings and numbers in getExceptionMessage (#2715)
Of course, strings aren't proper errors, but scripts sometimes do that, and Puppeteer loses such error messages.
2018-06-14 10:23:13 -07:00
Georgii Dolzhykov
93e128931f test: make tests work on non-English locales (#2736)
`Data.prototype.toString` may return non-ASCII characters, which aren't accepted by `setHeader`.

E.g., on Russian locale, it might look like this:
```
> new Date().toString()
'Thu Jun 14 2018 13:11:50 GMT+0300 (Финляндия (лето))'
```
2018-06-14 10:18:02 -07:00
Joel Einbinder
75ba86f41a
fix: emit all arguments from worker console logs (#2697)
Log.entryAdded doesn't report all the arguments from console logs. This PR switches to use Runtime.consoleAPICalled.

fixes #2640
2018-06-07 11:21:35 -07:00
Joel Einbinder
2ff0adcad8 feat: worker convenience methods (#2677)
This patch:
- adds `worker.evaluate` and `worker.evaluateHandle` methods as a shortcut to their execution context equivalents.
- makes the error messages a bit nicer when interacting with a closed worker (as opposed to a closed page).
- moves the worker tests into their own spec file.
2018-06-06 20:16:17 -05:00
Andrey Lushnikov
d8023726c5
fix: disable OOPIF by default (#2661)
This patch disables OOPIF by default.

**NOTE**: this is a temporary bandaid for the time we're crafting
the full-fledged support for site isolation over DevTools protocol.

References #2548.
2018-06-01 15:20:37 -07:00
Andrey Lushnikov
9955a1e673
fix(browser): ensure first page is created when browser is launched (#2658)
It's impossible to launch chromium without initial page.
This patch makes sure that `puppeteer.launch()` always returns a browser
with at least one page user can connect to.
2018-06-01 13:57:50 -07:00
Andrey Lushnikov
07b91f61a9
test: split out headful tests into headful.spec.js (#2657) 2018-06-01 13:48:34 -07:00
Andrey Lushnikov
724fa512cf
feat(network): introduce Request.isNavigationRequest() method (#2633)
This patch introduces `Request.isNavigationRequest()` method.

Fixes #2627, #1132.
2018-05-31 17:38:30 -07:00
Jan Potoms
f6356683cd feat(targets): add target.opener() (#2641)
This adds a `.opener` property to a target so that its origin can be tracked.
For now returns `null` when there's no `openerId`.

Fixes #1830
2018-05-31 17:06:29 -07:00
Andrey Lushnikov
0b94fa70eb
chore: stop using console.assert everywhere (#2646)
Since Node 10, `console.assert` no longer throws an AssertionError.
(This is generally good since it aligns Node.js with Browsers.)

This patch migrates all usages of `console.assert` in our codebase.
- All the `lib/` and testing code is migrated onto a handmade `assert`
function. This is to make Puppeteer transpilation / bundling easier.
- All the tooling is switched to use Node's `assert` module.

Fixes #2547.
2018-05-31 16:53:51 -07:00
Andrey Lushnikov
1c0ecc3d9c
test: fix flaky test (#2650)
When launching browser with a default URL, the page is not necessarily
loaded when we're reaching into it.
2018-05-31 16:39:49 -07:00
Andrey Lushnikov
0ba72df67d
test: verify ignoreHTTPSErrors works with puppeteer.connect (#2648)
References #2642.
2018-05-31 16:04:48 -07:00
Joel Einbinder
1c2adf61e9 fix(workers): workaround worker execution context flakiness (#2596)
Some of the worker tests were failing on the bots. After investigating, I found one race in the test, and one race upstream in Chromium which I filed upstream as https://crbug.com/846099. But I added a small hack here as a temporary workaround.

References #2632
2018-05-30 18:08:27 -07:00
Yotam Laufer
469b910a2d feat(page): allow screenshot to return a base64 string (#2586)
Fixes #2566
2018-05-30 14:27:08 -07:00
Joel Einbinder
1bbd094624 feat(test): enable dumpio in tests #2610
This patch allows logging the output of the Chromium process to be enabled in tests by passing in the environment variable `DUMPIO=true`.

Additionally, the `stderr` of the Chromium process will always be logged in the the "Output" section of failing page tests.
2018-05-29 15:45:03 -07:00
Joel Einbinder
8e12d197a2 fix(tests): normalize scrollbars in headful tests (#2622)
Scrollbars look different on different platforms, so must be made invisible in tests. As a drive-by, xdescribe was broken with the new test runner.

References #2524
2018-05-29 15:30:08 -07:00
Yaniv Efraim
b8df8bdf4a feat(launcher): launch browser with 'about:blank' by default (#2594)
fixes #2402
2018-05-25 17:26:40 -07:00