Commit Graph

1030 Commits

Author SHA1 Message Date
Andrey Lushnikov
5879c7f362
chore: refactor toMatchSnapshot once again (#12313)
Keep massaging code in preparation for `toHaveScreenshot`.

References #9938
2022-02-23 13:17:37 -08:00
Dmitry Gozman
4399623f9f
chore(test runner): make timeout a separate error in TestInfo.errors (#12315)
This way we control the timeout error message from the runner,
so that later on we can differentiate between test timeout, fixture
timeout and hook timeout.
2022-02-23 12:32:12 -08:00
Dmitry Gozman
114edecd3a
fix(list mode): keep outputDir intact (#12291) 2022-02-22 12:50:26 -08:00
Max Schmitt
be2e4866b0
test: add test for sendBeacon and asserting request body (#12274) 2022-02-22 20:15:24 +01:00
Dmitry Gozman
d3c4323021
fix(test runner): improve error message for unexpected calls (#12240) 2022-02-18 18:25:18 -08:00
Dmitry Gozman
ee0dd6ec71
fix(test runner): trim full output path (#12239)
Previously, we only trimmed the "full title" component, but
we should also trim the "relative path" component.
2022-02-18 15:40:36 -08:00
Andrey Lushnikov
0682672242
chore: move comparator logic to playwright-core (#12232)
This will enable implementation of `toHaveScreenshot` on the
server-side.

Drive-by: drop blink-diff

References #9938
2022-02-18 14:39:17 -08:00
Andrey Lushnikov
b9e86b79ee
chore: refactor toMatchSnapshot implementation (#12206)
This patch prepares for the `toHaveScreenshot` implementation
by splitting common parts from `toMatchSnapshot`.

Drive-by: fix default extension generation from `.bin` to `.dat`
for unknown buffers.
2022-02-18 11:21:58 -08:00
Dmitry Gozman
edac84d072
feat(remote): send browser/channel/headless in a header (#12205) 2022-02-18 07:54:33 -08:00
Dmitry Gozman
34eec7eae7
fix(webServer): route output through reporters (#12198) 2022-02-18 07:54:01 -08:00
Dmitry Gozman
15043801cb
chore: use transport for BrowserType.connect (#12196)
This gives us logging, ECONNRESET error handling and proper cleanup.
2022-02-17 20:48:14 -08:00
Andrey Lushnikov
a98babec69
feat(test-runner): introduce pixelCount and pixelRatio options (#12169)
This patch adds additional options to `toMatchSnapshot` method:
- `pixelCount` - acceptable number of pixels that differ to still
  consider images equal. Unset by default.
- `pixelRatio` - acceptable ratio of all image pixels (from 0 to 1) that differ to still
  consider images equal. Unset by default.

Fixes #12167, #10219
2022-02-17 15:44:03 -08:00
Andrey Lushnikov
c98d595bea
fix: support hiding caret in case of matching style rule (#12172) 2022-02-17 14:05:56 -08:00
Max Schmitt
21ae298015
fix(trace-viewer): don't crash when argument is null (#12186) 2022-02-17 22:12:42 +01:00
Max Schmitt
4115235f4d
feat(codegen): use web-first page assertions to match URL (#12177) 2022-02-17 20:52:35 +01:00
Max Schmitt
a667d94d45
chore(codegen): do not over-escape spaces (#12155) 2022-02-17 01:01:46 +01:00
Andrey Lushnikov
086333cd60
feat(test-runner): support unnamed snapshots (#12161)
Fixes #9007
2022-02-16 14:22:01 -08:00
Max Schmitt
92045b7faf
feat(codgen): support radio buttons (#12157) 2022-02-16 19:10:00 +01:00
Dmitry Gozman
47cc7c4ae8
chore: refactor internal cli commands to use commander (#12146) 2022-02-16 09:54:12 -08:00
Yury Semikhatsky
7ee35ae30d
fix(html-report): open all test traces in one viewer (#12142) 2022-02-16 09:09:42 -08:00
Yury Semikhatsky
08fd8d0762
fix(tracing): do not capture iframes in head (#12126) 2022-02-16 09:09:15 -08:00
Dmitry Gozman
85cb3c9713
test: add a test that fixture error after timeout is not a fatal error (#12141) 2022-02-15 18:05:20 -08:00
Andrey Lushnikov
65697d64be
test: fail canvas test on MacOS 11 and less (#12131) 2022-02-15 14:00:26 -08:00
pierscowburn
5db7ce5964
fix: propagate exit code in experimental mode (#12070)
In experimental ESM mode a child process is forked in order to run the tests. Currently the exit code of this child process is not propagated to the exit code of the parent process, which means that the process exits with a status code of `0` even if some of the tests failed.

This makes it difficult to use Playwright in CI in experimental mode, as the CI pipeline as a whole will pass despite the test failures.

This change addresses this by propagating the exit code in the case where it is non-zero.
2022-02-15 13:10:35 -08:00
Yury Semikhatsky
f15610b874
fix(fetch): always return non-empty body regardless of request method (#12102) 2022-02-15 09:06:21 -08:00
Andrey Lushnikov
363b8a6970
feat: support mask option in screenshot methods (#12072)
Fixes https://github.com/microsoft/playwright/issues/10162
2022-02-15 07:05:05 -08:00
Dmitry Gozman
5a0445b8da
feat(remote): let client enable/disable sock proxy (#12086) 2022-02-14 15:10:58 -08:00
Andrey Lushnikov
ef21ce3f56
feat(test-runner): filter out syntax error stack traces (#12095)
Filter out long stack traces from babel when it fails compilation
due to syntax error in test.
2022-02-14 14:33:14 -08:00
Dmitry Gozman
9814c592d2
fix(test runner): shutdown redundant workers (#12062) 2022-02-14 10:57:15 -08:00
Dmitry Gozman
fb00991a78
chore: intercept socks proxy in the driver (#12021) 2022-02-13 14:03:47 -08:00
Pavel Feldman
96b5831a49
chore: add support private methods in TS (#12051) 2022-02-11 14:46:49 -08:00
Yury Semikhatsky
abd7084bcc
fix: match default font families in headless chromium (#11340) 2022-02-11 09:06:17 -08:00
Dmitry Gozman
d8db785c0a
fix(reporters): correctly handle missing stdout.columns (#12016)
When columns are not available, do not trim the output.
2022-02-11 08:33:56 -08:00
Dmitry Gozman
66b5cf5ae1
feat(remote): make PlaywrightServer work with browserType.connect (#11849)
This changes PlaywrigtServer to serve connections like `ws://localhost:3333/?browser=chromium`:
- launches the browser;
- talks `browserType.connect`-style protocol over websocket;
- compatible with `connectOptions` fixture.

```js
await playwright.chromium.connect({ wsEndpoint: 'ws://localhost:3333/?browser=chrome' });
```
2022-02-10 16:36:23 -08:00
Ross Wollman
0d42c16a17
fix(test-runner): undefined body crash with manual attachments (#11995)
The new (as of 1.18) `async testInfo.attach(…)` API handles this
gracefully (and is part of the reason for the new API's existence).
However, for the foreseeable future, it's still possible to manually
push onto the attachments array where we can't validate the contents
until it's too late, so this change ensures more graceful handling in
that case.

Fixes #11565
2022-02-10 12:33:38 -08:00
Dmitry Gozman
9a8e55493f
test: add a test for fetch api respecting port forwarding (#12007) 2022-02-10 12:05:35 -08:00
Dmitry Gozman
9c66068971
fix(connect): make route.fulfill({ response }) work (#12006) 2022-02-10 12:05:04 -08:00
Andrey Lushnikov
9287ef2dfb
test: skip test when run with PWTEST_TRACING (#11999)
This test tries to enable tracing itself; double-enabling
tracing throws an error.

This started failing after 284f76357f
2022-02-10 09:45:18 -08:00
Pavel Feldman
fbc05b74a7
chore: revert "fix(test-runner): escape backslashes in win cli (#11763)" (#12004) 2022-02-10 07:02:37 -08:00
Mateusz Burzyński
b0cd5b1420
feat(mouse): set .buttons correctly for basic mouse commands in Chrome (#10698)
Co-authored-by: Andrey Lushnikov <aslushnikov@gmail.com>
2022-02-09 20:48:16 -08:00
Dmitry Gozman
284f76357f
test: unflake browsertype-connect.spec (#11994)
Consider the scenario:
- First test starts a remote server, connects to it and does not close.
- Remote server fixture stops the server in teardown. Meanwhile,
  the connected browser did not get notified about disconnect just yet.
- Second test starts and sets up tracing in the old connected browser.
- Tracing fails because the browser now realises it has disconnected.
2022-02-09 17:00:33 -08:00
Andrey Lushnikov
6904b3294e
fix(test-runner): fix browser initialization in test modifiers (#11984)
Fixes #11985
2022-02-09 15:30:14 -08:00
Dmitry Gozman
ae7c52154f
fix(fixtures): make sure connected browser respects context options (#11990)
Connected browser was wired up to the wrong browserType object.
2022-02-09 15:25:15 -08:00
Andrey Lushnikov
6f87955243
feat: introduce disableAnimations option for screenshots (#11870)
This option stops all kinds of CSS animations while doing screenshot:
- CSS animations
- CSS transitions
- Web Animations

Animations get different treatment depending on animation duration:
- finite animations are fast-forwarded to its end, issuing the
  `transitionend` event.
- Infinite animations are resetted to its beginning, and then
  resumed after the screenshot.

References #9938, fixes #11912
2022-02-09 12:52:11 -08:00
Darío Kondratiuk
48cc41f3e7
feat: add key support on react engine (#11970)
I've got [this question](https://stackoverflow.com/questions/71050193/react-locator-example/71052432#71052432) on StackOverflow. And although, in that case, the `key` was part of the `props` attributes. That might not always be true.

I am bringing this to the tell to see what you think about this.
I'm also fixing a typo :)
2022-02-09 11:33:15 -08:00
Andrey Lushnikov
439c8e9c40
test: fix tests for chromium-based browser channels (#11974) 2022-02-09 11:29:16 -08:00
Andrey Lushnikov
40b4218962
chore: roll stable test runner to Feb 9, 2022 (#11971) 2022-02-09 09:34:25 -08:00
Yury Semikhatsky
706c897031
feat(fixtures): respect tracing config for APIRequestContext (#11954) 2022-02-09 08:54:09 -08:00
Pavel Feldman
e9e5de2d57
feat(debug): allow preprocessing JS scripts as well (#11953) 2022-02-09 07:14:11 -08:00
Dmitry Gozman
19368e93af
feat(test runner): support connectOptions (#11919)
This allows to specify `connectOptions` in the config that
switch built-in `browser` to be remotely connected.
2022-02-08 20:45:42 -08:00