120 Commits

Author SHA1 Message Date
Dmitry Gozman
3cf48f9bd4
chore: simplify conversions around setInputFiles (#3516)
We do not need api types on the server side anymore.
2020-08-18 17:32:11 -07:00
Dmitry Gozman
aeadf50165
chore: use HeadersArray instead of Headers object on the server side (#3512)
This simplifies implementation and avoids multiple conversions.
Also adding some tests around lowercase and wrong types.
2020-08-18 15:38:29 -07:00
Dmitry Gozman
9790ea5b5d
chore: align more server-side options with rpc protocol (#3506)
This touches:
- noDefaultViewport;
- ignoreAllDefaultArgs;
- env;
- validateXYZ logic that was copying objects - we do not need that anymore;
- shuffles some converters closer to their usage.
2020-08-18 09:37:40 -07:00
Dmitry Gozman
141a255a07
chore: remove unused methods from server side (#3502)
Most of these were api methods that are no longer called directly.
2020-08-17 14:36:51 -07:00
Dmitry Gozman
1e9c0eb705
chore: remove logger infrastructure from server side (#3487)
We do not implement LoggerSink on the server, so we can
use a simple debugLogger.
2020-08-17 14:12:31 -07:00
Yury Semikhatsky
d8d845afcc
feat(screencast): add private recording APIs and basic test (#3296) 2020-08-10 21:22:57 -07:00
Dmitry Gozman
cdfe73fee3
api(console): make ConsoleMessageLocation properties required (#3290)
Everywhere in our api, possibly missing properties are nullable.
However, to make things easier for everyone, we just default to an
empty url instead, so that users do not have to null-check it.
2020-08-05 22:25:56 -07:00
Dmitry Gozman
fab5eba64f
fix(oopifs): translate coordinates to viewport (#3201)
Renderer-based method DOM.getContentQuads and DOM.getBoxModel return
coordinates relative to the local root's viewport, but we need them relative
to the root viewport.
2020-07-28 15:52:33 -07:00
Joel Einbinder
f4b7ed5542
fix(chromium): reland support selectAll on macos (#3038)
Co-authored-by: Joel Einbinder <joel.einbinde@gmail.com>
2020-07-21 16:33:46 -07:00
Pavel Feldman
99658c2d32
feat(bringToFront): enable on all browsers (#3052) 2020-07-21 09:36:54 -07:00
Pavel Feldman
a8216339d8
Revert "fix(chromium): select all on macos should work again (#3006)" (#3011) 2020-07-17 14:34:05 -07:00
Joel Einbinder
631fbce7ff
fix(chromium): select all on macos should work again (#3006)
* fix(chromium): select all on macos should work again

* Update src/chromium/crInput.ts

Co-authored-by: Joel Einbinder <joel.einbinde@gmail.com>
2020-07-17 10:59:48 -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
Dmitry Gozman
db3439d411
chore: introduce DocumentInfo (#2765)
It encapsulates documentId and request.
2020-07-06 15:58: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
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
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
Dmitry Gozman
971bd88922
fix(chromium): do not bring page to front before screenshot (#2614) 2020-06-18 10:52:08 -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
Pavel Feldman
894826dec0
chore: form the debug script for authoring hints / helpers (#2551) 2020-06-11 18:18:33 -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
Dmitry Gozman
80705ff5e9
chore: simplify logging a bit (#2512)
This merges a few classes and stops inheriting from InnerLogger.
2020-06-09 16:11:17 -07:00
Dmitry Gozman
c08da50bb3
chore: introduce session.sendMayFail to ease error logging (#2480) 2020-06-05 07:50:26 -07:00
Dmitry Gozman
8e6375f532
chore: reduce the number of evaluate methods, improve types (#2454)
Types can now handle non-trivial tuples with handles inside.
2020-06-03 13:22:05 -07:00
Dmitry Gozman
454411062b
fix(oopif): race between detachedFromTarget and frameAttached (#2419)
During remote -> local transition, these two events come in unpredictable order, so we try to handle both cases. Also, remote frame detach was not handled at all.
2020-06-01 13:47:02 -07:00
Dmitry Gozman
de0bbd3031
chore: remove page pause support (#2431) 2020-06-01 11:14:16 -07:00
Andrey Lushnikov
7a785ac268
fix: properly rewrite error message (#2392)
Error message is included in error's stack, so we should
re-write stack as well.

Fixes #2373
2020-05-28 16:33:31 -07:00
Pavel Feldman
e168fddac8
fix(evaluate): consistently serialize json values (#2377) 2020-05-27 17:19:05 -07:00
Dmitry Gozman
8f0f32b5e6
chore: move debug-related code to src/debug (#2309) 2020-05-26 14:08:32 -07:00
Dmitry Gozman
aac5bf24ec
fix(popups): do not override popup size from window features (#2139)
We usually force window size from the browser context. However,
popups that have window features insist on a specific window size,
so we respect that.
2020-05-22 15:56:37 -07:00
Dmitry Gozman
e2972ad5ba
feat(click): retry when the element it outside of the viewport (#2330)
The element might get animated into the viewport.
2020-05-22 11:15:57 -07:00
Pavel Feldman
aa0d844c76
chore: introduce utility script for evaluate helpers (#2306) 2020-05-20 15:55:33 -07:00
Dmitry Gozman
8957c86837
feat(debug): add source maps to evaluates in debug mode (#2267)
When PLAYWRIGHT_DEBUG_UI is set, we try to find the source
of the function in the current file and source map it.
2020-05-19 08:40:45 -07:00
Dmitry Gozman
359cb3a740
fix(oopif): adopt main requests into oopifs (#2284)
Main request for an OOPIF starts in the parent session, and the oopif
session is create only after the response has been received. Therefore,
we should adopt the request after oopif session is created.
2020-05-18 17:13:51 -07:00
Pavel Feldman
99b7aaace8
chore: refactor injected script harness (#2259) 2020-05-15 15:21:49 -07:00
Andrey Lushnikov
a38ac3fb62
fix: report hash in page.url() (#2252)
Fixes #2247
2020-05-14 17:23:19 -07:00
Pavel Feldman
f63ea3ffd2
feat(downloads): expose suggested filename (#2062) 2020-05-12 19:23:08 -07:00
Dmitry Gozman
072dcba94a
api(viewport): do not allow isMobile and deviceScaleFactor for null viewports (#2190)
Also make sure we do not alter viewport when passed null.
2020-05-12 18:31:17 -07:00
Pavel Feldman
9895cd0a31
chore: optionally create downloads folder (#2188) 2020-05-11 14:42:13 -07:00
Pavel Feldman
f6210ae996
fix(webkit): click moving targets on windows (#2101) 2020-05-04 16:30:19 -07:00
Dmitry Gozman
d7a1e013c6
fix(chromium): do not wait forever for navigations that target another tab/download (#2068) 2020-04-30 21:24:03 -07:00
Yury Semikhatsky
78b44ed2a0
fix: report new window downloads (#2019) 2020-04-29 18:36:24 -07:00
Dmitry Gozman
b11d7f15bb
feat(input): retry when hit target check fails, prepare for page pause (#2020) 2020-04-29 11:05:23 -07:00
Pavel Feldman
2fcc2b5552
chore(chromium): resize browser frame when emulating viewport (#1924) 2020-04-23 10:38:58 -07:00
Pavel Feldman
1f43ae692f
feat(logging): introduce logger sink api (#1861) 2020-04-20 07:52:26 -07:00
Dmitry Gozman
55b4bc99bd
feat(actions): requery the element when it was detached during the action (#1853) 2020-04-18 18:29:31 -07:00
Dmitry Gozman
f5942295d4
feat(api): wait for popups and downloads when performing actions (#1744) 2020-04-16 13:09:24 -07:00
Pavel Feldman
2280126344
api(setInputFiles): introduce page/frame helpers, document, break compat (#1818) 2020-04-16 10:25:28 -07:00
Andrey Lushnikov
0ba823dd6f
feat: introduce page.on('crash') event (#1782)
Currently, whenever the page crashes, it emits an `'error'` event.
Error event is a special type of event in node.js; if unhandled,
it crashes the process.

Instead of emitting `'error'` event, this patch switches to emitting
`'crash'` event. Playwright users are free to handle the event
however they like, or just to ignore it.
2020-04-15 00:04:35 -07:00
Craig Nishina
3167f2d34c
fix(chromium): prevent errors when frame does not exist when detaching from oopif (#1767)
When navigating away from the page loaded in `goto`, the frame no longer
exists. Page.removeFrameSession is called and throws an error. Instead
of calling the helper.assert method, moved removeChildFramesRecursively
into a conditional.

closes #1762
2020-04-14 19:01:01 -07:00