1573 Commits

Author SHA1 Message Date
Pavel Feldman
80c0711d98
feat(firefox): roll firefox to r1137 (#3095) 2020-07-22 15:59:37 -07:00
Pavel Feldman
2a08883ef8
chore(download): follow up to remove the redundant checks (#3097) 2020-07-22 15:59:11 -07:00
Ross Wollman
d8a17fb0ab
api(download): Add saveAs helper (#2872) 2020-07-22 14:55:27 -07:00
Andrey Lushnikov
ea5dfdbec7
fix: re-write Chromium startup error with clear instructions (#3070)
This patch detects Chromium crash with a sandboxing error and re-writes
the error to surface information nicely.

#### Error Before:

```sh
pwuser@23592d09b3bd:~/tmp$ node a.js
(node:324) UnhandledPromiseRejectionWarning: browserType.launch: Protocol error (Browser.getVersion): Target closed.
=========================== logs ===========================
[browser] <launching> /home/pwuser/.cache/ms-playwright/chromium-790602/chrome-linux/chrome --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disab
le-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=TranslateUI,BlinkGenPropertyTrees,ImprovedCookieControls,SameSiteByDefaultCookies --disable-hang-monitor --disab
le-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --user-data-dir=/tmp/playwrig
ht_chromiumdev_profile-mjSfr2 --remote-debugging-pipe --headless --hide-scrollbars --mute-audio --no-startup-window
[browser] <launched> pid=401
[browser] [0722/170825.030020:FATAL:zygote_host_impl_linux.cc(117)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux/suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live
dangerously and need an immediate workaround, you can try using --no-sandbox.
[browser] #0 0x55ac4f8c7be9 base::debug::CollectStackTrace()
[browser] #1 0x55ac4f841c13 base::debug::StackTrace::StackTrace()
[browser] #2 0x55ac4f853680 logging::LogMessage::~LogMessage()
[browser] #3 0x55ac4df2307e content::ZygoteHostImpl::Init()
[browser] #4 0x55ac4f40dd47 content::ContentMainRunnerImpl::Initialize()
[browser] #5 0x55ac4f45c9fa service_manager::Main()
[browser] #6 0x55ac4f40c361 content::ContentMain()
[browser] #7 0x55ac4f45b5bd headless::(anonymous namespace)::RunContentMain()
[browser] #8 0x55ac4f45b2bc headless::HeadlessShellMain()
[browser] #9 0x55ac4ccc22e7 ChromeMain
[browser] #10 0x7f0f3d736b97 __libc_start_main
[browser] #11 0x55ac4ccc212a _start
[browser]
[browser] Received signal 6
[browser] #0 0x55ac4f8c7be9 base::debug::CollectStackTrace()
[browser] #1 0x55ac4f841c13 base::debug::StackTrace::StackTrace()
[browser] #2 0x55ac4f8c7785 base::debug::(anonymous namespace)::StackDumpSignalHandler()
[browser] #3 0x7f0f437b3890 (/lib/x86_64-linux-gnu/libpthread-2.27.so+0x1288f)
[browser] #4 0x7f0f3d753e97 gsignal
[browser] #5 0x7f0f3d755801 abort
[browser] #6 0x55ac4f8c66e5 base::debug::BreakDebugger()
[browser] #7 0x55ac4f853aeb logging::LogMessage::~LogMessage()
[browser] #8 0x55ac4df2307e content::ZygoteHostImpl::Init()
[browser] #9 0x55ac4f40dd47 content::ContentMainRunnerImpl::Initialize()
[browser] #10 0x55ac4f45c9fa service_manager::Main()
[browser] #11 0x55ac4f40c361 content::ContentMain()
[browser] #12 0x55ac4f45b5bd headless::(anonymous namespace)::RunContentMain()
[browser] #13 0x55ac4f45b2bc headless::HeadlessShellMain()
[browser] #14 0x55ac4ccc22e7 ChromeMain
[browser] #15 0x7f0f3d736b97 __libc_start_main
[browser] #16 0x55ac4ccc212a _start
[browser]   r8: 0000000000000000  r9: 00007ffd38a863b0 r10: 0000000000000008 r11: 0000000000000246
[browser]  r12: 00007ffd38a87680 r13: 00007ffd38a86610 r14: 00007ffd38a87690 r15: aaaaaaaaaaaaaaaa
[browser]   di: 0000000000000002  si: 00007ffd38a863b0  bp: 00007ffd38a86600  bx: 00007ffd38a86e44
[browser]   dx: 0000000000000000  ax: 0000000000000000  cx: 00007f0f3d753e97  sp: 00007ffd38a863b0
[browser]   ip: 00007f0f3d753e97 efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000
[browser]  trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[browser] [end of stack trace]
[browser] Calling _exit(1). Core file will not be generated.
============================================================
Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.Error
    at /home/pwuser/tmp/node_modules/playwright/lib/chromium/crConnection.js:131:63
    at new Promise (<anonymous>)
    at CRSession.send (/home/pwuser/tmp/node_modules/playwright/lib/chromium/crConnection.js:130:16)
    at CRSession.send (/home/pwuser/tmp/node_modules/playwright/lib/helper.js:78:31)
    at Function.connect (/home/pwuser/tmp/node_modules/playwright/lib/chromium/crBrowser.js:54:39)
    at Chromium._connectToTransport (/home/pwuser/tmp/node_modules/playwright/lib/server/chromium.js:52:38)
    at Chromium._innerLaunch (/home/pwuser/tmp/node_modules/playwright/lib/server/browserType.js:87:36)
    at async ProgressController.run (/home/pwuser/tmp/node_modules/playwright/lib/progress.js:75:28)
    at async Chromium.launch (/home/pwuser/tmp/node_modules/playwright/lib/server/browserType.js:60:25)
    at async /home/pwuser/tmp/a.js:4:19
(node:324) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise reject
ion, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:324) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
```


#### Error After:

```sh
pwuser@23592d09b3bd:~/tmp$ node a.js
(node:222) UnhandledPromiseRejectionWarning: browserType.launch: Chromium sandboxing failed!
================================
To workaround sandboxing issues, do either of the following:
  - (preferred): Configure environment to support sandboxing: https://github.com/microsoft/playwright/blob/master/docs/troubleshooting.md
  - (alternative): Launch Chromium without sandbox using 'chromiumSandbox: false' option
================================
Error
    at /home/pwuser/tmp/node_modules/playwright/lib/chromium/crConnection.js:131:63
    at new Promise (<anonymous>)
    at CRSession.send (/home/pwuser/tmp/node_modules/playwright/lib/chromium/crConnection.js:130:16)
    at CRSession.send (/home/pwuser/tmp/node_modules/playwright/lib/helper.js:78:31)
    at Function.connect (/home/pwuser/tmp/node_modules/playwright/lib/chromium/crBrowser.js:54:27)
    at Chromium._connectToTransport (/home/pwuser/tmp/node_modules/playwright/lib/server/chromium.js:53:38)
    at Chromium._innerLaunch (/home/pwuser/tmp/node_modules/playwright/lib/server/browserType.js:89:36)
    at async ProgressController.run (/home/pwuser/tmp/node_modules/playwright/lib/progress.js:75:28)
    at async Chromium.launch (/home/pwuser/tmp/node_modules/playwright/lib/server/browserType.js:61:25)
    at async /home/pwuser/tmp/a.js:4:19
(node:222) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise reject
ion, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:222) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
```

References #2745
2020-07-22 10:57:58 -07:00
Dmitry Gozman
1aee8dfc7c
feat(rpc): align types/guids in the protocol with their pdl definition (#3079)
This makes the protocol self-explanatory, and avoids silly conversions
in codegenerators, e.g. cdpSession <-> CDPSession.
2020-07-22 10:37:21 -07:00
Pavel Feldman
f50f228a1f
browser(chromium): roll chromium to r790602 (#3082) 2020-07-22 09:21:23 -07:00
Pavel Feldman
2b0b0a9119
fix(misc): assorted fixes (#3031) 2020-07-21 23:48:21 -07:00
Dmitry Gozman
ced0bc2d1b
api: make clear the use of null in page.emulateMedia (#3078)
We can pass null to disable emulating particular feature.
This change updates the docs and rpc protocol accordingly.
2020-07-21 18:56:41 -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
Dmitry Gozman
db4e856a57
feat(rpc): use SerializedValue for CDPSession (#3076)
This is our way to define a schema for arbitrary values.
2020-07-21 15:58:00 -07:00
Dmitry Gozman
1553f19bab
chore: update error messages to match future rpc validator (#3075) 2020-07-21 15:25:31 -07:00
Dmitry Gozman
18cb1c017a
feat(rpc): inline selectors.register options in the protocol (#3072) 2020-07-21 14:41:33 -07:00
Dmitry Gozman
3dd61629e0
feat(rpc): update Response.finished to return string instead of Error (#3071) 2020-07-21 14:40:53 -07:00
Andrey Lushnikov
47e30f047b
feat: introduce chromiumSandbox launch option (#3067)
The option is intended to be used instead of the `--no-sandbox`
argument that is accepted exclusively by Chromium and crashes
WebKit.

References #2745
2020-07-21 13:49:09 -07:00
Andrey Lushnikov
af20d2704f
fix: auto-add --no-sandbox when running Chromium under root (#3064)
References #2745
2020-07-21 13:21:42 -07:00
Dmitry Gozman
3dead4c8d1
feat(rpc): remove last union types from the protocol (#3059) 2020-07-21 12:44:30 -07:00
Pavel Feldman
99658c2d32
feat(bringToFront): enable on all browsers (#3052) 2020-07-21 09:36:54 -07:00
Dmitry Gozman
2d59a8f9c2
feat(rpc): remove some union types (#3058) 2020-07-21 08:26:48 -07:00
Dmitry Gozman
5848ed8f41
feat(rpc): introduce protocol.pdl (#3054)
We now generate channels.ts from the protocol definition. There are still some shortcomings,
like union types - these will be addressed in follow ups.
2020-07-20 17:38:06 -07:00
Dmitry Gozman
cfe3aa3d94
test: add a few tests for null values (#3035) 2020-07-20 09:39:16 -07:00
Dmitry Gozman
29504c0824
feat(rpc): make SerializedValue format pdl-friendly (#3007)
This avoids sum types and instead uses different fields
for different types.
2020-07-19 19:46:19 -07:00
Andrey Lushnikov
9a2245d30a
devops: show package names instead of missing libs on Ubuntu 18.04 (#3013)
This patch starts putting package names to install on Ubuntu instead
of missing dependencies list.

The mapping of library to package name is obtained using the following
script: https://gist.github.com/aslushnikov/2766200430228c3700537292fccad064

References #2745
2020-07-17 16:50:20 -07:00
Andrey Lushnikov
ef2a6522b8
feat: support atomic browser installation - attempt 2 (#3008)
Currently, Ctrl-C while extracting browser might yield users in
a bad place.

This patch adds a marker file inside browser directory to make
sure that browser extraction completed.

Note: this was already attempted in #2489, but was eventually
reverted in #2534.

References #2660
2020-07-17 16:39:27 -07:00
Dmitry Gozman
91e1a25f34
feat(rpc): gracefully close browsers in server process on disconnect (#3005) 2020-07-17 16:14:23 -07:00
Pavel Feldman
9d9801192e
test: wire test commands to jest (#3014) 2020-07-17 16:09:27 -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
Pavel Feldman
096ec4c44f
test: move fixtures to jest (#3010) 2020-07-17 13:53:23 -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
Joel Einbinder
9140063c90
fix(accessibility): don't filter everything when the page has a title (#2909) 2020-07-17 10:48:50 -07:00
Dmitry Gozman
d8bedd851d
chore: explicitly type SerializedArgument, fix rpc dispatchEvent (#2988)
We now have types for SerializedValue/SerializedArgument. This will
allow us to avoid double parse/serialize for evaluation arguments/results.

Drive-by: typing exposed a bug in ElementHandle.dispatchEvent().
2020-07-17 09:53:13 -07:00
Pavel Feldman
070a257600
test: move all generic page tests to jest (#3002) 2020-07-17 09:49:12 -07:00
Dmitry Gozman
5cf3e4f0f2
feat(rpc): switch Env to use an array, split ignoreDefaultArgs (#2984) 2020-07-17 09:32:27 -07:00
Pavel Feldman
1c0504ae28
test: respect fixtures in describe, match image snapshots (#2989) 2020-07-16 22:38:52 -07:00
Tapajyoti Bose
16e3776a9c
fix(JSCoverageEntry): added scriptId and isBlockCoverage (#2955) 2020-07-16 20:32:49 -07:00
Pavel Feldman
424f11d165
test: convert some tests to the jest+fixtures (#2983) 2020-07-16 16:59:45 -07:00
Dmitry Gozman
056f0e290d
feat(rpc): ensure that error stack traces point to the user code (#2961)
This also adds more "_wrapApiCall" calls for correct logs and stack traces.
2020-07-16 14:32:21 -07:00
Dmitry Gozman
b890569afc
feat(rpc): move leftover extraHTTPHeaders to HeadersArray (#2980) 2020-07-16 13:36:22 -07:00
Dmitry Gozman
439e048a4c
feat(rpc): migrate DeviceDescriptors payload to an array (#2981)
Currently it is an object with arbitrary keys - that makes it
hard to have a protocol definition.
2020-07-16 13:18:54 -07:00
Dmitry Gozman
4c8ba3ed67
chore: remove cli (#2976)
It will be a separate package instead.
2020-07-16 13:13:26 -07:00
Pavel Feldman
ecc130c644
test: convert evaluation.spec to jest+fixtures (#2968) 2020-07-16 11:18:38 -07:00
Dmitry Gozman
198ecee875
api(exposeBinding): allow handles in the binding result (#2970) 2020-07-15 20:05:11 -07:00
Dmitry Gozman
aa4c893b09
feat(rpc): implement waitForNavigation on the client (#2949)
Drive-by: fix electron issues, exposed by the test using
waitForNavigation.

Drive-by: mark some tests skip(CHANNEL) that were mistakenly
marked skip(USES_HOOKS).
2020-07-15 18:48:19 -07:00
Andrey Lushnikov
0b9218149f
feat: validate browser dependencies before launching on Linux (#2960)
Missing dependencies is #1 problem with launching on Linux.

This patch starts validating browser dependencies before launching
browser on Linux. In case of a missing dependency, we will abandon
launching with an error that lists all missing libs.

References #2745
2020-07-15 15:24:38 -07:00
Dmitry Gozman
c51ea0afd1
feat(rpc): remove PageAttribution from the protocol, attribute on the client side (#2957)
This also changes timeout error format to
"page.click: Timeout 5000ms exceeded", so that all errors
can be similarly prefixed with api name.

We can now have different api names in different clients,
and our protocol is more reasonable.
2020-07-15 14:04:39 -07:00
Dmitry Gozman
7f6171579b
feat(rpc): use headers array in the protocol (#2959) 2020-07-15 13:21:21 -07:00
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