Commit graph

928 commits

Author SHA1 Message Date
Dmitry Gozman 2d5c0328cd
feat(rpc): return objects for every protocol command (#2950)
For future extensibility, returning objects with fields instead
of plain strings or channels.
2020-07-14 18:26:50 -07:00
Dmitry Gozman 1b84ec9023
fix(binding): dispatch binding after the page has been initialized (#2938)
... but not after it was closed.
2020-07-14 13:34:49 -07:00
Pavel Feldman d5bd459986
chore(rpc): remove some paths from the channel (#2934) 2020-07-14 10:51:37 -07:00
Dmitry Gozman cc8fe5a763
feat(rpc): support electron (#2933) 2020-07-13 21:46:59 -07:00
Dmitry Gozman 9fdb3e23c3
feat(rpc): support selectors (#2936) 2020-07-13 17:47:15 -07:00
Dmitry Gozman 65d45c18c3
feat(rpc): introduce Waiter for various waitFor implementations (#2935)
Use it for waitForEvent and waitForLoadState.
2020-07-13 16:03:24 -07:00
Dmitry Gozman 9fd30e58e2
feat(rpc): ensure feature-detection works as before (#2898)
For this, some tests are migrated from skip() to feature detection,
like our users would do.
2020-07-13 15:26:09 -07:00
Dmitry Gozman 2151757621
feat(rpc): run rpc tests in-process and out-of-process (#2929) 2020-07-13 15:00:20 -07:00
Dmitry Gozman 6d94c92053
feat(rpc): support no-serialization mode, run hook tests (#2925)
Added rpc_json_linux bots to excercise serialization - these
do not run hook tests.
2020-07-13 08:31:20 -07:00
Dmitry Gozman 6674458496
feat(rpc): log api calls into LoggerSink (#2904) 2020-07-10 18:00:10 -07:00
Dmitry Gozman c63b706aac
fix(events): avoid firing events after close/detach (#2919) 2020-07-10 16:38:01 -07:00
Dmitry Gozman fc6861410b
feat(rpc): merge DispatcherScope and Dispatcher (#2918) 2020-07-10 16:24:11 -07:00
Andrey Lushnikov a403d4beff
fix(firefox): fix launching firefox without dependencies (#2900)
We always have to reject promises with some error. Otherwise,
our error-rewriting logic in try-catch miserably fails.

With this patch, attempt to launch Firefox when it's missing
dependencies will actually result in a thrown exception with
pretty logs. Without this patch, Playwright throws internal error.
2020-07-10 16:04:19 -07:00
Pavel Feldman 631f76df75
chore(rpc): remove union types from page and handles (#2912) 2020-07-10 15:39:11 -07:00
Dmitry Gozman b6fd4dc56c
feat(rpc): merge ChannelOwner and ConnectionScope (#2911) 2020-07-10 15:11:47 -07:00
Pavel Feldman c89c30e333
fix(popup): do not report frameless pages (#2910) 2020-07-10 13:15:39 -07:00
Dmitry Gozman a91ec9a15d
feat(rpc): pass more tests (#2896)
Includes coverage, tracing and misc close() tests.
2020-07-09 15:33:01 -07:00
Joel Einbinder e90ba26250
fix(context): fire close event for persistent contexts (#2891) 2020-07-09 08:34:07 -07:00
Dmitry Gozman 8fe29feb21
feat(rpc): support more chromium-specific apis (#2883)
This includes page CDPSession, backgroundPages() and serviceWorkers().

This has also revealed an issue with closing order between the context
and the service worker.
2020-07-08 21:36:03 -07:00
Pavel Feldman b3ca4afd40
chore: misc test fixes (#2857) 2020-07-08 18:42:31 -07:00
Pavel Feldman 6209d14f87
chore: misc test fixes (#2888) 2020-07-08 18:42:04 -07:00
Yury Semikhatsky b93e0994bc
browser(webkit, firefox): bump versions (#2866) 2020-07-08 17:10:33 -07:00
Andrey Lushnikov 458aaa508f
feat(chromium): roll Chromium to r786218 (#2879)
This roll includes:
- https://crrev.com/786119 - mac: close context menu when destroying RenderViewContextMenuMacCocoa

Fixes #2700
2020-07-08 17:09:42 -07:00
Paul 71713c9580
fix(webkit): Fix default User-Agent (#2886)
Co-authored-by: pspaul <pspaul@pspaul.de>
2020-07-08 16:15:31 -07:00
Dmitry Gozman 0c80c22716
feat(rpc): plumb CDPSession (#2862) 2020-07-07 18:47:00 -07:00
Dmitry Gozman 2a86ead0ac
chore: replace FrameTask with internal events on Frame (#2856)
We now use a few helper.waitForEvent calls to wait for internal
events kNavigationEvent and kLifecycleEvent. With these events,
we should be able to replicate logic over rpc.
2020-07-07 15:22:05 -07:00
Dmitry Gozman 35cb20d5ad
test: unflake recorder tests (#2808)
We ensure that recorder is installed in the main frame before running the test.
2020-07-07 14:11:59 -07:00
Dmitry Gozman 0380400de4
chore: refactor waiting for lifecycle events (#2851)
Instead of checking lifecycle events on every change, we
notify precisely when lifecycle event in the subtree
is satisfied. This allows FrameTask to be later switched
to event-based approach, and will easily translate to the
rpc client.
2020-07-06 17:33:56 -07:00
Dmitry Gozman db3439d411
chore: introduce DocumentInfo (#2765)
It encapsulates documentId and request.
2020-07-06 15:58:27 -07:00
Andrey Lushnikov 15ddb5d32b
chore: update webkit version (#2804)
Safari Technology Preview reports WebKit 14.0. Align with them!
2020-07-06 15:13:53 -07:00
Dmitry Gozman ac2185a9d9
test: update http credentials tests (#2806) 2020-07-06 11:28:07 -07:00
Pavel Feldman 6bbe7eb006
chore(rpc): inline options parameter in all rpc channels (#2842) 2020-07-06 10:04:09 -07:00
Pavel Feldman 241d39f904
chore(rpc): exit server upon pipe disconnect (#2836) 2020-07-04 09:52:38 -07:00
Pavel Feldman 2540805bf2
chore(rpc): misc serializer improvements (#2832) 2020-07-03 18:04:08 -07:00
Joel Einbinder f484b20eea
fix(recorder): allow node to close gracefully (#2817) 2020-07-02 08:02:27 -07:00
Dmitry Gozman 19abc9bd9f
fix(dialogs): let click timeout, log information about dialogs (#2781)
We should not stall selector actions because of dialogs
and properly timeout instead. For this, we should not await
the handle.dispose() call because it will never happen
while dialog is shown.

Also, log information about dialogs to make it easier to debug.
2020-07-01 22:10:37 -07:00
Dmitry Gozman 9d6eaadba7
fix(navigation): ensure that goBack/goForward work with file urls (#2792) 2020-07-01 19:17:27 -07:00
Pavel Feldman c15dc94f8e
chore(rpc): explicitly create page dispatcher (#2799) 2020-07-01 18:36:09 -07:00
Dmitry Gozman e8e45e8450
feat(dom): migrate innerText, innerHTML and getAttribute to tasks (#2782)
This ensures synchronous access to avoid element recycling.
2020-07-01 16:10:53 -07:00
Dmitry Gozman ff1fe3ac39
fix(close): actually mark the page as closing (#2798)
Currently double-closing flakiness is seen on Firefox bots.
2020-07-01 16:05:56 -07:00
Dmitry Gozman 5c4751d5dd
chore: generate protocol during browser roll (#2719)
We now commit protocol.ts files during the roll.
New utils/roll_browser.js helps with that.

This makes our installation very shallow:
- build installer;
- download browsers.
2020-07-01 15:22:29 -07:00
Pavel Feldman c25fc4956d
chore(rpc): scope client-side handles (#2796) 2020-07-01 13:55:29 -07:00
Pavel Feldman 95538e73e7
chore(rpc): move classes around, fix tests, respect dispatcher scopes (#2784) 2020-06-30 22:21:17 -07:00
Pavel Feldman 87516cb3a3
chore(rpc): make dispatcher creation and lookup explicit (#2783) 2020-06-30 21:30:39 -07:00
Andrey Lushnikov 922cbe6718
chore: roll https-proxy-agent to v5 (#2777)
Co-authored-by: Luke Edwards <luke.edwards05@gmail.com>
2020-06-30 17:03:01 -07:00
Andrey Lushnikov 55a07dbf4d
fix: follow-up with offline comments on implementation of deprecation (#2770)
This moves all extra deprecation messages from vendor implementations
into a single vendor-neutral land.
2020-06-30 11:02:12 -07:00
Pavel Feldman e29f7b9f58
chore(rpc): support workers, file chooser, browser server (#2766) 2020-06-30 10:55:11 -07:00
Pavel Feldman 5bb018e0e5
chore(rpc): attribute calles to page, ignore USES_HOOKS (#2764) 2020-06-29 18:58:09 -07:00
Pavel Feldman 3a7d629c61
chore(rpc): pass more network tests (#2762) 2020-06-29 16:37:38 -07:00
Andrey Lushnikov 0963c1979e
chore: deprecate method context.setHTTPCredentials() (#2763)
This will start emitting deprecation warning once
`context.setHTTPCredentials` is called.
2020-06-29 16:37:01 -07:00
Dmitry Gozman 38236b4f29
fix(close): ensure close() can be called twice (#2744)
... without any exceptions.
2020-06-29 16:26:32 -07:00
Dmitry Gozman 1fa9d30992
fix(evaluate): awaitPromise when Promise is overwritten (#2759)
Firefox and WebKit require native promises to provide awaitPromise
functionality. When the Promise is overwritten, all evaluations
in the main world produce wrong Promise, so we wrap with async
function to get a native promise instead.
2020-06-29 16:25:52 -07:00
Pavel Feldman e920fde9f7
chore(rpc): bootstrap demo for rpc (#2741) 2020-06-27 11:32:27 -07:00
Pavel Feldman 4e94bdabfd
chore(rpc): serialize rpc into actual wire string (#2740) 2020-06-27 11:10:07 -07:00
Pavel Feldman 3e33523ee3
chore(rpc): clear the browsercontext test spec (#2739) 2020-06-26 22:38:21 -07:00
Pavel Feldman db12ddebb3
chore(rpc): clear the page test spec (#2736) 2020-06-26 21:22:03 -07:00
Pavel Feldman 6393407a6a
chore(rpc): support downloads, dialogs, persistent context (#2733) 2020-06-26 17:24:21 -07:00
Dmitry Gozman b54303a386
fix(textContent): make page.textContent(selector) atomic (#2717)
We now query selector and take textContent synchronously. This
avoids any issues with async processing: node being recycled,
detached, etc.

More methods will follow with the same atomic pattern.

Drive-by: fixed selector engine names being sometimes case-sensitive
and sometimes not.
2020-06-26 16:32:42 -07:00
Dmitry Gozman 43f70ab978
test: add more failing tests with react recycle (#2731) 2020-06-26 16:31:51 -07:00
Pavel Feldman 02f7501725
chore(rpc): strongly-type the initializer, remove __init__ phase (#2729) 2020-06-26 12:28:27 -07:00
Pavel Feldman 18d6140d3e
chore(rpc): support routes and bindings (#2725) 2020-06-26 11:51:47 -07:00
Dmitry Gozman 064a0a1154
fix(webkit): do not swallow errors when returning by value (#2723)
We currently return undefined whenever we had an error trying
return the evaluation result by error. The most common error
is "execution context destroyed".

This produces very unexpected undefined from methods that do not
ever expect undefined. Instead, we should throw because we were
not able to return the result.
2020-06-26 09:50:57 -07:00
Pavel Feldman 71618a9e2b
chore(rpc): implement input, a11y, console (#2722) 2020-06-25 18:01:18 -07:00
Dmitry Gozman ab6a6c9b82
chore: run most actions through page._runAbortableTask (#2721)
This introduces a single place for future snapshots.
2020-06-25 16:57:21 -07:00
Pavel Feldman bab6833232
chore: introduce the experimental rpc implementation (#2720) 2020-06-25 16:05:36 -07:00
Dmitry Gozman 5d5cf26a0e
fix(logs): streaming logs from InjectedScriptPoll without exception (#2712)
We used to get undefined messages, because we were mistakenly
fulfilling the logs multiple times.
2020-06-25 13:13:10 -07:00
Dmitry Gozman 807dc1f324
fix(crash): improve documentation for crash, reject waitForEvent (#2694) 2020-06-25 09:53:56 -07:00
Pavel Feldman bc3050776e
chore: prepare library types for rpc (#2706) 2020-06-25 08:30:56 -07:00
Dmitry Gozman f111974ad6
chore: prepare parsed selectors to more tasks (#2696)
We currently have dispatchEventTask and waitForSelectorTask.
However, most selector-based operations make sense as tasks, to ensure
atomic execution, e.g. textContent(selector) or focus(selector).
This will fight hydration, elements recycling and other async issues.

In preparation, decouple tasks from selectors parsing so that
we can have common infrastructure for tasks.
2020-06-24 17:03:28 -07:00
Dmitry Gozman 39ce35e154
fix(errors): strict error handling around element operations (#2567)
- Gave all possible dom errors distinct names, and throw them on the node side.
- Separated errors into FatalDOMError and RetargetableDOMError.
  Fatal errors are unrecoverable. Retargetable errors
  could be resolved by requerying the selector.
- This exposed a number of unhandled 'notconnected' cases.
- Added helper functions to handle errors and ensure TypeScript catches
  unhandled ones.
2020-06-24 15:12:17 -07:00
Dmitry Gozman 355305d31d
feat(screenshot): accept timeout, migrate to Progress, wait for visible (#2679)
Element screenshot now waits for the element to become visible and
throws on detach.

Both screenshot methods accept a timeout and capture logs using Progress.
Also, carefully handling exceptions and restoring the viewport.
2020-06-24 10:16:54 -07:00
Pavel Feldman fca514d74e
chore: move non-trivial types out of types.ts (#2680) 2020-06-23 14:51:06 -07:00
Dmitry Gozman d0a6e1a64e
fix(dom): make selectText and scrollIntoViewIfNeeded wait for visible (#2628)
All other methods wait for the element to be visible, so we should make
them behave similarly.
2020-06-23 13:02:31 -07:00
Joel Einbinder 9000ccb3b2
fix(click): don't timeout when innerWidth is modified (#2669)
We were evaluating `innerWidth` in the main context, where it could be modified.
2020-06-22 14:03:31 -07:00
Pavel Feldman eac7dab8b7
fix(cors): allow intercepting cors requests on chromium (#2643) 2020-06-19 17:14:32 -07:00
Dmitry Gozman d0336ea5c2
fix(network): disallow intercepting redirects (#2617)
WebKit and Firefox are only able to continue redirects.
Firefox is faking it on the backend, so you can't even stall it.

Instead, we just do not fire routes for redirects on all browsers,
to avoid surprises.
2020-06-18 17:15:47 -07:00
Joel Einbinder b88fabab13
test: add another test for browserContext.addInitScript (#2285) 2020-06-18 12:27:48 -07:00
Mike Tobia 63924d9a26
feat(install/download-hosts): allow multiple per browser (#2452)
In addition to `PLAYWRIGHT_DOWNLOAD_HOST` env variable, this patch adds a per-browser 
configuration:

- `PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST`
- `PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST`
- `PLAYWRIGHT_WEBKIT_DOWNLOAD_HOST`
2020-06-18 11:20:43 -07:00
Dmitry Gozman 971bd88922
fix(chromium): do not bring page to front before screenshot (#2614) 2020-06-18 10:52:08 -07:00
Dmitry Gozman f581e84829
fix(css selector): handle missing spaces between [] and > (#2612) 2020-06-17 23:20:12 -07:00
Dmitry Gozman f9633ea9b7
fix(scrollIntoView): ensure similar behavior across browsers, handle errors (#2599) 2020-06-17 10:48:07 -07:00
Pavel Feldman 277d50e39c
feat(webkit): roll WebKit to 1286 - interception (#2601) 2020-06-17 08:34:42 -07:00
Pavel Feldman c220fc7f46
chore(logs): rework logs for simplicity (#2592) 2020-06-16 17:11:19 -07:00
Pavel Feldman 59d0f8728d
test(recorder): add recorder sanity tests (#2582) 2020-06-16 10:15:08 -07:00
Pavel Feldman 1c7a8952b9
chore(cli): add recording mode (#2579) 2020-06-15 15:27:03 -07:00
Pavel Feldman f2c47b1d33
feat(cli): introduce basic playwright CLI tool (#2571) 2020-06-14 17:24:45 -07:00
Pavel Feldman 61b11252b4
chore(debug): various debug mode improvements (#2561) 2020-06-13 13:17:12 -07:00
Dmitry Gozman d4c466868b
chore: explicitly plumb various errors through the retries (#2554)
We are about to have more errors, so explicit plumbing helps with visibility.
2020-06-12 14:59:26 -07:00
Dmitry Gozman c4e8720eb5
feat(debug): generate preview for ElementHandle (#2549)
This is a best-effort debugging feature - we try to generate preview asynchronously,
so it might not be available immediately.
2020-06-12 11:10:18 -07:00
Dmitry Gozman 1bf9e65ef5
fix(log): include log name in progress recording (#2550) 2020-06-12 09:48:56 -07:00
Pavel Feldman 894826dec0
chore: form the debug script for authoring hints / helpers (#2551) 2020-06-11 18:18:33 -07:00
Dmitry Gozman 7ddf66418a
test: add a failing test with React rerender (#2545) 2020-06-11 15:19:35 -07:00
Pavel Feldman e287f19493
feat(debug): add basic recording helper infra (#2533) 2020-06-11 11:42:52 -07:00
Dmitry Gozman 5e97acde0c
fix(oopif): make Page.addInitScript and Page.exposeBinding work for oopifs (#2542) 2020-06-11 11:41:36 -07:00
Pavel Feldman 17433d1881
chore: verify launch options (#2530) 2020-06-10 20:48:54 -07:00
Andrey Lushnikov 89d1b52f43
chore: revert atomic install (#2534)
This reverts 2 commits:

- "fix(installer): create tmp directory inside `browserPath` (#2498)"
  commit 946b4efa3b.

- "feat: support atomic installation of browsers (#2489)"
  commit 3de0c087bc.

This addresses installation issues we see in some CI environments.
2020-06-10 18:49:03 -07:00
Dmitry Gozman c99f0d1f98
feat(debug): more logs while waiting for stable, enabled, etc. (#2531) 2020-06-10 18:45:18 -07:00
Pavel Feldman 903de2582a
chore(websocket): extract common socket part (#2506) 2020-06-10 16:33:27 -07:00
Dmitry Gozman 1bb33650b0
chore: remove ExtendedEventEmitter and inline waitForEvent (#2529) 2020-06-10 15:12:50 -07:00
Pavel Feldman 8ee19d53e7
feature(webkit): roll WebKit to 1273 (#2514) 2020-06-10 13:36:45 -07:00