Commit Graph

1954 Commits

Author SHA1 Message Date
Andrey Lushnikov
526bc3f252
fix(ssim-cie94): further tune SSIM-CIE94 to fight wk artifacts (#19370)
This patch adds a grid border around the image so that the SSIM
resolution doesn't drop for the border pixels.

We also add a test with WebKit rendering artifacts to make sure
new approach helps to fight this.
2022-12-08 16:08:41 -08:00
Andrey Lushnikov
6139b432fd
fix(ssim-cie94): increase SSIM window radius (#19343)
While migrating Playwright tests from pixelmatch comparator to the
ssim-cie94 comparator, we noticed a rendering artifact that happens
on playwright screenshot tests on WebKit Linux.

This PR adds a set of cropped-down examples and tunes the ssim-cie94
comparator to accept these rendering artifacts.
2022-12-07 16:25:16 -08:00
Dmitry Gozman
622c1a8da6
tests: run browserType.connect tests against launchServer and run-server (#19340) 2022-12-07 14:36:32 -08:00
Pavel Feldman
7aa3935dcc
chore: match selected options by both value and label (#19316) 2022-12-07 09:04:32 -08:00
Dmitry Gozman
fd22d8bde1
feat(tether): support hostname pattern in socks proxy (#19302)
For now, only '*' and 'localhost' are supported.

References #19287.
2022-12-07 08:46:35 -08:00
Fernando Garcia Llorente
cd4ccdfa29
feat: allow options in automatic screenshots (#19143)
Closes #9983 

Allowing Automatic Screenshots in `PlaywrightTestConfig` to have
`fullPage` & `omitBackground` as optional parameters.
2022-12-07 08:45:33 -08:00
Dmitry Gozman
d294c5da33
chore: roll stable-test-runner to 1.28.1 (#19310)
This required `allowJs: false` in our `tsconfig.json` due to the
following error:

```

Error: Cannot find module './utilsBundleImpl'
Require stack:
- <playwright>/packages/playwright-core/src/utilsBundle.ts
- <playwright>/packages/playwright-test/lib/reporters/html.js
- <playwright>/tests/playwright-test/reporter-html.spec.ts
- <playwright>/tests/playwright-test/stable-test-runner/node_modules/@playwright/test/lib/loader.js
- <playwright>/tests/playwright-test/stable-test-runner/node_modules/@playwright/test/lib/runner.js
- <playwright>/tests/playwright-test/stable-test-runner/node_modules/@playwright/test/lib/cli.js
- <playwright>/tests/playwright-test/stable-test-runner/node_modules/playwright-core/lib/cli/cli.js
- <playwright>/tests/playwright-test/stable-test-runner/node_modules/playwright-core/cli.js
- <playwright>/tests/playwright-test/stable-test-runner/node_modules/@playwright/test/cli.js

   at ../../packages/playwright-core/src/utilsBundle.ts:20

  18 | import path from 'path';
  19 |
> 20 | export const colors: typeof import('../bundles/utils/node_modules/colors/safe') = require('./utilsBundleImpl').colors;
     |                                                                                   ^
  21 | export const debug: typeof import('../bundles/utils/node_modules/@types/debug') = require('./utilsBundleImpl').debug;
  22 | export const getProxyForUrl: typeof import('../bundles/utils/node_modules/@types/proxy-from-env').getProxyForUrl = require('./utilsBundleImpl').getProxyForUrl;
  23 | export const HttpsProxyAgent: typeof import('../bundles/utils/node_modules/https-proxy-agent').HttpsProxyAgent = require('./utilsBundleImpl').HttpsProxyAgent;

    at Object.<anonymous> (<playwright>/packages/playwright-core/src/utilsBundle.ts:20:83)
    at Object.<anonymous> (<playwright>/packages/playwright-test/src/reporters/html.ts:17:1)

```
2022-12-06 15:46:19 -08:00
Yury Semikhatsky
beb15bb504
chore: rename setup => setupMatch (#19309) 2022-12-06 14:55:22 -08:00
Yury Semikhatsky
1b3e53697b
chore: TestStorage => TestStore (#19308) 2022-12-06 13:33:43 -08:00
Dmitry Gozman
4784dae10f
fix(role): accessibleName computation should walk the flat dom tree (#19301)
- When visiting `<slot>` element, descend into assigned nodes.
- When node has `assignedSlot`, skip it during regular traversal.

Fixes #18989.
2022-12-06 09:31:26 -08:00
Yury Semikhatsky
3c1b26b9f1
feat: make storage a global variable (#19283) 2022-12-05 21:37:37 -08:00
Yury Semikhatsky
f9ef18912d
feat: use setup() instead of test() for project setup (#19281) 2022-12-05 18:15:01 -08:00
Dmitry Gozman
81c8620bfe
chore: upgrade internal types to support TypeScript 4.9.3 (#19280)
Fixes https://github.com/microsoft/TypeScript/issues/51619

Co-authored-by: Max Schmitt <max@schmitt.mx>
2022-12-05 17:22:25 -08:00
Playwright Service
84a0aaaaff
feat(chromium-tip-of-tree): roll to r1065 (#19239)
Signed-off-by: Max Schmitt <max@schmitt.mx>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2022-12-05 11:22:03 -08:00
Dmitry Gozman
0be4fa768a
fix(codegen): do not generate Promise.all (#19182)
Drive-by: fix `download`, `dialog` and `popup` signals to use different
variable names in all languages.
2022-12-02 17:33:01 -08:00
Dmitry Gozman
c547416e24
test: unflake "should highlight locators with custom testId" (#19236) 2022-12-02 17:32:29 -08:00
Andrey Lushnikov
6d82460a02
feat: implement a new image comparison function (#19166)
This patch implements a new image comparison function, codenamed
"ssim-cie94". The goal of the new comparison function is to cancel out
browser non-determenistic rendering.

To use the new comparison function:

```ts
await expect(page).toHaveScreenshot({
  comparator: 'ssim-cie94',
});
```

As of Nov 30, 2022, we identified the following sources of
non-determenistic rendering for Chromium:
- Anti-aliasing for certain shapes might be different due to the
  way skia rasterizes certain shapes.
- Color blending might be different on `x86` and `aarch64`
architectures.

The new function employs a few heuristics to fight these
differences.

Consider two non-equal image pixels `(r1, g1, b1)` and `(r2, g2, b2)`:
1. If the [CIE94] metric is less then 1.0, then we consider these pixels
   **EQUAL**. (The value `1.0` is the [just-noticeable difference] for
   [CIE94].). Otherwise, proceed to next step.
1. If all the 8 neighbors of the first pixel match its color, or
   if the 8 neighbors of the second pixel match its color, then these
   pixels are **DIFFERENT**. (In case of anti-aliasing, some of the
   direct neighbors have to be blended up or down.) Otherwise, proceed
   to next step.
1. If SSIM in some locality around the different pixels is more than
   0.99, then consider this pixels to be **EQUAL**. Otherwise, mark them
   as **DIFFERENT**. (Local SSIM for anti-aliased pixels turns out to be
   very close to 1.0).

[CIE94]: https://en.wikipedia.org/wiki/Color_difference#CIE94
[just-noticeable difference]:
https://en.wikipedia.org/wiki/Just-noticeable_difference
2022-12-02 15:22:05 -08:00
Dmitry Gozman
6471e8536e
feat(test runner): support jsconfig.json's baseUrl+paths (#19219)
Fixes #19129.
2022-12-01 16:42:25 -08:00
Max Schmitt
3565d97a36
feat(recorder): make it work with [contenteditable] (#19066)
https://github.com/microsoft/playwright/issues/19029
2022-12-01 12:41:03 -08:00
Playwright Service
dbe4362b9c
feat(firefox): roll to r1366 (#19185)
Fixes https://github.com/microsoft/playwright/issues/18307.

Signed-off-by: Max Schmitt <max@schmitt.mx>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2022-11-30 19:13:11 -08:00
Pavel Feldman
f0e8d8f074
feat(api): introduce route.fetch and route.fulfill(json) (#19184) 2022-11-30 17:26:19 -08:00
Playwright Service
f952e1147b
feat(chromium-tip-of-tree): roll to r1063 (#19070)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2022-11-30 11:11:54 -08:00
Dmitry Gozman
307a0b6ea7
fix(dotnet): codegen/docs use Name instead of NameString (#19156) 2022-11-29 20:56:18 -08:00
Pavel Feldman
5ac426b3d5
chore: expose utility script to inner evaluates (#19147) 2022-11-29 16:57:11 -08:00
Dmitry Gozman
b1b21bdac5
fix(shards): zero-sized shard should not include all tests (#19148)
Fixes #19073.
2022-11-29 16:02:11 -08:00
Zihua Li
0c6a0f40c6
feat(keyboard): support simple cut-pasting using meta+x/v (#18756) 2022-11-29 12:58:14 -08:00
Dmitry Gozman
23e02dd006
test: unflake some timeout-dependent tests (#19139) 2022-11-29 12:54:53 -08:00
Shubham Kanodia
3d804ff7cd
chore: rewrite error message for missing snapshot (#19104) 2022-11-29 12:51:15 -08:00
Dmitry Gozman
43a6bf4d45
fix(inspector): support custom test id attribute (#18996)
Fixes #18959.
2022-11-29 11:43:47 -08:00
Dmitry Gozman
4f72a895e9
fix(inspector): render expect.not correctly (#19125)
Also fixes the same in expect logs.

References #19083.
2022-11-28 20:50:16 -08:00
Max Schmitt
dd18792087
test: navigator.webdriver is set to true (#19065)
https://github.com/microsoft/playwright/issues/18307
2022-11-28 20:03:49 -08:00
Pavel Feldman
85467d1b7d
chore: generate get by title (#19119) 2022-11-28 19:55:34 -08:00
Max Schmitt
b84a7a9e57
test: fix WebKit socks proxy tests (#19035)
Fixes https://github.com/microsoft/playwright/issues/18301
2022-11-23 13:03:38 -10:00
Yury Semikhatsky
d3f41eaa47
fix(fetch): cookie with domain=localhost (#18998)
Fixes https://github.com/microsoft/playwright/issues/18362
2022-11-23 09:22:49 -08:00
Yury Semikhatsky
31d45ad4dc
chore(runner): add all setup files in separate pass (#18978) 2022-11-22 16:22:48 -08:00
Dmitry Gozman
503f8f51dc
fix(reuse): stop pending operations upon reuse/disconnect (#18997) 2022-11-22 15:21:20 -08:00
Dmitry Gozman
190ed9465f
fix(chromium): detach from shared workers (#18976)
This prevents shared workers from stalling upon restart.

We receive `Inspector.targetCrashed` and
`Inspector.targetReloadedAfterCrash` events that assume
`Runtime.runIfWaitingForDebugger` from any attached client. It is easier
and more stable to just detach from shared workers, because we do not
inspect them.

For service workers, we should actually issue
`Runtime.runIfWaitingForDebugger` in such cases, because we attach to
them.

Fixes #18932.
2022-11-22 15:20:42 -08:00
Pavel Feldman
73e7c0ed3d
fix(electron): tolerate connection closed during quit (#18993) 2022-11-22 11:50:35 -08:00
Pavel Feldman
a0ea9b5fba
chore: simplify slowmo implementation (#18990) 2022-11-22 11:06:45 -08:00
Pavel Feldman
228f78c89d
chore: render browser window in trace (#18870) 2022-11-22 08:41:52 -08:00
Yury Semikhatsky
2dc51f6c46
fix(runner): run all setup files when there is test.only (#18967) 2022-11-21 16:33:23 -08:00
Pavel Feldman
b5d756686d
fix(electron): consistently emit ready event after app is loaded (#18972)
Fixes: https://github.com/microsoft/playwright/issues/18928
2022-11-21 15:13:53 -08:00
Dmitry Gozman
8ad3bc7ff3
fix(role selector): expanded=false does not match elements without aria-expanded (#18929)
Fixes #18920.
2022-11-21 14:13:51 -08:00
Yury Semikhatsky
e1189a96b6
feat(runner): run all setup files if none matched the filter (#18922)
The behavior regarding filters (both in config, command line and .only)
is the following:
- if some of tests match and none of setup match then we'll run all
setup files and all matching tests
- otherwise the filters apply to setup files the same way as to regular
tests
2022-11-21 09:23:28 -08:00
Dmitry Gozman
941090f0c4
fix(click): account for transformed iframes (#18926)
- Properly convert coordinates for iframes with non-zero borders.
- IFrames that have `transform` anywhere in the ancestors skip
`hitPoint`-based check because we cannot reliably translate the viewport
point into frame document's coordinates.

Fixes #18245.
2022-11-18 16:51:39 -08:00
Max Schmitt
b1e2b8b629
test: fix electron tests on windows (#18927) 2022-11-18 13:44:42 -10:00
Yury Semikhatsky
c0d0f54a12
feat(runner): allow filtering setup and tests (#18900)
Running `npx playwright test file:123` will have the following behavior
- if only test files match then only matching subset of tests will run
but all setup files will run as well
- if only setup files match the filter then only those setup tests will
run
- if both setup and test files match an error will be thrown
2022-11-18 11:35:29 -08:00
Diego Pino
b6ececf6e5
test: check channel is not null (#18908) 2022-11-18 06:12:55 -10:00
Dmitry Gozman
1ec0bb277d
feat(expect): ensure at least one expectation check, no matter the timeout (#18895)
References #18859.
2022-11-17 19:43:10 -08:00
Yury Semikhatsky
0f4b67bc6d
test(cli): setup files are in list-files and test --list output (#18890) 2022-11-17 16:31:04 -08:00