Commit Graph

1422 Commits

Author SHA1 Message Date
Yury Semikhatsky
4db5677e11
test: scroll and click with smooth scroll behavior (#13884) 2022-05-04 10:11:02 -07:00
Max Schmitt
0c2371cba9
tests: typo in tests and redundant tc (#13931) 2022-05-04 17:44:50 +01:00
Dmitry Gozman
9e0aa67d28
feat(codegen): brush up context options in pytest codegen (#13924) 2022-05-04 11:14:53 +01:00
Ronie Martinez
2c597f06bd
feat(codegen): pytest support in codegen (#13746)
feat(codegen): pytest support in codegen
2022-05-04 09:41:20 +01:00
Ross Wollman
fee35346f7
chore: increase timeout for component tests (#13913) 2022-05-03 22:04:43 -07:00
Pavel Feldman
214117c9c5
clean: speed up ct (#13915) 2022-05-03 21:25:50 -07:00
Pavel Feldman
13224d1c9f
chore: restore component testing options (#13910) 2022-05-03 15:48:46 -07:00
Pavel Feldman
29fd1d86df
chore: hide plugins for now (#13908) 2022-05-03 14:25:56 -07:00
Dmitry Gozman
85b86e19b8
feat(expect): ensure it works in global setup (#13896) 2022-05-03 21:53:15 +01:00
Max Schmitt
b5183b4cf9
chore: make React selectors work on React 18 (#13864)
Fixes #13845
2022-05-03 13:46:52 -07:00
Ross Wollman
c4af7f2fc8
fix: unbreak installation tests, include in primary CI runs (#13903) 2022-05-03 12:48:35 -07:00
Pavel Feldman
19ce4e3514
chore: refactor web server plugin to extract legacy (#13904) 2022-05-03 11:47:37 -07:00
Dmitry Gozman
ef32069299
chore: small test runner changes in preparation of global fixtures (#13899)
The main change is splitting up options from the config from other
fixtures to ensure unique location for them.
2022-05-03 15:19:27 +01:00
Ross Wollman
c15462d44c
chore: remove defunct GlobalInfo.attach test (#13895) 2022-05-03 14:18:16 +01:00
Dmitry Gozman
54dd6d01e5
feat(locator): layout options (leftOf, rightOf, above, below, near) (#13821)
This also includes corresponding selector engines `left-of` and others,
modeled after existing `has` selector engine.
2022-05-03 10:33:33 +01:00
Ross Wollman
3b3cad7d69
feat: rewrite gitCommitInfo plugin, drop GlobalInfo & attachments (#13837) 2022-05-02 16:28:14 -07:00
Yury Semikhatsky
ed344a882b
fix: delete headers with undefined value (#13880) 2022-05-02 12:38:57 -07:00
Yury Semikhatsky
539546ab74
test: can delete origin header in route.continue (#13879) 2022-05-02 12:38:33 -07:00
Dmitry Gozman
d87de8c52c
fix(test runner): restore --headed flag (#13872) 2022-05-02 16:55:14 +01:00
Pavel Feldman
1ffd18f131
fix(test): fix plugins test on win (#13860) 2022-04-30 22:30:06 -07:00
Pavel Feldman
a1b10c3856
chore: try serializing the config instead of requiring it in the worker (#13839) 2022-04-29 16:05:08 -07:00
Dmitry Gozman
dc3f2d26c4
docs: add details to the element screenshot methods (#13847) 2022-04-29 17:36:09 +01:00
Ross Wollman
4984878411
fix: await plugin.configure (#13834) 2022-04-28 16:22:20 -07:00
Ross Wollman
f486ce8c06
feat(plugins): add webServer implementation (#13779) 2022-04-28 15:08:10 -07:00
Ross Wollman
45972a0b6a
feat: add name for plugins (#13826)
Useful for debugging and eventually for reporters to give status updates on which phase of which plugin they are currently running.
2022-04-28 11:43:39 -07:00
Ross Wollman
e124d926ee
test: log more phases of plugins (#13825) 2022-04-28 11:22:09 -07:00
Pavel Feldman
e756528ad2
feat(plugins): expose suite to plugin setup (#13807) 2022-04-28 08:16:17 -07:00
Ross Wollman
22bc16ce7d
test: add plugin event order spec (#13802) 2022-04-27 18:34:18 -07:00
Pavel Feldman
a01b65bedd
chore: drop the legacy global setup mode (#13803) 2022-04-27 18:01:37 -07:00
Yury Semikhatsky
5588defa22
test: content that does not work without useInnerText (#13781) 2022-04-27 15:48:38 -07:00
Dmitry Gozman
38fdc5fe24
fix(selectors): refactor chaining logic (#13764)
This fixes a few issues:
- strict mode was producing false negatives if multiple query paths
  lead to the same element being picked;
- in some cases the number of intermediate items in the list was
  exponential and crashed quickly.

What changed:
- `visible` engine is a real engine now;
- `capture` selectors are transformed to `has=` selectors for
  easier implementation;
- chained querying switched from a list to a set to avoid
  exponential size.
2022-04-27 20:51:57 +01:00
Dmitry Gozman
3aba94dbef
chore: remove unnecessary types from overrides-test (#13794) 2022-04-27 16:14:37 +01:00
Max Schmitt
a0c24c01c8
chore: fix docs links for .NET roll (#13787) 2022-04-27 16:06:30 +02:00
Pavel Feldman
bc6f8e1f20
feat(poll): expose custom poll interval (#13776) 2022-04-26 21:32:38 -07:00
Pavel Feldman
2bc36794d1
chore: vite all frameworks (#13780) 2022-04-26 16:15:08 -07:00
Ross Wollman
3e84ab4701
test: run installation tests on all major platforms (#13742) 2022-04-26 11:09:49 -07:00
Dmitry Gozman
c0f0979055
fix(frames): networkidle for iframes with quirky urls (#13767) 2022-04-26 17:13:45 +01:00
Dmitry Gozman
1b159273ea
test: fix "should scroll zero-sized element into view" on headed (#13766)
Need to force-hide scrollbars.
2022-04-26 16:26:53 +01:00
Dmitry Gozman
39cfa2b6e3
test: switch temp dir tests to use userDataDir (#13745) 2022-04-26 09:32:58 +01:00
Ross Wollman
3ccac5b84d
fix: installation tests on Node.js 18 (#13744) 2022-04-25 13:24:11 -07:00
Dmitry Gozman
97750ccf9a
feat: locator.that (#13731)
Filters existing locator by options, currently `has` and `hasText`.
2022-04-25 20:06:18 +01:00
Yury Semikhatsky
aab1a746d3
fix: join individual css selectors by > in cssFallback (#13712) 2022-04-25 11:11:24 -07:00
Pavel Feldman
5e51c17d41
chore: use plugin story for components (#13717) 2022-04-25 10:40:58 -07:00
Ross Wollman
e69e836c40
chore: port installation tests to @playwright/test (#13644) 2022-04-25 09:30:14 -07:00
Yury Semikhatsky
2e6ef8f622
fix(runner): fail if worker cannot find some of the tests (#13666) 2022-04-25 09:05:40 -07:00
Dmitry Gozman
8e5854033a
fix: types generation for attach and GlobalInfo (#13727) 2022-04-25 13:56:37 +01:00
Dmitry Gozman
d2bdb1d7cf
docs: explain label retargeting in selectors doc and some input actions (#13725) 2022-04-25 13:55:41 +01:00
Dmitry Gozman
01a8977b4d
feat: make scrollIntoView work with zero-sized elements (#13702)
We skip waiting for "visible" state that enforces non-zero size.
Other invisible conditions like "display:none" fail during the
actual "scrolling" step and will retry.
2022-04-23 21:48:36 +01:00
Yury Semikhatsky
0839817ff2
test: delete should not hang in exposeBinding test (#13705) 2022-04-22 12:16:12 -07:00
Ross Wollman
3eac9c694c
fix(test-runner): mark attach as async (#13687)
Also brings back generation of experimental types as part of lint.
2022-04-22 09:27:02 -07:00
Max Schmitt
ca4cfca8ad
chore: make tests pass on Node.js 17+ (#13678) 2022-04-22 13:42:52 +02:00
Pavel Feldman
3d4caab153
chore: move playwright gallery into a subfolder (#13695) 2022-04-21 21:07:43 -07:00
Yury Semikhatsky
801dbe0699
fix(oopif): dispose child sessions when frame session is disposed (#13693) 2022-04-21 18:32:56 -07:00
Pavel Feldman
5990eb6074
chore: use vite plugin for registry (#13658) 2022-04-21 17:30:17 -07:00
Pavel Feldman
f3ba9f30fc chore: follow up to #13626, fix compilation 2022-04-19 13:33:05 -07:00
Yury Semikhatsky
0a401b2d86
docs: clarify semantics of redirected response (#13636) 2022-04-19 09:36:38 -07:00
Andrey Lushnikov
88a9262dbb
fix: resolve WebServer cwd dir wrt configDir (#13626)
Drive-by: speed-up webserver tests by not waiting 750ms to start it.

Fixes #13115
2022-04-19 07:45:36 -07:00
Andrey Lushnikov
a617604962
test: make sure toHaveScreenshot doesn't tolerate bad option values (#13627)
Fixes #13495
2022-04-19 07:43:18 -07:00
Andrey Lushnikov
80bc532874
fix: support undo/redo editing commands (#13606)
Fixes #13601
2022-04-18 22:22:52 -07:00
Pavel Feldman
7989427ea6
chore: bundle core deps (#13621) 2022-04-18 20:20:49 -07:00
Pavel Feldman
63ea81ec54
chore: make bundles typed (#13620) 2022-04-18 17:50:25 -07:00
Yury Semikhatsky
ed0dcdabc9
docs: clarify toBeDisabled behavior (#13616) 2022-04-18 17:06:01 -07:00
Pavel Feldman
58d79e5e4d
chore: add core utils bundle (#13615) 2022-04-18 13:47:23 -07:00
Pavel Feldman
eafb92f6a3
chore: embed expect types (#13609) 2022-04-18 10:54:40 -07:00
Pavel Feldman
5f843c347d
chore: bundle pixelmatch, it has not changed for 2 years (#13585) 2022-04-15 16:58:31 -07:00
Yury Semikhatsky
7ffce1da53
chore: remove PlaywrightClient and Docker factory (#13571) 2022-04-15 12:11:38 -07:00
Dmitry Gozman
02aa4fe617
chore: generate types for TestProject/TestConfig (#13574) 2022-04-15 10:27:38 -07:00
Dmitry Gozman
2f570fa586
test: remove stray logging (#13572) 2022-04-14 16:58:09 -07:00
Dmitry Gozman
189a5fa0f8
chore: freez FullProject public type (#13570)
This is similar to FullConfig.
Properties `expect` and `fullyParallel` are not exposed.
2022-04-14 16:58:01 -07:00
Dmitry Gozman
022f83d3b4
test: run "should remove temp dir on process.exit" on windows (#13568) 2022-04-14 16:07:03 -07:00
Yury Semikhatsky
aee6ba299a
chore: remove GridClient, run only page tests in service mode (#13566) 2022-04-14 15:30:04 -07:00
Wojciech Jureczka
7ba527c65f
chore: expose JSON Reporter types (#13241)
Resolves #13208
2022-04-14 13:55:29 -07:00
Dmitry Gozman
c86c2e8762
feat: restore toHaveScreenshot as experimental feature (#13549)
- Restore docs.
- Make `TestConfig.expect` generated.
- Allow experimental properties with "e" marker: `- foo e<float>`.
2022-04-14 13:22:42 -07:00
Ross Wollman
11179982fc
chore: force localPaths to be resolved (#13544) 2022-04-14 11:19:36 -07:00
Max Schmitt
584140f97a
fix: make fetch api work with connectOverCDP (#13521) 2022-04-14 12:53:49 +02:00
Dmitry Gozman
20dcc45afa
feat: support experimental doc entries (#13446)
feat: support experimental doc entries

- Params/options/members are marked as experimental in the docs.
- `experimental.d.ts` is generated that contains all types and
  includes experimental features.
- `experimental.d.ts` is references in our tests so that we
  can test experimental features.
- `fonts` option is restored as experimental.
2022-04-13 16:13:30 -07:00
Dmitry Gozman
166675b9c1
feat(test): more information about timing out fixtures (#13546)
- Always show a fixture that was running during timeout.
- Give custom titles to built-in fixtures.
- Specify setup/teardown fixture phase in the message.
- Split connect vs launch browser fixtures for better naming.

Example timeout message:

```log
Timeout of 2000ms exceeded while running fixture "built-in playwright configuration" teardown.
```
2022-04-13 15:13:31 -07:00
Dmitry Gozman
7a5b070e95
fix(type): focus switch between contenteditables in shadow dom (#13510)
Firefox has a bug: calling `node.focus()` does make the node focused,
but some internal "current contenteditable node" is not changed.
Blurring the previous one and focusing the new one helps.
2022-04-12 16:44:27 -07:00
Dmitry Gozman
2a97ad2487
test: check that we remove temp directories on process exit (#13494) 2022-04-12 12:28:33 -07:00
Dmitry Gozman
1e1df6395f
chore: generate expect types (#13439) 2022-04-11 10:42:19 -07:00
Yury Semikhatsky
9b07ca5050
test: reenable "should restore state from userDataDir" (#13475) 2022-04-11 09:08:40 -07:00
Ross Wollman
cdb68448e1
test: fix broken GlobalInfo.attach Windows test (#13441) 2022-04-08 17:48:01 -07:00
Dmitry Gozman
f6ccd4847e
fix(test runner): default workerIndex to -1 (#13440) 2022-04-08 15:23:23 -07:00
Ross Wollman
1af32e400f
feat(test-runner): introduce GlobalInfo (#13083) 2022-04-08 13:22:14 -07:00
Pavel Feldman
f0156d057e
chore: flatten supplements (#13437) 2022-04-08 12:52:40 -07:00
kaivean
d65263f151
feat(android): allow getting webviews by socket name (#13248) 2022-04-08 20:52:16 +02:00
github-actions[bot]
d91349f22a
feat(webkit): roll to r1629 (#13407) 2022-04-08 11:50:53 -07:00
Pavel Feldman
845e32cbb8
chore: use utils via index export (6) (#13417) 2022-04-07 21:48:41 -07:00
Pavel Feldman
e79b90f454
chore: use utils via index export (5) (#13413) 2022-04-07 20:18:22 -07:00
Dmitry Gozman
155bb7fcae
fix: wait for cleanup on double SIGINT (#13411)
This is a speculative fix to leftover tmp directories.
When users issues SIGINT twice, we enter `gracefullyClose()`
twice, and shortcut the second time. It turns out, we do
not wait for directories removal.

Note: it is unknown how often we reach this codepath in practice.
2022-04-07 19:20:54 -07:00
Max Schmitt
eaab6406cd
chore: skip android driver omitDriverInstall test (#13410) 2022-04-08 02:14:34 +02:00
Pavel Feldman
a3c02222bf
chore: use utils via index export (4) (#13404) 2022-04-07 14:36:13 -07:00
Pavel Feldman
40d5e3a3c9
chore: use utils via index export (3) (#13403) 2022-04-07 13:55:44 -07:00
Max Schmitt
5536e64538
feat(test-runner): support filtering by columns (#13401) 2022-04-07 22:45:45 +02:00
Dmitry Gozman
1dc2d02d35
chore: roll stable-test-runnner to apr-07 (#13374) 2022-04-07 14:58:04 +02:00
Pavel Feldman
bde7bf4ea9
chore: move registry & dispatchers to under server (#13370) 2022-04-06 22:21:27 -07:00
Pavel Feldman
5ae2017a5b
chore: always import type (#13365) 2022-04-06 14:57:14 -07:00
Ivan Kaliada
424de6c38f
fix: resolve ts compilerOptions.paths with prefixes and suffixes (#13105) 2022-04-06 14:14:03 -07:00
Pavel Feldman
f3bd910820
chore(test-runner): rewrite poll, soft, wrap (#13335) 2022-04-05 17:47:35 -07:00
Dmitry Gozman
4bb563b015
fix(expect): proper return types (#13334)
A few changes:
- `Matchers<R, T>` now carries both return and argument type.
- Based on the argument type, we apply playwright-specific Page/Locator matchers.
- Return type is usually void, unless wrapped with `expect.resolves`,
  `expect.rejects` or `expect.poll()`.
- To preserve compatibility with any extended types in the wild,
  argument type is optional.
2022-04-05 16:11:11 -07:00
Pavel Feldman
6ca58e18cb
fix(electron): better support for custom schemas (#13329) 2022-04-05 16:10:12 -07:00
Dmitry Gozman
e31a5b690a
chore: unrelease toHaveScreenshot and screenshotsDir (#13304) 2022-04-05 08:34:51 -07:00
Pavel Feldman
5c282e50a9
fix(svelte-ct): remove layout reset example (#13306) 2022-04-04 17:49:40 -07:00
Dmitry Gozman
a09b8dfa36
chore: unrelease 'fonts' screenshot option (#13300) 2022-04-04 14:51:11 -07:00
Ross Wollman
8a6b640fca
test: mark enum babel test as failing (#13282) 2022-04-04 12:49:39 -07:00
Pavel Feldman
8232497c88
feat(electron): expose app process(), detach on exit (#13280) 2022-04-04 11:50:46 -07:00
Ross Wollman
3636d8548f
chore: fix lint (#13279) 2022-04-03 21:22:47 -07:00
Ross Wollman
014deed913
test: repro enums in tsx undefined (#13272)
The enums imported from the .tsx file are ending up as "undefined";
from the .ts file they are defined.

Repro for #13265.
2022-04-03 21:12:00 -07:00
Pavel Feldman
b0103566c9
fix(addInitScript): tolerate trailing comments (#13275) 2022-04-03 18:47:12 -07:00
kaivean
5d2e8918d8
feat(android): add androidDevice.options.omitDriverInstall (#13249) 2022-04-02 16:00:38 -07:00
Pavel Feldman
66cf82766e
test(html-reporter): add image diff tests (#13262) 2022-04-01 18:11:15 -07:00
Pavel Feldman
55ee41c848
feat(html): render image diff slider (#13257) 2022-04-01 15:27:51 -07:00
Ross Wollman
12abae7f31
feat(test-runner): friendly expect errors for typos (#13229)
If you typo'd an `expect` property, you got a cryptic error message:

```
Uncaught TypeError: Cannot create proxy with a non-object as target or handler
```

Now we get this nice friendly message:

```
  1) a.spec.ts:6:9 › explodes ======================================================================

    Error: expect: Property 'toBeLessThen' not found.

    Did you mean 'toBeLessThan'?

    See https://playwright.dev/docs/test-assertions for available options and documentation.

      5 |         const { test } = pwt;
      6 |         test('explodes', () => {
    > 7 |           expect.soft(1).toBeLessThen();
        |           ^
      8 |         });
      9 |

```

Fixes #13218
2022-04-01 13:38:22 -07:00
Dmitry Gozman
fee9b6007f
test: fix windows paths in golden.spec (#13258) 2022-04-01 13:12:29 -07:00
Ross Wollman
16efbdef98
chore: remove/rename FullConfig._attachments (#13233)
This was originally introduced in #12734.

It will be replaced with GlobalInfo (#13083), but not before the 1.21
release.
2022-04-01 12:36:05 -07:00
Ross Wollman
e5ba0d6846
test: ensure tests do not run after globalSetup fail (#13255)
Resolves #13244
2022-04-01 12:35:25 -07:00
Dmitry Gozman
a200fe3528
feat(screenshot): rename "size" option to "scale" (#13254)
Drive-by: fix `caret` handling in `toHaveScreenshot`.
2022-04-01 12:28:40 -07:00
Dmitry Gozman
356fc35b85
feat(role selector): allow unquoted name attribute (#13224)
- This supports `role=button[name=Hello]` similarly to CSS selectors.
- Does not change `_react` or `_vue` behavior that insist on quoting the string.
- Uses CSS notion of "identifier" characters.
2022-04-01 10:08:02 -07:00
Yury Semikhatsky
7d7fe3c618
fix(route): remove cors option, compare origin (#13231) 2022-03-31 19:21:21 -07:00
Dmitry Gozman
9fc95dda84
fix(screenshot): do not stall on hideHiglight attempt 2 (#13222)
It turns out that "non stalling evaluate" can stall in Chromium
in some weird conditions, like `document.open` after some weird
`iframe.src` value.

We now only hide highlight in those frames where we did install
highlight in the first place.
2022-03-31 15:33:29 -07:00
Pavel Feldman
6a463195c4
chore: allow multiple image diffs (#13202) 2022-03-31 14:11:34 -07:00
Pavel Feldman
0346b5204b
chore: roll test runner to next (#13220) 2022-03-31 14:11:11 -07:00
Dmitry Gozman
e5182259b1
feat(role selector): docs and minor fixes (#13203)
- Added docs to `selectors.md`.
- `[pressed]` and `[checked]` do not match `"mixed"` states.
- Disallow `[name]` shorthand without a value.
- Renamed `includeHidden` to `include-hidden`.
2022-03-31 13:06:39 -07:00
Pavel Feldman
923f74c5a6
chore: allow matchers decorate step title (#13199) 2022-03-30 21:52:00 -07:00
Pavel Feldman
42f260c688
chore: prepare image diff for refactornig (#13197) 2022-03-30 17:42:08 -07:00
Dmitry Gozman
a8d4a8aa52
fix(text selector): ignore non-leading quote when parsing (#13170)
Previously, any unpaired quote in the text selector "escaped"
everything till the end of the selector string, and so any
subsequent chained selectors, including ">>" separator were ignored.

An example of misbehaving selector: `text=19" >> nth=1`.

Now, when text selector contains a non-leading quote, selector parser
does not assume it should escape ">>" separator and correctly
tokenizes all selectors from the chain.

Note that this behavior is a workaround for the fact that our
text selectors is somewhat poorly defined in this area. That said,
this workaround seems to be safe enough. It still does not work for
unpaired leading quotes like this: `text="19 >> nth=1`.
2022-03-30 09:33:32 -07:00
Pavel Feldman
81e7c0a77c
chore(html-report): render metainfo as a chip (#13166) 2022-03-29 18:13:08 -07:00
Andrey Lushnikov
a9989852d5
feat(vrt): new option "caret" for taking screenshots (#13164)
This has two values:
- `"hide"` to hide input caret for taking screenshot
- `"initial"` to keep caret behavior unchanged

Defaults to `"hide"`.

Fixes #12643
2022-03-29 17:48:13 -07:00
Pavel Feldman
5e17ed137b
fix(html-report): only invoke git once (#13165) 2022-03-29 15:49:58 -07:00
Dmitry Gozman
eb09306db2
feat(connect): add connectOptions.timeout (#13163) 2022-03-29 15:03:43 -07:00
Andrey Lushnikov
aa1daeba85
fix(html): put HTML report next to package.json by default (#13141)
Fixes #12970
2022-03-29 14:19:31 -07:00
Dmitry Gozman
6b48631eed
feat(role): add more tests for accessible name (#13154) 2022-03-29 11:59:44 -07:00
Pavel Feldman
1961959dcb
chore: migrate injected scripts to esbuild (#13143) 2022-03-28 23:10:17 -07:00
Dmitry Gozman
de0af27837
feat(test runner): show last tests in the worker on teardown error (#13139) 2022-03-28 19:58:24 -07:00
Dmitry Gozman
d59c2b996f
fix(parallel): minimize the number of beforeAll/afterAll hooks in parallel mode (#13138)
Previously, we always formed groups consisting of a single test.
Now, we group tests that share `beforeAll`/`afterAll` hooks into
`config.workers` equally-sized groups.
2022-03-28 16:10:32 -07:00
Ross Wollman
13dedd27ca
test: out-of-viewport should be considered visible (#13134)
Closes #13131.

Per the visibility spec on https://playwright.dev/docs/next/actionability#visible:

> Element is considered visible when it has non-empty bounding box and does not have visibility:hidden computed style. Note that elements of zero size or with display:none are not considered visible.

 non-empty bounding box
 does not have visibility:hidden

Given the above conditions are satisfied, the locator is considered visible.

https://github.com/microsoft/playwright/issues/8740 proposes something like `isInViewport()` that would be better suited for checking if an element is offscreen.
2022-03-28 16:10:16 -07:00
Dmitry Gozman
01a39e5b4c
test(role): add tests for implicit role calculation (#13132) 2022-03-28 15:22:50 -07:00
Philip Sanetra
be41c4a35d
fix(registry): Fix support for generic-linux (#13129)
Fixes https://github.com/microsoft/playwright/issues/13128
2022-03-28 14:50:56 -07:00
Dmitry Gozman
9420a53939
fix(esm): make sure import from './foo.js' is supported (#13137)
Drive-by: migrate all @esm tests to esm.spec.ts.
2022-03-28 14:37:46 -07:00
Dmitry Gozman
8c19f71c36
feat(selectors): role selector engine (#12999)
This introduces `role=button[name="Click me"][pressed]` attribute-style
role selector. It is only available under `env.PLAYWRIGHT_EXPERIMENTAL_FEATURES`.

Supported attributes:
- `role` is required, for example `role=button`;
- `name` is accessible name, supports matching operators and regular expressions:
  `role=button[name=/Click(me)?/]`;
- `checked` boolean/mixed, for example `role=checkbox[checked=false]`;
- `selected` boolean, for example `role=option[selected]`;
- `expanded` boolean, for example `role=button[expanded=true]`;
- `disabled` boolean, for example `role=button[disabled]`;
- `level` number, for example `role=heading[level=3]`;
- `pressed` boolean/mixed, for example `role=button[pressed="mixed"]`;
- `includeHidden` - by default, only non-hidden elements are considered.
   Passing `role=button[includeHidden]` matches hidden elements as well.
2022-03-28 09:24:58 -07:00
Pavel Feldman
1471bb7177
fix(tests): remove lock from component tests, test real experience (#13095) 2022-03-26 13:54:33 -07:00
Pavel Feldman
a4a2d41705 fix(tests): fix selenium installation tests 2022-03-26 08:36:25 -07:00
Pavel Feldman
a58707b8a6
chore: group tests under tests/ (2) (#13082) 2022-03-25 23:09:02 -07:00
Pavel Feldman
a454328c25
fix(test): follow up to tests refactoring (#13085) 2022-03-25 22:11:29 -07:00
Pavel Feldman
02cac8a066
chore: group tests under tests/ (1) (#13081) 2022-03-25 16:05:50 -07:00
Yury Semikhatsky
5734c18ef8
feat(route): add cors header in route.fulfill (#12943) 2022-03-25 14:56:57 -07:00
Pavel Feldman
6b81e76c2b
chore: migrate trace-viewer and recorder to vite (#13076) 2022-03-25 14:12:00 -07:00
Yury Semikhatsky
97e8ead57c
feat: large files upload in ff and wk (#12937) 2022-03-25 13:26:12 -07:00
Ross Wollman
ddc2cd4a3e
test: mark flaky proxy tests (#13050) 2022-03-24 14:50:59 -07:00
Max Schmitt
1797c5c249
chore(test-runner): support self signed certificate in webServer (#13032) 2022-03-24 17:30:52 +01:00
Dmitry Gozman
91408f2c5e
fix(storageState): provide nice error message for storage state issues (#13019) 2022-03-24 07:33:51 -07:00
Dmitry Gozman
3688e74e3e
fix(list mode): print errors to stderr (#13016)
`--list` mode now prints any errors encountered during test collection,
for example syntax errors, to `stderr`.
2022-03-24 07:33:33 -07:00
Andrey Lushnikov
e1700bd167
feat: use package.json directory as a default for outputDir (#12942)
This patch:
- starts using directory of `package.json` to resolve default
  output directory path
- starts using either `package.json` directory or configuration
  directory to resolve all relative paths

References #12970
2022-03-23 16:05:49 -07:00
Ross Wollman
39376cccd8
fix: allow unnamed cookies (#12991)
Fixes #12808.
2022-03-23 15:50:43 -07:00
Xiaoxing Ye
04e9d2ec08
test(test-runner): fix reporter-list test cannot be run on win32 vscode (#12951) 2022-03-23 11:48:05 +01:00
Dmitry Gozman
722302799e
feat(selectors): support regular expressions in attribute selectors (#12960)
Supports inline regex in addition to string: `_react=BookItem[author = /Ann?a/i]`.
This is similar to `text=` selector, but applies to `_react` and `_vue`
selectors. In the future, will also apply to `role=` selector.
2022-03-22 17:00:56 -07:00
Ross Wollman
541fb39a51
feat(html-reporter): add report context header (#12734)
Resolves #11318.

* Adds `TestConfig.attachments` public API. (We opted to not implement an analog to the async `TestInfo.attach(…)` API.)
* Adds `TestConfig.attachments` to common reporters.
* Dogfoods some git and CI-info inference to generate useful atttachments
* Updates HTML Reporter to include a side bar to present a pre-defined set of attachments (a.k.a git/commit context sidebar)

Here's what it looks like:

<img width="1738" alt="Screen Shot 2022-03-21 at 3 23 28 PM" src="https://user-images.githubusercontent.com/11915034/159373291-8b937d30-fba3-472a-853a-766018f6b3e2.png">

See `tests/playwright-test/reporter-html.spec.ts` for an example of usage (for dogfood-ing only). In the future, if this becomes user-facing, there the Global Setup bit would likely become unnecessary (as would interaction with attachments array); there would likely just be a nice top-level config and/or CLI flag to enable collecting of info.
2022-03-22 16:28:04 -07:00
Brian Rhoten
fb83d4b42c
fix(codegen): do not consider empty attributes for selector generation (#12880)
Co-authored-by: Brian Rhoten <brhoten@appriss.com>
2022-03-22 13:56:33 -07:00
Max Schmitt
d8ab76bf64
chore: throw when a Promise was passed to toMatchSnapshot (#12906) 2022-03-22 16:36:09 +01:00
Dmitry Gozman
4b877213a1
fix(tracing): preserve control values without modifying DOM (#12939)
Previously, we preserved input/textarea values by providing
`value` attribute or text child. This produces DOM that does not
actually match the original page.

This change starts using special attributes to modify values
directly when rendering.

Same treatment is also applied to options in `select` and
`checked` property of checkboxes and radio buttons.
2022-03-21 18:51:48 -07:00
Dmitry Gozman
dea6528c0c
feat(aria): introduce role utils (#12916)
This includes aria role and accessible name computation.
Accessible name is covered by wpt tests.
2022-03-21 17:26:45 -07:00
Andrey Lushnikov
7f51336068
fix: allow toMatchSnapshot to use text comparator for text data (#12934)
This was regressed awhile ago.

In v1.17 we shipped the following code: 30e15ad36f/packages/playwright-test/src/matchers/golden.ts (L122-L131)

`toMatchSnapshot` should fallback to text comparator in case of
unknown extension and string data.

Fixes #12862
2022-03-21 16:42:21 -07:00
Andrey Lushnikov
c18077c0de
feat(toHaveScreenshot): align screenshot generation & comparison (#12812)
This patch aligns the strategies that are used to generate new
screnshot expectations and to compare screenshot expectations against
baseline.

With this patch, `toHaveScreenshot` will:
- when generating a new expectation: will wait for 2 consecutive
  screenshots to match and accept the last one as expectation.
- when given an expectation:
  * will compare first screenshot against expectation. If matches,
    resolve successfully
  * if first screenshot doesn't match, then wait for 2 consecutive
    screenshots to match and then compare last screenshot with the
    expectation.

An example of a new detailed call log:

```
  1) a.spec.ts:3:1 › should work ===================================================================

    Error: Screenshot comparison failed:

      20000 pixels (ratio 0.03 of all image pixels) are different

    Call log:
      - expect.toHaveScreenshot with timeout 5000ms
      -   verifying given screenshot expectation
      - fast-path: checking first screenshot to match expectation
      - taking page screenshot
      -   disabled all CSS animations
      -   waiting for fonts to load...
      -   fonts in all frames are loaded
      - fast-path failed: first screenshot did not match expectation - 20000 pixels (ratio 0.03 of all image pixels) are different
      - waiting for 2 consecutive screenshots to match
      - waiting 100ms before taking screenshot
      - taking page screenshot
      -   disabled all CSS animations
      -   waiting for fonts to load...
      -   fonts in all frames are loaded
      - 2 consecutive screenshots matched
      - final screenshot did not match expectation - 20000 pixels (ratio 0.03 of all image pixels) are different
      - 20000 pixels (ratio 0.03 of all image pixels) are different

    Expected: /Users/andreylushnikov/tmp/test-results/a-should-work/should-work-1-expected.png
    Received: /Users/andreylushnikov/tmp/test-results/a-should-work/should-work-1-actual.png
        Diff: /Users/andreylushnikov/tmp/test-results/a-should-work/should-work-1-diff.png

      3 | test('should work', async ({ page }) => {
      4 |   await page.goto('file:///Users/andreylushnikov/prog/playwright/tests/assets/rotate-z.html');
    > 5 |   await expect(page).toHaveScreenshot();
        |                      ^
      6 | });
      7 |
```
2022-03-21 15:10:33 -07:00
Pavel Feldman
e044bae888
chore: make count() work with _vue selectors (#12899) 2022-03-18 21:22:33 -07:00
Dmitry Gozman
85b01056b6
fix(click): workaround elementsFromPoint issue in Chromium (#12888)
Block elements inside elements are not returned correctly
from `document.elementsFromPoint(x, y)` in some cases.
See https://bugs.chromium.org/p/chromium/issues/detail?id=1307458 for details.
2022-03-18 18:20:48 -07:00
Pavel Feldman
98ed81dc00
chore: do not initialize full sessions for pages used in session restore (#12886) 2022-03-18 18:17:37 -07:00
Pavel Feldman
4aaa63beaa
test: add a test for #12837 (#12838) 2022-03-18 18:09:59 -07:00
Andrey Lushnikov
cfe92e1608
feat(test-runner): implement expect.poll (#12815)
This patch implements `expect.poll()` method that polls given
predicate until a given synchronous predicate completes.

Usage:

```js
// wait until page gets 3 frames.
await expect.poll(() => page.frames().length, {
  timeout: 1000,
  message: 'custom error message',
}).toBe(3);
```

Fixes #10235
2022-03-18 16:31:26 -07:00
Dmitry Gozman
009185bb89
fix(test runner): do not print fixture location without a separate timeout (#12894)
Otherwise, user randomly sees some "extend" calls that have no real meaning.
2022-03-18 16:09:41 -07:00
Dmitry Gozman
209bde5000
feat(test runner): descrbe.skip (#12865)
`describe.skip` declares a test group that is skipped.
2022-03-18 16:07:11 -07:00
Max Schmitt
dd32956ccc
chore: improve handling with missing xserver (#12724) 2022-03-18 22:39:11 +01:00
Andrey Lushnikov
bb756c5b23
test: mark webkit ubuntu fonts test as fixme (#12885)
References https://github.com/microsoft/playwright/issues/12839
2022-03-18 09:35:41 -07:00
Yury Semikhatsky
a8d80621b2
feat(chromium): large file uploads (#12860) 2022-03-18 09:00:52 -07:00
Dmitry Gozman
3a009531b1
feat(hooks): add a step per hook (#12867)
It is now possible to see which hooks were run in the html report.
2022-03-17 19:33:01 -07:00
Pavel Feldman
c7d6f96328
chore: disambiguate internal flags (#12866) 2022-03-17 18:27:33 -07:00
Dmitry Gozman
25483452c0
feat(fixtures): per-fixture timeout (#12751)
By default, fixtures share timeout with the test they are instantiated for.
However, for more heavy fixtures, especially worker-scoped ones, it makes
sense to have a separate timeout.

This introduces `{ timeout: number }` option to the list of fixture options
that opts the fixture into a dedicated timeout rather than sharing it
with the test.
2022-03-17 09:36:03 -07:00
Max Schmitt
e231db1810
chore: restore expect.any()/expect.anything() (#12820) 2022-03-16 21:34:41 +01:00
Dmitry Gozman
f8c4cb3d24
fix(screenshot): do not stall on hideHighlight (#12764) 2022-03-15 14:13:45 -07:00
Andrey Lushnikov
88610c8b4c
fix: properly define apiName for web-first assertions (#12706)
Turns out relying on PWTRAP in stack is not reliable: depending on the
call structure, the stack might be cut unpredictably by Node.js.

This patch removes PWTRAP and instead plumbs explicit stack and
pre-set `apiName` all the way down to `wrapApiCall`.
2022-03-14 18:01:13 -07:00
Dmitry Gozman
237954212c
Revert "feat(line reporter): show stats, handle tty" (#12735)
This reverts commit be817d1a53, PR #12695.
Reason: found issues with stdout messing with stats.
2022-03-14 10:37:43 -07:00
Max Schmitt
adcd32fc6e
fix(expect): toHaveCSS with custom CSS properties (#12709) 2022-03-12 09:32:40 -08:00
Andrey Lushnikov
acae63c409
test: skip fonts test on Windows (#12708)
This test requires windows-specific test expectations. We'll use
it as a playground for the rebaseline workflow.

References #12707
2022-03-12 00:14:56 -08:00
Andrey Lushnikov
ef4b34fb7a
feat(toHaveScreenshot): enhance messaging in case of failures (#12677)
This patch:
- adds call logs to track screenshot timeouts, e.g. due to
  waiting for web fonts
- makes sure all snapshot expectations have `.png` extension
- throws a polite error when given a buffer or a string instead of a
  page or a locator
- removes stray NL between error description and call log
- makes sure `apiName` is always correct (and adds a test for it)
2022-03-11 22:40:28 -08:00
Dmitry Gozman
be817d1a53
feat(line reporter): show stats, handle tty (#12695)
- Line reporter now shows stats in addition to the test name:
  ```log
  [chromium] › page/page-click-react.spec.ts:108:1 › should not retarget when element changes on hover
  23% [21/93] Passed: 17 Flaky: 0 Failed: 0 Skipped: 4 (7s)
  ```

- When connected to a TTY or with `env.PLAYWRIGHT_LIVE_TERMINAL`
set to anything but `'0'` or `'false'`, line reporter updates in place.

- When not connected to a TTY, line reporter prints an update
after each ~1% of tests done, so it never prints more than 100 lines.

- Updated tests to the golden style.
2022-03-11 18:19:33 -08:00
Ross Wollman
72b95b9ffa
chore: dogfood dotenv (#12673)
Use a top-level .env file to control the internal testing setup.

This allows for easy manipulation of environment variables regardless
of your setup (VSCode Extension, CLI, etc.).
2022-03-11 15:12:25 -08:00
Andrey Lushnikov
95c774cf84
feat: support multiple screenshots in HTML report (#12577)
This patch adds support to multiple diffs. These are possible
due to soft assertions.

Drive-by: rename second screenshot in `toHaveScreenshot` failure when
re-generating expectations from "expected" to "previous".
2022-03-11 08:46:13 -08:00
Andrey Lushnikov
e3ab6388a9
feat(toHaveScreenshot): enable sensible defaults (#12675)
This patch:
- Enables configuration of certain defaults for some options of `expect.toHaveScreenshot` method via `TestProject.expect.toHaveScreenshot` property
- Sets sensible defaults for these options:
  * `fonts: "ready"`
  * `animations: "disabled"`
  * `size: "css"`
2022-03-11 08:45:36 -08:00
Andrey Lushnikov
1dc581c1a0
test: fix test that gave 2 pixel screenshot diff on Linux (#12671) 2022-03-10 20:26:31 -08:00
Andrey Lushnikov
b51157bdea
feat: bring back maxDiffPixels in toMatchSnapshot (#12627)
This patch reverts 2 commits that removed the feature from the method:
- "fix: explicitly ignore maxDiffPixels in toMatchSnapshot (#12570)"
  commit b8af8458d6.
- "chore: remove `maxDiffPixels` from toMatchSnapshot (#12539)"
  commit a3dff45974.
2022-03-10 18:41:16 -08:00
Andrey Lushnikov
42765804bc
chore: add "allow" as a default value for animations. (#12663) 2022-03-10 17:15:36 -08:00
Andrey Lushnikov
49e66c7f08
feat(screenshot): introduce new "fonts" option for screenshots (#12661)
This option will wait for webfonts to load before taking screenshots.
2022-03-10 16:54:36 -08:00
Andrey Lushnikov
12d8a262be
feat: support screenshotsDir option (#12642)
The `screenshotsDir` option controls the expectation storage
for `toHaveScreenshot()` function.

The new expectation management for screenshots has the following
key properties:
- All screenshots are stored in a single folder called `screenshotsDir`.
- Screenshot names **do not** respect `snapshotDir` and `snapshotSuffix`
  configurations.
- `screenshotsDir` is configurable per project. This way a "smoke tests"
  project can re-use screenshots from "all tests" project.
- Host platform is a top-level folder.

For example, given the following config:

```js
// playwright.config.ts
module.exports = {
  projects: [
    { name: 'Mobile Safari' },
    { name: 'Desktop Chrome' },
  ],
};
```

And the following test structure:

```
smoke-tests/
└── basic.spec.ts
```

Will result in the following screenshots folder structure by default:

```
__screenshots__/
└── darwin/
    ├── Mobile Safari/
    │   └── smoke-tests/
    │       └── basic.spec.ts/
    │           └── screenshot-expectation.png
    └── Desktop Chrome/
        └── smoke-tests/
            └── basic.spec.ts/
                └── screenshot-expectation.png
```
2022-03-10 16:50:26 -08:00
Pavel Feldman
4d3d0e2bda
chore: enable ts-esm support by default (#12658) 2022-03-10 14:48:33 -08:00
Dmitry Gozman
a388bb2302
feat(screenshot): size:'css'|'device' option (#12634)
With this experimental option, screenshot dimensions are in CSS pixels,
not physical device pixels, effectively ignoring the device scale factor.
2022-03-10 13:07:10 -08:00
Max Schmitt
90e76f9adb
test: rename #smoke to @smoke as test tags (#12652) 2022-03-10 19:42:52 +01:00
Max Schmitt
3f468abedd
fix(test-runner): ESM compatibly on Windows (#12615) 2022-03-10 19:27:25 +01:00
Max Schmitt
d805cd9097
chore: skip failing android tests 2 (#12647) 2022-03-10 18:46:50 +01:00
Andrey Lushnikov
75eef09c0d
feat: show expectation name as part of toHaveScreenshot title (#12612)
This patch adds snapshot file name as part of `toHaveScreenshot`
and `toMatchSnapshot` step title.
2022-03-09 20:09:45 -08:00
Dmitry Gozman
92430cc56c
chore(fixtures): do not force-close contexts in beforeAll (#12416)
This now happens the same way as for the test, in the worker cleanup
when browser closes, which is reported as a part of the test.
2022-03-09 07:26:46 -08:00
Dmitry Gozman
e8ce5d0258
feat(test runner): on beforeAll failure, precisely skip the tests (#12417)
Previously, we used to skip all the tests from the same file when
any `beforeAll` fails in the file.

Now, we only skip the rest of the tests affected by this particular
`beforeAll` and continue with other tests in the new worker.
2022-03-08 20:29:31 -08:00