Compare commits

...

1124 Commits

Author SHA1 Message Date
Pavel Feldman 7ec70c61d7
feat(aria): emit generic nodes (#35686) 2025-04-21 17:36:10 -07:00
Pavel Feldman bd89ddaca4
chore(breaking): do not include hidden elements in aria snapshot (#35684) 2025-04-21 16:07:14 -07:00
microsoft-playwright-automation[bot] fcfb61ab26
feat(webkit): roll to r2160 (#35665)
Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
2025-04-18 17:10:12 +02:00
Yury Semikhatsky 303901d7a5
chore(bidi): implement permissions API (#35662)
Limitations due to current Bidi protocol:

- Cannot revert to the browser default permission (before override). So when the client calls clearPermissions
 we always set the permission to `prompt` which is not necessarily what the browser had before the override.
- `*` pattern is not supported. Most clients don't want to do fine grained permission control in their tests.
2025-04-17 13:00:45 -07:00
Jonathan Berger 3032513e92
docs: Update intro-js.md (#35658) 2025-04-17 10:39:07 -07:00
Adam Gastineau 2dda48c9f0
fix(dev): properly pass HMR HTML reporter message when React devtools installed (#35657) 2025-04-17 09:42:25 -07:00
Max Schmitt 5ceb61c497
chore: roll stable-test-runner to 1.52.0-beta-1744901303000.tgz (#35654) 2025-04-17 17:43:17 +02:00
Max Schmitt 939aa16f77
fix(gha-reporter): follow-up for multiple jobs (#35656) 2025-04-17 17:33:59 +02:00
Max Schmitt 7bf770143c
fix(gha-reporter): minimize only relevant comments (#35648) 2025-04-17 16:40:50 +02:00
Max Schmitt aef47744df
chore: add v1.52 release notes (#35633) 2025-04-17 16:40:06 +02:00
Simon Knott 36a628d902
fix: expect.poll type with custom matcher (#35651) 2025-04-17 16:11:06 +02:00
Adam Gastineau 2ece112cb3
chore(build): add --install watch flag for automatic browser install (#35639) 2025-04-17 05:19:48 -07:00
Adam Gastineau 53abf161b0
chore: completely remove annotation warnings code (#35637) 2025-04-17 05:19:14 -07:00
Max Schmitt 5e3e29f7d2
docs(test-assertions): fix docs build (#35649) 2025-04-17 13:47:36 +02:00
microsoft-playwright-automation[bot] b1a72febc1
feat(chromium-tip-of-tree): roll to r1322 (#35581)
Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
2025-04-17 11:14:46 +02:00
microsoft-playwright-automation[bot] 68cfaacd39
feat(webkit): roll to r2159 (#35644) 2025-04-17 11:14:24 +02:00
Pavel Feldman 0109882a66
docs: add example w/ params for locator.evaluate (#35645) 2025-04-16 19:34:56 -07:00
Adam Gastineau 039e87f5cb
fix(blob): properly communicate attachments through blob merges (#35517) 2025-04-16 13:03:45 -07:00
J Garcia 37a9535a27
docs: fix grammar in fixtures page (#35590) 2025-04-16 10:00:05 -07:00
Pavel Feldman e4a9684ffe
chore: fix typos in aria docs (#35636) 2025-04-16 09:23:36 -07:00
Max Schmitt cd0b053165
chore: update browser_patches to b4f706670 (#35634) 2025-04-16 18:12:33 +02:00
Marcin Szafranek 8772389000
docs(test-assertions): document soft assertions with expect.poll (#35619) 2025-04-16 08:33:36 -07:00
Simon Knott 7c65d5e81e
fix(tele): don't spread buffer (#35632) 2025-04-16 16:37:34 +02:00
Dmitry Gozman 9b6176d709
chore: update generateDotNetApi (#35629) 2025-04-16 12:42:21 +01:00
Yury Semikhatsky 61fc320053
chore: fix detection of bot comments after migrating to graphql (#35626) 2025-04-15 14:28:11 -07:00
Yury Semikhatsky 224667e9ff
chore(bidi): support geolocation emulation (#35624) 2025-04-15 14:02:32 -07:00
Adam Gastineau 09529e9275
Revert "chore: add location named property to annotations (#35373)" (#35620) 2025-04-15 11:17:21 -07:00
Simon Knott cb2d94e467
chore: refactor error context (#35613) 2025-04-15 17:29:07 +02:00
Adam Gastineau 78600c60f8
chore: temporarily disable floating promise warning messages v2 (#35603) 2025-04-15 07:28:55 -07:00
Max Schmitt 47ad692952
chore: mark 1.53.0-next (#35615) 2025-04-15 14:07:49 +02:00
Simon Knott 76ee48dc9d
chore: followup on static annotations (#35579)
Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2025-04-15 09:07:42 +02:00
Yury Semikhatsky d79bb57ac1
chore(bidi): rename bidi-firefox-stable to moz-firefox channel (#35611) 2025-04-14 17:30:00 -07:00
Pavel Feldman 6262a1264f
chore: retry selecting option for the notconnected case (#35610) 2025-04-14 16:51:08 -07:00
Yury Semikhatsky 2a3f1cbf8a
chore: use graphql for queries and mutations in GHA markdown reporter (#35609) 2025-04-14 15:39:31 -07:00
microsoft-playwright-automation[bot] be7f774813
feat(webkit): roll to r2158 (#35606)
Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
2025-04-14 23:14:13 +02:00
microsoft-playwright-automation[bot] 01d176972a
feat(webkit): roll to r2157 (#35604)
Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
2025-04-14 21:35:39 +02:00
Marcin Szafranek 32d0cefc49
feat(cli): add paper format option for PDF generation (#35589) 2025-04-14 12:26:33 -07:00
Marcin Szafranek b32a9a05e2
docs(test-assertions): optimize custom matcher to handle negative assertions efficiently (#35599) 2025-04-14 12:07:01 -07:00
Ross Wollman ac2d9e62da
docs: add danger note to auth guide (#35409) 2025-04-14 12:04:22 -07:00
Jean-François Greffier 00336e98ed
docs: remove dupe js code frames 2025-04-14 12:02:14 -07:00
Yury Semikhatsky c1f1c039d9
chore: prefer channel browser for ui mode and codegen (#35588) 2025-04-14 10:39:53 -07:00
microsoft-playwright-automation[bot] 4e3b01ff83
feat(webkit): roll to r2156 - enable Skia on Windows (#35595) 2025-04-14 10:05:04 -07:00
microsoft-playwright-automation[bot] 9efdcf11b9
feat(chromium): roll to r1169 (#35594)
Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
2025-04-14 10:47:49 +02:00
Yury Semikhatsky c9cd9dc1e4
chore: rename *ConnectionTimeout to *SocketTimeout (#35583) 2025-04-11 09:57:18 -07:00
Marcin Szafranek ee073d6906
docs(selenium grid): fix path to Selenium WebDriver examples (#35578) 2025-04-11 18:44:20 +02:00
dependabot[bot] 63d6e466f2
chore(deps): bump vite from 6.2.5 to 6.2.6 (#35585)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-11 18:43:18 +02:00
Yury Semikhatsky adfad84bb8
fix: do not pass unsafe `matcherResult` over IPC (#35565) 2025-04-10 14:39:33 -07:00
Yury Semikhatsky 24699d6bd0
fix: timeout error when downloading browsers (#35564) 2025-04-10 13:55:49 -07:00
Yury Semikhatsky b10f920a15
chore: call findChromiumChannel only for Chromium based browsers (#35580) 2025-04-10 10:26:36 -07:00
Dmitry Gozman 6c3e507dcb
test: unskip routing test in firefox after roll to 1482 (#35576) 2025-04-10 16:30:12 +01:00
Max Schmitt c5b3bf1d8a
Revert "chore: opt-out of installation lock by default (#35436)" (#35577) 2025-04-10 16:35:24 +02:00
Dmitry Gozman 51a7b8f27f
test: unflake some network-tab related tests (#35574) 2025-04-10 15:18:34 +01:00
Simon Knott eed11cabb4
chore: improve view trace button (#35528) 2025-04-10 14:07:00 +02:00
Dmitry Gozman 669cdcce3e
chore: refactor some code around proxies (#35572) 2025-04-10 12:59:52 +01:00
Simon Knott f31e05bd07
chore(html): open `path` attachments in new tab (#35508) 2025-04-10 11:47:22 +02:00
Dmitry Gozman c9a1ad4d8d
chore: use a singleton "builtins" instead of passing it around (#35493) 2025-04-10 09:30:39 +01:00
Yury Semikhatsky c84bb713a6
chore(bidi): consider dymamic annations for .csv report (#35560) 2025-04-09 15:50:27 -07:00
Max Schmitt 9c01e1cbc8
test: skip 'should use http proxy for websocket requests on macOS 13 (#35563) 2025-04-09 23:21:03 +02:00
microsoft-playwright-automation[bot] ab29fb3caf
feat(webkit): roll to r2155 (#35561)
Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
2025-04-09 22:52:03 +02:00
microsoft-playwright-automation[bot] 4c5526b543
feat(firefox): roll to r1482 (#35557)
Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
2025-04-09 22:17:28 +02:00
microsoft-playwright-automation[bot] ef9b82715f
feat(firefox-beta): roll to r1477 (#35558)
Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
2025-04-09 22:16:55 +02:00
Yury Semikhatsky aafb068a75
docs(bidi): update readme with new vars (#35559) 2025-04-09 10:22:42 -07:00
Yury Semikhatsky 4d0c33bc4e
docs: comparison table for global setups (#35548) 2025-04-09 10:08:07 -07:00
Max Schmitt 01282e9462
test: skip 'propagate headers cross origin redirect after interception' on Android (#35556) 2025-04-09 17:20:13 +02:00
Max Schmitt 22e134e280
chore: introduce expect.toContainClass (instead of partial: true) (#35551)
Signed-off-by: Max Schmitt <max@schmitt.mx>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2025-04-09 14:47:22 +02:00
Max Schmitt a8314361b0
test: adjust windows WebSocket test expectation (#35553) 2025-04-09 14:36:05 +02:00
Max Schmitt b7799f3293
chore: fix 'npm run watch' memory leak in esbuild (#35547) 2025-04-08 23:16:42 +02:00
Dmitry Gozman a6d5c981af
Revert "feat: support proxy in connect/connectOverCDP (#35389)" (#35542) 2025-04-08 21:10:38 +01:00
Dmitry Gozman 0e964e2b99
chore: remove FullConfig.failOnFlakyTests (#35541) 2025-04-08 17:13:54 +01:00
Adam Gastineau 8beaf3c383
feat: display warnings only on test failure (#35464) 2025-04-08 07:34:12 -07:00
Simon Knott 22f8f21a30
chore(docs): browser locale vs user locale (#35535) 2025-04-08 16:12:40 +02:00
Max Schmitt 93d0bc4bab
Revert "test: roll Android WebView to ToT (#35456)" (#35539) 2025-04-08 16:11:44 +02:00
Max Schmitt 3b70f95b17
fix(android): do not report all artifactsDirs as errors (#35530) 2025-04-08 12:08:21 +02:00
Simon Knott 265e733752
test: add repro for broken cookies in frames in webkit on linux (#35510)
Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2025-04-08 11:33:18 +02:00
Simon Knott 815938b065
chore(aria): always include iframe (#35527) 2025-04-08 11:32:59 +02:00
Alex Rudenko 668bf580d7
chore: bump chromium-bidi (#35513) 2025-04-08 11:28:14 +02:00
Max Schmitt aa221cbe37
devops: allow manual trigger of bidi tests (#35529) 2025-04-08 10:40:15 +02:00
Dmitry Gozman 4c85672f02
fix(role): `<input type=file>` should be a button (#35514) 2025-04-08 09:02:19 +01:00
dependabot[bot] 6ff0c666fb
chore(deps): bump actions/create-github-app-token from 1 to 2 in the actions group (#35524)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-08 09:09:15 +02:00
Yury Semikhatsky 9d30505472
chore(bidi): use channel for preinstalled browsers, env for downloaded (#35523) 2025-04-07 16:55:02 -07:00
Max Schmitt 76d5b8778c
fix: update performance.now() when calling in a busy loop (#35435) 2025-04-07 22:40:58 +02:00
Max Schmitt 9cb05c56f5
fix(tests): correct timeout duration in clock pause test (#35522) 2025-04-07 22:38:10 +02:00
Dmitry Gozman 650af1726b
chore: add more logging to gitCommitInfo plugin (#35512) 2025-04-07 11:25:56 -07:00
Max Schmitt 5fce12dcca
devops: fix bidi trigger (#35519)
Signed-off-by: Max Schmitt <max@schmitt.mx>
2025-04-07 18:15:54 +02:00
microsoft-playwright-automation[bot] 438394cd6a
feat(chromium): roll to r1168 (#35516)
Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
2025-04-07 16:51:56 +02:00
Max Schmitt ab5f4639ca
devops: run bidi tests on CQ-bidi label (#35515)
Signed-off-by: Max Schmitt <max@schmitt.mx>
2025-04-07 16:36:00 +02:00
microsoft-playwright-automation[bot] 22fcf6ea81
feat(firefox): roll to r1481 (#35506)
Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
2025-04-07 13:27:32 +02:00
Simon Knott a2ddb2a3ea
fix: contrast on View Trace button (#35505) 2025-04-07 11:30:04 +02:00
Ekwinder aec54fa573
docs(python): Add await to response.json() for async ApiResponse class example (#35503) 2025-04-07 08:56:25 +02:00
microsoft-playwright-automation[bot] 54a9ae2b8d
feat(firefox-beta): roll to r1476 (#35492) 2025-04-04 13:31:29 -07:00
Yury Semikhatsky 0acedf1ca2
fix: markdown report publishing (#35500) 2025-04-04 13:30:33 -07:00
microsoft-playwright-automation[bot] 878e56c87e
feat(firefox): roll to r1480 (#35491) 2025-04-04 13:04:35 -07:00
dependabot[bot] ef4421c07b
chore(deps): bump vite from 6.2.4 to 6.2.5 (#35495) 2025-04-04 13:01:53 -07:00
Yury Semikhatsky 96f8b17018
test: enable some getSelection tests in WebKit (#35498) 2025-04-04 12:26:55 -07:00
Andrey Lushnikov f396bf2236
test: add regression test for bug 33561 (#35006) 2025-04-04 10:46:57 -07:00
microsoft-playwright-automation[bot] 02a82c9f62
feat(chromium-tip-of-tree): roll to r1320 (#35490)
Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
2025-04-04 17:07:32 +02:00
Yury Semikhatsky 1e04b697ab
devops: use esbuild instead of babel (#35467) 2025-04-03 22:40:35 -07:00
Pavel Feldman 26fa959a10
chore: allow matching aria children strictly (#35481) 2025-04-03 17:58:20 -07:00
Yury Semikhatsky 3eab92d312
chore: move github action deps to playwright-dashboard (#35484) 2025-04-03 16:31:59 -07:00
Yury Semikhatsky b8a0d5f6cd
chore: move injected scripts into packages/injected (#35483) 2025-04-03 16:09:03 -07:00
Yury Semikhatsky 43622f567f
chore: remove unused eslint-disable directives (#35482) 2025-04-03 15:22:14 -07:00
Yury Semikhatsky f9d9c5c512
chore: merge server/isomorphic into utils/isomorphic (#35480) 2025-04-03 13:36:50 -07:00
Dmitry Gozman 372f87339f
test: update "should create two pages in parallel" to include more scenarios (#35475) 2025-04-03 21:34:06 +01:00
Pavel Feldman effb64cdf4
chore: account for the aria disabled parent (#35430) 2025-04-03 12:53:01 -07:00
Adam Gastineau 26b9441d86
fix(uimode): show trace failure and any error messages on missing trace (#35344) 2025-04-03 11:13:19 -07:00
Max Schmitt 01ea1cafdc
devops: remove PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD env var (#35473) 2025-04-03 12:18:11 +02:00
Max Schmitt 482e929df7
devops: do not download browsers during 'npm run lint' (#35474) 2025-04-03 12:17:57 +02:00
Max Schmitt 2d65457db1
devops: remove unnecessary install-deps (#35471) 2025-04-03 11:54:39 +02:00
Simon Knott bc0d2c57e5
fix(html): falsy description shouldnt crash (#35470) 2025-04-03 11:44:22 +02:00
Yury Semikhatsky 19d0d54e66
chore: move markdown reporter to playwright-dashboard (#35465) 2025-04-02 17:26:33 -07:00
Yury Semikhatsky 6c5f3bbe39
chore: show snapshot for test.step (#35445)
We don't take before/after snapshot for `test.step`. To approximate the snapshots we could take either snapshots from the nested actions or from the outer ones. The current logic is the following:

**beforeSnapshot:**
- `beforeSnapshot` is always taken from the last finished action before the step. It also works nice for the actions without nested actions, such as simple `expect(1).toBe(1);`

**afterSnapshot:**
- We always use `afterSnapshot` from a "nested" action, if there is one. It is exactly what we want for `test.step` and it is acceptable for other actions.
- If there are no "nested" actions, use the `beforeSnapshot` 
  -  works best for simple `expect(a).toBe(b);` case
  - `test.step` without children with snapshot is likely a step with a bunch of `expect(a).toBe(b);` and the same logic as for single expect applies.

Fixes https://github.com/microsoft/playwright/issues/35285
2025-04-02 13:22:16 -07:00
Yury Semikhatsky b92e81c205
chore: fix typo in merge.config (#35462) 2025-04-02 09:48:45 -07:00
dependabot[bot] b6d3ffa367
chore(deps): bump vite from 6.2.3 to 6.2.4 (#35427)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-02 18:37:09 +02:00
Simon Knott 1206ef64e7
chore(html): render locator.fill value (#35457) 2025-04-02 15:40:37 +02:00
Adam Gastineau 92c5d656ab
chore: add location named property to annotations (#35373) 2025-04-02 06:29:22 -07:00
Max Schmitt 67d92f0f10
test: roll Android WebView to ToT (#35456) 2025-04-02 12:31:34 +02:00
Max Schmitt 788067bec7
chore: do not build playwright-client twice (#35454) 2025-04-02 12:31:15 +02:00
Yury Semikhatsky dbd3b6753c
chore: move GHA markdown reporter to playwright-dashboard (#35448) 2025-04-01 16:48:57 -07:00
Adam Gastineau 3ad5c2731a
chore(infra): allow builds to succeed in spite of audit failures (#35442) 2025-04-01 18:35:06 +02:00
Adam Gastineau 16f634649f
fix(reporter): remove stale annotations from JsonTestEnd (#35426) 2025-04-01 05:28:30 -07:00
Max Schmitt 49c13a0788
chore: opt-out of installation lock by default (#35436) 2025-04-01 13:10:11 +02:00
Max Schmitt 6405dace36
chore(driver): replace legacy --production with --omit=dev (#35437) 2025-04-01 11:19:11 +02:00
Jean-François Greffier 468ea7672d
docs: improve execution modes (#35412)
Signed-off-by: Jean-François Greffier <jfgreffier@users.noreply.github.com>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2025-04-01 10:00:04 +01:00
Yury Semikhatsky 6c22b8425f
chore(bidi): increase global timeout to 90min (#35428) 2025-03-31 12:08:55 -07:00
Adam Gastineau 7f2ceda249
Revert "chore: temporarily disable floating promise warning messages (#34957) (#35374) 2025-03-31 07:16:00 -07:00
Chris aa278d3aed
feat(trace-viewer): Move copy request buttons to toolbar (#35366) 2025-03-31 14:21:57 +01:00
Mark Skelton 3d603d1e5c
feat(html): add NOT filtering to HTML reporter (#35390) 2025-03-31 14:18:13 +01:00
Chris 62a8d4e01f
chore: Fix select warning when panes docked on right (#35404) 2025-03-31 14:16:41 +01:00
Max Schmitt fffd87af1d
test: add test for android cookies on webview (#35399) 2025-03-31 09:31:44 +02:00
Max Schmitt 63cf78471f
fix(trace-viewer): ConsoleTab: each child in a list should have a unique "key" prop (#35413) 2025-03-31 09:30:53 +02:00
Max Schmitt 81c6af0cc6
chore: remove unused 'x-playwright-reuse-context' header (#35414) 2025-03-31 09:28:09 +02:00
Yury Semikhatsky e2c8163b14
devops: add GitHub actions markdown reporter (#35406) 2025-03-28 15:32:59 -07:00
Chris fbf519c5a5
feat(html-reporter): Add extra space after any special token (#35365) 2025-03-28 14:47:08 +01:00
alscotty cb7f1121ee
feat(trace-viewer): add copy to clipboard button of snapshot url on hover (#35213) (#35255)
Co-authored-by: Max Schmitt <max@schmitt.mx>
2025-03-28 14:39:29 +01:00
microsoft-playwright-automation[bot] d0e0a60e0a
feat(chromium-tip-of-tree): roll to r1317 (#35395)
Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
2025-03-28 14:04:49 +01:00
Simon Knott 2f3fe8f113
feat(prompt): link to error prompt in terminal (#35341) 2025-03-28 13:42:18 +01:00
Dmitry Gozman 471a28e0d5
feat: support proxy in connect/connectOverCDP (#35389) 2025-03-28 12:03:54 +00:00
Simon Knott e3bb687cfc
feat: include iframes in aria snapshots with `ref` (#35396) 2025-03-28 12:46:20 +01:00
Max Schmitt 2c0e1e5e3a
docs(debug): add instructions for debugging tests using Chrome DevTools (#35394) 2025-03-28 10:50:18 +01:00
Simon Knott 8896454cdf
fix(prompt): take snapshot for unclosed contexts as well (#35387)
Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2025-03-27 16:25:46 +01:00
Simon Knott f5a7465a41
fix(serializers): correct byte length calculation for typed arrays (#35386) 2025-03-27 13:50:06 +01:00
Chris e82239fcb1
docs: Make clear that PR diffs should stay small (#35368) 2025-03-27 12:48:13 +01:00
Dmitry Gozman 89386628db
test: check that browsers use proxy for websocket requests (#35348) 2025-03-26 21:33:53 +00:00
Max Schmitt 5af22ed72e
fix(registry): find channels without proper win32 env (#35376) 2025-03-26 18:56:27 +01:00
Simon Knott 3340855109
chore: support typed arrays in indexeddb (#34949) 2025-03-26 18:04:45 +01:00
Simon Knott febb95a638
chore: highlight "view trace" on failing tests (#35342) 2025-03-26 16:27:48 +01:00
Chris 97a542c334
docs: Update typescript code blocks in docs (#35219) 2025-03-26 14:29:02 +00:00
Max Schmitt ef5e166fa8
chore: allow upstream TestServerConnection with 'ws' Node.js module (#35367) 2025-03-26 14:55:48 +01:00
Simon Knott 45fa3d17fc
feat: split up static and dynamic annotations (#35292)
Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2025-03-26 11:33:18 +01:00
Pavel Feldman cbed3f73e1
chore: mcp now has a new home at microsoft/playwright-mcp (#35351) 2025-03-26 10:04:17 +01:00
Max Schmitt f3b3593f88
chore: update vite to 5.4.15 (#35349) 2025-03-25 19:23:16 +01:00
Adam Gastineau 714d5d1b1e
chore: provide more actionable error messages when serializing values (#35297) 2025-03-25 10:32:44 -07:00
Simon Knott 6f1ec11072
fix: prompt button should not be hidden by error (#35268) 2025-03-25 18:26:04 +01:00
Dmitry Gozman 273df454e0
test: unskip "calling window.stop sync" (#35346) 2025-03-25 15:23:34 +00:00
Max Schmitt bef2310cf6
devops: fix GHA automation email (#35347) 2025-03-25 16:16:00 +01:00
dependabot[bot] 4e0d5742c4
chore(deps): bump vite from 6.1.0 to 6.2.3 (#35345)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-25 15:46:37 +01:00
microsoft-playwright-automation[bot] dea6b5a59a
feat(webkit): roll to r2152 (#35336) 2025-03-25 15:45:50 +01:00
microsoft-playwright-automation[bot] 95cbe85f7b
feat(webkit): roll to r2151 (#35335)
Co-authored-by: microsoft-playwright-automation[bot] <4203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
2025-03-25 15:44:23 +01:00
Max Schmitt 24c74dbc5d
devops: upload arm64 windows driver (#35343) 2025-03-25 15:04:09 +01:00
Dmitry Gozman 0467c28722
chore: builtins (#35197) 2025-03-25 13:49:28 +00:00
Simon Knott 87bc0f48ef
chore: provide error context to test server (#35339) 2025-03-25 14:07:02 +01:00
Max Schmitt 3d2aa1a5e4
docs(python): update async fixtures instructions (#35338) 2025-03-25 12:14:57 +01:00
Simon Knott 62821516bf
chore: use path as key in div (#35317) 2025-03-24 08:59:51 +01:00
Dmitry Gozman b3d19e2f80
docs: clarify locator.evaluate{,Handle} timeout option (#35319) 2025-03-21 20:09:31 +00:00
Yury Semikhatsky 8eea065aeb
test: enable route.continue cookie tests in firefox (#35320) 2025-03-21 11:35:06 -07:00
Max Schmitt b452896d4a
devops: update automation Git author (#35318) 2025-03-21 16:23:36 +01:00
Kunall Banerjee 943a0f8636
docs: fix minor typo in docs for global setup/teardown (#35311) 2025-03-21 15:21:54 +00:00
microsoft-playwright-automation[bot] 44c4aeca1f
feat(chromium): roll to r1164 (#35316)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-21 16:10:29 +01:00
microsoft-playwright-automation[bot] e7626934e9
feat(firefox): roll to r1478 (#35306)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-21 16:03:43 +01:00
microsoft-playwright-automation[bot] 6bb83340c7
feat(firefox-beta): roll to r1474 (#35307)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-21 16:02:32 +01:00
Simon Knott 071e49687c
fix(html): update video when clicking previous/next (#35309) 2025-03-21 15:30:38 +01:00
Simon Knott 53ed2f601b
fix(library): indexedDB shouldn't stumble over `null` in Firefox (#35308) 2025-03-21 10:24:28 +01:00
Yury Semikhatsky b83e0af11a
fix: do not allow to override cookie header (#35168)
Behavior before this PR regarding 'Cookie' header already varied between browsers:
- Chromium would not respect the 'Cookie' header if there was one with the same name in its cookie jar. If there was no corresponding cooke in the cookie jar, Chromium would apply one from the overrides.
- WebKit would always take one from the cookie jar.

To override cookies `addCookies` should be used instead.


See https://docs.google.com/document/d/1LXMSP4GVxFLYJxA6z4upKqwkgD-TnVCGeX-daS4VQjk/edit?usp=sharing for mode details.

Reference https://github.com/microsoft/playwright/issues/35154
2025-03-20 16:35:03 -07:00
Yury Semikhatsky b9ccc5b252
chore(bidi): hardcode "default" id for persistent context (#35303) 2025-03-20 13:42:48 -07:00
Max Schmitt fbffb8152f
chore: add toHaveClass partial option (#35229) 2025-03-20 21:20:50 +01:00
Dmitry Gozman 7cada0322a
fix(test runner): disregard native typescript execution in Node.js (#35300) 2025-03-20 19:17:17 +00:00
microsoft-playwright-automation[bot] c018b71d19
feat(chromium-tip-of-tree): roll to r1315 (#35299)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-20 17:11:40 +01:00
Playwright Service 61980670fb
feat(webkit): roll to r2150 (#35267)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-20 15:38:53 +01:00
microsoft-playwright-automation[bot] f274345168
feat(chromium-tip-of-tree): roll to r1314 (#35287)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-20 15:30:51 +01:00
horyu 850633adbe
docs: remove duplicate Introduction (#35261) 2025-03-20 15:29:48 +01:00
Yury Semikhatsky 3873b72ac1
chore(bidi): retrieve default context id from the browser (#35286) 2025-03-19 14:43:07 -07:00
Pavel Feldman 7f44471f76
chore: add missing mcp files to npm, default to chrome (#35282) 2025-03-19 12:48:31 -07:00
Max Schmitt 6de8f04f0e
devops: fix for Canary Trace Viewer deployment (#35284) 2025-03-19 20:46:39 +01:00
Yury Semikhatsky 23b6305c2d
fix(webkit): do not dipatch request event for about:blank (#35280) 2025-03-19 12:40:35 -07:00
Max Schmitt 90e7d2e9d8
devops: Speculative fix for Canary Trace Viewer deployment (#35281) 2025-03-19 18:21:58 +01:00
Pavel Feldman 0350ca32b4
chore: add mcp server fixture (#35262) 2025-03-19 08:21:53 -07:00
Max Schmitt 23c4c256b0
devops: migrate automations to GitHub App (#35273) 2025-03-19 14:39:39 +01:00
Simon Knott eafcbd3437
docs: update linked trace zip (#35265) 2025-03-19 09:49:38 +01:00
Pavel Feldman 8423c50a38
chore: add mcp tools test harness (#35260) 2025-03-18 19:44:56 -07:00
Pavel Feldman 23b5b05f67
chore: document mcp tools (#35258) 2025-03-18 16:59:56 -07:00
Pavel Feldman 0a3387fda3
chore: add mcp resources (#35257) 2025-03-18 15:23:47 -07:00
Yury Semikhatsky d2729c1362
chore(bidi): drop non standard permissions.setPermission (#35256) 2025-03-18 13:50:26 -07:00
Dmitry Gozman 2215b59554
docs: mention `--no-deps` in a few places (#35252) 2025-03-18 18:57:26 +00:00
Yury Semikhatsky 54d48c997f
chore(bidi): set viewport and init script per context (#35247) 2025-03-18 10:31:33 -07:00
Dmitry Gozman 66b3efa826
chore: simplify highlight and recorder (#35218) 2025-03-18 09:58:41 +00:00
Pavel Feldman 7ce4f88a5b
chore: use zod for mcp tools schemas (#35245)
Signed-off-by: Pavel Feldman <pavel.feldman@gmail.com>
Co-authored-by: Yury Semikhatsky <yurys@chromium.org>
2025-03-17 19:17:05 -07:00
Yury Semikhatsky 017596dfd9
chore(bidi): update protocol definitions (#35244) 2025-03-17 18:38:18 -07:00
Yury Semikhatsky f49f52248d
test: adjust unsafe headers test for electron, channels (#35237) 2025-03-17 11:41:55 -07:00
Max Schmitt 16468e65bd
test: isolate Electron userDataDir per-test (#35235) 2025-03-17 19:41:44 +01:00
Max Schmitt 0baa973207
chore: distribute win32-arm64 driver (#35185) 2025-03-17 18:36:54 +01:00
Dmitry Gozman 195fe11e1b
fix(trace viewer): preserve dialog.showModal() elements (#35231) 2025-03-17 14:57:43 +00:00
marcinet ced9abeb22
Correct typo in CONTRIBUTING.md (#35209)
Signed-off-by: marcinet <marcinet@gmail.com>
2025-03-17 13:50:18 +00:00
Chris beea7c30c5
feat: Add maxRedirects to options of apiRequest.newContext (#35160) 2025-03-17 13:47:52 +00:00
Dmitry Gozman accd7c6c9e
docs: clarify that userDataDir cannot be used concurrently (#35228) 2025-03-17 11:11:45 +00:00
Max Schmitt 36c55d8be0
chore: update TypeScript to v5.8 (#35227) 2025-03-17 11:43:48 +01:00
Max Schmitt 9aaeae70f4
docs: fix step numbering in CI introduction (#35225) 2025-03-17 11:33:11 +01:00
Chris ac1f512622
docs: Update wrong tab-item value (#35205)
Signed-off-by: Chris <57954026+cpAdm@users.noreply.github.com>
2025-03-15 16:49:43 +01:00
Yury Semikhatsky ba0bb01114
fix: do not hang in route.continue with unsafe header (#35201) 2025-03-14 14:02:45 -07:00
Yury Semikhatsky 90f6a657a1
test(route): set-cookie in redirect response (#35199) 2025-03-14 14:02:20 -07:00
Max Schmitt 0b6b5ea7ab
fix(routeWebSocket): relative WebSocket URL (#35193) 2025-03-14 16:31:37 +01:00
Playwright Service 4b1f3fa51f
feat(webkit): roll to r2149 (#35195)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-14 11:24:25 +01:00
Playwright Service 878bdcd0c3
feat(webkit): roll to r2148 (#35194)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-14 09:46:57 +01:00
Max Schmitt 834ccff25f
chore: roll stable-test-runner to 1.51.0-beta-1741803045000 (#35192) 2025-03-13 20:03:30 +01:00
Playwright Service 79c4505433
feat(chromium-tip-of-tree): roll to r1312 (#35189)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-13 19:15:03 +01:00
Playwright Service 67bec0cf0f
feat(chromium): roll to r1163 (#35187)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-13 16:32:27 +01:00
Max Schmitt 91624538f2
chore: bump Babel (#35171) 2025-03-13 11:38:03 +01:00
Chris e976acc8ea
docs: sync all tab choices (package-manager, java-jvm choice, ct) (#35182) 2025-03-13 10:45:02 +01:00
Chris deaa714ab4
docs: Update outdated links & broken anchors (#35181)
Signed-off-by: Max Schmitt <max@schmitt.mx>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2025-03-13 10:41:02 +01:00
Playwright Service cc4045e850
feat(webkit): roll to r2147 (#35164)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2025-03-13 00:38:11 +01:00
Dmitry Gozman 3b9515e7ef
chore: remove targetId workaround from clank (#35163) 2025-03-12 17:35:15 +00:00
Adam Gastineau a98075085e
fix(expect): properly handle custom asymmetric matcher regression (#35149) 2025-03-12 09:05:53 -07:00
Playwright Service 629f5f2a9a
feat(chromium-tip-of-tree): roll to r1311 (#35165)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-12 16:33:06 +01:00
Max Schmitt 3c14cb8d84 chore: sync package-lock.json 2025-03-12 11:04:11 +01:00
Playwright Service cd756afea5
feat(webkit): roll to r2146 (#35155)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-12 10:13:15 +01:00
Pavel Feldman adcf150263
chore: fix internal tool usage (#35156)
Signed-off-by: Pavel Feldman <pavel.feldman@gmail.com>
Co-authored-by: Yury Semikhatsky <yurys@chromium.org>
2025-03-11 20:27:01 -07:00
Yury Semikhatsky 74acbcea56
chore: resolve glob to regex in local utils for language ports (#35136) 2025-03-11 15:54:58 -07:00
Jean-François Greffier 85a66912c6
feat(config): failOnFlakyTests option (#35109) 2025-03-11 10:06:20 -07:00
Pavel Feldman 8f5b8c10c6
chore: sort web server properties (#35135) 2025-03-11 10:05:13 -07:00
Pavel Feldman 63e5257a4c
chrome: expose link/url in aria (#35134) 2025-03-11 10:04:52 -07:00
Playwright Service e2f95747e1
feat(chromium-tip-of-tree): roll to r1308 (#35017)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-11 16:59:58 +01:00
Playwright Service d67357396a
feat(chromium): roll to r1162 (#35076)
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>
2025-03-11 16:59:46 +01:00
Dmitry Gozman 2965c5790a
chore: refactor Dispatcher._scheduleJob to be sync and easier to follow (#35124) 2025-03-11 09:17:38 +00:00
Pavel Feldman ec4c66133e
chore: align monotonicTime across processes (#35130) 2025-03-10 19:19:20 -07:00
Pengoose 43ee924087
feat(webServer): support name option for custom web server log prefixes (#35105) 2025-03-10 19:12:59 -07:00
Pavel Feldman 2a53108cf0
chore: follow up to aria ref in mcp tool (#35133) 2025-03-10 15:06:50 -07:00
Pavel Feldman 807d9066d6
chore: allow generating aria references (#35132) 2025-03-10 14:39:37 -07:00
Pavel Feldman a586a90e78
chore: brush up mcp servers (#35103) 2025-03-10 12:36:52 -07:00
Max Schmitt 07f54e7d8a
docs: update macOS version requirement to 14 Ventura (#35089) 2025-03-10 16:45:04 +01:00
Adam Gastineau 5c17a1b937
fix(docs): properly render Trace Viewer debug video (#35122) 2025-03-10 06:45:37 -07:00
Dmitry Gozman 49f03c87fc
chore: housekeeping after the last firefox roll (#35116) 2025-03-10 11:26:24 +00:00
Dmitry Gozman 4767845f20
feat: support TestProject.workers limit (#35094) 2025-03-10 09:13:24 +00:00
Playwright Service 051833aef6
feat(webkit): roll to r2145 (#35097)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-10 09:59:01 +01:00
Marco Pasqualetti 05e311b085
docs(test-projects): add missing `devices` import in "Dependencies" snippet (#35108) 2025-03-10 09:13:35 +01:00
Pavel Feldman 7fe44bbd6f
chore: do not use |0 for rounding large numbers (#35096) 2025-03-07 11:14:06 -08:00
Siddharth Singha Roy a94d29eacf
chore(playwright-tools): add example for playwright mcp server (#35091) 2025-03-07 09:29:58 -08:00
Simon Knott 7fe17776e8
chore: simplify useSources (#35077) 2025-03-07 08:54:31 +01:00
Playwright Service 06fa184073
feat(webkit): roll to r2144 (#35084)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-07 08:26:07 +01:00
Dmitry Gozman e01c901e87
fix: do not screenshot the same page again in afterAll (#35079) 2025-03-06 21:06:19 +00:00
Pavel Feldman a52ad0743e
chore: do not disable fieldset legend (#35063) 2025-03-06 11:46:53 -08:00
Max Schmitt ad0581fafb
feat(firefox): roll to r1477 (#35069) 2025-03-06 13:17:52 +01:00
Playwright Service 130d12c084
feat(webkit): roll to r2143 (#35048)
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>
2025-03-06 12:49:30 +01:00
Max Schmitt bb0bdff815
chore: hide indexedDB in BrowserContext.storageState() by default (#35045) 2025-03-06 12:42:40 +01:00
Playwright Service 6fe490469a
feat(firefox-beta): roll to r1473 (#35067)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-06 11:02:17 +01:00
Dmitry Gozman a64ba9689a
docs: release notes for 1.51 for java, python, csharp (#35043) 2025-03-06 09:04:51 +00:00
Max Schmitt 6f99ad63dd
chore: hide indexedDB from storageState() and BrowserContext option (#35058) 2025-03-06 09:59:20 +01:00
Playwright Service aae74d7757
feat(webkit): roll to r2142 (#35026)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-06 09:42:05 +01:00
Simon Knott 0d00783c0c
chore: merge ESLint configs (#35038) 2025-03-06 09:15:37 +01:00
Pavel Feldman 319f4630de
chore: do not compute git diff on PRs (#35062) 2025-03-05 20:43:27 -08:00
Yury Semikhatsky f35a7bce72
chore: typo in prompt (#35059) 2025-03-05 13:49:03 -08:00
Pavel Feldman 1423d0f8a7
chore: rename to copy prompt (#35057) 2025-03-05 13:07:52 -08:00
Max Schmitt 43a09e827a Revert "chore: update issue templates to include type field (#34997)"
This reverts commit 7a2d56d0ff.
2025-03-05 18:33:38 +01:00
Yury Semikhatsky 9e76b3695c
docs: update more step.skip() examples (#35052) 2025-03-05 08:38:05 -08:00
Debbie O'Brien a3fafb60d4
docs: update step example (#35051) 2025-03-05 08:28:47 -08:00
Debbie O'Brien 4024605c5a
docs: update Git information image in release notes (#35050) 2025-03-05 16:06:43 +00:00
Simon Knott 1d9647b864
chore(ui/html): hide _ attachments (#35044)
Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2025-03-05 16:35:18 +01:00
Simon Knott f3a75e2cfe
docs: add copy-prompt to release notes (#35047) 2025-03-05 16:26:48 +01:00
Simon Knott f44cd3050b
chore(ui): hide top-level attach actions (#35040) 2025-03-05 15:37:25 +01:00
Dmitry Gozman 3773a73855
chore: roll stable test runner to 1.51.0-beta-1741166263000 (#35042) 2025-03-05 13:18:58 +00:00
Yury Semikhatsky 8415b6a108
docs: add touch event snippets for other langs (#35028) 2025-03-05 09:09:50 +00:00
Pavel Feldman 78fa911756
chore: improve prompt to use code frame and inline error (#35032) 2025-03-04 19:28:03 -08:00
Adam Gastineau d6a4c1cda4
chore: restore to.have.url matching via injected script (#35027) 2025-03-04 11:52:59 -08:00
epszaw 02a63fe9e8
feat: add ability to render base64-encoded trace recieved from window messages (#34976) 2025-03-04 10:56:01 -08:00
Simon Knott 88623ae3c2
refactor: store copy prompt contents in attachment (#34995) 2025-03-04 17:20:36 +01:00
Max Schmitt 5f75e69279
devops: do not run CR ToT tests twice (#35021) 2025-03-04 17:00:01 +01:00
Max Schmitt 4ebf070bca
devops: secondary workflow optimisations (#35023) 2025-03-04 16:59:04 +01:00
Max Schmitt 6cf8624b09
devops: stop testing ubuntu-20.04 (#35022) 2025-03-04 16:38:24 +01:00
Dmitry Gozman 9e0be8ee7c
chore: unblock 1.51 dotnet roll (#35016) 2025-03-04 15:01:15 +00:00
Playwright Service 54582c1771
feat(webkit): roll to r2141 and freeze macos-13 (#35000)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2025-03-04 11:39:20 +01:00
Playwright Service ecbf62945c
feat(firefox-beta): roll to r1472 (#35009)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-04 11:37:14 +01:00
Playwright Service b5688888f8
feat(firefox): roll to r1476 (#35010)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-04 11:37:06 +01:00
Pavel Feldman 1b02458988
chore: mute git error on vscode tests (#35004) 2025-03-03 17:52:49 -08:00
Pavel Feldman ee2a5264ad
chore: do not show other metadata in html report (#35001) 2025-03-03 15:28:18 -08:00
Pavel Feldman 85c6405093
chore: differentiate test.skip and step.skip (#35002) 2025-03-03 15:27:56 -08:00
Pavel Feldman 98443e5749
chrome: git commit info gha fix (#34981) 2025-03-03 07:36:30 -08:00
Max Schmitt 7a2d56d0ff
chore: update issue templates to include type field (#34997) 2025-03-03 16:07:41 +01:00
Simon Knott 7026e5dd70
chore: duplicate type expression (#34993) 2025-03-03 14:10:17 +01:00
Max Schmitt 02e65d1825
docs: update Docker configuration recommendations (#34986) 2025-03-03 11:23:33 +01:00
Playwright Service b4abcfed45
feat(chromium-tip-of-tree): roll to r1306 (#34917)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-01 12:48:01 +01:00
Yury Semikhatsky cd437c972d
fix: do not change glob pattern when converting to url (#34923) 2025-02-28 13:44:25 -08:00
Dmitry Gozman 218e4e90aa
chore: mark v1.52.0-next (#34974) 2025-02-28 20:38:53 +00:00
Dmitry Gozman f50221f75b
chore: allow running manifest v2 extensions for a little longer (#34978) 2025-02-28 20:14:25 +00:00
Dmitry Gozman 2dd541bc59
docs: update v1.51 js release notes (#34979) 2025-02-28 19:29:13 +00:00
Christopher Tangonan c22c10f7d8
feat(json-reporter): added parallelIndex to TestResult (#34740) 2025-02-28 10:00:51 -08:00
Yury Semikhatsky 4a79c214f0
chore: address step.skip() API review comments (#34958) 2025-02-28 09:32:04 -08:00
Pavel Feldman e033e5aa11
chore: move captureGitInfo back into config (#34961) 2025-02-28 07:33:03 -08:00
Dmitry Gozman 53f38f19a4
chore: change playwright-client private package version to 0.0.0 (#34975) 2025-02-28 14:16:41 +00:00
Dmitry Gozman 6a99f3a39a
chore: update browser_patches to 9ad8c4d334 (#34973) 2025-02-28 13:23:18 +00:00
Dmitry Gozman 8d8c9a55cd
docs: js release notes for 1.51 (#34972)
Signed-off-by: Dmitry Gozman <dgozman@gmail.com>
Co-authored-by: Simon Knott <info@simonknott.de>
2025-02-28 13:22:51 +00:00
Simon Knott 6dcb7d2bf5
chore: remove pageSnapshot option (#34962)
Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2025-02-28 13:16:58 +01:00
Dmitry Gozman e3eb267ca3
chore: bump webkit version to 18.4 (#34970) 2025-02-28 11:16:13 +00:00
Dmitry Gozman 934e123d1b
docs: update step.skip docs after api review (#34968) 2025-02-28 10:17:39 +00:00
Simon Knott 2573a80893
chore: change recommended snapshot extension to .aria.yml (#34963) 2025-02-28 10:03:39 +01:00
Simon Knott 44712fb8eb
test: windows clipboard contains \r\n (#34966) 2025-02-28 09:37:48 +01:00
Yury Semikhatsky fe9b4a841e
test: revert stray change in page-check (#34959) 2025-02-27 17:45:01 -08:00
Pavel Feldman 31f4a05eb6
chore: make git diff different for CI and local (#34955) 2025-02-27 14:06:13 -08:00
Pavel Feldman 7a61aa25e6
chore: provide blob name for web and html reporter tests (#34940) 2025-02-27 13:22:07 -08:00
Adam Gastineau 67d6f7f603
chore: temporarily disable floating promise warning messages (#34957) 2025-02-27 12:45:30 -08:00
Adam Gastineau b0ceed51a5
docs: Improve toHaveURL doc clarity (#34935) 2025-02-27 11:00:50 -08:00
Dmitry Gozman 08ea36caa2
chore: default reportSlowTests to 5 minutes (#34950) 2025-02-27 16:31:32 +00:00
Dmitry Gozman 70cc2b14e2
chore: apply "injected" eslint rules to "isomorphic" (#34953) 2025-02-27 16:31:05 +00:00
Playwright Service ad64f8d859
feat(chromium): roll to r1161 (#34952)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-27 17:01:07 +01:00
Simon Knott a1146fd4a3
chore: copy as prompt in ui should have codeframe (#34943)
Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-02-27 15:50:46 +01:00
Dmitry Gozman 3ce9ae6a7d
chore: replace locator.visible with filter({ visible }) (#34947) 2025-02-27 13:44:53 +00:00
Simon Knott 837abfbc15
chore: document indexeddb type as "unknown" (#34944) 2025-02-27 14:29:22 +01:00
Simon Knott 10fc0ef221
chore: make indexeddb opt-in (#34942) 2025-02-27 14:27:54 +01:00
Pavel Feldman 58db3f7e3f
chore: restore pr title in html report (#34937) 2025-02-26 19:22:31 -08:00
Henrik Skupin a803e6053a
chore(bidi): use fractional coordinates for pointerAction (#34929) 2025-02-26 16:28:14 -08:00
Yury Semikhatsky b5fe029c1b
chore: remove failOnStatusCode from Browser.newContext, rename (#34936) 2025-02-26 15:03:21 -08:00
Pavel Feldman cd23a224f6
chore: another iteration on gitCommit/gitDiff props (#34926) 2025-02-26 08:40:30 -08:00
Simon Knott 17c4d8e5ec
chore: change generated filename for `toMatchAriaSnapshot` from `.yml` to `.snapshot.yml` (#34931)
Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2025-02-26 16:29:56 +01:00
Simon Knott a04a93c1fd
chore: change pageSnapshot extension to `.snapshot.yml` (#34930) 2025-02-26 14:27:17 +01:00
Dmitry Gozman 439427c14e
chore: remove stages from TestInfoImpl (#34919) 2025-02-26 10:55:02 +00:00
Yury Semikhatsky aaac9923fd
fix: disable global timeout when debugging (#34922) 2025-02-25 11:33:15 -08:00
Pavel Feldman 411f938296
chore: clean up git commit metadata props and UI (#34867) 2025-02-25 09:21:17 -08:00
Dmitry Gozman b148cbad76
fix: remove unicode soft hyphen in normalizeWhitespace (#34920) 2025-02-25 16:54:02 +00:00
Simon Knott a9bbf4b56d
docs: recommend localhost over 127.0.0.1 (#34918) 2025-02-25 15:40:38 +01:00
Simon Knott 9e38473309
fix(runner): hide `APIResponse.*` calls from results (#34909) 2025-02-25 14:26:54 +01:00
Dmitry Gozman 81855d11e4
chore: add playwright-client to the list of packages (#34916) 2025-02-25 13:23:38 +00:00
Dmitry Gozman ed0bf35435
feat: locator.visible (#34905) 2025-02-25 11:48:15 +00:00
Yury Semikhatsky 9b633ddd2f
docs: touch events guide improvements (#34903) 2025-02-24 14:13:27 -08:00
Vitaliy Potapov c4be54b45c
Docs: improve docs and tests for URL glob pattern (#34899) 2025-02-24 12:22:24 -08:00
Simon Knott 1a8f00c45f
fix: don't wrap button contents in two lines (#34887) 2025-02-24 12:15:21 -08:00
Yury Semikhatsky dbbdabfd1b
chore: pass JSHandles instead of ObjectId to/from context delegate (#34895) 2025-02-24 12:11:17 -08:00
Yury Semikhatsky 954457ba9e
chore: fix firefox tests after switching to context delegate (#34898) 2025-02-22 17:12:39 -08:00
Yury Semikhatsky e091baad79
chore: make execution context delegate public (#34894) 2025-02-21 18:27:24 -08:00
Yury Semikhatsky e38099ef13
chore: getProperties can use context stored in JSHandle (#34893) 2025-02-21 17:55:02 -08:00
Yury Semikhatsky 1af59ee523
chore(bidi): do not leak utility handles (#34892) 2025-02-21 17:44:33 -08:00
Yury Semikhatsky 962a752832
chore: contain remote objects to browser-specific code (#34890) 2025-02-21 16:52:39 -08:00
Yury Semikhatsky 6486ac006e
chore: initialize utility script privately (#34812) 2025-02-21 13:59:55 -08:00
Pavel Feldman 325fe71bb9
chore: minor html report polish (#34864) 2025-02-21 13:49:23 -08:00
Yury Semikhatsky 65910c4ac5
test: unskip "should preserve cookie order from Set-Cookie header" (#34888) 2025-02-21 10:04:01 -08:00
Max Schmitt 132d93151c
test: replace setTimeout with builtinSetTimeout in UI mode test (#34885) 2025-02-21 07:38:24 -08:00
Max Schmitt af61d659cb
chore: fix roll_browser script (#34886) 2025-02-21 07:37:52 -08:00
Playwright Service 0bb5925d0d
feat(chromium): roll to r1160 (#34884)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2025-02-21 15:40:18 +01:00
Max Schmitt 428f196036
test: have typed RunResult.results (#34883) 2025-02-21 14:22:59 +01:00
Simon Knott 48fb536e12
chore(screenshot): warn about visibility of masked elements (#34881) 2025-02-21 13:52:44 +01:00
Sang Nguyen e4ceac8e4c
docs: correct closing tags for option elements in HTML examples (#34874) 2025-02-21 09:38:47 +01:00
Adam Gastineau c64f0ffa1d
chore: manually add exception for esbuild vulnerability (#34875) 2025-02-20 14:47:44 -08:00
Adam Gastineau 33c0a1b0ca
chore: add floating promise warning to hooks (#34861) 2025-02-20 10:46:49 -08:00
Simon Knott bb8e914294
feat(ui): collapse repeating console lines (#34857) 2025-02-20 14:48:20 +01:00
Playwright Service e43d287d8d
feat(webkit): roll to r2140 (#34866)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-20 11:15:46 +01:00
Simon Knott aca3fb275b
fix(runner): validate `config.tsconfig` (#34849) 2025-02-20 09:11:50 +01:00
Pavel Feldman d5adeb3cf4
chore: build a client bundle (#34847) 2025-02-19 15:27:00 -08:00
Simon Knott 1f1e2acf9b
chore: rename prompt button (#34851) 2025-02-19 14:32:58 -08:00
Adam Gastineau f5b8cca1eb
feat: Warn on floating promises (#34845) 2025-02-19 10:11:04 -08:00
Max Schmitt 3584e72223
chore: remove 'as *' imports because of `esModuleInterop: true` (#34854) 2025-02-19 15:32:12 +01:00
Simon Knott a3e8788b9c
chore: hide llm chat (#34852) 2025-02-19 14:14:18 +01:00
Max Schmitt 7f7ab96893
chore: fix tsc linting error (#34853) 2025-02-19 12:18:42 +01:00
Playwright Service dcb9ed8d41
feat(webkit): roll to r2139 (#34850)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-19 11:11:40 +01:00
Playwright Service 0baadb513b
feat(chromium-tip-of-tree): roll to r1304 (#34842)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-18 16:24:09 +01:00
Bedřich Schindler 741a7079fe
docs(ct): add brief information about CSS modules into FAQ (#34677) 2025-02-18 06:44:09 -08:00
Max Schmitt 081031f50e
chore: bump vite to v6 (#34663) 2025-02-18 13:29:16 +01:00
Max Schmitt 1af4e367f4
fix(testServer): pass use options to listFiles command (#34832) 2025-02-18 00:33:45 +01:00
Playwright Service 715123afbe
feat(firefox-beta): roll to r1471 (#34796)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-17 10:04:32 +01:00
Playwright Service 060ef5562d
feat(webkit): roll to r2138 (#34814)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-17 09:34:16 +01:00
Max Schmitt 605eb0d657 Revert "devops: migrate away from merge.config.ts (#34802)"
This reverts commit df6e3f043a.
2025-02-17 09:33:20 +01:00
Pavel Feldman f70f92d5cd
chore: do not use process in client (#34816) 2025-02-15 19:49:30 -08:00
Pavel Feldman 3606a434fe
chore: pass validator into validator context (#34810) 2025-02-15 08:28:28 -08:00
Pavel Feldman 024a52821a
chore: init eventEmitter w/ platform (#34809) 2025-02-14 17:06:11 -08:00
Yury Semikhatsky 145b6bf4fe
chore: browser independent setInputFiles implementation (#34808) 2025-02-14 16:44:27 -08:00
Pavel Feldman 8b28e637c8
chrome: remove state from isomorphic utils (#34795) 2025-02-14 15:10:50 -08:00
Yury Semikhatsky be95a08c4d
feat(webkit): roll to r2137, update tests (#34806) 2025-02-14 11:25:35 -08:00
Simon Knott fe0b327770
feat(ui): llm conversation about error (#34750) 2025-02-14 16:59:26 +01:00
Max Schmitt df6e3f043a
devops: migrate away from merge.config.ts (#34802) 2025-02-14 11:58:37 +01:00
Dmitry Gozman e6b405c012
chore: show gha pull request title instead of a merge commit (#34781) 2025-02-14 09:32:06 +00:00
Playwright Service 32c299c89d
feat(chromium): roll to r1159 (#34780)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2025-02-14 09:33:55 +01:00
Playwright Service e276d92dd3
feat(chromium-tip-of-tree): roll to r1303 (#34783)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-14 09:33:27 +01:00
Pavel Feldman 7f742a04b0
chore: make client compile for web (#34792) 2025-02-13 18:33:17 -08:00
Pavel Feldman 4a9b336168
chore: for not use Node's events in client (#34791) 2025-02-13 16:46:24 -08:00
Yury Semikhatsky 6833b664e3
test: update modernizr expectations with actual mobile Safari 18.3 values (#34789) 2025-02-13 16:37:15 -08:00
Pavel Feldman 163aacf4b6
chore: allow client operation w/o local utils (#34790) 2025-02-13 16:15:11 -08:00
Pavel Feldman 90ec838318
chore: move zones into platform (#34786) 2025-02-13 13:06:03 -08:00
Pavel Feldman 9ecf2f69ba
chore: move pipe transport utils to server/ (#34787) 2025-02-13 12:30:53 -08:00
Yury Semikhatsky e03402f7a7
chore(bidi): implement setInputFile(FilePayload) (#34785) 2025-02-13 12:11:05 -08:00
Playwright Service 5028fb6270
chore(driver): roll driver to recent Node.js LTS version (#34776)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-13 12:09:18 +01:00
Playwright Service ea67eca5be
feat(webkit): roll to r2134 (#34754)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-13 10:05:41 +01:00
Pavel Feldman ded909c13f
chrome: restore colors enabled/levels logic (#34767) 2025-02-12 21:13:25 -08:00
Pavel Feldman 3d760b657b
chore: move debug, env and user agent from utils/ (#34766) 2025-02-12 19:27:24 -08:00
Yury Semikhatsky 6951e6ad9d
chore(bidi): move private handle conversion to execution context (#34765) 2025-02-12 18:14:39 -08:00
Yury Semikhatsky bab197b493
test: adjust bidi browser name in browsertype-connect.spec (#34758) 2025-02-12 18:04:42 -08:00
Pavel Feldman e697b1a663
chore: remove stackTrace => path dependency (#34763) 2025-02-12 18:03:23 -08:00
Pavel Feldman c31ce783b7
chore: move event utils to server (#34761) 2025-02-12 15:22:10 -08:00
Pavel Feldman 0eeba380f2
chore: move crypto to server/util/ (#34759) 2025-02-12 14:43:52 -08:00
Yury Semikhatsky c2c336b97d
chore(bidi): implement setInputFiles (#34757) 2025-02-12 12:49:05 -08:00
Yury Semikhatsky 0bd3a99f04
tests: put filechooser and setInputFiles tests into separate files (#34756) 2025-02-12 12:28:19 -08:00
Yury Semikhatsky 148af21540
chore(bidi): implement getOwnerFrame (#34755) 2025-02-12 10:53:03 -08:00
Pavel Feldman f54478a23e
chore: move utils that are user in server to server/utils (3) (#34739) 2025-02-12 09:34:01 -08:00
Yury Semikhatsky 703ca9f851
Revert "chore(bidi): use fractional coordinates for pointerAction (#3… (#34753) 2025-02-12 09:00:01 -08:00
Dmitry Gozman 8eb816b363
fix(trace): do not save trace on failure after success in test+hooks (#34724) 2025-02-12 15:41:16 +00:00
Simon Knott 1ad7aad5fb
fix: prompt should mention contents (#34746) 2025-02-12 15:44:45 +01:00
Adam Gastineau 0501f8c132
chore(html-report): make scrollbar gutter stable (#34732) 2025-02-12 05:55:36 -08:00
Simon Knott b7785e1662
feat(runner): enable gitCommitInfo by default on GH Actions (#34743) 2025-02-12 14:51:00 +01:00
Dmitry Gozman 3e976e9f10
chore(chromium): re-enable PlzDedicatedWorker feature (#34400) 2025-02-12 13:22:35 +00:00
Max Schmitt c052627138
fix: allow empty userDataDir (#34730) 2025-02-12 14:21:57 +01:00
Pavel Feldman bd74fc4964
chore: move utils that are user in server to server/utils (2) (#34736) 2025-02-11 17:19:27 -08:00
Pavel Feldman 25a168fae5
chore: move utils that are user in server to server/utils (1) (#34734) 2025-02-11 15:40:41 -08:00
Yury Semikhatsky 934600b24b
test: reenable 2 screenshot tests on wk mac (#34735) 2025-02-11 15:21:15 -08:00
Yury Semikhatsky 6004865ee5
chore(tests): respect BIDIPATH in browsertype-connect.spec.ts (#34733) 2025-02-11 14:03:16 -08:00
JacksonLei123 5a76b17c87
feat: add failOnStatusCode option to API request context (#34346) 2025-02-11 13:23:11 -08:00
Pavel Feldman 46b048f018
chore: vendor stack utils (#34719) 2025-02-11 12:53:08 -08:00
Yury Semikhatsky 8e51be9069
chore(bidi): use fractional coordinates for pointerAction (#34675) 2025-02-11 12:09:48 -08:00
Simon Knott 8ed2f4319e
chore: add pageSnapshot option (#34669) 2025-02-11 11:04:57 -08:00
Udaiveer Pradhan d2e7e8acdb
fix(ui-mode): Watch mode button doesn't show active when test selected (#34581) 2025-02-11 10:32:39 -08:00
Playwright Service 3ae39166c2
feat(chromium-tip-of-tree): roll to r1302 (#34726)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-11 17:40:52 +01:00
Max Schmitt 416c9b3368
fix: allow relative userDataDir (#34710) 2025-02-11 17:40:00 +01:00
Pavel Feldman 72cd6f06aa
chore: prework for web ws connection (#34718) 2025-02-11 08:28:28 -08:00
Adam Gastineau 91f46bb5d0
chore(html-report): clean up git metadata display (#34713) 2025-02-11 05:16:46 -08:00
dependabot[bot] 6704370c3f
chore(deps-dev): bump esbuild from 0.18.20 to 0.25.0 (#34721)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-11 12:27:59 +01:00
Simon Knott 2eb6cbe357
chore: improve fix test prompt (#34709) 2025-02-11 08:40:46 +01:00
Pavel Feldman 51f944d16a
chore: extract pipe->connection code (#34689) 2025-02-10 15:04:33 -08:00
Pavel Feldman 2718ce7cbf
chore: short-cut localUtils usage in JS client (#34690) 2025-02-10 14:19:58 -08:00
Adam Gastineau ad6444e14c
chore(test): perform action to guarantee URL updates (#34714) 2025-02-10 12:57:25 -08:00
Adam Gastineau aeed1f5909
fix(runner): display no projects error across all `test` modes (#34676) 2025-02-10 12:52:53 -08:00
Playwright Service 71c7f465a0
feat(webkit): roll to r2132 (#34697) 2025-02-10 11:36:45 -08:00
Pavel Feldman 5d500dde22
chore: introduce platform for client (1) (#34683) 2025-02-10 10:22:32 -08:00
Simon Knott 0672f1ce67
feat(ui): "fix with ai" button (#34708) 2025-02-10 17:47:27 +01:00
Simon Knott 2f8d448dbb
feat(html): "copy prompt" button (#34670) 2025-02-10 15:02:19 +01:00
Max Schmitt 703e077f4b
chore: fix recorder tsconfig linting (#34704) 2025-02-10 13:23:04 +01:00
Priyanshi Saxena 76b7b52c34
docs: source section doc updated (#34627)
Co-authored-by: ankursaxena17 <32309836+ankursaxena17@users.noreply.github.com>
2025-02-10 12:22:53 +00:00
Max Schmitt 967c4f5e3b
chore: fix Locator type issues (#34705) 2025-02-10 13:05:17 +01:00
Playwright Service 4c8af0128f
feat(chromium): roll to r1158 (#34702)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2025-02-10 12:33:37 +01:00
Playwright Service a95186a373
feat(firefox): roll to r1475 (#34695)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-10 09:12:50 +01:00
Playwright Service f11ed1beab
feat(chromium-tip-of-tree): roll to r1301 (#34696)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-10 09:12:07 +01:00
Pavel Feldman 88c01434c6
chore: fix locator type check (#34682) 2025-02-07 14:53:28 -08:00
Pavel Feldman d5d47f2b6e
chore: organize imports in packages (#34681) 2025-02-07 14:44:00 -08:00
Pavel Feldman 4a7f6a6ef0
chore: organize imports in playwright-core (#34680) 2025-02-07 13:54:01 -08:00
Adam Gastineau 4bc8cf0d47
feat(recorder): display primary page URL in recorder title (#34637) 2025-02-07 12:05:04 -08:00
Simon Knott 893e7bbf3b
chore: add _browserTypes helpers to playwright (#34611) 2025-02-07 15:43:08 +01:00
Max Schmitt 9e433060fe
test: keep testing React 18 (#34671) 2025-02-07 12:24:53 +01:00
Simon Knott bc8d6ce344
feat: provide commit diff to HTML reporter (#34653)
Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2025-02-07 10:39:08 +01:00
Simon Knott fd24521f2e
chore: add page snapshot on test end (#34573)
Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Yury Semikhatsky <yurys@chromium.org>
2025-02-07 09:02:20 +01:00
Pavel Feldman 7da3be4a1a
chrome: update eslint 9 (#34666) 2025-02-06 19:48:27 -08:00
Henrik Skupin 6fddefde81
chore(bidi): pointerMove action needs to floor fractional values for x and y position (#34191) 2025-02-06 16:17:50 -08:00
Max Schmitt 8accb0ad1b
test: change ct-vite projects to type: module (#34662) 2025-02-06 23:11:06 +01:00
Yury Semikhatsky 34d9d4fc33
chore(html-report): show run duration for each retry (#34647) 2025-02-06 13:30:25 -08:00
Yury Semikhatsky 3d3154de86
chore(tracing): look up snapshot resources only in the same context (#34645) 2025-02-06 12:38:51 -08:00
Max Schmitt 427d7a22ea
Revert "chore: tidy up headless-shell hacks (#33967)" (#34659) 2025-02-06 19:17:20 +01:00
Simon Knott 902e83fe87
fix: allow opt out from `IndexedDB` in storagestate (#34650) 2025-02-06 16:40:14 +01:00
Dmitry Gozman 8d751cfe50
fix(fetch): filter out undefined `params` (#34654) 2025-02-06 15:16:45 +00:00
Simon Knott 365f411548
test(storageState): IndexedDB with `keyPath` (#34648) 2025-02-06 12:39:19 +01:00
Simon Knott 2b5493219b
chore: document typed array limitation (#34649) 2025-02-06 12:39:07 +01:00
Simon Knott 1c7436ec2f
chore: remove dead code (#34651) 2025-02-06 11:39:10 +01:00
Simon Knott 7aac96d780
chore: add encoded versions of IndexedDB key/value (#34630) 2025-02-06 09:48:30 +01:00
Pavel Feldman 11e1b8f30a
chore: fallback to the original code after babel transform (#34635) 2025-02-05 14:03:31 -08:00
Yury Semikhatsky 7f09ba7fa4
feat: step.attach() (#34614) 2025-02-05 12:27:44 -08:00
Pavel Feldman 4b64c47a25
chore: use explicit matcher call context (#34620) 2025-02-05 10:57:33 -08:00
Playwright Service 25ef2f1344
feat(webkit): roll to r2130 (#34631) 2025-02-05 09:05:10 -08:00
Yury Semikhatsky f1a392f844
chore: do not store empty step.attachments[] in trace (#34579) 2025-02-05 08:30:03 -08:00
Adam Gastineau cb208836b5
fix: display error when project is not found (#34577) 2025-02-05 06:58:02 -08:00
Adam Gastineau 50f22f13a4
docs: document config executing multiple times (#34576) 2025-02-05 06:10:32 -08:00
Simon Knott 311625b891
feat: recreate IndexedDB in storagestate (#34591) 2025-02-05 15:01:53 +01:00
Yury Semikhatsky fb3e8ed114
fix: reset APIRequestContext network trace between chunks (#34616) 2025-02-05 08:00:04 +00:00
Playwright Service 11913e6f39
feat(webkit): roll to r2127 (#34599) 2025-02-04 17:03:14 -08:00
Atsushi Kawamura (atzz/a2c) dc14490f13
docs: remove unnecessary hyphens in CircleCI's sharding example (#34609) 2025-02-04 15:38:39 +00:00
Playwright Service 50e1a8b55b
feat(chromium-tip-of-tree): roll to r1300 (#34610)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-04 16:06:35 +01:00
Simon Knott 5d82567346
feat: emulate `prefers-contrast` (#34494) 2025-02-04 11:15:51 +01:00
Max Schmitt 96d4dc1eda
docs: add backlink from WebSocket to WebSockeRoute (#34600) 2025-02-03 19:42:38 +01:00
Yury Semikhatsky f11f4a8477
docs: breaking changes in java 1.50 (#34601) 2025-02-03 09:39:33 -08:00
Adam Gastineau 5996a0df0a
Revert "Revert "chore(docs): clarify connection method via BrowserType.connect (#34560)" (#34594)" (#34595) 2025-02-03 06:21:00 -08:00
Max Schmitt 340834195b
docs: v1.50 release notes for ports (#34592)
Signed-off-by: Max Schmitt <max@schmitt.mx>
Co-authored-by: Simon Knott <info@simonknott.de>
2025-02-03 15:17:19 +01:00
Max Schmitt 3d5f85d7e4
Revert "chore(docs): clarify connection method via BrowserType.connect (#34560)" (#34594) 2025-02-03 14:24:33 +01:00
Simon Knott ebf82b0854
test: ensure that attachments are available in onStepEnd (#34590) 2025-02-03 13:54:28 +01:00
Max Schmitt 4e2d82e6c2
test: add test for color input click behavior (#34156) 2025-02-03 13:30:54 +01:00
Playwright Service 36478f250a
feat(firefox): roll to r1474 (#34587)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-03 12:04:12 +01:00
Playwright Service 162182b714
feat(firefox-beta): roll to r1470 (#34589)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-03 10:47:37 +01:00
Yury Semikhatsky cd7f3b6e65
devops: validate js code snippets in flint (#34580) 2025-01-31 16:52:55 -08:00
Yury Semikhatsky a1451c75f8
feat: conditional step.skip() (#34578) 2025-01-31 15:45:57 -08:00
Yury Semikhatsky da12af24c2
chore: harden trace file regex (#34563) 2025-01-31 15:34:53 -08:00
Playwright Service 399ba91150
feat(chromium-tip-of-tree): roll to r1299 (#34569)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-31 19:35:12 +01:00
Playwright Service 64f8689a81
feat(chromium): roll to r1157 (#34571)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-31 13:15:40 +01:00
GeneratorX16 4fa1d39c80
fix: Reverse Lumia 550 and Lumia 550 Landscape viewports (#34548) 2025-01-30 13:57:43 -08:00
Adam Gastineau 1936cfa6c3
chore(docs): clarify connection method via BrowserType.connect (#34560) 2025-01-30 12:31:59 -08:00
Debbie O'Brien d288fbcc41
docs: Improve aria snapshots documentation clarity and examples (#34509)
Signed-off-by: Debbie O'Brien <debs-obrien@users.noreply.github.com>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2025-01-30 20:07:48 +00:00
Dmitry Gozman ab62ef2dbb
fix(toMatchAriaSnapshot): fail test run when updating missing snapshot (#34556) 2025-01-30 19:18:07 +00:00
Adam Gastineau 5afb04b62e
fix(ui): add proper CORS header for loading traces in HMR mode (#34558) 2025-01-30 09:20:43 -08:00
Max Schmitt 833c729eb0
docs: roll follow-ups for .NET and Python (#34550) 2025-01-30 12:06:56 +01:00
Pavel Feldman eff5cd6dbb
fix(aria): disregard text area textContent (#34544) 2025-01-29 16:06:07 -08:00
Pavel Feldman 4b5b326478
chore: do not show steps in line reporter without tty (#34529) 2025-01-29 12:41:09 -08:00
Adam Gastineau f15171bcf0
fix(ui): don't display "Timed Out" when executing action (#34541) 2025-01-29 12:39:05 -08:00
Dmitry Gozman ba650161a8
feat: per-assertion snapshot path template in config (#34537) 2025-01-29 18:47:20 +00:00
Playwright Service b552637ee0
feat(chromium-tip-of-tree): roll to r1298 (#34540)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-29 18:29:23 +01:00
Dmitry Gozman 24f06ec1bf
feat(html report): show metadata (#34517) 2025-01-29 16:22:50 +00:00
Max Schmitt 6c2c90203e
devops(gha): allow workflow_dispatch in roll browser script (#34531)
Signed-off-by: Max Schmitt <max@schmitt.mx>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2025-01-29 17:16:50 +01:00
Dmitry Gozman 7d8265e610
Revert "Reapply "fix(har timing): record connect timing for proxied connections" (#32855) (#33003)" (#34535) 2025-01-29 14:51:31 +00:00
Andrey Lushnikov b419527aab
fix(firefox): disable fetch keep-alive for now before a proper fix (#34530) 2025-01-29 09:50:32 +00:00
Pavel Feldman 931b9f28cd
fix(codegen): attribute navigation to press/fill (#34528) 2025-01-28 17:59:16 -08:00
Pavel Feldman 391e9c4de0
fix(recorder): do not reset inspect highlight on inactivity (#34526) 2025-01-28 16:00:28 -08:00
Pavel Feldman 7060cd1bf7
chore: allow repetative application of rebaselines in the same session (#34524) 2025-01-28 14:37:47 -08:00
Pavel Feldman 7fd0c3e254
fix: follow the pseudo attr value in firefox computed style (#34525) 2025-01-28 14:37:04 -08:00
Danilo Akamine b27945d045
docs: remove duplicate reference (#34513) 2025-01-28 22:33:04 +01:00
Dmitry Gozman 7fc252fffc
test: fetch request through socks proxy over ipv4 (#34522) 2025-01-28 17:05:12 +00:00
Adam Gastineau 63f96efbe0
feat(trace-viewer): display query string in network tab (#34505) 2025-01-28 05:19:30 -08:00
Vitaliy Potapov 61d595ae48
feat: add new config prop populateGitInfo (#34329)
Co-authored-by: Yury Semikhatsky <yurys@chromium.org>
2025-01-28 07:54:31 +00:00
Pavel Feldman cea5dad686
chore: remove eslint-plugin-internal-playwright (#34510) 2025-01-27 20:13:27 -08:00
Pavel Feldman ab01dccf9d
chore: clean up tool example (#34512) 2025-01-27 20:13:18 -08:00
Pavel Feldman 2c0576ea76
chore: mark tools package as private (#34511) 2025-01-27 15:32:45 -08:00
Pavel Feldman bd2fdd0f20
chore: land experimental tools (#34503) 2025-01-27 14:49:38 -08:00
ReaZzy eaaef29dbd
fix: add validations to --shard cli parameter (#34463) (#34479) 2025-01-27 14:31:14 -08:00
Henrik Skupin d63907fc5b
chore(bidi): Disable some external services for Firefox (#34492) 2025-01-27 13:17:03 -08:00
Max Schmitt bc1a8c2191
test: add test for fetch with keepalive: true on Firefox (#34498) 2025-01-27 15:39:59 +01:00
Max Schmitt 8d716b28a1
chore(bidi): use full test title in CSV expectations (#34496) 2025-01-27 14:17:47 +01:00
Max Schmitt 52580d640d
Revert "fix(ci): Prevent workflows from automatically running on forks (#34408)" (#34488) 2025-01-27 14:03:19 +01:00
Dmitry Gozman 640e6a8aa7
chore: remove unused headers (#34491) 2025-01-27 09:58:19 +00:00
Pavel Feldman 245f4b5b86
fix: allow changed to be passed in config (#34473) 2025-01-24 15:42:58 -08:00
Playwright Service 3d9a9d2405
feat(firefox): roll to r1472 (#34455) 2025-01-24 15:17:14 -08:00
Playwright Service c815d090bc
feat(firefox-beta): roll to r1468 (#34454) 2025-01-24 15:16:18 -08:00
Alexandra Borovova 2afe287a81
Add canonical screenshots for firefox with webdriver bidi for screenshot element tests (#34289) 2025-01-24 15:15:24 -08:00
Yury Semikhatsky fb145d5ebd
test: do not check deprecated KeyboardEvent.keyCode property (#34472) 2025-01-24 15:09:39 -08:00
Adam Gastineau fccb2b0784
chore: fix codegen SIGINT test (#34468) 2025-01-24 14:21:42 -08:00
Henrik Skupin 9d91d7a1e9
chore(firefox): Don't upgrade HTTP requests to HTTPS (#34465) 2025-01-24 13:36:23 -08:00
Adam Gastineau b39c29d096
docs: remove toMatchAriaSnapshot path feature (#34471) 2025-01-24 21:16:58 +01:00
Yury Semikhatsky dcff914040
chore(bidi): make browserType.connect work (#34461) 2025-01-24 09:09:57 -08:00
Adam Gastineau c44590aa5b
chore: disable popover test on Darwin 13.7 WebKit (#34466) 2025-01-24 08:27:06 -08:00
Playwright Service bbd55587e4
feat(chromium): roll to r1156 (#34464)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-24 15:40:46 +01:00
Adam Gastineau f65dc0cee4
feat: toHaveURL predicate matcher (#34413) 2025-01-24 06:00:17 -08:00
Yury Semikhatsky f11768436a
chore: revert inadvertent test change (#34459) 2025-01-23 12:12:53 -08:00
Pavel Feldman bfb79990da
docs: issue guide (#34457) 2025-01-23 12:12:13 -08:00
Pavel Feldman 039f513744
docs: auto generate evaluate usage docs (#34458) 2025-01-23 12:11:54 -08:00
Playwright Service 04c03b998a
feat(webkit): roll to r2125 (#34453)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-23 18:37:42 +01:00
Playwright Service 2cf6153d9f
feat(chromium-tip-of-tree): roll to r1297 (#34451)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-23 16:40:15 +01:00
Debbie O'Brien 900382540a
docs: add --update-source-method option for snapshot updates in test-cli-js (#34448) 2025-01-23 14:17:23 +00:00
Dmitry Gozman ab3b4b8cd0
fix(test runner): respect updateSourceMethod from the config (#34442) 2025-01-23 12:11:26 +00:00
Playwright Service a9609ed6f2
chore(driver): roll driver to recent Node.js LTS version (#34440) 2025-01-23 11:30:12 +01:00
Henrik Skupin 34cb35859a
chore(bidi): simplify launcher tests for Firefox (#34405) 2025-01-22 13:06:24 -08:00
Adam Gastineau a06600aee9
chore: roll stable-test-runner to: 1.50.0-beta-1737557690000 (#34433) 2025-01-22 12:46:25 -08:00
Adam Gastineau a121f85ce9
chore: update browser patches to 2e93a0b95 (#34426) 2025-01-22 09:56:34 -08:00
Adam Gastineau 256dc47833
docs: switch gracefulShutdown to primarily mention SIGTERM and add Docker comment (#34430) 2025-01-22 09:49:34 -08:00
Max Schmitt 85e41f5b65
docs: update README for flakiness dashboard function update (#34424) 2025-01-22 16:33:19 +01:00
Adam Gastineau b75fc4c547
fix(ci): Prevent workflows from automatically running on forks (#34408) 2025-01-22 07:05:34 -08:00
Adam Gastineau 7e97e01505
docs: release notes for v1.50 js (#34380) 2025-01-22 06:20:24 -08:00
Adam Gastineau 49b3bbb920
docs: release notes for v1.50 js (#34380) 2025-01-22 06:17:54 -08:00
dependabot[bot] a689e534ac
chore(deps): bump vite from 5.4.6 to 5.4.14 (#34420)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-22 14:23:05 +01:00
dependabot[bot] 214b103b46
chore(deps-dev): bump undici from 5.28.4 to 5.28.5 (#34419)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-22 15:52:00 +03:00
Dmitry Gozman cf90c0f122
fix(aria snapshot): make rebase work when options are specified (#34409) 2025-01-22 07:53:53 +00:00
Playwright Service cf3bcd7d4a
feat(chromium-tip-of-tree): roll to r1296 (#34414)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-22 08:21:47 +03:00
Tasawar Hussain 6234c3b15e
docs: update test-fixtures-js.md (#34399) 2025-01-21 13:50:33 -08:00
Dmitry Gozman 888feb06be
fix(list reporter): do not break after output without trailing eol (#34410) 2025-01-21 18:30:09 +00:00
Dmitry Gozman 333e994e7d
fix(step.skip): show a skipped indicator in UI mode (#34407) 2025-01-21 18:28:41 +00:00
Dmitry Gozman e20b6d1617
feat(chromium-tip-of-tree): roll to r1295 (#34372) 2025-01-20 16:28:41 +00:00
Simon Knott 99fb188cb4
chore: move attachment link back to tree item, make it flash yellow (#34353) 2025-01-20 09:06:01 +01:00
Max Schmitt 86768b9ebc
test: add test for consistent hyphen rendering in headless/headed (#34159) 2025-01-18 19:04:56 +03:00
Yury Semikhatsky 372d4196d7
chore: step timeout improvements (#34386) 2025-01-17 21:15:47 -08:00
Pavel Feldman 9970446f51
chore: remove toMatchAriaSnapshot.path (#34379) 2025-01-17 14:35:15 -08:00
Henrik Skupin d082805ea9
chore(bidi): disable thottling of background tabs in Firefox (#34381) 2025-01-17 14:29:26 -08:00
Adam Gastineau 3c160df06a
chore: mark v1.51.0-next (#34382) 2025-01-17 12:34:59 -08:00
Pavel Feldman 1b21ec9cd8
chore: remove --save-trace codegen option (#34362) 2025-01-17 10:17:49 -08:00
Pavel Feldman b339d457e3
chore: dogfood jest-style aria snapshots (#34365) 2025-01-17 10:17:26 -08:00
Dmitry Gozman 07bcbcd1b4
feat(chromium): roll to r1155 (#34371) 2025-01-17 10:45:58 +00:00
Yury Semikhatsky 40b92eaf2a
docs: remove toMatchAriaSnapshot({path}) from language ports (#34363) 2025-01-16 16:56:13 -08:00
Yury Semikhatsky 5438814975
chore: do not fall back to previous LTS release deps for new Ubuntu LTS (#34360) 2025-01-16 15:20:40 -08:00
Yury Semikhatsky 587e778a5a
Revert "feat(aria): extend toHaveAccessibleName() to accept an array … (#34361) 2025-01-16 15:04:56 -08:00
Pavel Feldman 3cf0461a1a
chore: fix the scrollable locator tab (#34358) 2025-01-16 13:20:20 -08:00
Adam Gastineau 84bbc5fd35
feat(trace-viewer): Render context string for most actions (#34292) 2025-01-16 11:48:34 -08:00
Dmitry Gozman be6caed8df
chore: remove expectZone (#34312) 2025-01-16 18:53:32 +00:00
Pavel Feldman 08af3a2f06
chore: do not cache highlight agressively (#34349) 2025-01-16 08:27:48 -08:00
Yury Semikhatsky 00bb17751b
chore: delete recorder in traceviewer experiment (#34347) 2025-01-15 17:37:33 -08:00
Yury Semikhatsky 8d39c44b69
docs: improve toHaveClass paramter description (#34345) 2025-01-15 14:38:34 -08:00
Yury Semikhatsky 07f425434d
chore(bidi): support ControlOrMeta key (#34341) 2025-01-15 13:23:44 -08:00
Yury Semikhatsky 224d7bf847
fix(docker): install gpg on slim images (#34340) 2025-01-15 12:03:19 -08:00
Dmitry Gozman 4d55d3039a
chore: better error message when CSS selector fails to parse (#34331) 2025-01-15 11:34:51 -08:00
Dmitry Gozman aeec0c0e36
fix(test runner): esm loader in old Node versions (#34330) 2025-01-15 14:45:10 +00:00
Yury Semikhatsky 275f334b58
chore(step): remove step.fail and step.fixme, add step.skip (#34326) 2025-01-14 17:43:47 -08:00
Julian Descottes 0869195ba4
chore(bidi): Stop dividing BiDi network event timings by 1000 (#34324) 2025-01-14 15:27:49 -08:00
Yury Semikhatsky 8699d3b9c5
test(bidi): create inspected page before initializing recorder (#34323) 2025-01-14 14:57:42 -08:00
Pavel Feldman b0f0a2951a
docs: improve aria overload docs (#34319) 2025-01-13 18:25:57 -08:00
Pavel Feldman ad365c3bc3
chore: include child nodes when parsing snapshot (#34318) 2025-01-13 18:25:41 -08:00
Pavel Feldman fe96104ce2
docs: clarify updateSourceMethod (#34314) 2025-01-13 18:25:32 -08:00
Rui Figueira 9a9d22af44
feat(codegen): include framePath in jsonl format (#34310) 2025-01-13 17:32:26 -08:00
Playwright Service dfe80bb888
feat(firefox): roll to r1471 (#34309) 2025-01-13 17:26:26 -08:00
Yury Semikhatsky 2b2e84971f
chore(bidi): use original key name when computing bidi value (#34317) 2025-01-13 17:22:00 -08:00
Playwright Service d2e7ad38d5
feat(firefox-beta): roll to r1467 (#34303) 2025-01-13 13:58:34 -08:00
Julian Descottes 454b6f938d
test(bidi): Update browserName used for har file tests when using bidi (#34313) 2025-01-13 13:56:00 -08:00
Playwright Service 6b73ec6092
feat(webkit): roll to r2123 (#34260) 2025-01-13 13:53:18 -08:00
Zachary Blackwood f74a4d55cd
Fix typo "fore" -> "for" (#34315) 2025-01-13 12:30:19 -08:00
Simon Knott a33659f2a8
chore: move attachments link to step body (#34196) 2025-01-13 10:07:54 +01:00
Playwright Service 19c935cde7
feat(firefox): roll to r1470 (#34304) 2025-01-13 09:05:33 +03:00
Pavel Feldman 6179b5b1d7
chore: allow matching aria snapshot in trace viewer (#34302) 2025-01-11 10:14:21 -08:00
Pavel Feldman 0c8a6b80fb
chore: consolidate aria parser in isomorphic bundle (#34298) 2025-01-10 15:32:35 -08:00
Andrey Lushnikov 4bb464197f
test: unflake a few trace-viewer tests (#34299) 2025-01-10 14:57:50 -08:00
Andrey Lushnikov 2cd5003062
test: fix "should capture navigation" flakiness on firefox-headed (#34291) 2025-01-10 13:51:28 -08:00
Yury Semikhatsky 423005a7ab
chore(bidi): create parent dir for report.csv (#34294) 2025-01-10 13:43:43 -08:00
Dmitry Gozman f0a3a15e93
chore: explicitly reset apiZone instead of everything (#34265) 2025-01-10 20:15:05 +00:00
Dmitry Gozman 1f2eb499d2
fix(aria snapshots): normalize whitespace (#34285) 2025-01-10 19:31:47 +00:00
Julian Descottes 4f3a5e2133
chore(bidi): Fix handling of cookie headers in network.continueRequest (#34277) 2025-01-10 11:06:26 -08:00
Julian Descottes ca94291ab7
chore(bidi): Handle headers properly in BiDi network.continueRequest (#34268) 2025-01-10 10:15:38 -08:00
Henrik Skupin 89172175d6
Improve WebDriver BiDi key codes (#34286) 2025-01-10 09:19:28 -08:00
Adam Gastineau a2e2dfd446
feat: Enable snapshots for most remaining public commands (#34072) 2025-01-10 05:04:44 -08:00
Dmitry Gozman b32d546159
test: attempt to unflake vscode highlight tests (#34267) 2025-01-10 09:52:39 +00:00
Simon Knott 75d2661497
docs: fix android launchBrowser.pkg option (#34262) 2025-01-10 10:51:29 +01:00
Pavel Feldman 13bdd3c92f
feat(toBeChecked): allow indeterminate expectation (#34269) 2025-01-09 18:18:15 -08:00
Yury Semikhatsky 37c2569eb2
fix(inspector): do not start recording by default (#34276) 2025-01-09 14:58:41 -08:00
Yury Semikhatsky cd9d02faf9
chore: remove setAutoCloseAllowed (#34273) 2025-01-09 14:16:01 -08:00
Yury Semikhatsky 201fc48cf0
chore(bidi): write custom expectations only for timing out tests (#34270) 2025-01-09 11:10:14 -08:00
Alexandra Borovova c465e21161
chore(bidi): add missing canonical screenshots for tests running with Firefox and WebDriver BiDi (#34257) 2025-01-09 10:36:59 -08:00
Adam Gastineau 01ba528904
fix: Prepare CI to properly run Electron on ubuntu-latest (24.04) (#34238) 2025-01-09 06:34:59 -08:00
Playwright Service 9b58e4a93a
chore(driver): roll driver to recent Node.js LTS version (#34261) 2025-01-09 13:53:41 +03:00
Ben Hovinga 9f32c858e0
Fix typo (#34225) 2025-01-08 11:22:41 -08:00
Yury Semikhatsky edfbab2a79
fix: dispatch touch events in webkit (#34250) 2025-01-08 11:06:30 -08:00
Dmitry Gozman 7ee7e018fa
chore: update chrome extensions doc and tests (#34236) 2025-01-08 17:24:29 +00:00
JustasM d6d5944797
fix(ui): fix washed out dropdown colors in dark mode (#34186) 2025-01-08 06:14:22 -08:00
Adam Gastineau ada68cd6f0
feat(trace-viewer): Add setting for display canvas content in snapshots (#34010) 2025-01-08 05:08:00 -08:00
Yury Semikhatsky ff9242104b
docs: touch events emulation guide (#34201) 2025-01-07 16:47:00 -08:00
Yury Semikhatsky 6fb6282a9d
chore(bidi): propertly dispatch ControlRight key event (#34246) 2025-01-07 16:46:44 -08:00
Yury Semikhatsky 809225503c
docs: remove note about DataTrander limited availability (#34243) 2025-01-07 15:42:10 -08:00
Pavel Feldman 0d34369fc0
chore: include actual value in the elementState (#34245) 2025-01-07 15:31:18 -08:00
Yury Semikhatsky 0008816ee3
test: reenable "return empty content there is no iframe src" in cr and ff (#34241) 2025-01-07 11:49:14 -08:00
Pavel Feldman 7923d35e32
fix(retarget): do not unconditionally retarget to enclosing label (#34229) 2025-01-07 11:15:00 -08:00
Pavel Feldman 9514f0fb9d
fix(aria): escape leading dash in property values (#34227) 2025-01-07 11:14:45 -08:00
Playwright Service d2af88c1fe
feat(chromium-tip-of-tree): roll to r1293 (#34234)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-07 21:43:05 +03:00
Dmitry Gozman 63329a3471
chore: remove dependency from library on expectZone, straighten csi handling (#34211) 2025-01-07 13:30:04 +00:00
Simon Knott 527505e67b
docs: be more precise in what versions of Node.js are supported (#34231)
Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2025-01-07 14:23:27 +01:00
Yury Semikhatsky ec79f28ffe
chore(bidi): keep custom expectations only for timing out tests (#34228) 2025-01-06 17:36:49 -08:00
Yury Semikhatsky a9e6b51108
chore(bidi): implement query selector all ($$) method (#34226) 2025-01-06 16:37:11 -08:00
Pavel Feldman 4e8c83055f
chore: split output clients by capabilities and base dir (#34135) 2025-01-06 11:03:35 -08:00
Dmitry Gozman eeca68ba97
test: unflake some cookie tests in msedge (#34217) 2025-01-05 18:19:28 +00:00
Yury Semikhatsky 5a22475ea8
chore(bidi): fix signals tests (#34209) 2025-01-03 12:37:28 -08:00
Yury Semikhatsky 8b45ea6f2f
chore: properly initialize Touch arguments in TouchEvent (#34200) 2025-01-03 12:16:01 -08:00
Yury Semikhatsky dca95ba609
fix(bidi): set initial frame url from creation event (#34198) 2025-01-03 10:39:32 -08:00
Simon Knott 6bdd2694ee
feat(webserver): customize shutdown with new `gracefulShutdown` option (#34130)
Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2025-01-03 11:34:34 +01:00
Simon Knott 04a3574f80
feat(reporter): report `TestStep#attachments` (#34037) 2025-01-02 17:48:59 +01:00
Max Schmitt 175f05cafc
test: increase page-event-crash timeout (#34178) 2025-01-02 16:04:51 +01:00
David Gahnassia acdd666d95
docs(test-fixtures): removed redundancy (#34185) 2025-01-02 06:17:22 +01:00
Playwright Service 546b7b702c
feat(webkit): roll to r2122 (#34180)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-02 06:16:46 +01:00
Playwright Service da52befea0
feat(chromium-tip-of-tree): roll to r1291 (#34182)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-02 06:16:04 +01:00
Yury Semikhatsky 7769010e6e
chore(bidi): mark test expected to timeout as fixme (#34176) 2024-12-31 13:18:25 -08:00
Max Schmitt b2cbe7f2ec
chore(roll): roll WebKit to r2121 (#34179) 2024-12-31 11:22:10 +01:00
Henrik Skupin 940230d43a
Use csvReporter as well when running BiDi tests locally (#34167) 2024-12-30 14:48:22 -08:00
Dmitry Gozman cd32d1b08c
fix(test runner): apply `--last-failed` after sharding (#34166) 2024-12-30 18:45:49 +00:00
Henrik Skupin cab2bc4e2a
Combine file name and test name to a single identifier for CSV export of BiDi results (#34172) 2024-12-30 10:06:00 -08:00
Dmitry Gozman 9dbe63636d
fix(routeWebSocket): should work after context reuse (#34165) 2024-12-30 10:00:10 -08:00
Max Schmitt 4819747c85
chore: keep linting generated files (#34150) 2024-12-27 10:00:59 +00:00
Pengoose 7f141b2c42
feat: expect(locator).toHaveAccessibleErrorMessage (#33904) 2024-12-27 09:54:16 +00:00
Playwright Service 3ec8ee7a9b
feat(chromium): roll to r1153 (#34118)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-27 08:51:06 +01:00
Playwright Service 08644003d2
feat(chromium-tip-of-tree): roll to r1290 (#34144)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-26 22:27:56 +01:00
Gautier Ben Aïm 1c8e6f0921
docs: fixed typo (#34129) 2024-12-21 18:59:50 +01:00
Yury Semikhatsky 03cf7429a4
chore(bidi): upload report.csv to azure (#34122) 2024-12-20 18:04:21 -08:00
Yury Semikhatsky cce8e8e0e5
chore(html): use api prefix to qualify public types (#34121) 2024-12-20 14:03:38 -08:00
Evan Cahill c89e213eff
docs: Use locator.first() in locator.or examples (#34106) 2024-12-20 13:23:01 -08:00
Yury Semikhatsky a74c488b25
docs: document --no-shell option (#34120) 2024-12-20 10:24:10 -08:00
Adam Gastineau 875436855e
chore(lint): Ensure EOL newlines (#34117) 2024-12-20 09:17:09 -08:00
Yury Semikhatsky 3bc72eb841
chore(bidi): disambiguate report.csv artifact name (#34110) 2024-12-20 08:58:15 -08:00
Adam Gastineau a8dfdc8ac5
chore(ui): Dialog UI for upcoming settings menu (#34058) 2024-12-20 08:43:12 -08:00
Adam Gastineau 05472f5ef6
feat: Add time information to Call and Network tabs in Trace Viewer (#33935) 2024-12-20 05:01:16 -08:00
Yury Semikhatsky cc98166aaa
chore(bidi): add csv report (#34107) 2024-12-19 22:59:24 -08:00
Pavel Feldman a94952b87f
chore: make ts happy with zip import (#34108) 2024-12-19 22:59:05 -08:00
Pavel Feldman 04e670c909
fix(locator): do not explode locators (#34104) 2024-12-19 15:34:54 -08:00
Max Schmitt b7a1cfd786
chore: move winldd to CDN (#34078) 2024-12-19 23:29:21 +01:00
Yury Semikhatsky d7a52347e5
chore(bidi): skip tooling tests (#34105) 2024-12-19 14:04:05 -08:00
Max Schmitt 61ce37cd53
test: use checkInstalledSoftwareOnDisk for itest (#34103) 2024-12-19 22:09:49 +01:00
Pavel Feldman 6505a3e34c
fix(yaml): escape to disambiguate yaml arrays (#34096) 2024-12-19 12:46:54 -08:00
Pavel Feldman ec1d3313c3
Revert "feat(fetch/network): add generic to json method" (#34098) 2024-12-19 12:46:39 -08:00
Henrik Skupin edd789780a
WebDriver BiDi: "browsingContext.captureScreenshot" accepts quality from 0 to 1 (#34097) 2024-12-19 12:26:01 -08:00
Adam Gastineau 7d3a188530
chore(ui): Clean up settings component for shared uses (#34090) 2024-12-19 12:14:58 -08:00
Max Schmitt 613f6c5f95
devops: run bidi tests for bidi changes (#34099) 2024-12-19 21:03:33 +01:00
Yury Semikhatsky 8e721fac85
chore(bidi): no retries on CI (#34080) 2024-12-19 11:55:10 -08:00
Volodymyr Momot 94ffbcb9c5
feat(fetch/network): add generic to json method (#34091) 2024-12-19 10:36:02 -08:00
Playwright Service 9c14cccc24
feat(chromium-tip-of-tree): roll to r1288 (#34092) 2024-12-19 17:17:29 +01:00
Playwright Service a239ab3048
feat(ffmpeg): roll to r1011 (#34079)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-19 10:17:42 +01:00
Max Schmitt 4c9a116aff
chore: move protocol to d.ts types only files (#34077) 2024-12-19 00:23:35 +01:00
Playwright Service bddbf8950e
feat(webkit): roll to r2120 (#34069) 2024-12-19 00:08:27 +01:00
Rui Figueira c2d057ba23
chore: add url option to routeFromHAR call if codegen launched with --save-har-glob (#34048) 2024-12-18 13:34:06 -08:00
Dmitry Gozman d9e5ca06bf
fix(remote server): allow local paths in extension mode (#34051) 2024-12-18 13:32:16 -08:00
Max Schmitt f7c99ee6e3
chore: update CDN endpoints (#34061) 2024-12-18 22:26:01 +01:00
Andrew Goldis c57155e30c
docs: explain globalSetup caveats for reporters (#34063) 2024-12-18 13:16:03 -08:00
Simon Knott 67bc484d8b
chore(ui): test that UI works behind proxy, take 2 (#33771) 2024-12-18 12:39:08 +01:00
Simon Knott 443b2a2bbc
fix: don't rely on requestAnimationFrame (#34065) 2024-12-18 11:41:48 +01:00
Playwright Service c9ae644e5f
feat(chromium-tip-of-tree): roll to r1287 (#34057) 2024-12-17 22:31:01 +01:00
Max Schmitt 52b2548612
chore: no @web imports from @web package (#34055) 2024-12-17 20:27:21 +01:00
Max Schmitt 43e46d63dd
chore: use recorder/html types for exported shared types (#34056) 2024-12-17 20:26:56 +01:00
Yury Semikhatsky 7ed60ccf7f
feat(test): step.fail and step.fixme modifiers (#34042) 2024-12-17 11:17:22 -08:00
Adam Gastineau aabbcbf41d
fix(trace-viewer): Fix network log flicker #33929 (#34036) 2024-12-17 05:24:22 -08:00
Yury Semikhatsky 7ce1a540bc
chore(bidi): skip only timeouts on CI (#34041) 2024-12-16 15:28:21 -08:00
Pavel Feldman 94d0fc780d
chore: make visible=false work (#34040) 2024-12-16 14:14:51 -08:00
Yury Semikhatsky b58a4762f4
docs: improve note on `browser.close()` behavior (#34039) 2024-12-16 13:52:17 -08:00
Yury Semikhatsky 76bb01d77c
chore: rephrase suggestion for slow test files (#34012) 2024-12-16 13:35:19 -08:00
Dmitry Gozman d4b2c966cf
fix(codegen): fallback to `iframe[name/src]` when failed to generate selector (#34030) 2024-12-16 17:37:53 +00:00
Simon Knott 512cb36c9b
feat(html): link from attachment step to attachment (#33267) 2024-12-16 15:25:32 +01:00
Adam Gastineau 6270918f67
docs: Moved Trace Viewer running instructions to the top of the page (#33956) 2024-12-16 05:18:54 -08:00
Dmitry Gozman aa1fe61cc9
fix(list reporter): do not print step location instead of test location (#34022) 2024-12-16 10:15:52 +00:00
Dmitry Gozman f713d3adaf
chore: simplify page initialization logic across browser types (#34002) 2024-12-14 20:15:58 +00:00
Pavel Feldman 1e4239f48d
chore: allow selecting update source type via test server (#34014) 2024-12-14 10:58:16 -08:00
Pavel Feldman 3a10c32d8a
chore: report highlight parse error to debug controller (#33984) 2024-12-13 16:10:59 -08:00
Pavel Feldman cbc809edc7
chore: recorder toolbar polish (#33983) 2024-12-13 16:10:45 -08:00
Yury Semikhatsky 369f4b76b3
fix: throw an error when object reference chain is to long to serialize (#34008) 2024-12-13 13:38:26 -08:00
Max Schmitt 91d4b82dfb
fix(pwt): custom fixture titles in UI Mode / HTML Reporter (#34009) 2024-12-13 12:31:38 -08:00
Max Schmitt e995ecd9b8
chore: add docs for experimental 'watch mode' (#33988) 2024-12-13 10:38:27 -08:00
Dmitry Gozman 258881bea1
test: fix `should not transform external` for newer Node versions (#34006) 2024-12-13 17:17:49 +00:00
Rui Figueira c700a8405c
feat(trace-viewer): render iframe canvas in trace viewer (#33809) 2024-12-13 16:28:06 +01:00
Max Schmitt 65688d623e
chore: update TypeScript to v5.7 (#33994) 2024-12-13 04:52:04 -08:00
Simon Knott dd36de7809
fix(html): encode all stdio attachments (#33950) 2024-12-13 12:01:20 +01:00
Playwright Service b0cec5b351
feat(chromium-tip-of-tree): roll to r1286 (#33991)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-12 19:22:48 -08:00
Playwright Service dd41930e72
feat(webkit): roll to r2119 (#33992)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-12 19:22:27 -08:00
Yury Semikhatsky 0034c6b984
fix: parse locator with empty options (#33990) 2024-12-12 17:49:48 -08:00
Yury Semikhatsky 76d46d478f
fix: text-is() should ignore comments (#33980) 2024-12-12 17:49:31 -08:00
Max Schmitt e4413f2089
docs: add docs for 'run-server' (#33989) 2024-12-12 16:23:13 -08:00
Max Schmitt 21c456b2c1
chore: remove vite default scripts in package.json's (#33986) 2024-12-12 15:37:53 -08:00
Max Schmitt 16a1552e74
chore: remove 'npx playwright debug' (#33987) 2024-12-12 15:25:13 -08:00
Max Schmitt 38758c0596
chore: tidy up headless-shell hacks (#33967) 2024-12-12 12:23:03 -08:00
Jozef Izso a4add6ebaf
Fix typo in `AndroidServerLauncherImpl` class when on device was found (#33973) 2024-12-12 11:12:58 -08:00
Max Schmitt aca00a4ab0
chore: update README/device descriptors after roll (#33982) 2024-12-12 11:06:14 -08:00
Playwright Service fc9f5a6f28
feat(chromium): roll to r1152 (#33977) 2024-12-12 09:04:17 -08:00
Pavel Feldman 29fd2df124
chore: send aria snapshot to the debug controller (#33969) 2024-12-12 08:21:53 -08:00
Pavel Feldman 0e2b984287
chore: prioritize role over label and placeholder (#33970) 2024-12-12 08:21:00 -08:00
Max Schmitt e3629dc1df
fix: validate ffmpeg on context creation (#33903) 2024-12-11 23:07:03 -08:00
Max Schmitt 081f455ee9
fix: headless-shell follow-up (#33968) 2024-12-11 19:28:39 -08:00
Max Schmitt 8d57b7543e
chore: introduce chromium-tip-of-tree-headless-shell (#33964) 2024-12-11 18:11:33 -08:00
Max Schmitt 217a0e9003
chore: bump https/socks proxy-agent (#33965) 2024-12-11 17:52:52 -08:00
Max Schmitt b12ede48fc
test: fix html-reporter tests after #33754 (#33966) 2024-12-11 17:49:16 -08:00
Bill Collins e4e562cac5
fix(types): Global JSX namespace is deprecated (#33949) 2024-12-11 17:09:19 -08:00
Yury Semikhatsky 22e58aa084
docs: clarify --only-shell option (#33961) 2024-12-11 13:06:48 -08:00
Yury Semikhatsky 9e683d798f
docs: clarify setDefaultTimeout with 0 value (#33959) 2024-12-11 13:06:37 -08:00
Yury Semikhatsky 856704a176
chore: run server with headless shell for connect tests (#33957) 2024-12-11 10:35:14 -08:00
Playwright Service 5a1bae0f19
feat(chromium-tip-of-tree): roll to r1285 (#33945)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-11 10:30:17 -08:00
Simon Knott 6d424875e3
fix(html): remove filter clear button (#33754) 2024-12-11 15:16:21 +01:00
Simon Knott ed2be67e47
chore(trace viewer): support HMR (#33609) 2024-12-11 13:25:52 +01:00
Adam Gastineau a14d9750b3
docs: #33837 Clarify that clock.install must precede clock operations (#33901) 2024-12-10 16:18:41 -08:00
Pavel Feldman 4bcf505e19
chore: prefer generating role with text to css with text (#33942) 2024-12-10 16:03:33 -08:00
Playwright Service 4745f64bc0
feat(webkit): roll to r2118 (#33938) 2024-12-10 14:29:30 -08:00
Pavel Feldman acf1107220
chore: ignore checkbox/radio value in aria (#33941) 2024-12-10 14:04:18 -08:00
Yury Semikhatsky 599b09c1c0
docs: sharding per file with multiple projects (#33939) 2024-12-10 14:02:13 -08:00
Yury Semikhatsky 54c595c7ed
docs: add examples for clock.install() followed by pauseAt() (#33937) 2024-12-10 11:50:51 -08:00
Pavel Feldman a25bda6950
chore: allow storing aria snapshots in files (#33919) 2024-12-10 11:45:16 -08:00
Max Schmitt 200e868b63
chore: bump nanoid to 3.3.8 (#33936) 2024-12-10 11:19:36 -08:00
jinohkang-theori 27060a0f65
fix(connect): disable context takeover in websocket transport (#33811) 2024-12-09 18:07:00 -08:00
yangsisi d029b03d9f
fix(defineConfig): fix type issue passing custom property in the seco… (#33774)
Signed-off-by: yangsisi <13655750+yangsisi0422@users.noreply.github.com>
2024-12-09 09:20:47 -08:00
Dmitry Gozman 0937d2f7b9
fix(types): update types for test.extend (#33784) 2024-12-09 08:59:01 -08:00
Playwright Service dfa24462db
feat(webkit): roll to r2117 (#33902) 2024-12-06 16:43:25 -08:00
Playwright Service 2a1a9c9452
feat(webkit): roll to r2116 (#33897)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-06 15:38:51 -08:00
Simon Knott 4914f34a83
fix(recorder): allow clearing when recording is disabled (#33821) 2024-12-06 10:17:06 -08:00
Adam Gastineau a56a5cabbd
docs: clarify use of comments in contributions (#33896) 2024-12-06 10:09:35 -08:00
Yury Semikhatsky 733f9a2926
chore: pdf generation now works in headed mode too (#33879) 2024-12-05 17:53:31 -08:00
Simon Knott 993546c1bc
chore: r1284 fixup (#33883) 2024-12-05 16:22:52 -08:00
Simon Knott f6f6a6225c
docs: locale defaults to en-us (#33840) 2024-12-05 15:44:41 -08:00
Playwright Service ee8208beda
feat(chromium-tip-of-tree): roll to r1284 (#33876)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-05 09:34:30 -08:00
Playwright Service b86725bb98
feat(chromium): roll to r1151 (#33873)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-05 09:34:16 -08:00
Playwright Service b941359fce
chore(driver): roll driver to recent Node.js LTS version (#33870) 2024-12-05 06:08:44 -08:00
Dmitry Gozman be78e9e11f
fix: do not stall waiting for pending navigations after beforeunload dismiss (#33834) 2024-12-03 15:55:45 -08:00
Playwright Service abf6916909
feat(webkit): roll to r2113 (#33807) 2024-12-03 10:05:51 -08:00
Dmitry Gozman a7f2868594
fix(codegen): do not reset current tool upon clearing highlight (#33822) 2024-12-03 09:25:14 -08:00
Playwright Service e4211ee3ac
feat(chromium-tip-of-tree): roll to r1283 (#33845)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-03 07:14:05 -08:00
Max Schmitt 9b5f7f77b2
docs(network): add proxy back-ref to api docs (#33839) 2024-12-02 16:20:44 -08:00
Dmitry Gozman 4e33ade287
docs: fix codegen --viewport option examples (#33816) 2024-11-29 06:13:53 -08:00
Tasawar Hussain b456ac5f8c
docs: update ci.md (#33815)
Signed-off-by: Tasawar Hussain <31658686+tasawar-hussain@users.noreply.github.com>
2024-11-29 03:36:50 -08:00
Dmitry Gozman b5bd543cc6
test: skip 'should not auto play audio' with frozen time (#33799) 2024-11-28 06:36:49 -08:00
Playwright Service fd25f3ab85
feat(chromium-tip-of-tree): roll to r1282 (#33798)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-28 14:43:45 +01:00
Simon Knott 4fb6c4ed4c
fix(trace): in `indexTree` check `isVisible` before adding to result (#33797) 2024-11-28 14:04:34 +01:00
Dmitry Gozman a84488edaa
fix(aria): escape even more yaml (#33793) 2024-11-28 03:21:52 -08:00
Playwright Service ff6c283af5
feat(webkit): roll to r2112 (#33778)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-27 16:53:22 +01:00
Segev Finer f3ae940684
fix(ct-vue): Upgrade plugin-vue to be compatible with Vite 5 (#33758) 2024-11-26 17:42:36 +01:00
Max Schmitt 84df6e3297
docs(python): add note about async fixtures (#33760) 2024-11-26 16:23:19 +01:00
Playwright Service b9c923f87c
feat(chromium-tip-of-tree): roll to r1281 (#33769)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-26 14:26:35 +01:00
Playwright Service 3fd5174b9f
feat(webkit): roll to r2111 (#33759)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-25 22:35:34 +01:00
Dmitry Gozman 39285c4667
docs: update extensions doc for new headless (#33753) 2024-11-25 01:13:20 -08:00
Max Schmitt 9d92b0d3ec
docs(dotnet): add docs for xUnit (#33742) 2024-11-25 10:09:35 +01:00
Max Schmitt e0e4da8ead
docs(cli): fix docs rendering (#33751) 2024-11-24 14:50:12 +01:00
Pavel Feldman 0d9bcd45d5
chore: pin typescript while vue-tsc is broken (#33746) 2024-11-23 11:48:34 -08:00
Pavel Feldman 35dd3dd104
chore: use diff for snapshot delta (#33739) 2024-11-23 11:39:04 -08:00
Pavel Feldman 971b5da741
chore: introduce update-source-method (#33738) 2024-11-22 18:30:35 -08:00
Pavel Feldman 66d9f3acbe
chore: introduce update-snapshots=changed (#33735) 2024-11-22 17:41:31 -08:00
Yury Semikhatsky 66f709663e
fix(webkit): do not auto play audio without user gesture (#33734) 2024-11-22 14:53:29 -08:00
Dmitry Gozman 4696dd8682
fix(chromium): race between oopif attach and context clear (#33729) 2024-11-22 09:35:35 -08:00
Dmitry Gozman 7e09aa07de
feat(trace): preserve the open state of popovers (#33728) 2024-11-22 09:35:19 -08:00
Pavel Feldman 5f85a4a419
chore: add config markers / overwrite mode (#33723) 2024-11-22 09:12:58 -08:00
Dmitry Gozman f123f7ac69
fix: isEditable/toBeEditable throw for elements that cannot be editable/readonly (#33713) 2024-11-22 03:40:43 -08:00
Max Schmitt b7e47dc0bd
docs(test-runners): restructure .NET test-runners doc (#33727) 2024-11-22 12:35:14 +01:00
Playwright Service b32fdade16
feat(chromium): roll to r1150 (#33718)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-22 12:05:16 +01:00
Pavel Feldman e0f0996bbd
chore: climb file tree to git root for patches (#33722) 2024-11-21 17:32:07 -08:00
Pavel Feldman 605df0be8f
chore: add more info about snapshot testing (#33721) 2024-11-21 16:11:01 -08:00
Max Schmitt 5da0b94357
feat(webkit): roll to r2108 (#33710)
Co-authored-by: Yury Semikhatsky <yurys@chromium.org>
2024-11-21 14:42:21 -08:00
Playwright Service c2a8375ef2
feat(chromium-tip-of-tree): roll to r1280 (#33719)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-21 22:36:39 +01:00
Max Schmitt 92436518ff
docs(python): add LocatorAssertions.NotToMatchAriaSnapshot (#33712) 2024-11-21 15:53:37 +01:00
Max Schmitt 77d82b8b07
chore: remove dead code in urlMatches (#33714) 2024-11-21 15:53:28 +01:00
Dmitry Gozman d3ffdefd50
docs: release notes for languages v1.49 (#33706) 2024-11-21 05:45:00 -08:00
Max Schmitt f43b86fea4
devops: delete .devcontainer/devcontainer.json (#33709)
Signed-off-by: Max Schmitt <max@schmitt.mx>
2024-11-21 12:22:45 +01:00
Simon Knott fc19e6e7b4
fix(test): export TestDetailsAnnotation (#33698) 2024-11-20 17:28:56 +01:00
Max Schmitt 6a32589330
test: update 'should work for canvas' test expectation (#33685) 2024-11-20 17:13:07 +01:00
Simon Knott 89f4d4ce4f
chore(html): hmr report should survive reload (#33696) 2024-11-20 16:35:39 +01:00
Simon Knott 81e28a8854
docs(aria): add demo video (#33668) 2024-11-20 15:36:51 +01:00
Simon Knott bfd64ac11b
docs: add video for 1.49 (#33693) 2024-11-20 15:36:38 +01:00
Dmitry Gozman 94776ad18a
docs: note that permissions list may change (#33690) 2024-11-20 06:08:34 -08:00
Josh Kelley 1afb56ee1b
docs: add docs for 1.49.0's new "chromium" option (#33680) 2024-11-20 01:19:39 -08:00
Simon Knott 1d3605d1fc
feat(trace viewer): add "Copy as Playwright Request" button (#33298) 2024-11-20 10:16:43 +01:00
Simon Knott f1ddd379f3
fix(html): don't conflate file names (#33600) 2024-11-20 10:16:33 +01:00
Dmitry Gozman 50c8fbf750
fix(ui mode): do not render anonymous describe (#33675) 2024-11-20 00:51:31 -08:00
Simon Knott ae10d56836
docs(fixtures): add rules of thumb for fixture usage (#33472) 2024-11-20 09:06:54 +01:00
Max Schmitt 402bb4ccf8
devops: update GitHub Actions via dependabot (#33683) 2024-11-20 08:13:35 +01:00
Pavel Feldman b40889d1a8
chore: escape more yaml values (#33686) 2024-11-19 17:09:49 -08:00
Max Schmitt 7f7b440c72
devops: deduplicate redudant information in client side changes issue (#33666) 2024-11-19 19:06:20 +01:00
Playwright Service aa0ac04d06
feat(webkit): roll to r2105 (#33679)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-19 17:56:50 +01:00
Playwright Service 4d4fa69a0a
feat(chromium-tip-of-tree): roll to r1279 (#33676)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-19 16:49:59 +01:00
Simon Knott 4979ce2b5d
chore(html): Reveal elements with `Anchor` abstraction (#33537) 2024-11-19 16:40:02 +01:00
Simon Knott 8c1002a98b
fix(sw): fix UI mode on codespaces by not passing `server` (#33664) 2024-11-19 16:39:47 +01:00
Dmitry Gozman 6e19bc341f
fix(role): ignore invalid `aria-labelledby` attributes (#33667) 2024-11-19 03:56:16 -08:00
Max Schmitt ecf6f27159
fix: dark-mode in UI Mode (#33662) 2024-11-19 10:29:05 +01:00
Simon Knott e047f6bc07
chore(build): typo in trace-viewer output dir (#33661) 2024-11-19 10:02:41 +01:00
Yury Semikhatsky dc91bab6cc
chore: fix npm audit (#33659) 2024-11-18 16:24:54 -08:00
Yury Semikhatsky 6d71805f4a
fix: do not send favicon request to network when interception is on (#33639) 2024-11-18 11:01:39 -08:00
Max Schmitt 150092438f
chore(recorder): support HMR (#33637) 2024-11-18 18:23:29 +01:00
Simon Knott acd862c6c9
chore(trace): remove embedded trace viewer (#33651) 2024-11-18 16:57:53 +01:00
Max Schmitt 0b312248cd
test: add test for crash on label with input file (#33654) 2024-11-18 16:56:59 +01:00
Max Schmitt 72c532846f
chore(roll): roll Firefox Beta to r1466 (#33653) 2024-11-18 16:56:49 +01:00
aairiian 7f054ef8c6
feat(aria): extend toHaveAccessibleName() to accept an array of expected accessible names (#33277) 2024-11-18 07:46:47 -08:00
Simon Knott 3fa33ca81f
chore(build): fix bug where sw changes aren't copied in watch mode (#33579) 2024-11-18 16:04:12 +01:00
Simon Knott 5e8b469c1c
fix(test): hide response.* calls from reports (#33620) 2024-11-18 13:59:40 +01:00
Max Schmitt d7d8ab62a2
chore: roll stable-test-runner to 1.49.0-beta-1731772650000 (#33648) 2024-11-18 10:21:48 +01:00
Max Schmitt 6fce5620e0
fix(ui-mode): use onChange instead of onClick for <input type='checkbox' (#33636) 2024-11-18 10:21:28 +01:00
Rui Figueira 82c77a5e9e
fix(ui-mode): prevent websocket connection leaks on reload (#33643) 2024-11-18 01:03:21 -08:00
Pavel Feldman 46321e5bf2
chore: clear highlight when performing action (#33638) 2024-11-16 07:56:33 -08:00
Pavel Feldman a98021499f
chore: add cm placeholder text (#33635) 2024-11-15 16:19:35 -08:00
Jean-François Greffier 508021362d
fix minor typos in "Getting Started" (#33613) 2024-11-15 14:45:54 -08:00
Max Schmitt 37ce53945e
fix(ui-mode): fix issue when updating state while rendering (#33634) 2024-11-15 23:45:25 +01:00
Rui Figueira c36b5a6059
fix: ensure toMatchAriaSnapshot is properly commented in javascript c… (#33593) 2024-11-15 14:44:27 -08:00
Pavel Feldman d127255881
chore: add AriaSnapshot internal type (#33631) 2024-11-15 13:48:43 -08:00
Pavel Feldman 44cd1d03cc
chore: highlight edited locator while recording (#33632) 2024-11-15 13:43:00 -08:00
Max Schmitt b91f609b14
chore: fix react attribute casing in TestErrorView (#33633) 2024-11-15 22:25:26 +01:00
Yury Semikhatsky e24780f825
chore: unshift shortest whitespace prefix only (#33618) 2024-11-15 12:47:25 -08:00
Dmitry Gozman 77dee44984
fix(rebase): do not apply multiple rebaselines to the same assertion (#33629) 2024-11-15 09:08:31 -08:00
Max Schmitt c81504c5d6
fix(codegen): document.documentElement is null on early navigation (#33627) 2024-11-15 17:14:49 +01:00
Amaechi Hope e61cea597a
docs(dotnet): fix assertion snippets (#33622) 2024-11-15 15:02:40 +01:00
Dmitry Gozman 2aa9e11a7f
fix(aria): normalize whitespace in toMatchAccessible{Name,Description} (#33619) 2024-11-15 02:49:03 -08:00
Dmitry Gozman eaf3536014
fix(trace): afterAll hook should not break tracing with reused context (#33616) 2024-11-14 13:24:02 -08:00
Yury Semikhatsky f5477d9051
docs: add ariaSnapshot.timeout for language ports (#33614) 2024-11-14 12:23:42 -08:00
Max Schmitt b3e5daff2b
cherry-pick(#33606): feat(chromium): roll to r1149 (#33612) 2024-11-14 19:40:46 +01:00
Playwright Service b61b3a5a13
feat(chromium): roll to r1149 (#33606) 2024-11-14 16:39:24 +01:00
Playwright Service 5e579cc29c
feat(chromium-tip-of-tree): roll to r1278 (#33608)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-14 16:38:56 +01:00
Max Schmitt 358fad45cd
chore: add ESRP CDN for browser downloads (#33585) 2024-11-14 16:19:42 +01:00
Max Schmitt b8f824ca6b
chore: throw if protocol can't get generated when rolling (#33607) 2024-11-14 16:12:07 +01:00
Simon Knott 445ff73c6e
chore(trace viewer): decouple test server from web server (#33542) 2024-11-14 15:27:33 +01:00
Simon Knott 25c039401d
fix(canvas snapshots): position mismatch in headless mode (#33575) 2024-11-14 15:27:09 +01:00
Dmitry Gozman 80ce205d81
docs: update docs about headless shell (#33604) 2024-11-14 05:38:16 -08:00
Dmitry Gozman 31a2b7bbdc
chore: update headless shell treatment (#33603) 2024-11-14 04:20:44 -08:00
Dmitry Gozman 9f59dbdc57
fix(merge): update error.cause location (#33583) 2024-11-14 01:15:21 -08:00
Simon Knott dc93c8a05b
chore(release): alternative headless mode release notes (#33578)
Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Yury Semikhatsky <yurys@chromium.org>
2024-11-14 08:40:51 +01:00
Pavel Feldman 4817483ff2
chore: allow highlighting aria template from extension (#33594) 2024-11-13 21:33:38 -08:00
Yury Semikhatsky a8af7cc435
chore: remove macOS <=12 checks (#33591) 2024-11-13 17:21:21 -08:00
Yury Semikhatsky 5203c780ae
feat: step timeout option (#33560) 2024-11-13 11:17:54 -08:00
Max Schmitt eab6447ad9
test: add 'should show errors with causes in the error tab' (#33577) 2024-11-13 17:32:32 +01:00
Simon Knott da7639b737
chore(build): empty out dir (#33576) 2024-11-13 13:08:50 +01:00
Max Schmitt cd41404b05
chore: mark v1.50.0-next (#33572) 2024-11-13 12:51:54 +01:00
Max Schmitt d1ae5f6ac4
chore: update browser patches to bb81b1c60 (#33573) 2024-11-13 12:34:49 +01:00
Max Schmitt 382d98760c
chore: update WebKit version to 18.2 (#33570) 2024-11-13 12:33:45 +01:00
Max Schmitt e535b3aa5f
docs(best-practises): add note about saving browser downloads (#33568) 2024-11-13 12:11:12 +01:00
Dmitry Gozman 099dd80806
fix(recorder): align apiName with the real one (#33567) 2024-11-13 03:06:34 -08:00
Dmitry Gozman 88082b417a
chore: release notes for v1.49 js (#33565) 2024-11-13 03:04:43 -08:00
Dmitry Gozman f54d3f44c2
chore: download and launch chromium-headless-shell for headless chromium (#33454) 2024-11-13 02:52:28 -08:00
Pavel Feldman d685763c49
chore: use diff instead of diffmatchpatch (#33550) 2024-11-12 14:46:29 -08:00
Max Schmitt 0aa8da8035
test: fix csharp har tests on Windows (#33556) 2024-11-12 14:42:07 +01:00
Playwright Service 55b81a83e8
feat(chromium-tip-of-tree): roll to r1277 (#33555)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-12 13:55:12 +01:00
Dmitry Gozman 33f9c8279c
chore: more aria snapshot fixes (#33534) 2024-11-12 02:26:54 -08:00
Simon Knott 114884335d
chore(html): support HMR for local dev (#33511) 2024-11-12 11:11:50 +01:00
Pavel Feldman 1b65f26f02
chore: apply rebaselines in a task (#33549) 2024-11-11 21:15:05 -08:00
Pengoose a501232bf0
fix(expect): adjust normalization for regex values in toHaveText matcher (#33533) 2024-11-11 17:19:04 -08:00
Pavel Feldman e534fba60f
chore: render recorder placeholders (#33548) 2024-11-11 16:38:02 -08:00
Max Schmitt d8a98a2bf5
test: fix flaky page.pause() tests end up stalling (#33544) 2024-11-11 22:19:58 +01:00
Yury Semikhatsky e691ca7fbf
fix(codegen): generate routeFromHAR for --save-har option (#33480) 2024-11-11 11:59:20 -08:00
Yury Semikhatsky e3ed9fa7c3
chore: drop support for solid component testing (#33523) 2024-11-11 10:26:50 -08:00
Pavel Feldman 649e0e0235
chore: nicer cm widgets for aria (#33524) 2024-11-11 09:40:50 -08:00
Max Schmitt 5a8b49910a
fix(ct): msw interception after msw v2.6.4 release (#33536) 2024-11-11 11:37:29 +01:00
Max Schmitt d5ebe285c1
fix(transform): allow import attributes always (#33527) 2024-11-11 10:26:13 +01:00
Pavel Feldman 503f74da90
chore: allow editing aria template in recorder (tests) (#33522) 2024-11-08 17:18:51 -08:00
Dmitry Gozman c29f573243
fix(aria snapshot): assorted fixes (#33512) 2024-11-08 10:25:05 -08:00
Yury Semikhatsky 9c6c58f8ce
docs: note about screenshot environment (#33501) 2024-11-08 08:33:04 -08:00
Pavel Feldman b021b58379
chore: allow editing aria template in recorder (#33482) 2024-11-08 07:43:01 -08:00
Dmitry Gozman d561ba7b86
fix(chromium-headless-shell): fallback to chromium when running headed (#33490) 2024-11-08 07:04:41 -08:00
Simon Knott f7a388dcb4
chore: HMR for Trace Viewer build script changes (#33291) 2024-11-08 15:08:58 +01:00
Playwright Service 93b7b6e279
feat(webkit): roll to r2104 (#33500)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-08 13:23:20 +01:00
Playwright Service 7073f80879
feat(chromium-tip-of-tree): roll to r1276 (#33494)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-07 16:43:58 +01:00
Playwright Service 910ecdf556
feat(chromium): roll to r1148 (#33491)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-07 14:51:33 +01:00
Dmitry Gozman 67e8defbe9
docs: update tracing.group docs (#33487) 2024-11-07 03:57:18 -08:00
Dmitry Gozman 43e4ba9f2f
fix(click): better compensate for integer click coordinates in firefox (#33467) 2024-11-07 00:01:00 -08:00
Yury Semikhatsky 50775698ae
fix: parent step for API calls inside waitForEvent callback (#33409) 2024-11-06 17:35:16 -08:00
Yury Semikhatsky 523e50088a
test: do not rely on http://localhost2 dns resolution failure (#33479) 2024-11-06 14:20:38 -08:00
Pavel Feldman 3f8bd36a3a
fix(html): align prev/next with the group title (#33462) 2024-11-06 08:31:55 -08:00
Pavel Feldman 2f8a14c6e2
test: cover more aria escaping edge cases (#33463) 2024-11-06 08:31:32 -08:00
Simon Knott 8c4738ab1a
Revert "chore(trace viewer): always format trace location as URL, not file path" (#33476) 2024-11-06 17:17:59 +01:00
Simon Knott 0d92737a07
chore(web): replace static ID with React.useId (#33474) 2024-11-06 14:42:48 +01:00
Simon Knott f554f42b82
feat(trace viewer): link from attach action to attachment tab (#33265) 2024-11-06 10:22:15 +01:00
Pavel Feldman d4ad520a9b
chore: fix more aria escaping edge cases (#33460) 2024-11-05 16:22:02 -08:00
Pavel Feldman 9d94ad152e
chore: dedupe tags in base reporter title (#33461) 2024-11-05 16:18:10 -08:00
Pavel Feldman a655b0bfb3
chrome: aria api review (#33458) 2024-11-05 15:23:38 -08:00
Dmitry Gozman 697d7a40b1
fix(routeWebSocket): make it work with http(s) baseURL (#33457) 2024-11-05 11:46:05 -08:00
Max Schmitt 1003f3429c
chore: roll chromium-headless-shell to r1147 (#33455) 2024-11-05 15:19:39 +01:00
Max Schmitt c96245dde7
docs(aria-snapshot): fix markdown rendering / langs (#33453) 2024-11-05 15:04:26 +01:00
Dmitry Gozman 9b2ca93a50
chore: followup to tracing.group (#33450) 2024-11-05 04:45:54 -08:00
Playwright Service 96a7f49b72
feat(chromium-tip-of-tree): roll to r1275 (#33451)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-05 13:30:24 +01:00
René fa10bcd5a3
feat(tracing) Adding groups to trace via pw-api (#33081)
Signed-off-by: René <snooz@posteo.de>
Signed-off-by: René <41592183+Snooz82@users.noreply.github.com>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2024-11-05 03:45:37 -08:00
Playwright Service da4614ea7c
feat(firefox): roll to r1466 (#33448)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-05 11:56:03 +01:00
Max Schmitt 9a668aeab3
fix(websocket): pass through underlying WebSocket protocol (#33446) 2024-11-05 11:13:33 +01:00
Simon Knott 8e140a4873
fix(global setup): simplify ordering (#33444) 2024-11-05 10:36:29 +01:00
Max Schmitt ba6386e0ae
fix(download): fix second browser download of channels (#33429) 2024-11-05 10:34:00 +01:00
Simon Knott 26a7dd4dd4
chore(reporter): add another surrogate pair test case (#33428) 2024-11-05 07:55:17 +01:00
Pavel Feldman 58b1f322ab
docs: iterate over aria docs (2) (#33440) 2024-11-04 19:24:54 -08:00
Pavel Feldman ec8161cb0a
docs: iterate over aria docs (#33439) 2024-11-04 17:52:53 -08:00
Yury Semikhatsky 513c57536a
chore: relax checks when installing channels on unsupported platforms (#33436) 2024-11-04 16:53:13 -08:00
Pavel Feldman f138c30915
chore: improve aria template error reporting (#33438) 2024-11-04 15:33:09 -08:00
Yury Semikhatsky 36a975c30b
chore: override host platform with env variable (#33434) 2024-11-04 14:14:24 -08:00
Playwright Service ab22f81922
feat(chromium): roll to r1147 (#33430)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-04 21:38:43 +01:00
Pavel Feldman 8b49d568de
docs: start adding the aria snapshot documentation (#33407) 2024-11-04 10:53:46 -08:00
Playwright Service cf137845df
feat(webkit): roll to r2103 (#33431)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-04 19:39:18 +01:00
Simon Knott cb0171e571
chore(expect): clarify message() for custom matchers (#33321) 2024-11-04 16:58:20 +01:00
Simon Knott edf1eb154d
chore(trace viewer): always format trace location as URL, not file path (#33344) 2024-11-04 16:25:44 +01:00
Max Schmitt 4560686427
test: re-add headless-new fixme's (#33426) 2024-11-04 16:18:36 +01:00
Simon Knott b148ce1ad1
fix(debug controller): highlight selectors in iframe (#33273) 2024-11-04 14:41:06 +01:00
Max Schmitt 96a29b69eb
feat(chromium-tip-of-tree): roll to r1274 (#33423) 2024-11-04 14:23:17 +01:00
Dmitry Gozman 82f6c15e6a
feat(chromium): switch to headless=new by default (#33262)
Co-authored-by: Max Schmitt <max@schmitt.mx>
2024-11-04 12:56:00 +01:00
Max Schmitt 76ffc2374c
devops: increase heap size to 8 GB for merge report workflow (#33422)
Signed-off-by: Max Schmitt <max@schmitt.mx>
2024-11-04 11:42:50 +01:00
Playwright Service abcd1ff201
feat(webkit): roll to r2102 (#33408)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-02 01:10:15 +01:00
Pavel Feldman 1d4650cea2
chore(snapshot): support aria-owns (#33404) 2024-11-01 15:25:38 -07:00
Playwright Service 3cd753f6bb
feat(webkit): roll to r2101 (#33401)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-01 21:43:33 +01:00
Pavel Feldman 80bd246543
chore: use React.useId for a11y (#33402) 2024-11-01 13:38:16 -07:00
Pavel Feldman c76f004ec3
chore: move compress call log to server (#33399) 2024-11-01 13:38:01 -07:00
Pavel Feldman fc0ce7046b
chore: perform e2e rebase test (#33390) 2024-11-01 12:25:05 -07:00
Max Schmitt 3b4b8f9e49
docs(python): add snippet for new_context fixture (#33392) 2024-11-01 17:50:34 +01:00
Playwright Service 18453f3889
feat(webkit): roll to r2100 (#33395) 2024-11-01 17:45:58 +01:00
Max Schmitt 33593c5f06
docs(browsers): add note for Python about channels in launch() (#33396) 2024-11-01 17:45:07 +01:00
Yury Semikhatsky c95feccce4
chore: support reverse in ansi2html, drop ansi-to-html (#33389) 2024-10-31 21:42:06 -07:00
Pavel Feldman 26c2049d5a
chore: treat input value as text in templates (#33388) 2024-10-31 20:41:52 -07:00
Pavel Feldman 135ed28740
chore: more yaml escaping tests (#33387) 2024-10-31 17:14:11 -07:00
Playwright Service dcf85edcb7
feat(chromium): roll to r1146 (#33380)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-01 00:50:09 +01:00
Pavel Feldman c462e29e73
chore(aria): generate single patch for all baselines (#33384) 2024-10-31 15:34:17 -07:00
Playwright Service 69404561f9
feat(webkit): roll to r2099 (#33385)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-31 21:34:01 +01:00
Pavel Feldman a2e901e080
chore: generate aria name regex when possible (#33373) 2024-10-31 11:25:38 -07:00
Pavel Feldman 676f014b5f
chore: use objects for string aria template notes (#33371) 2024-10-30 17:25:51 -07:00
Pavel Feldman a43b99368e
chore: support aria snapshots in tsx (#33369) 2024-10-30 17:25:30 -07:00
Playwright Service 81e7d9fa25
feat(webkit): roll to r2098 (#33366) 2024-10-30 21:55:44 +01:00
Max Schmitt 1342e7f6b6
Revert "chore: add Devuan OS fallback to Debian (#32990)" (#33365) 2024-10-30 21:28:16 +01:00
Max Schmitt 512645463e
test: rebase headless-shell/--headless=new/Edge tests (#33350) 2024-10-30 15:12:05 +01:00
Simon Knott 64802fc284
fix(line reporter): wrap chinese characters correctly (#33322) 2024-10-30 13:29:31 +01:00
Pavel Feldman 6f5c7b4358
feat(html): render prev/next test buttons (#33356) 2024-10-29 18:29:07 -07:00
Pavel Feldman 9ce401d44a
chore: suggest aria snapshots w/ regex (#33334) 2024-10-29 16:19:08 -07:00
Max Schmitt 3b1883444d
chore: bump Docker Node.js to 22 (#33348) 2024-10-29 21:04:13 +01:00
Denis LE 7a1739792f
docs(best-practices): improve wording (#33342) 2024-10-29 16:27:14 +01:00
Playwright Service 53ff35cbc4
chore(driver): roll driver to recent Node.js LTS version (#33349)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-29 16:14:22 +01:00
Simon Knott 0221f15f4f
chore(control-or-meta): mention in docs (#33338) 2024-10-29 10:07:59 +01:00
Playwright Service 0df801d632
feat(webkit): roll to r2097 (#33336)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-29 06:59:12 +01:00
Max Schmitt 9eb4fe5546
feat(pwt): serialize and expose Error.cause from Worker process (#32833) 2024-10-29 00:01:59 +01:00
Max Schmitt 5c0fdfed50
chore: throw when using headless-shell with headed mode (#33292) 2024-10-28 22:33:21 +01:00
Max Schmitt 19e863191c
test: use 'chrome' for UI mode tests (#33329) 2024-10-28 21:56:46 +01:00
Max Schmitt c9a93486a1
test: update macOS-15 WebKit cookie tests expectations (#33332) 2024-10-28 20:34:08 +01:00
Pavel Feldman 4b7c8d8a20
chore: use stable library along with the test runner in ttest (#33312) 2024-10-25 23:15:10 -07:00
Yury Semikhatsky 88c42f7887
chore: delete unused source-map-support code (#33306) 2024-10-25 16:20:33 -07:00
Yury Semikhatsky 0ace47e7cf
chore: revert exposed expect error details on TestError (#33310) 2024-10-25 16:20:18 -07:00
Pavel Feldman 74e5e5560f
chore: update missing snapshots by default (#33311) 2024-10-25 16:13:38 -07:00
Yury Semikhatsky c66af9c525
chore: make expect timeout field required in the protocol (#33309) 2024-10-25 15:26:41 -07:00
Yury Semikhatsky 4facda8685
chore: fix source-map type import error (#33308) 2024-10-25 13:51:08 -07:00
Yury Semikhatsky 87b896e597
chore: remove playwright-ct-vue2 (#33302) 2024-10-25 13:31:55 -07:00
Yury Semikhatsky 1e8884621a
chore: unify toHaveScreenshot error formatting (#33300) 2024-10-25 12:36:39 -07:00
Yury Semikhatsky f98531baee
chore: remove check for node < 16 (#33301) 2024-10-25 10:33:43 -07:00
DetachHead 7e00112fec
docs(python): improve the typing example with the pytest plugin (#33296) 2024-10-25 15:27:14 +02:00
Pavel Feldman 9707e97867
chore: revert #33228 - it needs a proper review (#33284) 2024-10-25 09:36:03 +02:00
Pavel Feldman ff5f1628dc
chore: allow aria snapshot rebaselines (#33256) 2024-10-24 16:49:10 -07:00
Max Schmitt a2dec8da63
fix(codegen): SIGINT handling was leading to zombie processes (#33269) 2024-10-24 19:23:19 +02:00
Playwright Service 0509eca9b6
feat(chromium): roll to r1145 (#33274)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-24 17:47:34 +02:00
Max Schmitt adc38cfd8b
test: rebaseline test expectations (#33270) 2024-10-24 16:49:35 +02:00
Dmitry Gozman 67471cb3c5
test: make a few tests headed/headless agnostic (#33268) 2024-10-24 06:03:36 -07:00
Simon Knott 3641e5984f
chore: HMR for Trace Viewer (#33228) 2024-10-24 14:34:59 +02:00
Dmitry Gozman 2e01154bb5
feat: screenshot:on-first-failure (#33266) 2024-10-24 04:41:35 -07:00
Dmitry Gozman 1950bbdc6e
test: unflake "should not leak recorders" (#33264) 2024-10-24 02:47:34 -07:00
Max Schmitt 487134fbaf
devops: add chromium-headless-shell bots (#33242) 2024-10-24 11:34:41 +02:00
Simon Knott 69f56b9f63
fix(locator generator): handle `frameLocator()` and `locator().contentFrame()` (#33208) 2024-10-24 10:52:54 +02:00
Pavel Feldman 6ae6b4865c
chore: always use TestInfoErrorImpl (impl) in @playwright/test (#33255) 2024-10-23 17:36:05 -07:00
Pavel Feldman 9a0a6cec10
chore: remove the leaf node notion (#33249) 2024-10-23 17:34:21 -07:00
Pavel Feldman 24cafbc8cb
chore: use diff_match_patch with types (#33254) 2024-10-23 16:04:37 -07:00
Pavel Feldman 8da065a2ea
Revert "chore: remove unused @babel/parser (#32654)" (#33252) 2024-10-23 12:57:15 -07:00
Dmitry Gozman 9a6e1b71a4
fix(trace viewer): make LRUCache per-trace (#33245) 2024-10-23 10:25:16 -07:00
Dmitry Gozman ec9c11f1cd
fix(trace viewer): limit the number of contexts loaded in sw (#33244) 2024-10-23 10:25:04 -07:00
Dmitry Gozman 993a6b2a2a
fix(recorder): do not leak when instantiated in snapshots (#33240) 2024-10-23 10:24:53 -07:00
Max Schmitt f1f2a7b33a
chore: warn when browser with revision override is getting installed (#33226) 2024-10-23 18:14:55 +02:00
Max Schmitt 0d12fbe002
fix: have more friendly playwright-report error when opening TV via file:// (#33239) 2024-10-23 12:19:29 +02:00
Simon Knott 3322a7f3bb
chore(trace): remove screenshot instead of snapshot code (#33225) 2024-10-23 12:17:02 +02:00
Pavel Feldman 6bfdad068c
chore: introduce accessibility tab in recorder (#33235) 2024-10-22 16:36:03 -07:00
Max Schmitt 6800fd45a2
feat(webkit): roll to r2095 (#33229) 2024-10-22 22:30:54 +02:00
Yury Semikhatsky 8ec981c394
chore: move github reporter formatting out of base (#33213) 2024-10-22 11:45:12 -07:00
Max Schmitt 29ca54eb38
chore: add headless shell builds (#33222) 2024-10-22 15:47:50 +02:00
Playwright Service c8431ca122
feat(chromium-tip-of-tree): roll to r1271 (#33224)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-22 15:47:17 +02:00
Max Schmitt 131f8b39c3
docs(vscode): outline more that global teardown needs to be executed manually (#33221) 2024-10-22 14:25:23 +02:00
Simon Knott ef84051c91
feat(tracing): clip `canvas` contents from screenshots (#33119) 2024-10-22 14:12:25 +02:00
Rui Figueira b194d6a1e9
fix(recorder): fix recorder injected icons (#33198) 2024-10-22 12:44:18 +02:00
Max Schmitt b275c19612
chore: update eslintignore to lint files in utils/ folders (#33218) 2024-10-22 11:52:20 +02:00
Pavel Feldman 2a3d67195d
chore: use aria snapshots in some ui mode tests (#33212) 2024-10-21 21:54:06 -07:00
Max Schmitt 0351fd9401
docs: use WebSocketFrame abstraction for Java & .NET (#33211) 2024-10-21 21:21:30 +02:00
Yury Semikhatsky aebceb345e
chore: expose expect error details on TestError (#33183) 2024-10-21 11:15:55 -07:00
Max Schmitt 36d3a6764e
docs: set minimal Ubuntu version to 22 and Debian to 12 (#33207) 2024-10-21 18:41:27 +02:00
Max Schmitt e866e3306e
devops: stop publishing Ubuntu 20.04 (#33203) 2024-10-21 17:00:10 +02:00
Playwright Service 014577d345
feat(webkit): roll to r2094 (#33188) 2024-10-21 11:33:16 +02:00
Simon Knott 40d5a1cb4a
fix(ff): resource type for image sets should be `image` (#33195) 2024-10-21 11:14:48 +02:00
Meir Blachman 4b187107ee
devops: fix 'client side changes bot' PR links in PRs (#33189) 2024-10-20 18:44:48 +02:00
Pavel Feldman 97d26e8166
chore: add aria attribute tests (#33184) 2024-10-19 14:23:08 -07:00
Pavel Feldman 64bf1bc107
chore: support basic aria attributes (#33182) 2024-10-18 20:18:18 -07:00
Max Schmitt b1fb4f16a7
chore: hide 'markdown' reporter (#33140) 2024-10-18 23:00:05 +02:00
Pavel Feldman 2e8e7a66cd
chore: implement tree w/o list (#33169) 2024-10-18 13:50:43 -07:00
Max Schmitt 6ea17a5d82
chore: move non-test utility workflows to ubuntu-24.04 (#33176) 2024-10-18 16:38:55 +02:00
Playwright Service 02f8acce02
feat(chromium): roll to r1143 (#33163)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-18 11:34:39 +02:00
Playwright Service 58ef9e2e5f
feat(firefox-beta): roll to r1465 (#33170)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-18 11:34:28 +02:00
Simon Knott 0d63df4875
feat(test runner): allow multiple global setups (#32955)
Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2024-10-18 11:03:00 +02:00
Pavel Feldman 29c84a33c3
chore: compute aria text consistently with the role accumulated text (#33157) 2024-10-17 17:06:18 -07:00
Pavel Feldman 623a8916f9
chore: implement tree w/o list (#33167) 2024-10-17 16:57:45 -07:00
Dmitry Gozman aa952c1b03
fix(html report): generate test snippets when test dir is non-root (#33162) 2024-10-17 08:33:15 -07:00
Dmitry Gozman a2a5b102ab
chore: update CONTRIBUTING.md (#33138) 2024-10-17 06:13:17 -07:00
LeoTM edb041f9e3
chore(docs): fix documentation url (#33161)
Signed-off-by: LeoTM <1881059+leotm@users.noreply.github.com>
2024-10-17 06:12:19 -07:00
LeoTM 65983b4bf8
chore(docs): remove dead link to install config (#33160)
Signed-off-by: LeoTM <1881059+leotm@users.noreply.github.com>
2024-10-17 06:08:14 -07:00
Dmitry Gozman 2d150eec25
fix: correct types for things like `test.describe.only` (#33142) 2024-10-17 03:34:05 -07:00
Amaechi Hope 7af9e93304
docs(api): fix code snippets for locator ele (#33153) 2024-10-17 09:11:53 +02:00
Debbie O'Brien 9848ebec5a
docs: add video to release notes (#33147) 2024-10-16 18:36:46 +02:00
Pengoose d10a5e5693
feat(testType): add support for test.fail.only method (#33001) 2024-10-16 06:47:23 -07:00
Lars Hanisch 183720b56a
fix(docker): correct Ubuntu Noble name in name template (#33133) 2024-10-16 10:15:40 +02:00
Pavel Feldman 94321fef1c
chore: implement locator.ariaSnapshot (#33125) 2024-10-15 18:47:26 -07:00
Pavel Feldman b92b855638
test: unflake ff debugger test (#33124) 2024-10-15 16:21:55 -07:00
Pavel Feldman b421bd8b0d
chore: add a basic snapshot generator test (#33123) 2024-10-15 15:21:45 -07:00
Pavel Feldman 4b1fbde2ad
chore: generate match snapshot (#33105) 2024-10-15 13:38:55 -07:00
Pavel Feldman 23b1012c70
chore: fix ff test for codegen (#33122) 2024-10-15 13:34:08 -07:00
Anand M Cherian d40425ea58
docs: update to "Matching one of the two alternative locators" section (#33079)
Signed-off-by: Anand M Cherian <63868951+Anand-M-Cherian@users.noreply.github.com>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2024-10-15 12:45:03 -07:00
Playwright Service 615f1dbd63
feat(chromium-tip-of-tree): roll to r1269 (#33117)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-15 17:51:57 +02:00
Dmitry Gozman 59a50cf596
fix(chromium): disable PlzDedicatedWorker again (#33110) 2024-10-15 02:13:19 -07:00
Dmitry Gozman 17837e564d
fix(routeWebSocket): make sure ws url without trailing slash is supported (#33095) 2024-10-15 02:08:27 -07:00
Dmitry Gozman 8a275e5a5b
docs: improve docs for WebSocketRoute (#33097) 2024-10-15 02:07:03 -07:00
Pavel Feldman 2c05d294a8
chore: fix webkit visibility check in aria matcher (#33102) 2024-10-14 15:55:21 -07:00
Pavel Feldman a38ff6e0d8
chore: experimental toMatchAriaSnapshot (#33014) 2024-10-14 14:07:19 -07:00
Pavel Feldman 6cfcbe0d6d
chore: fix codegen selector while debugging (#33099)
Fixes #33052
2024-10-14 14:04:24 -07:00
Dmitry Gozman ecd147ce43
fix(test runner): when sharding with beforeAll, use shards total instead of workers (#33083)
Otherwise, we might split the `beforeAll`-grouped test group into
`workers` parts instead of `shard.total` parts as the user would expect.

Fixes #33077.
2024-10-14 13:46:06 -07:00
Yury Semikhatsky f8806d253d
chore(bidi): remove assertion from response dispatch (#33100)
After the context has been disposed we can't route any callbacks to it
because
it is not in the map, so the assertion doesn't make sense as it always
ends up in
the top level session.

Fixes the following error:
```
  pw:browser <closing ws> Closing websocket due to failed onmessage callback. eventData={"type":"success","id":32,"result":{}} e=Assertion error Error: Assertion error
  pw:browser     at assert (/home/yurys/playwright/packages/playwright-core/src/utils/debug.ts:21:11)
  pw:browser     at BidiSession.dispatchMessage (/home/yurys/playwright/packages/playwright-core/src/server/bidi/bidiConnection.ts:229:13)
  pw:browser     at BidiConnection.call [as _dispatchMessage] (/home/yurys/playwright/packages/playwright-core/src/server/bidi/bidiConnection.ts:93:25)
```
2024-10-14 13:25:30 -07:00
Playwright Service c7fbeddaf4
feat(webkit): roll to r2092 (#33078) 2024-10-14 22:21:49 +02:00
Simon Knott a8df750a48
fix(har): account for reused sockets (#33087)
Closes https://github.com/microsoft/playwright/issues/32960

If the socket is reused, the connect and DNS timings are set to -1,
because that timing doesn't apply to the current request. The time
between request start and the socket being free is counted as `blocked`.
2024-10-14 17:22:29 +02:00
Max Schmitt 9fcf60464d
chore: various v1.48.0 roll fixes for .NET (#33096) 2024-10-14 16:32:11 +02:00
Remigiusz Dudek 4c2d62a881
feat(html-reporter): recognize video attachment by the contentType (#33074)
Closes https://github.com/microsoft/playwright/issues/33073.

---------

Signed-off-by: Remigiusz Dudek <remigiusz_dudek@tlen.pl>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2024-10-14 05:16:19 -07:00
Fumiaki MATSUSHIMA 0a63427c77
fix(codegen): fix unselect issue (#33076) 2024-10-13 13:16:01 +02:00
Playwright Service 699f51b227
feat(webkit): roll to r2091 (#33070) 2024-10-11 17:18:06 -07:00
Playwright Service e4b0d5e6dd
feat(chromium): roll to r1142 (#33062)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-11 16:33:59 +02:00
Max Schmitt 87624c5434
Revert "fix(codegen): fix unselect issue (#32127)" (#33065)
This reverts commit 5121b19ac6.

The tree is red and fixing seems non-trivial.

Closes https://github.com/microsoft/playwright/issues/33064
Closes https://github.com/microsoft/playwright/pull/33060
2024-10-11 16:33:17 +02:00
Yury Semikhatsky b9cce598dd
fix(screenshot): show image diff inline in errors list (#32997)
The diff is now shown inline in the errors list.

There are 2 possible failures of toHaveScreenshot
* Previous and actual snapshot mismatch. In this case html report will
show diff between Actual/Previous and have Expected as a separate
screenshot.
* Actual/Previous are equal but they differ from the expected. In this
case html report only contains Actual/Expected images and the diff.

Reference: https://github.com/microsoft/playwright/issues/32341

<img width="1039" alt="image"
src="https://github.com/user-attachments/assets/b458f986-cc25-4721-862c-0cc2c1b01a42">
2024-10-10 16:49:17 -07:00
Playwright Service 10a9e1c730
feat(webkit): roll to r2090 (#33050) 2024-10-11 00:08:03 +02:00
Yury Semikhatsky 82fe882004
fix(webkit): scroll mobile page with background-attachment: fixed (#33048)
Fixes #31551
Fixes #23573
2024-10-10 14:32:27 -07:00
Playwright Service 7de084b6dc
feat(chromium-tip-of-tree): roll to r1268 (#33042)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-10 16:32:00 +02:00
Playwright Service 217b57df4c
feat(webkit): roll to r2089 (#33039)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-10 13:10:54 +02:00
Dmitry Gozman 25dd9b5cd4
feat: config.build.tsconfig (#33026)
Allows to specify `tsconfig` in the configuration file, which applies to
test files but not the config file itself.

Fixes #32808.
2024-10-10 01:37:46 -07:00
Pavel Feldman 8f3353865d
fix(ui): bring back the headed param (#33030)
Fixes https://github.com/microsoft/playwright/issues/33023
2024-10-09 17:46:54 -07:00
Playwright Service bc30cc795e
feat(chromium): roll to r1141 (#33027)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-09 14:55:37 +02:00
Dmitry Gozman c2cbf26497
docs: refresh timeouts doc (#33025)
After changes a few releases ago, specify that `afterEach` hooks are
included in a separate timeout.

Fixes #32851.
2024-10-09 05:10:10 -07:00
Max Schmitt 6210fef681
test: fix android tests (#33021) 2024-10-09 11:22:27 +02:00
Yury Semikhatsky bcf4ff1e47
chore(bidi): update setContent expectations for ff (#32992) 2024-10-08 11:58:01 -07:00
Simon Knott 892d67ffef
feat(test runner): allow stopping testrun with escape (#32584)
Closes https://github.com/microsoft/playwright/issues/32579
2024-10-08 11:39:54 -07:00
Fumiaki MATSUSHIMA 5121b19ac6
fix(codegen): fix unselect issue (#32127)
Fixes https://github.com/microsoft/playwright/issues/31290
2024-10-08 11:38:52 -07:00
Pavel Feldman dbe881cfdc
docs: add a section on balancing shards (#33011)
Closes https://github.com/microsoft/playwright/issues/32922
2024-10-08 08:35:02 -07:00
Pavel Feldman 6c9823eeaf
chore: allow minimal height for trace attachments (#32996) 2024-10-08 08:33:45 -07:00
Max Schmitt d0f2170e21
Revert "fix(test): do not allow mixing tests from different types (#29284)" (#33002)
This reverts commit 4784139bb0.

Closes https://github.com/microsoft/playwright/issues/29734
2024-10-08 16:00:40 +02:00
Simon Knott 042161e1ce
Reapply "fix(har timing): record connect timing for proxied connections" (#32855) (#33003)
This reapplies what we reverted in
https://github.com/microsoft/playwright/pull/32989.

Max and me debugged this, and found that the test failures come from
SOCKS proxy now preferring IPv6 over IPv4. We've updated the tests and
made sure that this doesn't mask any breaking change.

I'm enabling CQ1 to make sure we don't oversee any other CI failures.
2024-10-08 14:17:50 +02:00
Playwright Service 992994f036
feat(chromium-tip-of-tree): roll to r1267 (#33007)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-08 14:13:45 +02:00
Max Schmitt 47a889ac48
chore: roll stable-test-runner to 1.48.0-beta-1728384960000 (#33008) 2024-10-08 14:01:45 +02:00
Dmitry Gozman 814f7eb556
test: fix/fixme/update a few tests (#33006) 2024-10-08 03:59:35 -07:00
Playwright Service 5b29ead6f0
chore(driver): roll driver to recent Node.js LTS version (#33005)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-08 12:53:38 +02:00
Dmitry Gozman 0f2cbdedac
fix(routeWebSocket): do not show in the trace (#32991) 2024-10-08 02:47:24 -07:00
Simon Knott 1b589c4bd3
Revert "fix(har timing): record `connect` timing for proxied connections" (#32989)
Reverts microsoft/playwright#32855. This broke two tests on main, and we
don't yet know how to fix it other than downgrading.
2024-10-08 10:13:21 +02:00
Mark 04bf425268
feat(base-reporter): Add tags to test output (#32930) 2024-10-07 17:14:46 -07:00
Pavel Feldman 7047c3a6c6
fix(codegen): do not codegen non-existing fixtures (#32993)
Closes https://github.com/microsoft/playwright/issues/32981
2024-10-07 17:12:36 -07:00
Yury Semikhatsky 6ba5ee3a83
chore(ui-mode): expand all button (#32994)
<img width="230" alt="image"
src="https://github.com/user-attachments/assets/dd7fa3a1-39ec-4b88-9279-d664c9c4e5cd">


Reference https://github.com/microsoft/playwright/issues/32825
2024-10-07 15:42:12 -07:00
Aaron Sherwood 4d13677ebd
chore: add Devuan OS fallback to Debian (#32990) 2024-10-07 23:24:18 +02:00
Yury Semikhatsky 4ab857ce8e
test: fetch header propagation on redirect (#32970)
Documenting current behavior with and without interception.

Reference https://github.com/microsoft/playwright/issues/32939
2024-10-07 14:06:28 -07:00
Yury Semikhatsky 4fe33db392
docs(route): header override propagation (#32971)
Fix https://github.com/microsoft/playwright/issues/32939
2024-10-07 13:52:55 -07:00
Simon Knott 9a6f03eb87
fix(fetch): listener leaks on Socket (#32956)
Closes https://github.com/microsoft/playwright/issues/32951

`node:http` reuses TCP Sockets under the hood. We weren't cleaning up
our listeners, leading to the `MaxListenersExceededWarning`.

This PR adds cleanup logic. It also raises the warning threshhold, so
that it doesn't trigger until there's 100 concurrent requests over the
same socket.
2024-10-07 18:43:25 +02:00
Simon Knott d3fbf1aaeb
fix(clock): amend setSystemTime docs (#32901)
As discussed yesterday over
https://github.com/microsoft/playwright/issues/32807. Adds some words to
differentiate `setSystemTime` from `setFixedTime`.

---------

Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2024-10-07 12:12:12 +02:00
Dmitry Gozman e6afb650be
test: mark a few tests as fixme (#32985) 2024-10-07 02:58:03 -07:00
Max Schmitt 001ba37706
test: update webview2 skipme's (#32984)
This leaves only reasonable skipmes for WebView2 in the code base.
2024-10-07 11:08:07 +02:00
Bruno 317ddd4117
docs(best practices): tabs with yarn and pnpm commands added (#32980) 2024-10-07 10:48:30 +02:00
Simon Knott de4a4d1ce1
fix(har timing): record `connect` timing for proxied connections (#32855)
Fixes a bug discovered in
https://github.com/microsoft/playwright/pull/32647. When using http
proxy, the `connect` event isn't emitted so we don't populate
`tcpConnectionAt`. The updated version of `https-proxy-agent` emits a
`proxyConnect` as a replacement, so this PR updates and listens to that
event.
For socks proxies, the `on("socket")` event is emitted once the SOCKS
connection is established, which is the equivalent of having a TCP
connection available.

---------

Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2024-10-07 09:59:13 +02:00
Max Schmitt ddeabdf770
devops: speculative fix for flakiness dashboard data loss (#32963) 2024-10-04 18:47:35 +02:00
Dmitry Gozman b284df984b
test: enable test after chromium roll to 1140 (#32965)
Fixes #32355. Fixed after the last roll #32949.
2024-10-04 09:23:11 -07:00
Dmitry Gozman 9f842da8b3
fix: throw when element handle is detached while waiting for selector (#32961) 2024-10-04 08:23:25 -07:00
Dmitry Gozman eaeaa0b158
test: remove tests that we are not going to ever fix (#32962) 2024-10-04 08:22:36 -07:00
Dmitry Gozman 34ad67659f
test: remove some fixmes (#32953) 2024-10-04 08:22:27 -07:00
Simon Knott 40670e6ffd
fix(emulate media): document "no-preference" as deprecated (#32881)
Closes https://github.com/microsoft/playwright/issues/32862.

`prefers-color-scheme: no-preference` was removed from browsers. This PR
marks it as deprecated in our docs and removes all mentions.

---------

Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2024-10-04 16:49:32 +02:00
Simon Knott 80ff7c396a
chore(docs): fix code highlighting (#32927)
Closes https://github.com/microsoft/playwright/issues/32921

This is the diff when rolling to `playwright.dev` locally:
<img width="1262" alt="Screenshot 2024-10-02 at 14 54 42"
src="https://github.com/user-attachments/assets/aade7ad4-420c-48c4-a2c9-03fe815a3959">

---------

Signed-off-by: Simon Knott <info@simonknott.de>
2024-10-04 16:38:13 +02:00
Simon Knott 6be97f34dd
docs(test-reporters): replace reporter showcase with list of interesting OSS implementations (#32896)
As discussed yesterday, this PR replaces the "reporter showcase" with a
list of interesting implementations for folks who are writing their own
custom reporters.

---------

Signed-off-by: Simon Knott <info@simonknott.de>
2024-10-04 16:29:13 +02:00
Dmitry Gozman 84b4fd4e40
feat: wait for pending navigation to resolve before many actions (#32899)
This includes all actions that perform locator handler check.
    
Note this makes it impossible to interact with the page while a main
frame navigation is ongoing. This was already the case for Chromium, but
now WebKit and Firefox align with it.

Setting `PLAYWRIGHT_SKIP_NAVIGATION_CHECK` environment variable disables
this behavior.
2024-10-04 07:25:18 -07:00
Simon Knott 1b457b1ff8
fix(html reporter): render annotation newlines (#32948)
Closes https://github.com/microsoft/playwright/issues/32925. Before this
change, newlines in annotation descriptions weren't respected. This
change makes them shown. Here's how it looks for this annotation:

```ts
test.info().annotations.push({
  type: 'user story',
  description: '\n- user goes to the page\n- user clicks the button\n- user sees the result',
});
```

Before:

<img width="1071" alt="Screenshot 2024-10-04 at 09 55 15"
src="https://github.com/user-attachments/assets/89e74ff5-ea83-48da-a33b-833423916d95">

After:

<img width="1031" alt="Screenshot 2024-10-04 at 09 51 08"
src="https://github.com/user-attachments/assets/0f2914e8-bd88-4970-aa68-6a5a9828295c">
2024-10-04 14:18:38 +02:00
Simon Knott ff0c498904
fix(ct-vue): update default slot should work (#32952)
Closes https://github.com/microsoft/playwright/issues/32809

We were writing onto the wrong object.
2024-10-04 14:18:21 +02:00
Dmitry Gozman 10d6812058
chore: clear `pendingDocument()` for the same-document navigation (#32954)
WebKit notifies about a pending same-document navigation through
`Page.frameScheduledNavigation`, and committing it should clear the
`pendingDocument()`.

Extracted from #32899.
2024-10-04 04:54:56 -07:00
Max Schmitt 895be9f8de
chore: lint java docs snippets (#32945) 2024-10-04 11:34:04 +02:00
Playwright Service 0a45549533
feat(chromium): roll to r1140 (#32949)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-04 11:14:08 +02:00
Max Schmitt dfa4ab8726
test: speed up only-changed CT test (#32947) 2024-10-04 10:06:56 +02:00
Yury Semikhatsky d7020cba63
test: scroll mobile page with background-attachment: fixed (#31992)
Reference: https://github.com/microsoft/playwright/issues/31551
Reference: https://github.com/microsoft/playwright/issues/23573
2024-10-03 18:16:49 -07:00
Dmitry Gozman 6b1d0361cd
fix(chromium): reset mouse position upon page reuse (#32944)
Similarly to Firefox, move the mouse to (-1, -1) upon page reuse. This
fixes the corresponding test on all platforms.
2024-10-03 08:09:00 -07:00
Dmitry Gozman d98fa5da2f
test: update some expectations for headed chromium, unskip tests (#32943) 2024-10-03 07:59:48 -07:00
Playwright Service 076a6e84a1
feat(chromium-tip-of-tree): roll to r1266 (#32942)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-03 16:03:30 +02:00
Dmitry Gozman 0ffac886e8
test: fix android tests (#32932)
One test is removed, since it's impossible to fix. Hopefully, the rest
will pass.
2024-10-03 03:37:43 -07:00
Dmitry Gozman 3c5967d4f5
fix(trace viewer): clear old highlighted elements upon change (#32917)
When the list of highlighted elements changes over time, we should
update the elements marked as `__playwright_target__` in the snapshot.

A good example is an `expect(locator).toHaveText([...])` where the list
of elements changes from 4 items to 3 after clicking a "Delete" button.
2024-10-02 23:48:26 -07:00
Playwright Service 616425a0fb
feat(firefox): roll to r1465 (#32938) 2024-10-03 08:25:44 +02:00
Max Schmitt 8715652a0d
devops: don't run codegen tests in trace-events mode (#32810) 2024-10-02 23:22:00 +02:00
Yury Semikhatsky d7651b8f56
chore(bidi): disable firefox tracing on CI (#32935)
Disabling as it produces [too much
output](https://github.com/microsoft/playwright/pull/32908#issuecomment-2387914821).
2024-10-02 11:16:56 -07:00
Simon Knott 29ffcdfc4e
test(html reporter): filtering by type works (#32931)
The folks who opened
https://github.com/microsoft/playwright/issues/32925 would benefit from
filtering by annotation existence. Turns out we already have it! This PR
adds a test to ensure it stays that way.
2024-10-02 16:29:27 +02:00
Dmitry Gozman face24dc66
test: unflake/skip a few tests (#32929) 2024-10-02 06:58:21 -07:00
Max Schmitt 31a4a74598
chore: do not create a GitHub Status Check for merge results (#32928) 2024-10-02 15:23:42 +02:00
Simon Knott 3a5bf1cc1d
fix(trace viewer): reveal stack for highlighted action (#32919)
Closes https://github.com/microsoft/playwright/issues/32915.

In the `Call` and `Logs` tabs, we update the contents based on the
hovered action. We document that this is also the case for the `Source`
tab:


78054a7652/docs/src/test-ui-mode-js.md?plain=1#L61-L65

But it isn't. Not sure if it's a regression or not, but this PR fixes
it.
2024-10-02 13:30:44 +02:00
Max Schmitt 6373fe703d
docs: fix Java/.NET types for docs rolling (#32924) 2024-10-02 13:27:56 +02:00
Max Schmitt 67c37cf813
docs(ci): recommend noble instead of jammy (#32923) 2024-10-02 13:12:11 +02:00
Viet Nguyen Duc dbf7976dd8
docs(selenium): update docker image tag in feat Playwright connect Selenium Grid (#32777) 2024-10-02 11:34:05 +02:00
Simon Knott 6ccaad3a1b
chore: call out that that the vscode extension is for Node.js (#32882)
In https://github.com/microsoft/playwright/issues/32861, an interested
.NET user wanted to try Playwright and found the VS Code Getting Started
guide. It didn't work for them because the VS Code Extension is for
usage with Node.js, and they don't have NPM installed. We can reduce
confusion by mentioning that VS Code Getting started is for Node.js.

---------

Signed-off-by: Simon Knott <info@simonknott.de>
2024-10-02 11:19:51 +02:00
Simon Knott 208a54529d
fix(ct-react): support shorthand fragment notation (#32900)
Closes https://github.com/microsoft/playwright/issues/32853

Vite turns the shorthand fragment notation `<></>` into `import {
Fragment } from "react"; <Fragment></Fragment>`. On the Node.js side of
things, this `react` import resolves to our mock version of React, which
currently mocks `Fragment` as `{}`. Currently, we pass that straight to
`React.createElement`, which throws an error.

The fix is to make our `Fragment` mock detectable with a tag, and when
we render it replace it with the real `__pwReact.Fragment`.
2024-10-02 11:19:09 +02:00
Playwright Service 0fd9452127
feat(webkit): roll to r2084 (#32912)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-02 09:02:32 +02:00
Dmitry Gozman 773202867d
feat(trace): highlight strict mode violation elements in the snapshot (#32893)
This is fixing a case where the test failed with strict mode violation,
but all the matched elements are not highlighted in the trace.

For example, all the buttons will be highlighted when the following line
fails due to strict mode violation:
```ts
await page.locator('button').click();
```

To achieve this, we mark elements during `querySelector` phase instead
of inside `onBeforeInputAction`. This allows us to only mark from inside
the `InjectedScript` and remove the other way of marking from inside the
`Snapshotter`.
2024-10-02 00:00:45 -07:00
Max Schmitt daac0ddd24
fix(fetch): fallback to given URL if baseURL is invalid (#32911) 2024-10-01 22:43:32 +02:00
Max Schmitt c84305ed73
test: retry installation tests up to 3 times (#32910)
Installation tests can fail due to e.g. network issues. Lets align with
library tests and retry up to 3 times.
2024-10-01 13:12:38 -07:00
Yury Semikhatsky 228eb141db
chore(bidi): enable logs in Firefox on CI (#32908) 2024-10-01 11:15:27 -07:00
Max Schmitt 78054a7652
chore: remove 'screenshot instead of snapshot' usages (#32905)
Fixes https://github.com/microsoft/playwright/issues/32904
2024-10-01 18:38:10 +02:00
Playwright Service 00e1a99d65
feat(chromium): roll to r1139 (#32906)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-01 18:18:45 +02:00
Playwright Service 8688af0580
feat(chromium-tip-of-tree): roll to r1265 (#32894)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-01 16:02:21 +02:00
Playwright Service 60db16bad3
feat(chromium): roll to r1138 (#32898)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-01 15:15:00 +02:00
Simon Knott 4bcfa56a13
chore(test runner): mention different timeout (#32883)
In https://github.com/microsoft/playwright/issues/32872, a user notes
that we document `.focus()` to not timeout by default, but in practice
when used without the test runner, it defaults to a 30s timeout.

I've discussed this with Dima, and he noted that our JS documentation
focuses on usage with the Playwright test runner, not with the library.
The test runner disables timeouts for operations in favour of timeouts
for test cases. In the library, we default to a 30s timeouts. This PR
adds this to the "key differences" table.
2024-10-01 11:46:42 +02:00
Max Schmitt 6f16b6cc08
chore: unflake 'should record' (#32880) 2024-09-30 20:32:04 +02:00
Dmitry Gozman 6f99d48a12
test: unflake two tests (#32879)
- the test that closes a context must not be a "page test";
- account for stray browser requests in the proxy test.
2024-09-30 07:49:18 -07:00
Simon Knott c67a7335ab
chore(ui): ensure that --ignore-snapshots is respected (#32875)
Closes https://github.com/microsoft/playwright/issues/32868.

The actual fix was already delivered in
https://github.com/microsoft/playwright/pull/32798/files#diff-98ff2ff92b08ca7e8b274abb3ba6b2eec9bab332e340d062cc18ad1dfe505bf2R299,
this PR adds a test to ensure we don't regress.
2024-09-30 15:12:37 +02:00
Max Schmitt b78103ba50
devops: simplify 'headed' testing matrix (#32878) 2024-09-30 14:40:56 +02:00
Max Schmitt dde8090916
devops: unite channel tests into single GHA matrix workflows (#32876) 2024-09-30 14:24:05 +02:00
Dmitry Gozman 011034050b
chore: update browser patches to 09195c9 (#32877) 2024-09-30 05:14:45 -07:00
Dmitry Gozman 541ce9f0bb
chore: mark 1.49.0-next (#32873) 2024-09-30 04:24:57 -07:00
1253 changed files with 75907 additions and 40651 deletions

View File

@ -1,11 +0,0 @@
{
"name": "Playwright",
"image": "mcr.microsoft.com/playwright:next",
"postCreateCommand": "npm install && npm run build && apt-get update && apt-get install -y software-properties-common && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\" && apt-get install -y docker-ce-cli",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"runArgs": [
"-v", "/var/run/docker.sock:/var/run/docker.sock"
]
}

View File

@ -1,21 +0,0 @@
test/assets/modernizr.js
/tests/third_party/
/packages/*/lib/
*.js
/packages/playwright-core/src/generated/*
/packages/playwright-core/src/third_party/
/packages/playwright-core/types/*
/packages/playwright-ct-core/src/generated/*
/index.d.ts
node_modules/
browser_patches/*/checkout/
browser_patches/chromium/output/
**/*.d.ts
output/
test-results/
tests/components/
tests/installation/fixture-scripts/
examples/
DEPS
.cache/
utils/

View File

@ -1,15 +0,0 @@
module.exports = {
extends: "./.eslintrc.js",
parserOptions: {
ecmaVersion: 9,
sourceType: "module",
project: "./tsconfig.json",
},
rules: {
"@typescript-eslint/no-base-to-string": "error",
"@typescript-eslint/no-unnecessary-boolean-literal-compare": 2,
},
parserOptions: {
project: "./tsconfig.json"
},
};

View File

@ -1,136 +0,0 @@
module.exports = {
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "notice"],
parserOptions: {
ecmaVersion: 9,
sourceType: "module",
},
extends: [
"plugin:react/recommended",
"plugin:react-hooks/recommended"
],
settings: {
react: { version: "18" }
},
/**
* ESLint rules
*
* All available rules: http://eslint.org/docs/rules/
*
* Rules take the following form:
* "rule-name", [severity, { opts }]
* Severity: 2 == error, 1 == warning, 0 == off.
*/
rules: {
"@typescript-eslint/no-unused-vars": [2, {args: "none"}],
"@typescript-eslint/consistent-type-imports": [2, {disallowTypeAnnotations: false}],
/**
* Enforced rules
*/
// syntax preferences
"object-curly-spacing": ["error", "always"],
"quotes": [2, "single", {
"avoidEscape": true,
"allowTemplateLiterals": true
}],
"jsx-quotes": [2, "prefer-single"],
"no-extra-semi": 2,
"@typescript-eslint/semi": [2],
"comma-style": [2, "last"],
"wrap-iife": [2, "inside"],
"spaced-comment": [2, "always", {
"markers": ["*"]
}],
"eqeqeq": [2],
"accessor-pairs": [2, {
"getWithoutSet": false,
"setWithoutGet": false
}],
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
"curly": [2, "multi-or-nest", "consistent"],
"new-parens": 2,
"arrow-parens": [2, "as-needed"],
"prefer-const": 2,
"quote-props": [2, "consistent"],
"nonblock-statement-body-position": [2, "below"],
// anti-patterns
"no-var": 2,
"no-with": 2,
"no-multi-str": 2,
"no-caller": 2,
"no-implied-eval": 2,
"no-labels": 2,
"no-new-object": 2,
"no-octal-escape": 2,
"no-self-compare": 2,
"no-shadow-restricted-names": 2,
"no-cond-assign": 2,
"no-debugger": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty-character-class": 2,
"no-unreachable": 2,
"no-unsafe-negation": 2,
"radix": 2,
"valid-typeof": 2,
"no-implicit-globals": [2],
"no-unused-expressions": [2, { "allowShortCircuit": true, "allowTernary": true, "allowTaggedTemplates": true}],
"no-proto": 2,
// es2015 features
"require-yield": 2,
"template-curly-spacing": [2, "never"],
// spacing details
"space-infix-ops": 2,
"space-in-parens": [2, "never"],
"array-bracket-spacing": [2, "never"],
"comma-spacing": [2, { "before": false, "after": true }],
"keyword-spacing": [2, "always"],
"space-before-function-paren": [2, {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}],
"no-whitespace-before-property": 2,
"keyword-spacing": [2, {
"overrides": {
"if": {"after": true},
"else": {"after": true},
"for": {"after": true},
"while": {"after": true},
"do": {"after": true},
"switch": {"after": true},
"return": {"after": true}
}
}],
"arrow-spacing": [2, {
"after": true,
"before": true
}],
"@typescript-eslint/func-call-spacing": 2,
"@typescript-eslint/type-annotation-spacing": 2,
// file whitespace
"no-multiple-empty-lines": [2, {"max": 2}],
"no-mixed-spaces-and-tabs": 2,
"no-trailing-spaces": 2,
"linebreak-style": [ process.platform === "win32" ? 0 : 2, "unix" ],
"indent": [2, 2, { "SwitchCase": 1, "CallExpression": {"arguments": 2}, "MemberExpression": 2 }],
"key-spacing": [2, {
"beforeColon": false
}],
// copyright
"notice/notice": [2, {
"mustMatch": "Copyright",
"templateFile": require("path").join(__dirname, "utils", "copyright.js"),
}],
// react
"react/react-in-jsx-scope": 0
}
};

View File

@ -23,5 +23,5 @@ body:
> [!IMPORTANT]
> This issue will be closed.
options:
- label: I understand
- label: I understand that this issue will be closed
required: true

View File

@ -1,7 +1,6 @@
name: Report regression
description: Functionality that used to work and does not any more
title: "[Regression]: "
body:
- type: markdown
attributes:

View File

@ -41,9 +41,6 @@ runs:
npm ci
echo "::endgroup::"
shell: bash
env:
DEBUG: pw:install
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
- run: |
echo "::group::npm run build"
npm run build

View File

@ -22,13 +22,3 @@ runs:
name: blob-report-${{ inputs.job_name }}
path: ${{ inputs.report_dir }}/**
retention-days: 7
- name: Write triggering pull request number in a file
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
shell: bash
run: echo '${{ github.event.number }}' > pull_request_number.txt;
- name: Upload artifact with the pull request number
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: pull-request-${{ inputs.job_name }}
path: pull_request_number.txt

14
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
actions:
patterns:
- "*"

View File

@ -33,8 +33,8 @@ jobs:
- name: Cherry-pick commits
id: cherry-pick
run: |
git config --global user.name github-actions
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git config --global user.name microsoft-playwright-automation[bot]
git config --global user.email 203992400+microsoft-playwright-automation[bot]@users.noreply.github.com
for COMMIT_HASH in $(echo "${{ github.event.inputs.commit_hashes }}" | tr "," "\n"); do
git cherry-pick --no-commit "$COMMIT_HASH"
@ -59,10 +59,15 @@ jobs:
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
git checkout -b "$BRANCH_NAME"
git push origin $BRANCH_NAME
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
- name: Create Pull Request
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
github-token: ${{ steps.app-token.outputs.token }}
script: |
const readableCommitHashesList = '${{ github.event.inputs.commit_hashes }}'.split(',').map(hash => `- ${hash}`).join('\n');
const response = await github.rest.pulls.create({

View File

@ -20,8 +20,7 @@ jobs:
node-version: 18
- run: npm ci
env:
DEBUG: pw:install
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
- run: npm run build
- name: Download blob report artifact
@ -34,7 +33,9 @@ jobs:
run: |
npx playwright merge-reports --config .github/workflows/merge.config.ts ./all-blob-reports
env:
NODE_OPTIONS: --max-old-space-size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: --max-old-space-size=8192
HTML_REPORT_URL: 'https://mspwblobreport.z1.web.core.windows.net/run-${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}-${{ github.sha }}/index.html'
- name: Azure Login
uses: azure/login@v2
@ -50,91 +51,3 @@ jobs:
echo "Report url: https://mspwblobreport.z1.web.core.windows.net/$REPORT_DIR/index.html"
env:
AZCOPY_AUTO_LOGIN_TYPE: AZCLI
- name: Read pull request number
uses: ./.github/actions/download-artifact
with:
namePrefix: 'pull-request'
path: '.'
- name: Comment on PR
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
let prNumber;
if (context.payload.workflow_run.event === 'pull_request') {
const prs = context.payload.workflow_run.pull_requests;
if (prs.length) {
prNumber = prs[0].number;
} else {
prNumber = parseInt(fs.readFileSync('pull_request_number.txt').toString());
console.log('Read pull request number from file: ' + prNumber);
}
} else {
core.error('Unsupported workflow trigger event: ' + context.payload.workflow_run.event);
return;
}
if (!prNumber) {
core.error('No pull request found for commit ' + context.sha + ' and workflow triggered by: ' + context.payload.workflow_run.event);
return;
}
{
// Mark previous comments as outdated by minimizing them.
const { data: comments } = await github.rest.issues.listComments({
...context.repo,
issue_number: prNumber,
});
for (const comment of comments) {
if (comment.user.login === 'github-actions[bot]' && /\[Test results\]\(https:\/\/.+?\) for "${{ github.event.workflow_run.name }}"/.test(comment.body)) {
await github.graphql(`
mutation {
minimizeComment(input: {subjectId: "${comment.node_id}", classifier: OUTDATED}) {
clientMutationId
}
}
`);
}
}
}
const reportDir = 'run-${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}-${{ github.sha }}';
const reportUrl = `https://mspwblobreport.z1.web.core.windows.net/${reportDir}/index.html#?q=s%3Afailed%20s%3Aflaky`;
core.notice('Report url: ' + reportUrl);
const mergeWorkflowUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const reportMd = await fs.promises.readFile('report.md', 'utf8');
function formatComment(lines) {
let body = lines.join('\n');
if (body.length > 65535)
body = body.substring(0, 65000) + `... ${body.length - 65000} more characters`;
return body;
}
const { data: response } = await github.rest.issues.createComment({
...context.repo,
issue_number: prNumber,
body: formatComment([
`### [Test results](${reportUrl}) for "${{ github.event.workflow_run.name }}"`,
reportMd,
'',
`Merge [workflow run](${mergeWorkflowUrl}).`
]),
});
core.info('Posted comment: ' + response.html_url);
const check = await github.rest.checks.create({
...context.repo,
name: 'Merge report (${{ github.event.workflow_run.name }})',
head_sha: '${{ github.event.workflow_run.head_sha }}',
status: 'completed',
conclusion: 'success',
details_url: reportUrl,
output: {
title: 'Test results for "${{ github.event.workflow_run.name }}"',
summary: [
reportMd,
'',
'---',
`Full [HTML report](${reportUrl}). Merge [workflow run](${mergeWorkflowUrl}).`
].join('\n'),
}
});

View File

@ -16,7 +16,7 @@ env:
jobs:
doc-and-lint:
name: "docs & lint"
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
@ -24,8 +24,7 @@ jobs:
node-version: 18
- run: npm ci
- run: npm run build
- run: npx playwright install-deps
- run: npx playwright install
- run: npx playwright install --with-deps
- run: npm run lint
- name: Verify clean tree
run: |
@ -35,10 +34,11 @@ jobs:
exit 1
fi
- name: Audit prod NPM dependencies
run: npm audit --omit dev
run: node utils/check_audit.js
continue-on-error: true
lint-snippets:
name: "Lint snippets"
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
@ -50,6 +50,12 @@ jobs:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
- run: npm ci
- run: pip install -r utils/doclint/linting-code-snippets/python/requirements.txt
- run: mvn package
working-directory: utils/doclint/linting-code-snippets/java
- run: node utils/doclint/linting-code-snippets/cli.js

View File

@ -1,4 +1,4 @@
export default {
testDir: '../../tests',
reporter: [['markdown'], ['html']]
reporter: [[require.resolve('../../packages/playwright-dashboard/lib/ghaMarkdownReporter')], ['html']]
};

View File

@ -12,14 +12,24 @@ on:
jobs:
check:
name: Check
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
if: github.repository == 'microsoft/playwright'
steps:
- uses: actions/checkout@v4
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
repositories: |
playwright
playwright-python
playwright-java
playwright-dotnet
- name: Create GitHub issue
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
github-token: ${{ steps.app-token.outputs.token }}
script: |
const currentPlaywrightVersion = require('./package.json').version.match(/\d+\.\d+/)[0];
const { data } = await github.rest.git.getCommit({
@ -28,6 +38,10 @@ jobs:
commit_sha: context.sha,
});
const commitHeader = data.message.split('\n')[0];
const prMatch = commitHeader.match(/#(\d+)/);
const formattedCommit = prMatch
? `https://github.com/microsoft/playwright/pull/${prMatch[1]}`
: `https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${context.sha} (${commitHeader})`;
const title = '[Ports]: Backport client side changes for ' + currentPlaywrightVersion;
for (const repo of ['playwright-python', 'playwright-java', 'playwright-dotnet']) {
@ -50,7 +64,7 @@ jobs:
issueBody = issueCreateData.body;
}
const newBody = issueBody.trimEnd() + `
- [ ] https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${context.sha} (${commitHeader})`;
- [ ] ${formattedCommit}`;
const data = await github.rest.issues.update({
owner: context.repo.owner,
repo: repo,

View File

@ -28,7 +28,6 @@ jobs:
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build
- run: npx playwright install-deps
- name: "@next: publish with commit timestamp (triggered manually)"
if: contains(github.ref, 'main') && github.event_name == 'workflow_dispatch'
run: |
@ -65,20 +64,26 @@ jobs:
publish-trace-viewer:
name: "publish Trace Viewer to trace.playwright.dev"
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
if: github.repository == 'microsoft/playwright'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
repositories: trace.playwright.dev
- name: Deploy Canary
run: bash utils/build/deploy-trace-viewer.sh --canary
if: contains(github.ref, 'main')
env:
GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Deploy BETA
run: bash utils/build/deploy-trace-viewer.sh --beta
if: contains(github.ref, 'release')
env:
GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }}

View File

@ -29,7 +29,6 @@ jobs:
platforms: arm64
- run: npm ci
- run: npm run build
- run: npx playwright install-deps
- name: Azure Login
uses: azure/login@v2
with:

View File

@ -24,7 +24,6 @@ jobs:
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build
- run: npx playwright install-deps
- run: utils/build/build-playwright-driver.sh
- name: Azure Login
uses: azure/login@v2

View File

@ -10,7 +10,7 @@ env:
jobs:
publish-npm-release:
name: "publish to NPM"
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
if: github.repository == 'microsoft/playwright'
permissions:
contents: read
@ -23,7 +23,6 @@ jobs:
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build
- run: npx playwright install-deps
- run: utils/publish_all_packages.sh --release-candidate
if: ${{ github.event.release.prerelease }}
env:

View File

@ -7,14 +7,20 @@ on:
jobs:
publish-trace-viewer:
name: "publish Trace Viewer to trace.playwright.dev"
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
if: github.repository == 'microsoft/playwright'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
repositories: trace.playwright.dev
- name: Deploy Stable
run: bash utils/build/deploy-trace-viewer.sh --stable
env:
GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }}

View File

@ -3,16 +3,28 @@ name: Roll Browser into Playwright
on:
repository_dispatch:
types: [roll_into_pw]
workflow_dispatch:
inputs:
browser:
description: 'Browser name, e.g. chromium'
required: true
type: string
revision:
description: 'Browser revision without v prefix, e.g. 1234'
required: true
type: string
env:
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
BROWSER: ${{ github.event.client_payload.browser || github.event.inputs.browser }}
REVISION: ${{ github.event.client_payload.revision || github.event.inputs.revision }}
permissions:
contents: write
jobs:
roll:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
@ -24,30 +36,35 @@ jobs:
run: npx playwright install-deps
- name: Roll to new revision
run: |
./utils/roll_browser.js ${{ github.event.client_payload.browser }} ${{ github.event.client_payload.revision }}
./utils/roll_browser.js $BROWSER $REVISION
npm run build
- name: Prepare branch
id: prepare-branch
run: |
BRANCH_NAME="roll-into-pw-${{ github.event.client_payload.browser }}/${{ github.event.client_payload.revision }}"
BRANCH_NAME="roll-into-pw-${BROWSER}/${REVISION}"
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
git config --global user.name github-actions
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git config --global user.name microsoft-playwright-automation[bot]
git config --global user.email 203992400+microsoft-playwright-automation[bot]@users.noreply.github.com
git checkout -b "$BRANCH_NAME"
git add .
git commit -m "feat(${{ github.event.client_payload.browser }}): roll to r${{ github.event.client_payload.revision }}"
git push origin $BRANCH_NAME
git commit -m "feat(${BROWSER}): roll to r${REVISION}"
git push origin $BRANCH_NAME --force
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
- name: Create Pull Request
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
github-token: ${{ steps.app-token.outputs.token }}
script: |
const response = await github.rest.pulls.create({
owner: 'microsoft',
repo: 'playwright',
head: 'microsoft:${{ steps.prepare-branch.outputs.BRANCH_NAME }}',
base: 'main',
title: 'feat(${{ github.event.client_payload.browser }}): roll to r${{ github.event.client_payload.revision }}',
title: 'feat(${{ env.BROWSER }}): roll to r${{ env.REVISION }}',
});
await github.rest.issues.addLabels({
owner: 'microsoft',

View File

@ -27,17 +27,22 @@ jobs:
echo "HAS_CHANGES=1" >> $GITHUB_OUTPUT
BRANCH_NAME="roll-driver-nodejs/$(date +%Y-%b-%d)"
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
git config --global user.name github-actions
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git config --global user.name microsoft-playwright-automation[bot]
git config --global user.email 203992400+microsoft-playwright-automation[bot]@users.noreply.github.com
git checkout -b "$BRANCH_NAME"
git add .
git commit -m "chore(driver): roll driver to recent Node.js LTS version"
git push origin $BRANCH_NAME
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
- name: Create Pull Request
if: ${{ steps.prepare-branch.outputs.HAS_CHANGES == '1' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
github-token: ${{ steps.app-token.outputs.token }}
script: |
await github.rest.pulls.create({
owner: 'microsoft',

View File

@ -2,18 +2,24 @@ name: tests BiDi
on:
workflow_dispatch:
inputs:
ref:
description: Playwright SHA / ref to test. Use 'refs/pull/PULL_REQUEST_ID/head' to test a PR. Defaults to the current branch.
required: false
default: ''
pull_request:
branches:
- main
paths:
- .github/workflows/tests_bidi.yml
- packages/playwright-core/src/server/bidi/**
- tests/bidi/**
schedule:
# Run every day at midnight
- cron: '0 0 * * *'
env:
FORCE_COLOR: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
jobs:
test_bidi:
@ -26,21 +32,53 @@ jobs:
strategy:
fail-fast: false
matrix:
channel: [bidi-chromium, bidi-firefox-nightly]
channel: [bidi-chromium, moz-firefox]
steps:
- uses: actions/checkout@v4
if: github.event_name != 'workflow_dispatch'
- uses: actions/checkout@v4
if: github.event_name == 'workflow_dispatch'
with:
ref: ${{ github.event.inputs.ref }}
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
- run: npm run build
- run: npx playwright install --with-deps chromium
if: matrix.channel == 'bidi-chromium'
- run: npx -y @puppeteer/browsers install firefox@nightly
if: matrix.channel == 'bidi-firefox-nightly'
- if: matrix.channel == 'moz-firefox'
id: install_firefox
run: |
npx -y @puppeteer/browsers install firefox@nightly |\
awk 'END { $1=""; sub(/^ /,""); print "bidi_ffpath="$0 }' |\
tee -a $GITHUB_OUTPUT
- name: Run tests
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run biditest -- --project=${{ matrix.channel }}*
env:
PWTEST_USE_BIDI_EXPECTATIONS: '1'
BIDI_FFPATH: ${{ steps.install_firefox.outputs.bidi_ffpath }}
- name: Upload csv report to GitHub
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: csv-report-${{ matrix.channel }}
path: test-results/report.csv
retention-days: 7
- name: Azure Login
if: ${{ !cancelled() && github.ref == 'refs/heads/main' }}
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_BLOB_REPORTS_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_BLOB_REPORTS_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_BLOB_REPORTS_SUBSCRIPTION_ID }}
- name: Upload report.csv to Azure
if: ${{ !cancelled() && github.ref == 'refs/heads/main' }}
run: |
REPORT_DIR='bidi-reports'
azcopy cp "./test-results/report.csv" "https://mspwblobreport.blob.core.windows.net/\$web/$REPORT_DIR/${{ matrix.channel }}.csv"
echo "Report url: https://mspwblobreport.z1.web.core.windows.net/$REPORT_DIR/${{ matrix.channel }}.csv"
env:
AZCOPY_AUTO_LOGIN_TYPE: AZCLI

View File

@ -147,6 +147,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Ubuntu Binary Installation # TODO: Remove when https://github.com/electron/electron/issues/42510 is fixed
if: ${{ runner.os == 'Linux' }}
run: |
if grep -q "Ubuntu 24" /etc/os-release; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
fi
shell: bash
- uses: ./.github/actions/run-test
with:
browsers-to-install: chromium

View File

@ -23,6 +23,7 @@ env:
# Force terminal colors. @see https://www.npmjs.com/package/colors
FORCE_COLOR: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
DEBUG_GIT_COMMIT_INFO: 1
jobs:
test_linux:
@ -63,7 +64,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
os: [ubuntu-22.04]
runs-on: ${{ matrix.os }}
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
@ -134,8 +135,6 @@ jobs:
with:
node-version: 18
- run: npm ci
env:
DEBUG: pw:install
- run: npm run build
- run: npx playwright install --with-deps
@ -165,6 +164,7 @@ jobs:
runs-on: ubuntu-latest
env:
PWTEST_BOT_NAME: "vscode-extension"
DEBUG_GIT_COMMIT_INFO: ""
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
@ -184,7 +184,7 @@ jobs:
run: node -e "const p = require('./package.json'); delete p.devDependencies['@playwright/test']; fs.writeFileSync('./package.json', JSON.stringify(p, null, 2));"
working-directory: ./playwright-vscode
- name: Build extension
run: npm install && npm run build
run: npm ci && npm run build
working-directory: ./playwright-vscode
- name: Run extension tests
run: npm run test -- --workers=1
@ -215,6 +215,13 @@ jobs:
- uses: actions/checkout@v4
- run: npm install -g yarn@1
- run: npm install -g pnpm@8
- name: Setup Ubuntu Binary Installation # TODO: Remove when https://github.com/electron/electron/issues/42510 is fixed
if: ${{ runner.os == 'Linux' }}
run: |
if grep -q "Ubuntu 24" /etc/os-release; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
fi
shell: bash
- uses: ./.github/actions/run-test
with:
command: npm run itest

View File

@ -31,7 +31,7 @@ jobs:
fail-fast: false
matrix:
browser: [chromium, firefox, webkit]
os: [ubuntu-20.04, ubuntu-24.04]
os: [ubuntu-24.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
@ -107,6 +107,13 @@ jobs:
- uses: actions/checkout@v4
- run: npm install -g yarn@1
- run: npm install -g pnpm@8
- name: Setup Ubuntu Binary Installation # TODO: Remove when https://github.com/electron/electron/issues/42510 is fixed
if: ${{ runner.os == 'Linux' }}
run: |
if grep -q "Ubuntu 24" /etc/os-release; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
fi
shell: bash
- uses: ./.github/actions/run-test
with:
node-version: ${{ matrix.node_version }}
@ -123,7 +130,11 @@ jobs:
fail-fast: false
matrix:
browser: [chromium, firefox, webkit]
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, macos-14-xlarge, windows-latest]
os: [ubuntu-24.04, macos-14-xlarge, windows-latest]
include:
# We have different binaries per Ubuntu version for WebKit.
- browser: webkit
os: ubuntu-22.04
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
@ -143,7 +154,7 @@ jobs:
fail-fast: false
matrix:
mode: [driver, service]
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
@ -169,7 +180,7 @@ jobs:
- browser: webkit
- browser: chromium
channel: chromium-tip-of-tree
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
@ -184,354 +195,96 @@ jobs:
PWTEST_TRACE: 1
PWTEST_CHANNEL: ${{ matrix.channel }}
chrome_stable_linux:
name: "Chrome Stable (Linux)"
test_chromium_channels:
name: Test ${{ matrix.channel }} on ${{ matrix.runs-on }}
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: ubuntu-20.04
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
channel: [chrome, chrome-beta, msedge, msedge-beta, msedge-dev]
runs-on: [ubuntu-22.04, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: chrome
browsers-to-install: ${{ matrix.channel }}
command: npm run ctest
bot-name: "chrome-stable-linux"
bot-name: ${{ matrix.channel }}-${{ matrix.runs-on }}
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: chrome
chrome_stable_win:
name: "Chrome Stable (Win)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: chrome
command: npm run ctest
bot-name: "chrome-stable-windows"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: chrome
chrome_stable_mac:
name: "Chrome Stable (Mac)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: chrome
command: npm run ctest
bot-name: "chrome-stable-mac"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: chrome
PWTEST_CHANNEL: ${{ matrix.channel }}
chromium_tot:
name: Chromium tip-of-tree ${{ matrix.os }}
name: Chromium tip-of-tree ${{ matrix.os }}${{ matrix.headed }}
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-13, windows-latest]
os: [ubuntu-22.04, macos-13, windows-latest]
headed: ['--headed', '']
exclude:
# Tested in tests_primary.yml already
- os: ubuntu-22.04
headed: ''
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: chromium-tip-of-tree
command: npm run ctest
bot-name: "tip-of-tree-${{ matrix.os }}"
command: npm run ctest -- ${{ matrix.headed }}
bot-name: "chromium-tip-of-tree-${{ matrix.os }}${{ matrix.headed }}"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: chromium-tip-of-tree
chromium_tot_headed:
name: Chromium tip-of-tree headed ${{ matrix.os }}
chromium_tot_headless_shell:
name: Chromium tip-of-tree headless-shell-${{ matrix.os }}
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: chromium-tip-of-tree
command: npm run ctest -- --headed
bot-name: "tip-of-tree-headed-${{ matrix.os }}"
browsers-to-install: chromium-tip-of-tree-headless-shell
command: npm run ctest
bot-name: "chromium-tip-of-tree-headless-shell-${{ matrix.os }}"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: chromium-tip-of-tree
PWTEST_CHANNEL: chromium-tip-of-tree-headless-shell
firefox_beta_linux:
name: "Firefox Beta (Linux)"
firefox_beta:
name: Firefox Beta ${{ matrix.os }}
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: ubuntu-20.04
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: firefox-beta chromium
command: npm run ftest
bot-name: "firefox-beta-linux"
bot-name: "firefox-beta-${{ matrix.os }}"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: firefox-beta
firefox_beta_win:
name: "Firefox Beta (Win)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: firefox-beta chromium
command: npm run ftest -- --workers=1
bot-name: "firefox-beta-windows"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: firefox-beta
firefox_beta_mac:
name: "Firefox Beta (Mac)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: firefox-beta chromium
command: npm run ftest
bot-name: "firefox-beta-mac"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: firefox-beta
edge_stable_mac:
name: "Edge Stable (Mac)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: msedge
command: npm run ctest
bot-name: "edge-stable-mac"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: msedge
edge_stable_win:
name: "Edge Stable (Win)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: msedge
command: npm run ctest
bot-name: "edge-stable-windows"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: msedge
edge_stable_linux:
name: "Edge Stable (Linux)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: msedge
command: npm run ctest
bot-name: "edge-stable-linux"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: msedge
edge_beta_mac:
name: "Edge Beta (Mac)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: msedge-beta
command: npm run ctest
bot-name: "edge-beta-mac"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: msedge-beta
edge_beta_win:
name: "Edge Beta (Win)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: msedge-beta
command: npm run ctest
bot-name: "edge-beta-windows"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: msedge-beta
edge_beta_linux:
name: "Edge Beta (Linux)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: msedge-beta
command: npm run ctest
bot-name: "edge-beta-linux"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: msedge-beta
edge_dev_mac:
name: "Edge Dev (Mac)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: msedge-dev
command: npm run ctest
bot-name: "edge-dev-mac"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: msedge-dev
edge_dev_win:
name: "Edge Dev (Win)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: msedge-dev
command: npm run ctest
bot-name: "edge-dev-windows"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: msedge-dev
edge_dev_linux:
name: "Edge Dev (Linux)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: msedge-dev
command: npm run ctest
bot-name: "edge-dev-linux"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: msedge-dev
chrome_beta_linux:
name: "Chrome Beta (Linux)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: chrome-beta
command: npm run ctest
bot-name: "chrome-beta-linux"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: chrome-beta
chrome_beta_win:
name: "Chrome Beta (Win)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: chrome-beta
command: npm run ctest
bot-name: "chrome-beta-windows"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: chrome-beta
chrome_beta_mac:
name: "Chrome Beta (Mac)"
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
browsers-to-install: chrome-beta
command: npm run ctest
bot-name: "chrome-beta-mac"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: chrome-beta
build-playwright-driver:
name: "build-playwright-driver"
runs-on: ubuntu-24.04
@ -542,22 +295,27 @@ jobs:
node-version: 18
- run: npm ci
- run: npm run build
- run: npx playwright install-deps
- run: utils/build/build-playwright-driver.sh
test_linux_chromium_headless_new:
name: Linux Chromium Headless New
test_channel_chromium:
name: Test channel=chromium
environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-test
with:
# TODO: this should pass --no-shell.
# However, codegen tests do not inherit the channel and try to launch headless shell.
browsers-to-install: chromium
command: npm run ctest
bot-name: "headless-new"
bot-name: "channel-chromium-${{ matrix.runs-on }}"
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PLAYWRIGHT_CHROMIUM_USE_HEADLESS_NEW: 1
PWTEST_CHANNEL: chromium

View File

@ -1,70 +0,0 @@
name: "tests service"
on:
workflow_dispatch:
env:
FORCE_COLOR: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
jobs:
test:
name: "Service"
strategy:
fail-fast: false
matrix:
service-os: [linux, windows]
browser: [chromium, firefox, webkit]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}-* --workers=10 --retries=0
env:
PWTEST_MODE: service2
PWTEST_TRACE: 1
PWTEST_BOT_NAME: "${{ matrix.browser }}-${{ matrix.service-os }}-service"
PLAYWRIGHT_SERVICE_ACCESS_KEY: ${{ secrets.PLAYWRIGHT_SERVICE_ACCESS_KEY }}
PLAYWRIGHT_SERVICE_URL: ${{ secrets.PLAYWRIGHT_SERVICE_URL }}
PLAYWRIGHT_SERVICE_OS: ${{ matrix.service-os }}
PLAYWRIGHT_SERVICE_RUN_ID: ${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }}
- name: Upload blob report to GitHub
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: all-blob-reports
path: blob-report
retention-days: 2
merge_reports:
name: "Merge reports"
needs: [test]
if: ${{ !cancelled() }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- name: Download blob report artifact
uses: actions/download-artifact@v4
with:
name: all-blob-reports
path: all-blob-reports
- run: npx playwright merge-reports --reporter markdown,html ./all-blob-reports
- name: Upload HTML report to Azure
run: |
REPORT_DIR='run-service-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }}'
azcopy cp --recursive "./playwright-report/*" "https://mspwblobreport.blob.core.windows.net/\$web/$REPORT_DIR"
echo "Report url: https://mspwblobreport.z1.web.core.windows.net/$REPORT_DIR/index.html#?q=s:failed"
env:
AZCOPY_AUTO_LOGIN_TYPE: SPN
AZCOPY_SPA_APPLICATION_ID: '${{ secrets.AZCOPY_SPA_APPLICATION_ID }}'
AZCOPY_SPA_CLIENT_SECRET: '${{ secrets.AZCOPY_SPA_CLIENT_SECRET }}'
AZCOPY_TENANT_ID: '${{ secrets.AZCOPY_TENANT_ID }}'

View File

@ -19,7 +19,7 @@ jobs:
fail-fast: false
matrix:
browser: [chromium, firefox, webkit]
os: [ubuntu-20.04, ubuntu-22.04]
os: [ubuntu-22.04, ubuntu-24.04]
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed

View File

@ -9,8 +9,14 @@ on:
jobs:
trigger:
name: "trigger"
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
repositories: playwright-browsers
- run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
@ -18,4 +24,4 @@ jobs:
--data "{\"event_type\": \"playwright_tests\", \"client_payload\": {\"ref\": \"${GITHUB_SHA}\"}}" \
https://api.github.com/repos/microsoft/playwright-browsers/dispatches
env:
GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}

1
.gitignore vendored
View File

@ -35,3 +35,4 @@ test-results
.cache/
.eslintcache
playwright.env
/firefox/

View File

@ -1,92 +1,92 @@
# Contributing
- [How to Contribute](#how-to-contribute)
* [Getting Code](#getting-code)
* [Code reviews](#code-reviews)
* [Code Style](#code-style)
* [API guidelines](#api-guidelines)
* [Commit Messages](#commit-messages)
* [Writing Documentation](#writing-documentation)
* [Adding New Dependencies](#adding-new-dependencies)
* [Running & Writing Tests](#running--writing-tests)
* [Public API Coverage](#public-api-coverage)
- [Contributor License Agreement](#contributor-license-agreement)
* [Code of Conduct](#code-of-conduct)
## Choose an issue
## How to Contribute
Playwright **requires an issue** for every contribution, except for minor documentation updates. We strongly recommend
to pick an issue
labeled [open-to-a-pull-request](https://github.com/microsoft/playwright/issues?q=is%3Aissue%20state%3Aopen%20label%3Aopen-to-a-pull-request)
for your first contribution to the project.
We strongly recommend that you open an issue before beginning any code modifications. This is particularly important if the changes involve complex logic or if the existing code isn't immediately clear. By doing so, we can discuss and agree upon the best approach to address a bug or implement a feature, ensuring that our efforts are aligned.
If you are passionate about a bug/feature, but cannot find an issue describing it, **file an issue first**. This will
facilitate the discussion, and you might get some early feedback from project maintainers before spending your time on
creating a pull request.
### Getting Code
Make sure you're running Node.js 20 to verify and upgrade NPM do:
## Make a change
Make sure you're running Node.js 20 or later.
```bash
node --version
npm --version
npm i -g npm@latest
```
1. Clone this repository
```bash
git clone https://github.com/microsoft/playwright
cd playwright
```
2. Install dependencies
```bash
npm ci
```
3. Build Playwright
```bash
npm run build
```
4. Run tests
This will run a test on line `23` in `page-fill.spec.ts`:
```bash
npm run ctest -- page-fill:23
```
See [here](#running--writing-tests) for more information about running and writing tests.
### Code reviews
All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.
### Code Style
- Coding style is fully defined in [.eslintrc](https://github.com/microsoft/playwright/blob/main/.eslintrc.js)
- Comments should be generally avoided. If the code would not be understood without comments, consider re-writing the code to make it self-explanatory.
To run code linter, use:
Clone the repository. If you plan to send a pull request, it might be better to [fork the repository](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo) first.
```bash
npm run eslint
git clone https://github.com/microsoft/playwright
cd playwright
```
### API guidelines
Install dependencies and run the build in watch mode.
```bash
npm ci
npm run watch
npx playwright install
```
When authoring new API methods, consider the following:
**Experimental dev mode with Hot Module Replacement for recorder/trace-viewer/UI Mode**
- Expose as little information as needed. When in doubt, dont expose new information.
- Methods are used in favor of getters/setters.
- The only exception is namespaces, e.g. `page.keyboard` and `page.coverage`
- All string literals must be lowercase. This includes event names and option values.
- Avoid adding "sugar" API (API that is trivially implementable in user-space) unless they're **very** common.
```
PW_HMR=1 npm run watch
PW_HMR=1 npx playwright show-trace
PW_HMR=1 npm run ctest -- --ui
PW_HMR=1 npx playwright codegen
PW_HMR=1 npx playwright show-report
```
### Commit Messages
Playwright is a multi-package repository that uses npm workspaces. For browser APIs, look at [`packages/playwright-core`](https://github.com/microsoft/playwright/blob/main/packages/playwright-core). For test runner, see [`packages/playwright`](https://github.com/microsoft/playwright/blob/main/packages/playwright).
Commit messages should follow the Semantic Commit Messages format:
Note that some files are generated by the build, so the watch process might override your changes if done in the wrong file. For example, TypeScript types for the API are generated from the [`docs/src`](https://github.com/microsoft/playwright/blob/main/docs/src).
Coding style is fully defined in [eslint.config.mjs](https://github.com/microsoft/playwright/blob/main/eslint.config.mjs). Before creating a pull request, or at any moment during development, run linter to check all kinds of things:
```bash
npm run lint
```
Comments should have an explicit purpose and should improve readability rather than hinder it. If the code would not be understood without comments, consider re-writing the code to make it self-explanatory.
### Write documentation
Every part of the public API should be documented in [`docs/src`](https://github.com/microsoft/playwright/blob/main/docs/src), in the same change that adds/changes the API. We use markdown files with custom structure to specify the API. Take a look around for an example.
Various other files are generated from the API specification. If you are running `npm run watch`, these will be re-generated automatically.
Larger changes will require updates to the documentation guides as well. This will be made clear during the code review.
## Add a test
Playwright requires a test for almost any new or modified functionality. An exception would be a pure refactoring, but chances are you are doing more than that.
There are multiple [test suites](https://github.com/microsoft/playwright/blob/main/tests) in Playwright that will be executed on the CI. The two most important that you need to run locally are:
- Library tests cover APIs not related to the test runner.
```bash
# fast path runs all tests in Chromium
npm run ctest
# slow path runs all tests in three browsers
npm run test
```
- Test runner tests.
```bash
npm run ttest
```
Since Playwright tests are using Playwright under the hood, everything from our documentation applies, for example [this guide on running and debugging tests](https://playwright.dev/docs/running-tests#running-tests).
Note that tests should be *hermetic*, and not depend on external services. Tests should work on all three platforms: macOS, Linux and Windows.
## Write a commit message
Commit messages should follow the [Semantic Commit Messages](https://www.conventionalcommits.org/en/v1.0.0/) format:
```
label(namespace): title
@ -97,131 +97,59 @@ footer
```
1. *label* is one of the following:
- `fix` - playwright bug fixes.
- `feat` - playwright features.
- `docs` - changes to docs, e.g. `docs(api): ..` to change documentation.
- `test` - changes to playwright tests infrastructure.
- `devops` - build-related work, e.g. CI related patches and general changes to the browser build infrastructure
- `fix` - bug fixes
- `feat` - new features
- `docs` - documentation-only changes
- `test` - test-only changes
- `devops` - changes to the CI or build
- `chore` - everything that doesn't fall under previous categories
2. *namespace* is put in parenthesis after label and is optional. Must be lowercase.
2. *namespace* is put in parentheses after label and is optional. Must be lowercase.
3. *title* is a brief summary of changes.
4. *description* is **optional**, new-line separated from title and is in present tense.
5. *footer* is **optional**, new-line separated from *description* and contains "fixes" / "references" attribution to github issues.
5. *footer* is **optional**, new-line separated from *description* and contains "fixes" / "references" attribution to GitHub issues.
Example:
```
fix(firefox): make sure session cookies work
feat(trace viewer): network panel filtering
This patch fixes session cookies in the firefox browser.
This patch adds a filtering toolbar to the network panel.
<link to a screenshot>
Fixes #123, fixes #234
Fixes #123, references #234.
```
### Writing Documentation
## Send a pull request
All API classes, methods, and events should have a description in [`docs/src`](https://github.com/microsoft/playwright/blob/main/docs/src). There's a [documentation linter](https://github.com/microsoft/playwright/tree/main/utils/doclint) which makes sure documentation is aligned with the codebase.
All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose.
Make sure to keep your PR (diff) small and readable. If necessary, split your contribution into multiple PRs.
Consult [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more information on using pull requests.
To run the documentation linter, use:
After a successful code review, one of the maintainers will merge your pull request. Congratulations!
## More details
**No new dependencies**
There is a very high bar for new dependencies, including updating to a new version of an existing dependency. We recommend to explicitly discuss this in an issue and get a green light from a maintainer, before creating a pull request that updates dependencies.
**Custom browser build**
To run tests with custom browser executable, specify `CRPATH`, `WKPATH` or `FFPATH` env variable that points to browser executable:
```bash
npm run doc
CRPATH=<path-to-executable> npm run ctest
```
To build the documentation site locally and test how your changes will look in practice:
You will also find `DEBUG=pw:browser` useful for debugging custom-builds.
1. Clone the [microsoft/playwright.dev](https://github.com/microsoft/playwright.dev) repo
1. Follow [the playwright.dev README instructions to "roll docs"](https://github.com/microsoft/playwright.dev/#roll-docs) against your local `playwright` repo with your changes in progress
1. Follow [the playwright.dev README instructions to "run dev server"](https://github.com/microsoft/playwright.dev/#run-dev-server) to view your changes
**Building documentation site**
### Adding New Dependencies
The [playwright.dev](https://playwright.dev/) documentation site lives in a separate repository, and documentation from [`docs/src`](https://github.com/microsoft/playwright/blob/main/docs/src) is frequently rolled there.
For all dependencies (both installation and development):
- **Do not add** a dependency if the desired functionality is easily implementable.
- If adding a dependency, it should be well-maintained and trustworthy.
A barrier for introducing new installation dependencies is especially high:
- **Do not add** installation dependency unless it's critical to project success.
### Running & Writing Tests
- Every feature should be accompanied by a test.
- Every public api event/method should be accompanied by a test.
- Tests should be *hermetic*. Tests should not depend on external services.
- Tests should work on all three platforms: Mac, Linux and Win. This is especially important for screenshot tests.
Playwright tests are located in [`tests`](https://github.com/microsoft/playwright/blob/main/tests) and use `@playwright/test` test runner.
These are integration tests, making sure public API methods and events work as expected.
- To run all tests:
```bash
npx playwright install
npm run test
```
Be sure to run `npm run build` or let `npm run watch` run before you re-run the
tests after making your changes to check them.
- To run tests in Chromium
```bash
npm run ctest # also `ftest` for firefox and `wtest` for WebKit
npm run ctest -- page-fill:23 # runs line 23 of page-fill.spec.ts
```
- To run tests in WebKit / Firefox, use `wtest` or `ftest`.
- To run the Playwright test runner tests
```bash
npm run ttest
npm run ttest -- --grep "specific test"
```
- To run a specific test, substitute `it` with `it.only`, or use the `--grep 'My test'` CLI parameter:
```js
...
// Using "it.only" to run a specific test
it.only('should work', async ({server, page}) => {
const response = await page.goto(server.EMPTY_PAGE);
expect(response.ok).toBe(true);
});
// or
playwright test --config=xxx --grep 'should work'
```
- To disable a specific test, substitute `it` with `it.skip`:
```js
...
// Using "it.skip" to skip a specific test
it.skip('should work', async ({server, page}) => {
const response = await page.goto(server.EMPTY_PAGE);
expect(response.ok).toBe(true);
});
```
- To run tests in non-headless (headed) mode:
```bash
npm run ctest -- --headed
```
- To run tests with custom browser executable, specify `CRPATH`, `WKPATH` or `FFPATH` env variable that points to browser executable:
```bash
CRPATH=<path-to-executable> npm run ctest
```
- When should a test be marked with `skip` or `fixme`?
- **`skip(condition)`**: This test *should ***never*** work* for `condition`
where `condition` is usually something like: `test.skip(browserName === 'chromium', 'This does not work because of ...')`.
- **`fixme(condition)`**: This test *should ***eventually*** work* for `condition`
where `condition` is usually something like: `test.fixme(browserName === 'chromium', 'We are waiting for version x')`.
Most of the time this should not concern you. However, if you are doing something unusual in the docs, you can build locally and test how your changes will look in practice:
1. Clone the [microsoft/playwright.dev](https://github.com/microsoft/playwright.dev) repo.
1. Follow [the playwright.dev README instructions to "roll docs"](https://github.com/microsoft/playwright.dev/#roll-docs) against your local `playwright` repo with your changes in progress.
1. Follow [the playwright.dev README instructions to "run dev server"](https://github.com/microsoft/playwright.dev/#run-dev-server) to view your changes.
## Contributor License Agreement

35
FILING_ISSUES.md Normal file
View File

@ -0,0 +1,35 @@
# How to File a Bug Report That Actually Gets Resolved
Make sure youre on the latest Playwright release before filing. Check existing GitHub issues to avoid duplicates.
## Use the Template
Follow the **Bug Report** template. It guides you step-by-step:
- Fill it out thoroughly.
- Clearly list the steps needed to reproduce the bug.
- Provide what you expected to see versus what happened in reality.
- Include system info from `npx envinfo --preset playwright`.
## Keep Your Repro Minimal
We can't parse your entire code base. Reduce it down to the absolute essentials:
- Start a fresh project (`npm init playwright@latest new-project`).
- Add only the code/DOM needed to show the problem.
- Only use major frameworks if necessary (React, Angular, static HTTP server, etc.).
- Avoid adding extra libraries unless absolutely necessary. Note that we won't install any suspect dependencies.
## Why This Matters
- Most issues that lack a repro turn out to be misconfigurations or usage errors.
- We can't fix problems if we cant reproduce them ourselves.
- We cant debug entire private projects or handle sensitive credentials.
- Each confirmed bug will have a test in our repo, so your repro must be as clean as possible.
## More Help
- [Stack Overflows Minimal Reproducible Example Guide](https://stackoverflow.com/help/minimal-reproducible-example)
- [Playwright Debugging Tools](https://playwright.dev/docs/debug)
## Bottom Line
A well-isolated bug speeds up verification and resolution. Minimal, public repro or its unlikely we can assist.

View File

@ -1,6 +1,6 @@
# 🎭 Playwright
[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-130.0.6723.19-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-130.0-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-18.0-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop --> [![Join Discord](https://img.shields.io/badge/join-discord-infomational)](https://aka.ms/playwright/discord)
[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-136.0.7103.25-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-137.0-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-18.4-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop --> [![Join Discord](https://img.shields.io/badge/join-discord-infomational)](https://aka.ms/playwright/discord)
## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright)
@ -8,9 +8,9 @@ Playwright is a framework for Web Testing and Automation. It allows testing [Chr
| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->130.0.6723.19<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| WebKit <!-- GEN:webkit-version -->18.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Firefox <!-- GEN:firefox-version -->130.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Chromium <!-- GEN:chromium-version -->136.0.7103.25<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| WebKit <!-- GEN:webkit-version -->18.4<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Firefox <!-- GEN:firefox-version -->137.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
Headless execution is supported for all browsers on all platforms. Check out [system requirements](https://playwright.dev/docs/intro#system-requirements) for details.
@ -46,7 +46,6 @@ npx playwright install
You can optionally install only selected browsers, see [install browsers](https://playwright.dev/docs/cli#install-browsers) for more details. Or you can install no browsers at all and use existing [browser channels](https://playwright.dev/docs/browsers).
* [Getting started](https://playwright.dev/docs/intro)
* [Installation configuration](https://playwright.dev/docs/installation)
* [API reference](https://playwright.dev/docs/api/class-playwright)
## Capabilities
@ -163,7 +162,7 @@ test('Intercept network requests', async ({ page }) => {
## Resources
* [Documentation](https://playwright.dev/docs/intro)
* [Documentation](https://playwright.dev)
* [API reference](https://playwright.dev/docs/api/class-playwright/)
* [Contribution guide](CONTRIBUTING.md)
* [Changelog](https://github.com/microsoft/playwright/releases)

View File

@ -1,17 +0,0 @@
{
"assumptions": {
"setPublicClassFields": true
},
"plugins": [
["@babel/plugin-transform-typescript", { "allowDeclareFields": true } ],
"@babel/plugin-transform-export-namespace-from",
"@babel/plugin-transform-class-properties",
"@babel/plugin-transform-logical-assignment-operators",
"@babel/plugin-transform-nullish-coalescing-operator",
"@babel/plugin-transform-optional-chaining",
"@babel/plugin-transform-modules-commonjs"
],
"ignore": [
"**/*.d.ts"
]
}

View File

@ -1,3 +1,3 @@
REMOTE_URL="https://github.com/mozilla/gecko-dev"
BASE_BRANCH="release"
BASE_REVISION="cf0397e3ba298868fdca53f894da5b0d239dc09e"
BASE_REVISION="5e1efb776a56e399f6810204a2eca13f18a3eba6"

View File

@ -145,10 +145,13 @@ class NetworkRequest {
}
this._expectingInterception = false;
this._expectingResumedRequest = undefined; // { method, headers, postData }
this._overriddenHeadersForRedirect = redirectedFrom?._overriddenHeadersForRedirect;
this._sentOnResponse = false;
this._fulfilled = false;
if (this._pageNetwork)
if (this._overriddenHeadersForRedirect)
overrideRequestHeaders(httpChannel, this._overriddenHeadersForRedirect);
else if (this._pageNetwork)
appendExtraHTTPHeaders(httpChannel, this._pageNetwork.combinedExtraHTTPHeaders());
this._responseBodyChunks = [];
@ -201,11 +204,13 @@ class NetworkRequest {
this._interceptedChannel.synthesizeHeader(header.name, header.value);
if (header.name.toLowerCase() === 'set-cookie') {
Services.cookies.QueryInterface(Ci.nsICookieService);
Services.cookies.setCookieStringFromHttp(this.httpChannel.URI, header.value, this.httpChannel);
for (const cookieString of header.value.split('\n'))
Services.cookies.setCookieStringFromHttp(this.httpChannel.URI, cookieString, this.httpChannel);
}
}
const synthesized = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(Ci.nsIStringInputStream);
synthesized.data = base64body ? atob(base64body) : '';
if (base64body)
synthesized.setByteStringData(atob(base64body));
this._interceptedChannel.startSynthesizedResponse(synthesized, null, null, '', false);
this._interceptedChannel.finishSynthesizedResponse();
this._interceptedChannel = undefined;
@ -230,20 +235,13 @@ class NetworkRequest {
if (!this._expectingResumedRequest)
return;
const { method, headers, postData } = this._expectingResumedRequest;
this._overriddenHeadersForRedirect = headers;
this._expectingResumedRequest = undefined;
if (headers) {
for (const header of requestHeaders(this.httpChannel)) {
// We cannot remove the "host" header.
if (header.name.toLowerCase() === 'host')
continue;
this.httpChannel.setRequestHeader(header.name, '', false /* merge */);
}
for (const header of headers)
this.httpChannel.setRequestHeader(header.name, header.value, false /* merge */);
} else if (this._pageNetwork) {
if (headers)
overrideRequestHeaders(this.httpChannel, headers);
else if (this._pageNetwork)
appendExtraHTTPHeaders(this.httpChannel, this._pageNetwork.combinedExtraHTTPHeaders());
}
if (method)
this.httpChannel.requestMethod = method;
if (postData !== undefined)
@ -773,6 +771,20 @@ function requestHeaders(httpChannel) {
return headers;
}
function clearRequestHeaders(httpChannel) {
for (const header of requestHeaders(httpChannel)) {
// We cannot remove the "host" header.
if (header.name.toLowerCase() === 'host')
continue;
httpChannel.setRequestHeader(header.name, '', false /* merge */);
}
}
function overrideRequestHeaders(httpChannel, headers) {
clearRequestHeaders(httpChannel);
appendExtraHTTPHeaders(httpChannel, headers);
}
function causeTypeToString(causeType) {
for (let key in Ci.nsIContentPolicy) {
if (Ci.nsIContentPolicy[key] === causeType)
@ -860,7 +872,7 @@ function setPostData(httpChannel, postData, headers) {
return;
const synthesized = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(Ci.nsIStringInputStream);
const body = atob(postData);
synthesized.setData(body, body.length);
synthesized.setByteStringData(body);
const overriddenHeader = (lowerCaseName) => {
if (headers) {
@ -892,7 +904,7 @@ function convertString(s, source, dest) {
const is = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(
Ci.nsIStringInputStream
);
is.setData(s, s.length);
is.setByteStringData(s);
const listener = Cc["@mozilla.org/network/stream-loader;1"].createInstance(
Ci.nsIStreamLoader
);

View File

@ -22,6 +22,8 @@ const ALL_PERMISSIONS = [
];
let globalTabAndWindowActivationChain = Promise.resolve();
// This is a workaround for https://github.com/microsoft/playwright/issues/34586
let globalNewPageChain = Promise.resolve();
class DownloadInterceptor {
constructor(registry) {
@ -308,6 +310,7 @@ class TargetRegistry {
}
async newPage({browserContextId}) {
const result = globalNewPageChain.then(async () => {
const browserContext = this.browserContextForId(browserContextId);
const features = "chrome,dialog=no,all";
// See _callWithURIToLoad in browser.js for the structure of window.arguments
@ -357,6 +360,9 @@ class TargetRegistry {
throw new Error('Failed to override timezone');
}
return target.id();
});
globalNewPageChain = result.catch(error => { /* swallow errors to keep chain running */ });
return result;
}
targets() {
@ -384,6 +390,7 @@ class PageTarget {
this._linkedBrowser = tab.linkedBrowser;
this._browserContext = browserContext;
this._viewportSize = undefined;
this._zoom = 1;
this._initialDPPX = this._linkedBrowser.browsingContext.overrideDPPX;
this._url = 'about:blank';
this._openerId = opener ? opener.id() : undefined;
@ -393,7 +400,7 @@ class PageTarget {
this._videoRecordingInfo = undefined;
this._screencastRecordingInfo = undefined;
this._dialogs = new Map();
this.forcedColors = 'no-override';
this.forcedColors = 'none';
this.disableCache = false;
this.mediumOverride = '';
this.crossProcessCookie = {
@ -496,9 +503,11 @@ class PageTarget {
this.updateUserAgent(browsingContext);
this.updatePlatform(browsingContext);
this.updateDPPXOverride(browsingContext);
this.updateZoom(browsingContext);
this.updateEmulatedMedia(browsingContext);
this.updateColorSchemeOverride(browsingContext);
this.updateReducedMotionOverride(browsingContext);
this.updateContrastOverride(browsingContext);
this.updateForcedColorsOverride(browsingContext);
this.updateForceOffline(browsingContext);
this.updateCacheDisabled(browsingContext);
@ -534,7 +543,16 @@ class PageTarget {
}
updateDPPXOverride(browsingContext = undefined) {
(browsingContext || this._linkedBrowser.browsingContext).overrideDPPX = this._browserContext.deviceScaleFactor || this._initialDPPX;
browsingContext ||= this._linkedBrowser.browsingContext;
const dppx = this._zoom * (this._browserContext.deviceScaleFactor || this._initialDPPX);
browsingContext.overrideDPPX = dppx;
}
async updateZoom(browsingContext = undefined) {
browsingContext ||= this._linkedBrowser.browsingContext;
// Update dpr first, and then UI zoom.
this.updateDPPXOverride(browsingContext);
browsingContext.fullZoom = this._zoom;
}
_updateModalDialogs() {
@ -584,7 +602,7 @@ class PageTarget {
const toolbarTop = stackRect.y;
this._window.resizeBy(width - this._window.innerWidth, height + toolbarTop - this._window.innerHeight);
await this._channel.connect('').send('awaitViewportDimensions', { width, height });
await this._channel.connect('').send('awaitViewportDimensions', { width: width / this._zoom, height: height / this._zoom });
} else {
this._linkedBrowser.style.removeProperty('width');
this._linkedBrowser.style.removeProperty('height');
@ -596,8 +614,8 @@ class PageTarget {
const actualSize = this._linkedBrowser.getBoundingClientRect();
await this._channel.connect('').send('awaitViewportDimensions', {
width: actualSize.width,
height: actualSize.height,
width: actualSize.width / this._zoom,
height: actualSize.height / this._zoom,
});
}
}
@ -629,13 +647,23 @@ class PageTarget {
(browsingContext || this._linkedBrowser.browsingContext).prefersReducedMotionOverride = this.reducedMotion || this._browserContext.reducedMotion || 'none';
}
setContrast(contrast) {
this.contrast = fromProtocolContrast(contrast);
this.updateContrastOverride();
}
updateContrastOverride(browsingContext = undefined) {
(browsingContext || this._linkedBrowser.browsingContext).prefersContrastOverride = this.contrast || this._browserContext.contrast || 'none';
}
setForcedColors(forcedColors) {
this.forcedColors = fromProtocolForcedColors(forcedColors);
this.updateForcedColorsOverride();
}
updateForcedColorsOverride(browsingContext = undefined) {
(browsingContext || this._linkedBrowser.browsingContext).forcedColorsOverride = (this.forcedColors !== 'no-override' ? this.forcedColors : this._browserContext.forcedColors) || 'no-override';
const isActive = this.forcedColors === 'active' || this._browserContext.forcedColors === 'active';
(browsingContext || this._linkedBrowser.browsingContext).forcedColorsOverride = isActive ? 'active' : 'none';
}
async setInterceptFileChooserDialog(enabled) {
@ -649,6 +677,14 @@ class PageTarget {
await this.updateViewportSize();
}
async setZoom(zoom) {
// This is default range from the ZoomManager.
if (zoom < 0.3 || zoom > 5)
throw new Error('Invalid zoom value, must be between 0.3 and 5');
this._zoom = zoom;
await this.updateZoom();
}
close(runBeforeUnload = false) {
this._gBrowser.removeTab(this._tab, {
skipPermitUnload: !runBeforeUnload,
@ -855,11 +891,19 @@ function fromProtocolReducedMotion(reducedMotion) {
throw new Error('Unknown reduced motion: ' + reducedMotion);
}
function fromProtocolContrast(contrast) {
if (contrast === 'more' || contrast === 'less' || contrast === 'custom' || contrast === 'no-preference')
return contrast;
if (contrast === null)
return undefined;
throw new Error('Unknown contrast: ' + contrast);
}
function fromProtocolForcedColors(forcedColors) {
if (forcedColors === 'active' || forcedColors === 'none')
return forcedColors;
if (forcedColors === null)
return undefined;
if (!forcedColors)
return 'none';
throw new Error('Unknown forced colors: ' + forcedColors);
}
@ -893,8 +937,9 @@ class BrowserContext {
this.forceOffline = false;
this.disableCache = false;
this.colorScheme = 'none';
this.forcedColors = 'no-override';
this.forcedColors = 'none';
this.reducedMotion = 'none';
this.contrast = 'none';
this.videoRecordingOptions = undefined;
this.crossProcessCookie = {
initScripts: [],
@ -921,6 +966,12 @@ class BrowserContext {
page.updateReducedMotionOverride();
}
setContrast(contrast) {
this.contrast = fromProtocolContrast(contrast);
for (const page of this.pages)
page.updateContrastOverride();
}
setForcedColors(forcedColors) {
this.forcedColors = fromProtocolForcedColors(forcedColors);
for (const page of this.pages)

View File

@ -105,7 +105,10 @@ class Juggler {
};
// Force create hidden window here, otherwise its creation later closes the web socket!
// Since https://phabricator.services.mozilla.com/D219834, hiddenDOMWindow is only available on MacOS.
if (Services.appShell.hasHiddenWindow) {
Services.appShell.hiddenDOMWindow;
}
let pipeStopped = false;
let browserHandler;

View File

@ -46,8 +46,6 @@ class FrameTree {
Ci.nsISupportsWeakReference,
]);
this._addedScrollbarsStylesheetSymbol = Symbol('_addedScrollbarsStylesheetSymbol');
this._wdm = Cc["@mozilla.org/dom/workers/workerdebuggermanager;1"].createInstance(Ci.nsIWorkerDebuggerManager);
this._wdmListener = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIWorkerDebuggerManagerListener]),
@ -130,24 +128,12 @@ class FrameTree {
}
_onDOMWindowCreated(window) {
if (!window[this._addedScrollbarsStylesheetSymbol] && this.scrollbarsHidden) {
const styleSheetService = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService);
const ioService = Cc["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
const uri = ioService.newURI('chrome://juggler/content/content/hidden-scrollbars.css', null, null);
const sheet = styleSheetService.preloadSheet(uri, styleSheetService.AGENT_SHEET);
window.windowUtils.addSheet(sheet, styleSheetService.AGENT_SHEET);
window[this._addedScrollbarsStylesheetSymbol] = true;
}
const frame = this.frameForDocShell(window.docShell);
if (!frame)
return;
frame._onGlobalObjectCleared();
}
setScrollbarsHidden(hidden) {
this.scrollbarsHidden = hidden;
}
setJavaScriptDisabled(javaScriptDisabled) {
this._javaScriptDisabled = javaScriptDisabled;
for (const frame of this.frames())

View File

@ -120,7 +120,8 @@ class PageAgent {
// After the dragStart event is dispatched and handled by Web,
// it might or might not create a new drag session, depending on its preventing default.
setTimeout(() => {
this._browserPage.emit('pageInputEvent', { type: 'juggler-drag-finalized', dragSessionStarted: !!dragService.getCurrentSession() });
const session = this._getCurrentDragSession();
this._browserPage.emit('pageInputEvent', { type: 'juggler-drag-finalized', dragSessionStarted: !!session });
}, 0);
}
}),
@ -526,8 +527,14 @@ class PageAgent {
});
}
_getCurrentDragSession() {
const frame = this._frameTree.mainFrame();
const domWindow = frame?.domWindow();
return domWindow ? dragService.getCurrentSession(domWindow) : undefined;
}
async _dispatchDragEvent({type, x, y, modifiers}) {
const session = dragService.getCurrentSession();
const session = this._getCurrentDragSession();
const dropEffect = session.dataTransfer.dropEffect;
if ((type === 'drop' && dropEffect !== 'none') || type === 'dragover') {
@ -551,9 +558,8 @@ class PageAgent {
return;
}
if (type === 'dragend') {
const session = dragService.getCurrentSession();
if (session)
dragService.endDragSession(true);
const session = this._getCurrentDragSession();
session?.endDragSession(true);
return;
}
}

View File

@ -45,10 +45,6 @@ function initialize(browsingContext, docShell) {
docShell.languageOverride = locale;
},
scrollbarsHidden: (hidden) => {
data.frameTree.setScrollbarsHidden(hidden);
},
javaScriptDisabled: (javaScriptDisabled) => {
data.frameTree.setJavaScriptDisabled(javaScriptDisabled);
},

View File

@ -219,6 +219,10 @@ class BrowserHandler {
await this._targetRegistry.browserContextForId(browserContextId).setForcedColors(nullToUndefined(forcedColors));
}
async ['Browser.setContrast']({browserContextId, contrast}) {
await this._targetRegistry.browserContextForId(browserContextId).setContrast(nullToUndefined(contrast));
}
async ['Browser.setVideoRecordingOptions']({browserContextId, options}) {
await this._targetRegistry.browserContextForId(browserContextId).setVideoRecordingOptions(options);
}
@ -255,10 +259,6 @@ class BrowserHandler {
await this._targetRegistry.browserContextForId(browserContextId).setDefaultViewport(nullToUndefined(viewport));
}
async ['Browser.setScrollbarsHidden']({browserContextId, hidden}) {
await this._targetRegistry.browserContextForId(browserContextId).applySetting('scrollbarsHidden', nullToUndefined(hidden));
}
async ['Browser.setInitScripts']({browserContextId, scripts}) {
await this._targetRegistry.browserContextForId(browserContextId).setInitScripts(scripts);
}

View File

@ -240,6 +240,10 @@ class PageHandler {
await this._pageTarget.setViewportSize(viewportSize === null ? undefined : viewportSize);
}
async ['Page.setZoom']({zoom}) {
await this._pageTarget.setZoom(zoom);
}
async ['Runtime.evaluate'](options) {
return await this._contentPage.send('evaluate', options);
}
@ -298,10 +302,11 @@ class PageHandler {
return await this._contentPage.send('setFileInputFiles', options);
}
async ['Page.setEmulatedMedia']({colorScheme, type, reducedMotion, forcedColors}) {
async ['Page.setEmulatedMedia']({colorScheme, type, reducedMotion, forcedColors, contrast}) {
this._pageTarget.setColorScheme(colorScheme || null);
this._pageTarget.setReducedMotion(reducedMotion || null);
this._pageTarget.setForcedColors(forcedColors || null);
this._pageTarget.setContrast(contrast || null);
this._pageTarget.setEmulatedMedia(type);
}

View File

@ -394,12 +394,6 @@ const Browser = {
viewport: t.Nullable(pageTypes.Viewport),
}
},
'setScrollbarsHidden': {
params: {
browserContextId: t.Optional(t.String),
hidden: t.Boolean,
}
},
'setInitScripts': {
params: {
browserContextId: t.Optional(t.String),
@ -469,6 +463,12 @@ const Browser = {
forcedColors: t.Nullable(t.Enum(['active', 'none'])),
},
},
'setContrast': {
params: {
browserContextId: t.Optional(t.String),
contrast: t.Nullable(t.Enum(['less', 'more', 'custom', 'no-preference'])),
},
},
'setVideoRecordingOptions': {
params: {
browserContextId: t.Optional(t.String),
@ -800,6 +800,11 @@ const Page = {
viewportSize: t.Nullable(pageTypes.Size),
},
},
'setZoom': {
params: {
zoom: t.Number,
},
},
'bringToFront': {
params: {
},
@ -810,6 +815,7 @@ const Page = {
colorScheme: t.Optional(t.Enum(['dark', 'light', 'no-preference'])),
reducedMotion: t.Optional(t.Enum(['reduce', 'no-preference'])),
forcedColors: t.Optional(t.Enum(['active', 'none'])),
contrast: t.Optional(t.Enum(['less', 'more', 'custom', 'no-preference'])),
},
},
'setCacheDisabled': {

View File

@ -23,8 +23,8 @@ XPCOM_MANIFESTS += [
LOCAL_INCLUDES += [
'/dom/media/systemservices',
'/media/libyuv/libyuv/include',
'/third_party/abseil-cpp',
'/third_party/libwebrtc',
'/third_party/libwebrtc/third_party/abseil-cpp',
]
LOCAL_INCLUDES += [

View File

@ -343,10 +343,17 @@ nsresult nsScreencastService::StartVideoRecording(nsIScreencastServiceClient* aC
return NS_ERROR_FAILURE;
gfx::IntMargin margin;
auto bounds = widget->GetScreenBounds().ToUnknownRect();
// Screen bounds is the widget location on screen.
auto screenBounds = widget->GetScreenBounds().ToUnknownRect();
// Client bounds is the content location, in terms of parent widget.
// To use it, we need to translate it to screen coordinates first.
auto clientBounds = widget->GetClientBounds().ToUnknownRect();
for (auto parent = widget->GetParent(); parent != nullptr; parent = parent->GetParent()) {
auto pb = parent->GetClientBounds().ToUnknownRect();
clientBounds.MoveBy(pb.X(), pb.Y());
}
// Crop the image to exclude frame (if any).
margin = bounds - clientBounds;
margin = screenBounds - clientBounds;
// Crop the image to exclude controls.
margin.top += offsetTop;

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,10 @@ pref("dom.input_events.security.minTimeElapsedInMS", 0);
pref("dom.iframe_lazy_loading.enabled", false);
// This setting is experimental and is only enabled on early betas.
// Disable it unconditionally since it breaks proxy tests.
pref("dom.security.https_first", false);
pref("datareporting.policy.dataSubmissionEnabled", false);
pref("datareporting.policy.dataSubmissionPolicyAccepted", false);
pref("datareporting.policy.dataSubmissionPolicyBypassNotification", true);
@ -88,6 +92,10 @@ pref("geo.provider.testing", true);
// THESE ARE NICHE PROPERTIES THAT ARE NICE TO HAVE
// =================================================================
// We never want to have interactive screen capture picker enabled in FF build.
pref("media.getdisplaymedia.screencapturekit.enabled", false);
pref("media.getdisplaymedia.screencapturekit.picker.enabled", false);
// Enable software-backed webgl. See https://phabricator.services.mozilla.com/D164016
pref("webgl.forbid-software", false);
@ -100,6 +108,11 @@ pref("extensions.formautofill.addresses.supported", "off");
// firefox behavior with other browser defaults.
pref("security.enterprise_roots.enabled", true);
// There's a security features warning that might be shown on certain Linux distributions & configurations:
// https://support.mozilla.org/en-US/kb/install-firefox-linux#w_security-features-warning
// This notification should never be shown in automation scenarios.
pref("security.sandbox.warn_unprivileged_namespaces", false);
// Avoid stalling on shutdown, after "xpcom-will-shutdown" phase.
// This at least happens when shutting down soon after launching.
// See AppShutdown.cpp for more details on shutdown phases.

View File

@ -1,3 +1,3 @@
REMOTE_URL="https://github.com/WebKit/WebKit.git"
BASE_BRANCH="main"
BASE_REVISION="f371dbc2bb4292037ed394e2162150a16ef977fc"
BASE_REVISION="ba8bcf39b0a89706b998447abba82590ad50fc36"

View File

@ -33,6 +33,7 @@
#import <WebKit/WKUserContentControllerPrivate.h>
#import <WebKit/WKWebViewConfigurationPrivate.h>
#import <WebKit/WKWebViewPrivate.h>
#import <WebKit/WKWebpagePreferencesPrivate.h>
#import <WebKit/WKWebsiteDataStorePrivate.h>
#import <WebKit/WebNSURLExtras.h>
#import <WebKit/WebKit.h>
@ -97,7 +98,7 @@ const NSActivityOptions ActivityOptions =
for (NSString *argument in subArray) {
if (![argument hasPrefix:@"--"])
_initialURL = argument;
_initialURL = [argument copy];
if ([argument hasPrefix:@"--user-data-dir="]) {
NSRange range = NSMakeRange(16, [argument length] - 16);
_userDataDir = [[argument substringWithRange:range] copy];
@ -230,7 +231,7 @@ const NSActivityOptions ActivityOptions =
configuration = [[WKWebViewConfiguration alloc] init];
configuration.websiteDataStore = [self persistentDataStore];
configuration._controlledByAutomation = true;
configuration.preferences._fullScreenEnabled = YES;
configuration.preferences.elementFullscreenEnabled = YES;
configuration.preferences._developerExtrasEnabled = YES;
configuration.preferences._mediaDevicesEnabled = YES;
configuration.preferences._mockCaptureDevicesEnabled = YES;
@ -240,6 +241,8 @@ const NSActivityOptions ActivityOptions =
configuration.preferences._hiddenPageDOMTimerThrottlingAutoIncreases = NO;
configuration.preferences._pageVisibilityBasedProcessSuppressionEnabled = NO;
configuration.preferences._domTimersThrottlingEnabled = NO;
// Do not auto play audio and video with sound.
configuration.defaultWebpagePreferences._autoplayPolicy = _WKWebsiteAutoplayPolicyAllowWithoutSound;
_WKProcessPoolConfiguration *processConfiguration = [[[_WKProcessPoolConfiguration alloc] init] autorelease];
processConfiguration.forceOverlayScrollbars = YES;
configuration.processPool = [[[WKProcessPool alloc] _initWithConfiguration:processConfiguration] autorelease];

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
1006
1007

View File

@ -1,3 +1,5 @@
SET /p BUILD_NUMBER=<BUILD_NUMBER
SET CL=/DBUILD_NUMBER=%BUILD_NUMBER%
%DEVENV% %~dp0\PrintDeps.sln /build "Release|x64"
call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat"
devenv %~dp0\PrintDeps.sln /build "Release|x64"

View File

@ -70,8 +70,9 @@ For example, you can use [`AxeBuilder.include()`](https://github.com/dequelabs/a
`AxeBuilder.analyze()` will scan the page *in its current state* when you call it. To scan parts of a page that are revealed based on UI interactions, use [Locators](./locators.md) to interact with the page before invoking `analyze()`:
```java
@Test
void navigationMenuFlyoutShouldNotHaveAutomaticallyDetectableAccessibilityViolations() throws Exception {
public class HomepageTests {
@Test
void navigationMenuFlyoutShouldNotHaveAutomaticallyDetectableAccessibilityViolations() throws Exception {
page.navigate("https://your-site.com/");
page.locator("button[aria-label=\"Navigation Menu\"]").click();
@ -86,6 +87,7 @@ void navigationMenuFlyoutShouldNotHaveAutomaticallyDetectableAccessibilityViolat
.analyze();
assertEquals(Collections.emptyList(), accessibilityScanResults.getViolations());
}
}
```
@ -105,7 +107,7 @@ AxeResults accessibilityScanResults = new AxeBuilder(page)
assertEquals(Collections.emptyList(), accessibilityScanResults.getViolations());
```
You can find a complete listing of the rule tags axe-core supports in [the "Axe-core Tags" section of the axe API documentation](https://www.deque.com/axe/core-documentation/api-documentation/#axe-core-tags).
You can find a complete listing of the rule tags axe-core supports in [the "Axe-core Tags" section of the axe API documentation](https://www.deque.com/axe/core-documentation/api-documentation/#axecore-tags).
## Handling known issues
@ -158,8 +160,9 @@ This approach avoids the downsides of using `AxeBuilder.exclude()` at the cost o
Here is an example of using fingerprints based on only rule IDs and "target" selectors pointing to each violation:
```java
@Test
shouldOnlyHaveAccessibilityViolationsMatchingKnownFingerprints() throws Exception {
public class HomepageTests {
@Test
shouldOnlyHaveAccessibilityViolationsMatchingKnownFingerprints() throws Exception {
page.navigate("https://your-site.com/");
AxeResults accessibilityScanResults = new AxeBuilder(page).analyze();
@ -171,15 +174,15 @@ shouldOnlyHaveAccessibilityViolationsMatchingKnownFingerprints() throws Exceptio
new ViolationFingerprint("color-contrast", "[li:nth-child(2) > span]"),
new ViolationFingerprint("label", "[input]")
), violationFingerprints);
}
}
// You can make your "fingerprint" as specific as you like. This one considers a violation to be
// "the same" if it corresponds the same Axe rule on the same element.
//
// Using a record type makes it easy to compare fingerprints with assertEquals
public record ViolationFingerprint(String ruleId, String target) { }
// You can make your "fingerprint" as specific as you like. This one considers a violation to be
// "the same" if it corresponds the same Axe rule on the same element.
//
// Using a record type makes it easy to compare fingerprints with assertEquals
public record ViolationFingerprint(String ruleId, String target) { }
public List<ViolationFingerprint> fingerprintsFromScanResults(AxeResults results) {
public List<ViolationFingerprint> fingerprintsFromScanResults(AxeResults results) {
return results.getViolations().stream()
// Each violation refers to one rule and multiple "nodes" which violate it
.flatMap(violation -> violation.getNodes().stream()
@ -190,6 +193,7 @@ public List<ViolationFingerprint> fingerprintsFromScanResults(AxeResults results
node.getTarget().toString()
)))
.collect(Collectors.toList());
}
}
```
@ -210,8 +214,8 @@ This example fixture creates an `AxeBuilder` object which is pre-configured with
class AxeTestFixtures extends TestFixtures {
AxeBuilder makeAxeBuilder() {
return new AxeBuilder(page)
.withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
.exclude('#commonly-reused-element-with-known-issue');
.withTags(new String[]{"wcag2a", "wcag2aa", "wcag21a", "wcag21aa"})
.exclude("#commonly-reused-element-with-known-issue");
}
}
```
@ -229,7 +233,7 @@ public class HomepageTests extends AxeTestFixtures {
AxeResults accessibilityScanResults = makeAxeBuilder()
// Automatically uses the shared AxeBuilder configuration,
// but supports additional test-specific configuration too
.include('#specific-element-under-test')
.include("#specific-element-under-test")
.analyze();
assertEquals(Collections.emptyList(), accessibilityScanResults.getViolations());

View File

@ -113,7 +113,7 @@ test('should not have any automatically detectable WCAG A or AA violations', asy
});
```
You can find a complete listing of the rule tags axe-core supports in [the "Axe-core Tags" section of the axe API documentation](https://www.deque.com/axe/core-documentation/api-documentation/#axe-core-tags).
You can find a complete listing of the rule tags axe-core supports in [the "Axe-core Tags" section of the axe API documentation](https://www.deque.com/axe/core-documentation/api-documentation/#axecore-tags).
## Handling known issues
@ -244,7 +244,7 @@ type AxeFixture = {
// This new "test" can be used in multiple test files, and each of them will get
// a consistently configured AxeBuilder instance.
export const test = base.extend<AxeFixture>({
makeAxeBuilder: async ({ page }, use, testInfo) => {
makeAxeBuilder: async ({ page }, use) => {
const makeAxeBuilder = () => new AxeBuilder({ page })
.withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
.exclude('#commonly-reused-element-with-known-issue');
@ -255,8 +255,7 @@ export const test = base.extend<AxeFixture>({
export { expect } from '@playwright/test';
```
```js tab=js-js
// axe-test.js
```js tab=js-js title="axe-test.js"
const base = require('@playwright/test');
const AxeBuilder = require('@axe-core/playwright').default;
@ -265,7 +264,7 @@ const AxeBuilder = require('@axe-core/playwright').default;
// This new "test" can be used in multiple test files, and each of them will get
// a consistently configured AxeBuilder instance.
exports.test = base.test.extend({
makeAxeBuilder: async ({ page }, use, testInfo) => {
makeAxeBuilder: async ({ page }, use) => {
const makeAxeBuilder = () => new AxeBuilder({ page })
.withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
.exclude('#commonly-reused-element-with-known-issue');

View File

@ -93,11 +93,20 @@ Element is considered stable when it has maintained the same bounding box for at
## Enabled
Element is considered enabled unless it is a `<button>`, `<select>`, `<input>` or `<textarea>` with a `disabled` property.
Element is considered enabled when it is **not disabled**.
Element is **disabled** when:
- it is a `<button>`, `<select>`, `<input>`, `<textarea>`, `<option>` or `<optgroup>` with a `[disabled]` attribute;
- it is a `<button>`, `<select>`, `<input>`, `<textarea>`, `<option>` or `<optgroup>` that is a part of a `<fieldset>` with a `[disabled]` attribute;
- it is a descendant of an element with `[aria-disabled=true]` attribute.
## Editable
Element is considered editable when it is [enabled] and does not have `readonly` property set.
Element is considered editable when it is [enabled] and is **not readonly**.
Element is **readonly** when:
- it is a `<select>`, `<input>` or `<textarea>` with a `[readonly]` attribute;
- it has an `[aria-readonly=true]` attribute and an aria role that [supports it](https://w3c.github.io/aria/#aria-readonly).
## Receives Events

View File

@ -194,6 +194,7 @@ public class TestGitHubAPI {
These tests assume that repository exists. You probably want to create a new one before running tests and delete it afterwards. Use `@BeforeAll` and `@AfterAll` hooks for that.
```java
public class TestGitHubAPI {
// ...
void createTestRepository() {
@ -223,6 +224,7 @@ These tests assume that repository exists. You probably want to create a new one
disposeAPIRequestContext();
closePlaywright();
}
}
```
### Complete test example
@ -381,8 +383,9 @@ The following test creates a new issue via API and then navigates to the list of
project to check that it appears at the top of the list. The check is performed using [LocatorAssertions].
```java
@Test
void lastCreatedIssueShouldBeFirstInTheList() {
public class TestGitHubAPI {
@Test
void lastCreatedIssueShouldBeFirstInTheList() {
Map<String, String> data = new HashMap<>();
data.put("title", "[Feature] request 1");
data.put("body", "Feature description");
@ -393,6 +396,7 @@ void lastCreatedIssueShouldBeFirstInTheList() {
page.navigate("https://github.com/" + USER + "/" + REPO + "/issues");
Locator firstIssue = page.locator("a[data-hovercard-type='issue']").first();
assertThat(firstIssue).hasText("[Feature] request 1");
}
}
```
@ -402,8 +406,9 @@ The following test creates a new issue via user interface in the browser and the
it was created:
```java
@Test
void lastCreatedIssueShouldBeOnTheServer() {
public class TestGitHubAPI {
@Test
void lastCreatedIssueShouldBeOnTheServer() {
page.navigate("https://github.com/" + USER + "/" + REPO + "/issues");
page.locator("text=New Issue").click();
page.locator("[aria-label='Title']").fill("Bug report 1");
@ -414,6 +419,7 @@ void lastCreatedIssueShouldBeOnTheServer() {
APIResponse newIssue = request.get("https://github.com/" + USER + "/" + REPO + "/issues/" + issueId);
assertThat(newIssue).isOK();
assertTrue(newIssue.text().contains("Bug report 1"));
}
}
```

View File

@ -258,7 +258,7 @@ test('last created issue should be on the server', async ({ page }) => {
await page.getByRole('textbox', { name: 'Title' }).fill('Bug report 1');
await page.getByRole('textbox', { name: 'Comment body' }).fill('Bug description');
await page.getByText('Submit new issue').click();
const issueId = page.url().substr(page.url().lastIndexOf('/'));
const issueId = new URL(page.url()).pathname.split('/').pop();
const newIssue = await apiContext.get(
`https://api.github.com/repos/${USER}/${REPO}/issues/${issueId}`

View File

@ -114,7 +114,7 @@ def test_should_create_feature_request(api_request_context: APIRequestContext) -
### Setup and teardown
These tests assume that repository exists. You probably want to create a new one before running tests and delete it afterwards. Use a [session fixture](https://docs.pytest.org/en/stable/fixture.html#fixture-scopes) for that. The part before `yield` is the before all and after is the after all.
These tests assume that repository exists. You probably want to create a new one before running tests and delete it afterwards. Use a [session fixture](https://docs.pytest.org/en/stable/how-to/fixtures.html#fixture-scopes) for that. The part before `yield` is the before all and after is the after all.
```python
# ...

View File

@ -22,7 +22,7 @@ assistive technologies themselves. By default, Playwright tries to approximate t
* deprecated: This method is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for integration with Axe.
- returns: <[null]|[Object]>
- `role` <[string]> The [role](https://www.w3.org/TR/wai-aria/#usage_intro).
- `role` <[string]> The [role](https://www.w3.org/TR/wai-aria/#usage).
- `name` <[string]> A human readable name for the node.
- `value` <[string]|[float]> The current value of the node, if applicable.
- `description` <[string]> An additional human readable description of the node, if applicable.

View File

@ -136,7 +136,7 @@ Launches Chrome browser on the device, and returns its persistent context.
### option: AndroidDevice.launchBrowser.pkg
* since: v1.9
- `command` <[string]>
- `pkg` <[string]>
Optional package name to launch instead of default Chrome for Android.

View File

@ -21,6 +21,13 @@ Creates new instances of [APIRequestContext].
### option: APIRequest.newContext.extraHTTPHeaders = %%-context-option-extrahttpheaders-%%
* since: v1.16
### option: APIRequest.newContext.failOnStatusCode
* since: v1.51
- `failOnStatusCode` <[boolean]>
Whether to throw on response codes other than 2xx and 3xx. By default response object is returned
for all status codes.
### option: APIRequest.newContext.httpCredentials = %%-context-option-httpcredentials-%%
* since: v1.16
@ -30,6 +37,13 @@ Creates new instances of [APIRequestContext].
### option: APIRequest.newContext.ignoreHTTPSErrors = %%-context-option-ignorehttpserrors-%%
* since: v1.16
### option: APIRequest.newContext.maxRedirects
* since: v1.52
- `maxRedirects` <[int]>
Maximum number of request redirects that will be followed automatically. An error will be thrown if the number is exceeded.
Defaults to `20`. Pass `0` to not follow redirects. This can be overwritten for each request individually.
### option: APIRequest.newContext.timeout
* since: v1.16
- `timeout` <[float]>

View File

@ -890,3 +890,9 @@ Returns storage state for this request context, contains current cookies and loc
### option: APIRequestContext.storageState.path = %%-storagestate-option-path-%%
* since: v1.16
### option: APIRequestContext.storageState.indexedDB
* since: v1.51
- `indexedDB` ?<boolean>
Set to `true` to include IndexedDB in the storage state snapshot.

View File

@ -13,7 +13,8 @@ async def run(playwright: Playwright):
assert response.ok
assert response.status == 200
assert response.headers["content-type"] == "application/json; charset=utf-8"
assert response.json()["name"] == "foobar"
json_data = await response.json()
assert json_data["name"] == "foobar"
assert await response.body() == '{"status": "ok"}'

View File

@ -14,15 +14,15 @@ test('navigates to login', async ({ page }) => {
```
```java
...
// ...
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
public class TestPage {
...
// ...
@Test
void navigatesToLoginPage() {
...
APIResponse response = page.request().get('https://playwright.dev');
// ...
APIResponse response = page.request().get("https://playwright.dev");
assertThat(response).isOK();
}
}

View File

@ -20,10 +20,10 @@ import com.microsoft.playwright.*;
public class Example {
public static void main(String[] args) {
try (Playwright playwright = Playwright.create()) {
BrowserType firefox = playwright.firefox()
BrowserType firefox = playwright.firefox();
Browser browser = firefox.launch();
Page page = browser.newPage();
page.navigate('https://example.com');
page.navigate("https://example.com");
browser.close();
}
}
@ -96,7 +96,7 @@ In case this browser is connected to, clears all created contexts belonging to t
browser server.
:::note
This is similar to force quitting the browser. Therefore, you should call [`method: BrowserContext.close`] on any [BrowserContext]'s you explicitly created earlier with [`method: Browser.newContext`] **before** calling [`method: Browser.close`].
This is similar to force-quitting the browser. To close pages gracefully and ensure you receive page close events, call [`method: BrowserContext.close`] on any [BrowserContext] instances you explicitly created earlier using [`method: Browser.newContext`] **before** calling [`method: Browser.close`].
:::
The [Browser] object itself is considered to be disposed and cannot be used anymore.
@ -202,7 +202,7 @@ Browser browser = playwright.firefox().launch(); // Or 'chromium' or 'webkit'.
BrowserContext context = browser.newContext();
// Create a new page in a pristine context.
Page page = context.newPage();
page.navigate('https://example.com');
page.navigate("https://example.com");
// Graceful close up everything
context.close();
@ -331,7 +331,7 @@ await browser.stopTracing();
```java
browser.startTracing(page, new Browser.StartTracingOptions()
.setPath(Paths.get("trace.json")));
page.goto('https://www.google.com');
page.navigate("https://www.google.com");
browser.stopTracing();
```

View File

@ -655,7 +655,7 @@ import com.microsoft.playwright.*;
public class Example {
public static void main(String[] args) {
try (Playwright playwright = Playwright.create()) {
BrowserType webkit = playwright.webkit()
BrowserType webkit = playwright.webkit();
Browser browser = webkit.launch(new BrowserType.LaunchOptions().setHeadless(false));
BrowserContext context = browser.newContext();
context.exposeBinding("pageURL", (source, args) -> source.page().url());
@ -813,8 +813,9 @@ import java.util.Base64;
public class Example {
public static void main(String[] args) {
try (Playwright playwright = Playwright.create()) {
BrowserType webkit = playwright.webkit()
BrowserType webkit = playwright.webkit();
Browser browser = webkit.launch(new BrowserType.LaunchOptions().setHeadless(false));
BrowserContext context = browser.newContext();
context.exposeFunction("sha256", args -> {
String text = (String) args[0];
MessageDigest crypto;
@ -962,9 +963,14 @@ specified.
* since: v1.8
- `permissions` <[Array]<[string]>>
A permission or an array of permissions to grant. Permissions can be one of the following values:
A list of permissions to grant.
:::danger
Supported permissions differ between browsers, and even between different versions of the same browser. Any permission may stop working after an update.
:::
Here are some permissions that may be supported by some browsers:
* `'accelerometer'`
* `'accessibility-events'`
* `'ambient-light-sensor'`
* `'background-sync'`
* `'camera'`
@ -1197,9 +1203,7 @@ Enabling routing disables http cache.
* since: v1.8
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]>
A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
When a [`option: Browser.newContext.baseURL`] via the context options was provided and the passed URL is a path,
it gets merged via the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.
A glob pattern, regex pattern, or predicate that receives a [URL] to match during routing. If [`option: Browser.newContext.baseURL`] is set in the context options and the provided URL is a string that does not start with `*`, it is resolved using the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.
### param: BrowserContext.route.handler
* since: v1.8
@ -1406,7 +1410,7 @@ This setting will change the default maximum time for all the methods accepting
* since: v1.8
- `timeout` <[float]>
Maximum time in milliseconds
Maximum time in milliseconds. Pass `0` to disable timeout.
## async method: BrowserContext.setExtraHTTPHeaders
* since: v1.8
@ -1506,7 +1510,7 @@ Whether to emulate network being offline for the browser context.
- `name` <[string]>
- `value` <[string]>
Returns storage state for this browser context, contains current cookies and local storage snapshot.
Returns storage state for this browser context, contains current cookies, local storage snapshot and IndexedDB snapshot.
## async method: BrowserContext.storageState
* since: v1.8
@ -1516,6 +1520,13 @@ Returns storage state for this browser context, contains current cookies and loc
### option: BrowserContext.storageState.path = %%-storagestate-option-path-%%
* since: v1.8
### option: BrowserContext.storageState.indexedDB
* since: v1.51
- `indexedDB` ?<boolean>
Set to `true` to include [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) in the storage state snapshot.
If your application uses IndexedDB to store authentication tokens, like Firebase Authentication, enable this.
## property: BrowserContext.tracing
* since: v1.12
- type: <[Tracing]>

View File

@ -89,13 +89,17 @@ class BrowserTypeExamples
* since: v1.8
- returns: <[Browser]>
This method attaches Playwright to an existing browser instance. When connecting to another browser launched via `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is compatible with 1.2.x).
This method attaches Playwright to an existing browser instance created via `BrowserType.launchServer` in Node.js.
:::note
The major and minor version of the Playwright instance that connects needs to match the version of Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
:::
### param: BrowserType.connect.wsEndpoint
* since: v1.10
- `wsEndpoint` <[string]>
A browser websocket endpoint to connect to.
A Playwright browser websocket endpoint to connect to. You obtain this endpoint via `BrowserServer.wsEndpoint`.
### option: BrowserType.connect.headers
* since: v1.11
@ -152,6 +156,10 @@ The default browser context is accessible via [`method: Browser.contexts`].
Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
:::
:::note
This connection is significantly lower fidelity than the Playwright protocol connection via [`method: BrowserType.connect`]. If you are experiencing issues or attempting to use advanced functionality, you probably want to use [`method: BrowserType.connect`].
:::
**Usage**
```js
@ -316,11 +324,13 @@ this context will automatically close the browser.
* since: v1.8
- `userDataDir` <[path]>
Path to a User Data Directory, which stores browser session data like cookies and local storage. More details for
Path to a User Data Directory, which stores browser session data like cookies and local storage. Pass an empty string to create a temporary directory.
More details for
[Chromium](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md#introduction) and
[Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile).
Note that Chromium's user data directory is the **parent** directory of the "Profile Path" seen at `chrome://version`. Pass an empty string to
use a temporary directory instead.
[Firefox](https://wiki.mozilla.org/Firefox/CommandLineOptions#User_profile). Chromium's user data directory is the **parent** directory of the "Profile Path" seen at `chrome://version`.
Note that browsers do not allow launching multiple instances with the same User Data Directory.
### option: BrowserType.launchPersistentContext.-inline- = %%-shared-browser-options-list-v1.8-%%
* since: v1.8

View File

@ -161,6 +161,41 @@ await page.Clock.PauseAtAsync(DateTime.Parse("2020-02-02"));
await page.Clock.PauseAtAsync("2020-02-02");
```
For best results, install the clock before navigating the page and set it to a time slightly before the intended test time. This ensures that all timers run normally during page loading, preventing the page from getting stuck. Once the page has fully loaded, you can safely use [`method: Clock.pauseAt`] to pause the clock.
```js
// Initialize clock with some time before the test time and let the page load
// naturally. `Date.now` will progress as the timers fire.
await page.clock.install({ time: new Date('2024-12-10T08:00:00') });
await page.goto('http://localhost:3333');
await page.clock.pauseAt(new Date('2024-12-10T10:00:00'));
```
```python async
# Initialize clock with some time before the test time and let the page load
# naturally. `Date.now` will progress as the timers fire.
await page.clock.install(time=datetime.datetime(2024, 12, 10, 8, 0, 0))
await page.goto("http://localhost:3333")
await page.clock.pause_at(datetime.datetime(2024, 12, 10, 10, 0, 0))
```
```python sync
# Initialize clock with some time before the test time and let the page load
# naturally. `Date.now` will progress as the timers fire.
page.clock.install(time=datetime.datetime(2024, 12, 10, 8, 0, 0))
page.goto("http://localhost:3333")
page.clock.pause_at(datetime.datetime(2024, 12, 10, 10, 0, 0))
```
```java
// Initialize clock with some time before the test time and let the page load
// naturally. `Date.now` will progress as the timers fire.
SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd'T'HH:mm:ss");
page.clock().install(new Clock.InstallOptions().setTime(format.parse("2024-12-10T08:00:00")));
page.navigate("http://localhost:3333");
page.clock().pauseAt(format.parse("2024-12-10T10:00:00"));
```
### param: Clock.pauseAt.time
* langs: js, java
* since: v1.45
@ -193,6 +228,8 @@ Resumes timers. Once this method is called, time resumes flowing, timers are fir
Makes `Date.now` and `new Date()` return fixed fake time at all times,
keeps all the timers running.
Use this method for simple scenarios where you only need to test with a predefined time. For more advanced scenarios, use [`method: Clock.install`] instead. Read docs on [clock emulation](../clock.md) to learn more.
**Usage**
```js
@ -249,7 +286,7 @@ Time to be set.
## async method: Clock.setSystemTime
* since: v1.45
Sets current system time but does not trigger any timers.
Sets system time, but does not trigger any timers. Use this to test how the web page reacts to a time shift, for example switching from summer to winter time, or changing time zones.
**Usage**

View File

@ -44,8 +44,8 @@ ConsoleMessage msg = page.waitForConsoleMessage(() -> {
});
// Deconstruct console.log arguments
msg.args().get(0).jsonValue() // hello
msg.args().get(1).jsonValue() // 42
msg.args().get(0).jsonValue(); // hello
msg.args().get(1).jsonValue(); // 42
```
```python async

View File

@ -6,7 +6,7 @@ The [FormData] is used create form data that is sent via [APIRequestContext].
```java
import com.microsoft.playwright.options.FormData;
...
// ...
FormData form = FormData.create()
.set("firstName", "John")
.set("lastName", "Doe")
@ -28,7 +28,7 @@ the new value onto the end of the existing set of values.
```java
import com.microsoft.playwright.options.FormData;
...
// ...
FormData form = FormData.create()
// Only name and value are set.
.append("firstName", "John")
@ -100,7 +100,7 @@ Sets a field on the form. File values can be passed either as `Path` or as `File
```java
import com.microsoft.playwright.options.FormData;
...
// ...
FormData form = FormData.create()
// Only name and value are set.
.set("firstName", "John")

View File

@ -104,38 +104,23 @@ await page.Keyboard.PressAsync("Shift+A");
An example to trigger select-all with the keyboard
```js
// on Windows and Linux
await page.keyboard.press('Control+A');
// on macOS
await page.keyboard.press('Meta+A');
await page.keyboard.press('ControlOrMeta+A');
```
```java
// on Windows and Linux
page.keyboard().press("Control+A");
// on macOS
page.keyboard().press("Meta+A");
page.keyboard().press("ControlOrMeta+A");
```
```python async
# on windows and linux
await page.keyboard.press("Control+A")
# on mac_os
await page.keyboard.press("Meta+A")
await page.keyboard.press("ControlOrMeta+A")
```
```python sync
# on windows and linux
page.keyboard.press("Control+A")
# on mac_os
page.keyboard.press("Meta+A")
page.keyboard.press("ControlOrMeta+A")
```
```csharp
// on Windows and Linux
await page.Keyboard.PressAsync("Control+A");
// on macOS
await page.Keyboard.PressAsync("Meta+A");
await page.Keyboard.PressAsync("ControlOrMeta+A");
```
## async method: Keyboard.down
@ -257,7 +242,7 @@ await browser.close();
Page page = browser.newPage();
page.navigate("https://keycode.info");
page.keyboard().press("A");
page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("A.png"));
page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("A.png")));
page.keyboard().press("ArrowLeft");
page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("ArrowLeft.png")));
page.keyboard().press("Shift+O");

View File

@ -38,7 +38,7 @@ for li in page.get_by_role('listitem').all():
```
```java
for (Locator li : page.getByRole('listitem').all())
for (Locator li : page.getByRole("listitem").all())
li.click();
```
@ -150,6 +150,80 @@ var button = page.GetByRole(AriaRole.Button).And(page.GetByTitle("Subscribe"));
Additional locator to match.
## async method: Locator.ariaSnapshot
* since: v1.49
- returns: <[string]>
Captures the aria snapshot of the given element.
Read more about [aria snapshots](../aria-snapshots.md) and [`method: LocatorAssertions.toMatchAriaSnapshot`] for the corresponding assertion.
**Usage**
```js
await page.getByRole('link').ariaSnapshot();
```
```java
page.getByRole(AriaRole.LINK).ariaSnapshot();
```
```python async
await page.get_by_role("link").aria_snapshot()
```
```python sync
page.get_by_role("link").aria_snapshot()
```
```csharp
await page.GetByRole(AriaRole.Link).AriaSnapshotAsync();
```
**Details**
This method captures the aria snapshot of the given element. The snapshot is a string that represents the state of the element and its children.
The snapshot can be used to assert the state of the element in the test, or to compare it to state in the future.
The ARIA snapshot is represented using [YAML](https://yaml.org/spec/1.2.2/) markup language:
* The keys of the objects are the roles and optional accessible names of the elements.
* The values are either text content or an array of child elements.
* Generic static text can be represented with the `text` key.
Below is the HTML markup and the respective ARIA snapshot:
```html
<ul aria-label="Links">
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
<ul>
```
```yml
- list "Links":
- listitem:
- link "Home"
- listitem:
- link "About"
```
### option: Locator.ariaSnapshot.emitGeneric
* since: v1.53
- `emitGeneric` <[boolean]>
Generate `generic` aria nodes for elements w/o roles (similar to Chrome DevTools).
### option: Locator.ariaSnapshot.ref
* since: v1.52
- `ref` <[boolean]>
Generate symbolic reference for each element. One can use `aria-ref=<ref>` locator immediately after capturing the
snapshot to perform actions on the element.
### option: Locator.ariaSnapshot.timeout = %%-input-timeout-%%
* since: v1.49
### option: Locator.ariaSnapshot.timeout = %%-input-timeout-js-%%
* since: v1.49
## async method: Locator.blur
* since: v1.28
@ -572,13 +646,11 @@ properties:
You can also specify [JSHandle] as the property value if you want live objects to be passed into the event:
```js
// Note you can only create DataTransfer in Chromium and Firefox
const dataTransfer = await page.evaluateHandle(() => new DataTransfer());
await locator.dispatchEvent('dragstart', { dataTransfer });
```
```java
// Note you can only create DataTransfer in Chromium and Firefox
JSHandle dataTransfer = page.evaluateHandle("() => new DataTransfer()");
Map<String, Object> arg = new HashMap<>();
arg.put("dataTransfer", dataTransfer);
@ -586,13 +658,11 @@ locator.dispatchEvent("dragstart", arg);
```
```python async
# note you can only create data_transfer in chromium and firefox
data_transfer = await page.evaluate_handle("new DataTransfer()")
await locator.dispatch_event("#source", "dragstart", {"dataTransfer": data_transfer})
```
```python sync
# note you can only create data_transfer in chromium and firefox
data_transfer = page.evaluate_handle("new DataTransfer()")
locator.dispatch_event("#source", "dragstart", {"dataTransfer": data_transfer})
```
@ -807,29 +877,35 @@ If [`param: expression`] throws or rejects, this method throws.
**Usage**
Passing argument to [`param: expression`]:
```js
const tweets = page.locator('.tweet .retweets');
expect(await tweets.evaluate(node => node.innerText)).toBe('10 retweets');
const result = await page.getByTestId('myId').evaluate((element, [x, y]) => {
return element.textContent + ' ' + x * y;
}, [7, 8]);
console.log(result); // prints "myId text 56"
```
```java
Locator tweets = page.locator(".tweet .retweets");
assertEquals("10 retweets", tweets.evaluate("node => node.innerText"));
Object result = page.getByTestId("myId").evaluate("(element, [x, y]) => {\n" +
" return element.textContent + ' ' + x * y;\n" +
"}", Arrays.asList(7, 8));
System.out.println(result); // prints "myId text 56"
```
```python async
tweets = page.locator(".tweet .retweets")
assert await tweets.evaluate("node => node.innerText") == "10 retweets"
result = await page.get_by_testid("myId").evaluate("(element, [x, y]) => element.textContent + ' ' + x * y", [7, 8])
print(result) # prints "myId text 56"
```
```python sync
tweets = page.locator(".tweet .retweets")
assert tweets.evaluate("node => node.innerText") == "10 retweets"
result = page.get_by_testid("myId").evaluate("(element, [x, y]) => element.textContent + ' ' + x * y", [7, 8])
print(result) # prints "myId text 56"
```
```csharp
var tweets = page.Locator(".tweet .retweets");
Assert.AreEqual("10 retweets", await tweets.EvaluateAsync("node => node.innerText"));
var result = await page.GetByTestId("myId").EvaluateAsync<string>("(element, [x, y]) => element.textContent + ' ' + x * y)", new[] { 7, 8 });
Console.WriteLine(result); // prints "myId text 56"
```
### param: Locator.evaluate.expression = %%-evaluate-expression-%%
@ -844,11 +920,19 @@ Assert.AreEqual("10 retweets", await tweets.EvaluateAsync("node => node.innerTex
Optional argument to pass to [`param: expression`].
### option: Locator.evaluate.timeout = %%-input-timeout-%%
### option: Locator.evaluate.timeout
* since: v1.14
* langs: python, java, csharp
- `timeout` <[float]>
### option: Locator.evaluate.timeout = %%-input-timeout-js-%%
Maximum time in milliseconds to wait for the locator before evaluating. Note that after locator is resolved, evaluation itself is not limited by the timeout. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.
### option: Locator.evaluate.timeout
* since: v1.14
* langs: js
- `timeout` <[float]>
Maximum time in milliseconds to wait for the locator before evaluating. Note that after locator is resolved, evaluation itself is not limited by the timeout. Defaults to `0` - no timeout.
## async method: Locator.evaluateAll
* since: v1.14
@ -933,11 +1017,19 @@ See [`method: Page.evaluateHandle`] for more details.
Optional argument to pass to [`param: expression`].
### option: Locator.evaluateHandle.timeout = %%-input-timeout-%%
### option: Locator.evaluateHandle.timeout
* since: v1.14
* langs: python, java, csharp
- `timeout` <[float]>
### option: Locator.evaluateHandle.timeout = %%-input-timeout-js-%%
Maximum time in milliseconds to wait for the locator before evaluating. Note that after locator is resolved, evaluation itself is not limited by the timeout. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.
### option: Locator.evaluateHandle.timeout
* since: v1.14
* langs: js
- `timeout` <[float]>
Maximum time in milliseconds to wait for the locator before evaluating. Note that after locator is resolved, evaluation itself is not limited by the timeout. Defaults to `0` - no timeout.
## async method: Locator.fill
* since: v1.14
@ -1058,6 +1150,9 @@ await rowLocator
### option: Locator.filter.hasNotText = %%-locator-option-has-not-text-%%
* since: v1.33
### option: Locator.filter.visible = %%-locator-option-visible-%%
* since: v1.51
## method: Locator.first
* since: v1.14
- returns: <[Locator]>
@ -1422,7 +1517,7 @@ Boolean disabled = await page.GetByRole(AriaRole.Button).IsDisabledAsync();
* since: v1.14
- returns: <[boolean]>
Returns whether the element is [editable](../actionability.md#editable).
Returns whether the element is [editable](../actionability.md#editable). If the target element is not an `<input>`, `<textarea>`, `<select>`, `[contenteditable]` and does not have a role allowing `[aria-readonly]`, this method throws an error.
:::warning[Asserting editable state]
If you need to assert that an element is editable, prefer [`method: LocatorAssertions.toBeEditable`] to avoid flakiness. See [assertions guide](../test-assertions.md) for more details.
@ -1656,16 +1751,21 @@ var banana = await page.GetByRole(AriaRole.Listitem).Nth(2);
Creates a locator matching all elements that match one or both of the two locators.
Note that when both locators match something, the resulting locator will have multiple matches and violate [locator strictness](../locators.md#strictness) guidelines.
Note that when both locators match something, the resulting locator will have multiple matches, potentially causing a [locator strictness](../locators.md#strictness) violation.
**Usage**
Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog shows up instead. In this case, you can wait for either a "New email" button, or a dialog and act accordingly.
:::note
If both "New email" button and security dialog appear on screen, the "or" locator will match both of them,
possibly throwing the ["strict mode violation" error](../locators.md#strictness). In this case, you can use [`method: Locator.first`] to only match one of them.
:::
```js
const newEmail = page.getByRole('button', { name: 'New' });
const dialog = page.getByText('Confirm security settings');
await expect(newEmail.or(dialog)).toBeVisible();
await expect(newEmail.or(dialog).first()).toBeVisible();
if (await dialog.isVisible())
await page.getByRole('button', { name: 'Dismiss' }).click();
await newEmail.click();
@ -1674,7 +1774,7 @@ await newEmail.click();
```java
Locator newEmail = page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("New"));
Locator dialog = page.getByText("Confirm security settings");
assertThat(newEmail.or(dialog)).isVisible();
assertThat(newEmail.or(dialog).first()).isVisible();
if (dialog.isVisible())
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Dismiss")).click();
newEmail.click();
@ -1683,7 +1783,7 @@ newEmail.click();
```python async
new_email = page.get_by_role("button", name="New")
dialog = page.get_by_text("Confirm security settings")
await expect(new_email.or_(dialog)).to_be_visible()
await expect(new_email.or_(dialog).first).to_be_visible()
if (await dialog.is_visible()):
await page.get_by_role("button", name="Dismiss").click()
await new_email.click()
@ -1692,7 +1792,7 @@ await new_email.click()
```python sync
new_email = page.get_by_role("button", name="New")
dialog = page.get_by_text("Confirm security settings")
expect(new_email.or_(dialog)).to_be_visible()
expect(new_email.or_(dialog).first).to_be_visible()
if (dialog.is_visible()):
page.get_by_role("button", name="Dismiss").click()
new_email.click()
@ -1701,7 +1801,7 @@ new_email.click()
```csharp
var newEmail = page.GetByRole(AriaRole.Button, new() { Name = "New" });
var dialog = page.GetByText("Confirm security settings");
await Expect(newEmail.Or(dialog)).ToBeVisibleAsync();
await Expect(newEmail.Or(dialog).First).ToBeVisibleAsync();
if (await dialog.IsVisibleAsync())
await page.GetByRole(AriaRole.Button, new() { Name = "Dismiss" }).ClickAsync();
await newEmail.ClickAsync();
@ -1998,9 +2098,9 @@ Triggers a `change` and `input` event once all the provided options have been se
```html
<select multiple>
<option value="red">Red</div>
<option value="green">Green</div>
<option value="blue">Blue</div>
<option value="red">Red</option>
<option value="green">Green</option>
<option value="blue">Blue</option>
</select>
```
@ -2295,7 +2395,7 @@ This method expects [Locator] to point to an
## async method: Locator.tap
* since: v1.14
Perform a tap gesture on the element matching the locator.
Perform a tap gesture on the element matching the locator. For examples of emulating other gestures by manually dispatching touch events, see the [emulating legacy touch events](../touch-events.md) page.
**Details**

View File

@ -14,14 +14,14 @@ test('status becomes submitted', async ({ page }) => {
```
```java
...
// ...
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
public class TestLocator {
...
// ...
@Test
void statusBecomesSubmitted() {
...
// ...
page.getByRole(AriaRole.BUTTON).click();
assertThat(page.locator(".status")).hasText("Submitted");
}
@ -197,6 +197,21 @@ The opposite of [`method: LocatorAssertions.toBeVisible`].
### option: LocatorAssertions.NotToBeVisible.timeout = %%-csharp-java-python-assertions-timeout-%%
* since: v1.18
## async method: LocatorAssertions.NotToContainClass
* since: v1.52
* langs: python
The opposite of [`method: LocatorAssertions.toContainClass`].
### param: LocatorAssertions.NotToContainClass.expected
* since: v1.52
- `expected` <[string]|[Array]<[string]>>
Expected class or RegExp or a list of those.
### option: LocatorAssertions.NotToContainClass.timeout = %%-csharp-java-python-assertions-timeout-%%
* since: v1.52
## async method: LocatorAssertions.NotToContainText
* since: v1.20
* langs: python
@ -240,6 +255,24 @@ Expected accessible description.
### option: LocatorAssertions.NotToHaveAccessibleDescription.timeout = %%-csharp-java-python-assertions-timeout-%%
* since: v1.44
## async method: LocatorAssertions.NotToHaveAccessibleErrorMessage
* since: v1.50
* langs: python
The opposite of [`method: LocatorAssertions.toHaveAccessibleErrorMessage`].
### param: LocatorAssertions.NotToHaveAccessibleErrorMessage.errorMessage
* since: v1.50
- `errorMessage` <[string]|[RegExp]>
Expected accessible error message.
### option: LocatorAssertions.NotToHaveAccessibleErrorMessage.ignoreCase = %%-assertions-ignore-case-%%
* since: v1.50
### option: LocatorAssertions.NotToHaveAccessibleErrorMessage.timeout = %%-csharp-java-python-assertions-timeout-%%
* since: v1.50
## async method: LocatorAssertions.NotToHaveAccessibleName
* since: v1.44
@ -442,6 +475,23 @@ Expected options currently selected.
### option: LocatorAssertions.NotToHaveValues.timeout = %%-csharp-java-python-assertions-timeout-%%
* since: v1.23
## async method: LocatorAssertions.NotToMatchAriaSnapshot
* since: v1.49
* langs: python
The opposite of [`method: LocatorAssertions.toMatchAriaSnapshot`].
### param: LocatorAssertions.NotToMatchAriaSnapshot.expected
* since: v1.49
- `expected` <string>
### option: LocatorAssertions.NotToMatchAriaSnapshot.timeout = %%-js-assertions-timeout-%%
* since: v1.49
### option: LocatorAssertions.NotToMatchAriaSnapshot.timeout = %%-csharp-java-python-assertions-timeout-%%
* since: v1.49
## async method: LocatorAssertions.toBeAttached
* since: v1.33
@ -524,6 +574,16 @@ await Expect(locator).ToBeCheckedAsync();
* since: v1.18
- `checked` <[boolean]>
Provides state to assert for. Asserts for input to be checked by default.
This option can't be used when [`option: LocatorAssertions.toBeChecked.indeterminate`] is set to true.
### option: LocatorAssertions.toBeChecked.indeterminate
* since: v1.50
- `indeterminate` <[boolean]>
Asserts that the element is in the indeterminate (mixed) state. Only supported for checkboxes and radio buttons.
This option can't be true when [`option: LocatorAssertions.toBeChecked.checked`] is provided.
### option: LocatorAssertions.toBeChecked.timeout = %%-js-assertions-timeout-%%
* since: v1.18
@ -701,7 +761,7 @@ expect(locator).to_be_enabled()
```csharp
var locator = Page.Locator("button.submit");
await Expect(locator).toBeEnabledAsync();
await Expect(locator).ToBeEnabledAsync();
```
### option: LocatorAssertions.toBeEnabled.enabled
@ -973,6 +1033,107 @@ await Expect(
### option: LocatorAssertions.toBeVisible.timeout = %%-csharp-java-python-assertions-timeout-%%
* since: v1.18
## async method: LocatorAssertions.toContainClass
* since: v1.52
* langs:
- alias-java: containsClass
Ensures the [Locator] points to an element with given CSS classes. All classes from the asserted value, separated by spaces, must be present in the [Element.classList](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList) in any order.
**Usage**
```html
<div class='middle selected row' id='component'></div>
```
```js
const locator = page.locator('#component');
await expect(locator).toContainClass('middle selected row');
await expect(locator).toContainClass('selected');
await expect(locator).toContainClass('row middle');
```
```java
assertThat(page.locator("#component")).containsClass("middle selected row");
assertThat(page.locator("#component")).containsClass("selected");
assertThat(page.locator("#component")).containsClass("row middle");
```
```python async
from playwright.async_api import expect
locator = page.locator("#component")
await expect(locator).to_contain_class("middle selected row")
await expect(locator).to_contain_class("selected")
await expect(locator).to_contain_class("row middle")
```
```python sync
from playwright.sync_api import expect
locator = page.locator("#component")
expect(locator).to_contain_class("middle selected row")
expect(locator).to_contain_class("selected")
expect(locator).to_contain_class("row middle")
```
```csharp
var locator = Page.Locator("#component");
await Expect(locator).ToContainClassAsync("middle selected row");
await Expect(locator).ToContainClassAsync("selected");
await Expect(locator).ToContainClassAsync("row middle");
```
When an array is passed, the method asserts that the list of elements located matches the corresponding list of expected class lists. Each element's class attribute is matched against the corresponding class in the array:
```html
<div class='list'></div>
<div class='component inactive'></div>
<div class='component active'></div>
<div class='component inactive'></div>
</div>
```
```js
const locator = page.locator('list > .component');
await expect(locator).toContainClass(['inactive', 'active', 'inactive']);
```
```java
assertThat(page.locator("list > .component")).containsClass(new String[] {"inactive", "active", "inactive"});
```
```python async
from playwright.async_api import expect
locator = page.locator("list > .component")
await expect(locator).to_contain_class(["inactive", "active", "inactive"])
```
```python sync
from playwright.sync_api import expect
locator = page.locator("list > .component")
await expect(locator).to_contain_class(["inactive", "active", "inactive"])
```
```csharp
var locator = Page.Locator("list > .component");
await Expect(locator).ToContainClassAsync(new string[]{"inactive", "active", "inactive"});
```
### param: LocatorAssertions.toContainClass.expected
* since: v1.52
- `expected` <[string]|[Array]<[string]>>
A string containing expected class names, separated by spaces, or a list of such strings to assert multiple elements.
### option: LocatorAssertions.toContainClass.timeout = %%-js-assertions-timeout-%%
* since: v1.52
### option: LocatorAssertions.toContainClass.timeout = %%-csharp-java-python-assertions-timeout-%%
* since: v1.52
## async method: LocatorAssertions.toContainText
* since: v1.20
* langs:
@ -1181,7 +1342,7 @@ expect(locator).to_have_accessible_description("Save results to disk")
```csharp
var locator = Page.GetByTestId("save-button");
await Expect(locator).toHaveAccessibleDescriptionAsync("Save results to disk");
await Expect(locator).ToHaveAccessibleDescriptionAsync("Save results to disk");
```
### param: LocatorAssertions.toHaveAccessibleDescription.description
@ -1200,6 +1361,56 @@ Expected accessible description.
* since: v1.44
## async method: LocatorAssertions.toHaveAccessibleErrorMessage
* since: v1.50
* langs:
- alias-java: hasAccessibleErrorMessage
Ensures the [Locator] points to an element with a given [aria errormessage](https://w3c.github.io/aria/#aria-errormessage).
**Usage**
```js
const locator = page.getByTestId('username-input');
await expect(locator).toHaveAccessibleErrorMessage('Username is required.');
```
```java
Locator locator = page.getByTestId("username-input");
assertThat(locator).hasAccessibleErrorMessage("Username is required.");
```
```python async
locator = page.get_by_test_id("username-input")
await expect(locator).to_have_accessible_error_message("Username is required.")
```
```python sync
locator = page.get_by_test_id("username-input")
expect(locator).to_have_accessible_error_message("Username is required.")
```
```csharp
var locator = Page.GetByTestId("username-input");
await Expect(locator).ToHaveAccessibleErrorMessageAsync("Username is required.");
```
### param: LocatorAssertions.toHaveAccessibleErrorMessage.errorMessage
* since: v1.50
- `errorMessage` <[string]|[RegExp]>
Expected accessible error message.
### option: LocatorAssertions.toHaveAccessibleErrorMessage.timeout = %%-js-assertions-timeout-%%
* since: v1.50
### option: LocatorAssertions.toHaveAccessibleErrorMessage.timeout = %%-csharp-java-python-assertions-timeout-%%
* since: v1.50
### option: LocatorAssertions.toHaveAccessibleErrorMessage.ignoreCase = %%-assertions-ignore-case-%%
* since: v1.50
## async method: LocatorAssertions.toHaveAccessibleName
* since: v1.44
* langs:
@ -1231,7 +1442,7 @@ expect(locator).to_have_accessible_name("Save to disk")
```csharp
var locator = Page.GetByTestId("save-button");
await Expect(locator).toHaveAccessibleNameAsync("Save to disk");
await Expect(locator).ToHaveAccessibleNameAsync("Save to disk");
```
### param: LocatorAssertions.toHaveAccessibleName.name
@ -1336,49 +1547,48 @@ Attribute name.
* langs:
- alias-java: hasClass
Ensures the [Locator] points to an element with given CSS classes. This needs to be a full match
or using a relaxed regular expression.
Ensures the [Locator] points to an element with given CSS classes. When a string is provided, it must fully match the element's `class` attribute. To match individual classes use [`method: LocatorAssertions.toContainClass`].
**Usage**
```html
<div class='selected row' id='component'></div>
<div class='middle selected row' id='component'></div>
```
```js
const locator = page.locator('#component');
await expect(locator).toHaveClass(/selected/);
await expect(locator).toHaveClass('selected row');
await expect(locator).toHaveClass('middle selected row');
await expect(locator).toHaveClass(/(^|\s)selected(\s|$)/);
```
```java
assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
assertThat(page.locator("#component")).hasClass("selected row");
assertThat(page.locator("#component")).hasClass("middle selected row");
assertThat(page.locator("#component")).hasClass(Pattern.compile("(^|\\s)selected(\\s|$)"));
```
```python async
from playwright.async_api import expect
locator = page.locator("#component")
await expect(locator).to_have_class(re.compile(r"selected"))
await expect(locator).to_have_class("selected row")
await expect(locator).to_have_class("middle selected row")
await expect(locator).to_have_class(re.compile(r"(^|\\s)selected(\\s|$)"))
```
```python sync
from playwright.sync_api import expect
locator = page.locator("#component")
expect(locator).to_have_class(re.compile(r"selected"))
expect(locator).to_have_class("selected row")
expect(locator).to_have_class("middle selected row")
expect(locator).to_have_class(re.compile(r"(^|\\s)selected(\\s|$)"))
```
```csharp
var locator = Page.Locator("#component");
await Expect(locator).ToHaveClassAsync(new Regex("selected"));
await Expect(locator).ToHaveClassAsync("selected row");
await Expect(locator).ToHaveClassAsync("middle selected row");
await Expect(locator).ToHaveClassAsync(new Regex("(^|\\s)selected(\\s|$)"));
```
Note that if array is passed as an expected value, entire lists of elements can be asserted:
When an array is passed, the method asserts that the list of elements located matches the corresponding list of expected class values. Each element's class attribute is matched against the corresponding string or regular expression in the array:
```js
const locator = page.locator('list > .component');
@ -2048,7 +2258,7 @@ await expect(locator).toHaveValues([/R/, /G/]);
```
```java
page.locator("id=favorite-colors").selectOption(["R", "G"]);
page.locator("id=favorite-colors").selectOption(new String[]{"R", "G"});
assertThat(page.locator("id=favorite-colors")).hasValues(new Pattern[] { Pattern.compile("R"), Pattern.compile("G") });
```
@ -2103,3 +2313,91 @@ Expected options currently selected.
### option: LocatorAssertions.toHaveValues.timeout = %%-csharp-java-python-assertions-timeout-%%
* since: v1.23
## async method: LocatorAssertions.toMatchAriaSnapshot
* since: v1.49
* langs:
- alias-java: matchesAriaSnapshot
Asserts that the target element matches the given [accessibility snapshot](../aria-snapshots.md).
**Usage**
```js
await page.goto('https://demo.playwright.dev/todomvc/');
await expect(page.locator('body')).toMatchAriaSnapshot(`
- heading "todos"
- textbox "What needs to be done?"
`);
```
```python async
await page.goto("https://demo.playwright.dev/todomvc/")
await expect(page.locator('body')).to_match_aria_snapshot('''
- heading "todos"
- textbox "What needs to be done?"
''')
```
```python sync
page.goto("https://demo.playwright.dev/todomvc/")
expect(page.locator('body')).to_match_aria_snapshot('''
- heading "todos"
- textbox "What needs to be done?"
''')
```
```csharp
await page.GotoAsync("https://demo.playwright.dev/todomvc/");
await Expect(page.Locator("body")).ToMatchAriaSnapshotAsync(@"
- heading ""todos""
- textbox ""What needs to be done?""
");
```
```java
page.navigate("https://demo.playwright.dev/todomvc/");
assertThat(page.locator("body")).matchesAriaSnapshot("""
- heading "todos"
- textbox "What needs to be done?"
""");
```
### param: LocatorAssertions.toMatchAriaSnapshot.expected
* since: v1.49
- `expected` <string>
### option: LocatorAssertions.toMatchAriaSnapshot.timeout = %%-js-assertions-timeout-%%
* since: v1.49
### option: LocatorAssertions.toMatchAriaSnapshot.timeout = %%-csharp-java-python-assertions-timeout-%%
* since: v1.49
## async method: LocatorAssertions.toMatchAriaSnapshot#2
* since: v1.50
* langs: js
Asserts that the target element matches the given [accessibility snapshot](../aria-snapshots.md).
Snapshot is stored in a separate `.aria.yml` file in a location configured by `expect.toMatchAriaSnapshot.pathTemplate` and/or `snapshotPathTemplate` properties in the configuration file.
**Usage**
```js
await expect(page.locator('body')).toMatchAriaSnapshot();
await expect(page.locator('body')).toMatchAriaSnapshot({ name: 'body.aria.yml' });
```
### option: LocatorAssertions.toMatchAriaSnapshot#2.name
* since: v1.50
* langs: js
- `name` <[string]>
Name of the snapshot to store in the snapshot folder corresponding to this test.
Generates sequential names if not specified.
### option: LocatorAssertions.toMatchAriaSnapshot#2.timeout = %%-js-assertions-timeout-%%
* since: v1.50
### option: LocatorAssertions.toMatchAriaSnapshot#2.timeout = %%-csharp-java-python-assertions-timeout-%%
* since: v1.50

View File

@ -1041,9 +1041,9 @@ await page.dragAndDrop('#source', '#target', {
```
```java
page.dragAndDrop("#source", '#target');
page.dragAndDrop("#source", "#target");
// or specify exact positions relative to the top-left corners of the elements:
page.dragAndDrop("#source", '#target', new Page.DragAndDropOptions()
page.dragAndDrop("#source", "#target", new Page.DragAndDropOptions()
.setSourcePosition(34, 7).setTargetPosition(10, 20));
```
@ -1217,8 +1217,6 @@ await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches);
// → true
await page.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches);
// → false
await page.evaluate(() => matchMedia('(prefers-color-scheme: no-preference)').matches);
// → false
```
```java
@ -1227,8 +1225,6 @@ page.evaluate("() => matchMedia('(prefers-color-scheme: dark)').matches");
// → true
page.evaluate("() => matchMedia('(prefers-color-scheme: light)').matches");
// → false
page.evaluate("() => matchMedia('(prefers-color-scheme: no-preference)').matches");
// → false
```
```python async
@ -1237,8 +1233,6 @@ await page.evaluate("matchMedia('(prefers-color-scheme: dark)').matches")
# → True
await page.evaluate("matchMedia('(prefers-color-scheme: light)').matches")
# → False
await page.evaluate("matchMedia('(prefers-color-scheme: no-preference)').matches")
# → False
```
```python sync
@ -1247,7 +1241,6 @@ page.evaluate("matchMedia('(prefers-color-scheme: dark)').matches")
# → True
page.evaluate("matchMedia('(prefers-color-scheme: light)').matches")
# → False
page.evaluate("matchMedia('(prefers-color-scheme: no-preference)').matches")
```
```csharp
@ -1256,8 +1249,6 @@ await page.EvaluateAsync("matchMedia('(prefers-color-scheme: dark)').matches");
// → true
await page.EvaluateAsync("matchMedia('(prefers-color-scheme: light)').matches");
// → false
await page.EvaluateAsync("matchMedia('(prefers-color-scheme: no-preference)').matches");
// → false
```
### option: Page.emulateMedia.media
@ -1281,16 +1272,16 @@ Passing `'Null'` disables CSS media emulation.
* langs: js, java
- `colorScheme` <null|[ColorScheme]<"light"|"dark"|"no-preference">>
Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. Passing
`null` disables color scheme emulation.
Emulates [prefers-colors-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) media feature, supported values are `'light'` and `'dark'`. Passing
`null` disables color scheme emulation. `'no-preference'` is deprecated.
### option: Page.emulateMedia.colorScheme
* since: v1.9
* langs: csharp, python
- `colorScheme` <[ColorScheme]<"light"|"dark"|"no-preference"|"null">>
Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. Passing
`'Null'` disables color scheme emulation.
Emulates [prefers-colors-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) media feature, supported values are `'light'` and `'dark'`. Passing
`'Null'` disables color scheme emulation. `'no-preference'` is deprecated.
### option: Page.emulateMedia.reducedMotion
* since: v1.12
@ -1318,6 +1309,18 @@ Emulates `'forced-colors'` media feature, supported values are `'active'` and `'
* langs: csharp, python
- `forcedColors` <[ForcedColors]<"active"|"none"|"null">>
### option: Page.emulateMedia.contrast
* since: v1.51
* langs: js, java
- `contrast` <null|[Contrast]<"no-preference"|"more">>
Emulates `'prefers-contrast'` media feature, supported values are `'no-preference'`, `'more'`. Passing `null` disables contrast emulation.
### option: Page.emulateMedia.contrast
* since: v1.51
* langs: csharp, python
- `contrast` <[Contrast]<"no-preference"|"more"|"null">>
## async method: Page.evalOnSelector
* since: v1.9
* discouraged: This method does not wait for the element to pass actionability
@ -1716,7 +1719,7 @@ public class Example {
public static void main(String[] args) {
try (Playwright playwright = Playwright.create()) {
BrowserType webkit = playwright.webkit();
Browser browser = webkit.launch({ headless: false });
Browser browser = webkit.launch(new BrowserType.LaunchOptions().setHeadless(false));
BrowserContext context = browser.newContext();
Page page = context.newPage();
page.exposeBinding("pageURL", (source, args) -> source.page().url());
@ -1886,26 +1889,27 @@ public class Example {
public static void main(String[] args) {
try (Playwright playwright = Playwright.create()) {
BrowserType webkit = playwright.webkit();
Browser browser = webkit.launch({ headless: false });
Browser browser = webkit.launch(new BrowserType.LaunchOptions().setHeadless(false));
Page page = browser.newPage();
page.exposeFunction("sha256", args -> {
String text = (String) args[0];
MessageDigest crypto;
try {
crypto = MessageDigest.getInstance("SHA-256");
String text = (String) args[0];
MessageDigest crypto = MessageDigest.getInstance("SHA-256");
byte[] token = crypto.digest(text.getBytes(StandardCharsets.UTF_8));
return Base64.getEncoder().encodeToString(token);
} catch (NoSuchAlgorithmException e) {
return null;
}
byte[] token = crypto.digest(text.getBytes(StandardCharsets.UTF_8));
return Base64.getEncoder().encodeToString(token);
});
page.setContent("<script>\n" +
page.setContent(
"<script>\n" +
" async function onClick() {\n" +
" document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');\n" +
" }\n" +
"</script>\n" +
"<button onclick=\"onClick()\">Click me</button>\n" +
"<div></div>\n");
"<div></div>"
);
page.click("button");
}
}
@ -2106,7 +2110,7 @@ const frame = page.frame({ url: /.*domain.*/ });
```
```java
Frame frame = page.frameByUrl(Pattern.compile(".*domain.*");
Frame frame = page.frameByUrl(Pattern.compile(".*domain.*"));
```
```py
@ -2770,10 +2774,6 @@ This method requires Playwright to be started in a headed mode, with a falsy [`o
Returns the PDF buffer.
:::note
Generating a pdf is currently only supported in Chromium headless.
:::
`page.pdf()` generates a pdf of the page with `print` css media. To generate a pdf with `screen` media, call
[`method: Page.emulateMedia`] before calling `page.pdf()`:
@ -3161,12 +3161,12 @@ await page.getByRole('button', { name: 'Start here' }).click();
```java
// Setup the handler.
page.addLocatorHandler(page.getByText("Sign up to the newsletter"), () => {
page.addLocatorHandler(page.getByText("Sign up to the newsletter"), () -> {
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("No thanks")).click();
});
// Write the test as usual.
page.goto("https://example.com");
page.navigate("https://example.com");
page.getByRole("button", Page.GetByRoleOptions().setName("Start here")).click();
```
@ -3218,12 +3218,12 @@ await page.getByRole('button', { name: 'Start here' }).click();
```java
// Setup the handler.
page.addLocatorHandler(page.getByText("Confirm your security details")), () => {
page.addLocatorHandler(page.getByText("Confirm your security details"), () -> {
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Remind me later")).click();
});
// Write the test as usual.
page.goto("https://example.com");
page.navigate("https://example.com");
page.getByRole("button", Page.GetByRoleOptions().setName("Start here")).click();
```
@ -3275,12 +3275,12 @@ await page.getByRole('button', { name: 'Start here' }).click();
```java
// Setup the handler.
page.addLocatorHandler(page.locator("body")), () => {
page.addLocatorHandler(page.locator("body"), () -> {
page.evaluate("window.removeObstructionsForTestIfNeeded()");
}, new Page.AddLocatorHandlerOptions.setNoWaitAfter(true));
}, new Page.AddLocatorHandlerOptions().setNoWaitAfter(true));
// Write the test as usual.
page.goto("https://example.com");
page.navigate("https://example.com");
page.getByRole("button", Page.GetByRoleOptions().setName("Start here")).click();
```
@ -3326,7 +3326,7 @@ await page.addLocatorHandler(page.getByLabel('Close'), async locator => {
```
```java
page.addLocatorHandler(page.getByLabel("Close"), locator => {
page.addLocatorHandler(page.getByLabel("Close"), locator -> {
locator.click();
}, new Page.AddLocatorHandlerOptions().setTimes(1));
```
@ -3607,9 +3607,7 @@ Enabling routing disables http cache.
* since: v1.8
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]>
A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
When a [`option: Browser.newContext.baseURL`] via the context options was provided and the passed URL is a path,
it gets merged via the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.
A glob pattern, regex pattern, or predicate that receives a [URL] to match during routing. If [`option: Browser.newContext.baseURL`] is set in the context options and the provided URL is a string that does not start with `*`, it is resolved using the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.
### param: Page.route.handler
* since: v1.8
@ -3699,8 +3697,8 @@ await page.routeWebSocket('/ws', ws => {
```java
page.routeWebSocket("/ws", ws -> {
ws.onMessage(message -> {
if ("request".equals(message))
ws.onMessage(frame -> {
if ("request".equals(frame.text()))
ws.send("response");
});
});
@ -3730,8 +3728,8 @@ page.route_web_socket("/ws", handler)
```csharp
await page.RouteWebSocketAsync("/ws", ws => {
ws.OnMessage(message => {
if (message == "request")
ws.OnMessage(frame => {
if (frame.Text == "request")
ws.Send("response");
});
});
@ -3982,7 +3980,7 @@ This setting will change the default maximum time for all the methods accepting
* since: v1.8
- `timeout` <[float]>
Maximum time in milliseconds
Maximum time in milliseconds. Pass `0` to disable timeout.
## async method: Page.setExtraHTTPHeaders
* since: v1.8

View File

@ -14,14 +14,14 @@ test('navigates to login', async ({ page }) => {
```
```java
...
// ...
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
public class TestPage {
...
// ...
@Test
void navigatesToLoginPage() {
...
// ...
page.getByText("Sign in").click();
assertThat(page).hasURL(Pattern.compile(".*/login"));
}
@ -296,7 +296,18 @@ Ensures the page is navigated to the given URL.
**Usage**
```js
await expect(page).toHaveURL(/.*checkout/);
// Check for the page URL to be 'https://playwright.dev/docs/intro' (including query string)
await expect(page).toHaveURL('https://playwright.dev/docs/intro');
// Check for the page URL to contain 'doc', followed by an optional 's', followed by '/'
await expect(page).toHaveURL(/docs?\//);
// Check for the predicate to be satisfied
// For example: verify query strings
await expect(page).toHaveURL(url => {
const params = url.searchParams;
return params.has('search') && params.has('options') && params.get('id') === '5';
});
```
```java
@ -323,8 +334,17 @@ expect(page).to_have_url(re.compile(".*checkout"))
await Expect(Page).ToHaveURLAsync(new Regex(".*checkout"));
```
### param: PageAssertions.toHaveURL.url
* since: v1.18
* langs: js
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]>
Expected URL string, RegExp, or predicate receiving [URL] to match.
When [`option: Browser.newContext.baseURL`] is provided via the context options and the `url` argument is a string, the two values are merged via the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor and used for the comparison against the current browser URL.
### param: PageAssertions.toHaveURL.urlOrRegExp
* since: v1.18
* langs: csharp, python, java
- `urlOrRegExp` <[string]|[RegExp]>
Expected URL string or RegExp.
@ -333,7 +353,7 @@ Expected URL string or RegExp.
* since: v1.44
- `ignoreCase` <[boolean]>
Whether to perform case-insensitive match. [`option: ignoreCase`] option takes precedence over the corresponding regular expression flag if specified.
Whether to perform case-insensitive match. [`option: ignoreCase`] option takes precedence over the corresponding regular expression parameter if specified. A provided predicate ignores this flag.
### option: PageAssertions.toHaveURL.timeout = %%-js-assertions-timeout-%%
* since: v1.18

View File

@ -35,14 +35,13 @@ def test_status_becomes_submitted(page: Page) -> None:
```
```java
...
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
public class TestExample {
...
// ...
@Test
void statusBecomesSubmitted() {
...
// ...
page.locator("#submit-button").click();
assertThat(page.locator(".status")).hasText("Submitted");
}

View File

@ -102,10 +102,14 @@ await page.RouteAsync("**/*", async route =>
**Details**
Note that any overrides such as [`option: url`] or [`option: headers`] only apply to the request being routed. If this request results in a redirect, overrides will not be applied to the new redirected request. If you want to propagate a header through redirects, use the combination of [`method: Route.fetch`] and [`method: Route.fulfill`] instead.
The [`option: headers`] option applies to both the routed request and any redirects it initiates. However, [`option: url`], [`option: method`], and [`option: postData`] only apply to the original request and are not carried over to redirected requests.
[`method: Route.continue`] will immediately send the request to the network, other matching handlers won't be invoked. Use [`method: Route.fallback`] If you want next matching handler in the chain to be invoked.
:::warning
The `Cookie` header cannot be overridden using this method. If a value is provided, it will be ignored, and the cookie will be loaded from the browser's cookie store. To set custom cookies, use [`method: BrowserContext.addCookies`].
:::
### option: Route.continue.url
* since: v1.8
- `url` <[string]>

View File

@ -4,6 +4,8 @@
The Touchscreen class operates in main-frame CSS pixels relative to the top-left corner of the viewport. Methods on the
touchscreen can only be used in browser contexts that have been initialized with `hasTouch` set to true.
This class is limited to emulating tap gestures. For examples of other gestures simulated by manually dispatching touch events, see the [emulating legacy touch events](../touch-events.md) page.
## async method: Touchscreen.tap
* since: v1.8

View File

@ -281,6 +281,80 @@ given name prefix inside the [`option: BrowserType.launch.tracesDir`] directory
To specify the final trace zip file name, you need to pass `path` option to
[`method: Tracing.stopChunk`] instead.
## async method: Tracing.group
* since: v1.49
:::caution
Use `test.step` instead when available.
:::
Creates a new group within the trace, assigning any subsequent API calls to this group, until [`method: Tracing.groupEnd`] is called. Groups can be nested and will be visible in the trace viewer.
**Usage**
```js
// use test.step instead
await test.step('Log in', async () => {
// ...
});
```
```java
// All actions between group and groupEnd
// will be shown in the trace viewer as a group.
page.context().tracing().group("Open Playwright.dev > API");
page.navigate("https://playwright.dev/");
page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("API")).click();
page.context().tracing().groupEnd();
```
```python sync
# All actions between group and group_end
# will be shown in the trace viewer as a group.
page.context.tracing.group("Open Playwright.dev > API")
page.goto("https://playwright.dev/")
page.get_by_role("link", name="API").click()
page.context.tracing.group_end()
```
```python async
# All actions between group and group_end
# will be shown in the trace viewer as a group.
await page.context.tracing.group("Open Playwright.dev > API")
await page.goto("https://playwright.dev/")
await page.get_by_role("link", name="API").click()
await page.context.tracing.group_end()
```
```csharp
// All actions between GroupAsync and GroupEndAsync
// will be shown in the trace viewer as a group.
await Page.Context.Tracing.GroupAsync("Open Playwright.dev > API");
await Page.GotoAsync("https://playwright.dev/");
await Page.GetByRole(AriaRole.Link, new() { Name = "API" }).ClickAsync();
await Page.Context.Tracing.GroupEndAsync();
```
### param: Tracing.group.name
* since: v1.49
- `name` <[string]>
Group name shown in the trace viewer.
### option: Tracing.group.location
* since: v1.49
- `location` ?<[Object]>
- `file` <[string]>
- `line` ?<[int]>
- `column` ?<[int]>
Specifies a custom location for the group to be shown in the trace viewer. Defaults to the location of the [`method: Tracing.group`] call.
## async method: Tracing.groupEnd
* since: v1.49
Closes the last group created by [`method: Tracing.group`].
## async method: Tracing.stop
* since: v1.12

View File

@ -1,7 +1,9 @@
# class: WebSocket
* since: v1.8
The [WebSocket] class represents websocket connections in the page.
The [WebSocket] class represents WebSocket connections within a page. It provides the ability to inspect and manipulate the data being transmitted and received.
If you want to intercept or modify WebSocket frames, consider using [WebSocketRoute].
## event: WebSocket.close
* since: v1.8

View File

@ -8,7 +8,7 @@ Whenever a [`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSoc
By default, the routed WebSocket will not connect to the server. This way, you can mock entire communcation over the WebSocket. Here is an example that responds to a `"request"` with a `"response"`.
```js
await page.routeWebSocket('/ws', ws => {
await page.routeWebSocket('wss://example.com/ws', ws => {
ws.onMessage(message => {
if (message === 'request')
ws.send('response');
@ -17,9 +17,9 @@ await page.routeWebSocket('/ws', ws => {
```
```java
page.routeWebSocket("/ws", ws -> {
ws.onMessage(message -> {
if ("request".equals(message))
page.routeWebSocket("wss://example.com/ws", ws -> {
ws.onMessage(frame -> {
if ("request".equals(frame.text()))
ws.send("response");
});
});
@ -30,7 +30,7 @@ def message_handler(ws: WebSocketRoute, message: Union[str, bytes]):
if message == "request":
ws.send("response")
await page.route_web_socket("/ws", lambda ws: ws.on_message(
await page.route_web_socket("wss://example.com/ws", lambda ws: ws.on_message(
lambda message: message_handler(ws, message)
))
```
@ -40,15 +40,15 @@ def message_handler(ws: WebSocketRoute, message: Union[str, bytes]):
if message == "request":
ws.send("response")
page.route_web_socket("/ws", lambda ws: ws.on_message(
page.route_web_socket("wss://example.com/ws", lambda ws: ws.on_message(
lambda message: message_handler(ws, message)
))
```
```csharp
await page.RouteWebSocketAsync("/ws", ws => {
ws.OnMessage(message => {
if (message == "request")
await page.RouteWebSocketAsync("wss://example.com/ws", ws => {
ws.OnMessage(frame => {
if (frame.Text == "request")
ws.Send("response");
});
});
@ -56,6 +56,69 @@ await page.RouteWebSocketAsync("/ws", ws => {
Since we do not call [`method: WebSocketRoute.connectToServer`] inside the WebSocket route handler, Playwright assumes that WebSocket will be mocked, and opens the WebSocket inside the page automatically.
Here is another example that handles JSON messages:
```js
await page.routeWebSocket('wss://example.com/ws', ws => {
ws.onMessage(message => {
const json = JSON.parse(message);
if (json.request === 'question')
ws.send(JSON.stringify({ response: 'answer' }));
});
});
```
```java
page.routeWebSocket("wss://example.com/ws", ws -> {
ws.onMessage(frame -> {
JsonObject json = new JsonParser().parse(frame.text()).getAsJsonObject();
if ("question".equals(json.get("request").getAsString())) {
Map<String, String> result = new HashMap();
result.put("response", "answer");
ws.send(gson.toJson(result));
}
});
});
```
```python async
def message_handler(ws: WebSocketRoute, message: Union[str, bytes]):
json_message = json.loads(message)
if json_message["request"] == "question":
ws.send(json.dumps({ "response": "answer" }))
await page.route_web_socket("wss://example.com/ws", lambda ws: ws.on_message(
lambda message: message_handler(ws, message)
))
```
```python sync
def message_handler(ws: WebSocketRoute, message: Union[str, bytes]):
json_message = json.loads(message)
if json_message["request"] == "question":
ws.send(json.dumps({ "response": "answer" }))
page.route_web_socket("wss://example.com/ws", lambda ws: ws.on_message(
lambda message: message_handler(ws, message)
))
```
```csharp
await page.RouteWebSocketAsync("wss://example.com/ws", ws => {
ws.OnMessage(frame => {
using var jsonDoc = JsonDocument.Parse(frame.Text);
JsonElement root = jsonDoc.RootElement;
if (root.TryGetProperty("request", out JsonElement requestElement) && requestElement.GetString() == "question")
{
var response = new Dictionary<string, string> { ["response"] = "answer" };
string jsonResponse = JsonSerializer.Serialize(response);
ws.Send(jsonResponse);
}
});
});
```
**Intercepting**
Alternatively, you may want to connect to the actual server, but intercept messages in-between and modify or block them. Calling [`method: WebSocketRoute.connectToServer`] returns a server-side `WebSocketRoute` instance that you can send messages to, or handle incoming messages.
@ -77,11 +140,11 @@ await page.routeWebSocket('/ws', ws => {
```java
page.routeWebSocket("/ws", ws -> {
WebSocketRoute server = ws.connectToServer();
ws.onMessage(message -> {
if ("request".equals(message))
ws.onMessage(frame -> {
if ("request".equals(frame.text()))
server.send("request2");
else
server.send(message);
server.send(frame.text());
});
});
```
@ -117,11 +180,11 @@ page.route_web_socket("/ws", handler)
```csharp
await page.RouteWebSocketAsync("/ws", ws => {
var server = ws.ConnectToServer();
ws.OnMessage(message => {
if (message == "request")
ws.OnMessage(frame => {
if (frame.Text == "request")
server.Send("request2");
else
server.Send(message);
server.Send(frame.Text);
});
});
```
@ -152,13 +215,13 @@ await page.routeWebSocket('/ws', ws => {
```java
page.routeWebSocket("/ws", ws -> {
WebSocketRoute server = ws.connectToServer();
ws.onMessage(message -> {
if (!"blocked-from-the-page".equals(message))
server.send(message);
ws.onMessage(frame -> {
if (!"blocked-from-the-page".equals(frame.text()))
server.send(frame.text());
});
server.onMessage(message -> {
if (!"blocked-from-the-server".equals(message))
ws.send(message);
server.onMessage(frame -> {
if (!"blocked-from-the-server".equals(frame.text()))
ws.send(frame.text());
});
});
```
@ -200,13 +263,13 @@ page.route_web_socket("/ws", handler)
```csharp
await page.RouteWebSocketAsync("/ws", ws => {
var server = ws.ConnectToServer();
ws.OnMessage(message => {
if (message != "blocked-from-the-page")
server.Send(message);
ws.OnMessage(frame => {
if (frame.Text != "blocked-from-the-page")
server.Send(frame.Text);
});
server.OnMessage(message => {
if (message != "blocked-from-the-server")
ws.Send(message);
server.OnMessage(frame => {
if (frame.Text != "blocked-from-the-server")
ws.Send(frame.Text);
});
});
```
@ -255,13 +318,26 @@ By default, closing one side of the connection, either in the page or on the ser
### param: WebSocketRoute.onClose.handler
* since: v1.48
- `handler` <[function]\([number]|[undefined], [string]|[undefined]\): [Promise<any>|any]>
* langs: js, python
- `handler` <[function]\([int]|[undefined], [string]|[undefined]\): [Promise<any>|any]>
Function that will handle WebSocket closure. Received an optional [close code](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close#code) and an optional [close reason](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close#reason).
### param: WebSocketRoute.onClose.handler
* since: v1.48
* langs: java
- `handler` <[function]\([null]|[int], [null]|[string]\)>
Function that will handle WebSocket closure. Received an optional [close code](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close#code) and an optional [close reason](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close#reason).
## async method: WebSocketRoute.onMessage
### param: WebSocketRoute.onClose.handler
* since: v1.48
* langs: csharp
- `handler` <[function]\([int?], [string]\)>
Function that will handle WebSocket closure. Received an optional [close code](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close#code) and an optional [close reason](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close#reason).
## method: WebSocketRoute.onMessage
* since: v1.48
This method allows to handle messages that are sent by the WebSocket, either from the page or from the server.

View File

@ -259,9 +259,9 @@ Specify environment variables that will be visible to the browser. Defaults to `
- `httpOnly` <[boolean]>
- `secure` <[boolean]>
- `sameSite` <[SameSiteAttribute]<"Strict"|"Lax"|"None">> sameSite flag
- `origins` <[Array]<[Object]>> localStorage to set for context
- `origins` <[Array]<[Object]>>
- `origin` <[string]>
- `localStorage` <[Array]<[Object]>>
- `localStorage` <[Array]<[Object]>> localStorage to set for context
- `name` <[string]>
- `value` <[string]>
@ -363,7 +363,7 @@ Target URL.
## js-fetch-option-params
* langs: js
- `params` <[Object]<[string], [string]|[number]|[boolean]>|[URLSearchParams]|[string]>
- `params` <[Object]<[string], [string]|[float]|[boolean]>|[URLSearchParams]|[string]>
Query parameters to be sent with the URL.
@ -639,14 +639,14 @@ If no origin is specified, the username and password are sent to any servers upo
* langs: js, java
- `colorScheme` <null|[ColorScheme]<"light"|"dark"|"no-preference">>
Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See
Emulates [prefers-colors-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) media feature, supported values are `'light'` and `'dark'`. See
[`method: Page.emulateMedia`] for more details. Passing `null` resets emulation to system defaults. Defaults to `'light'`.
## context-option-colorscheme-csharp-python
* langs: csharp, python
- `colorScheme` <[ColorScheme]<"light"|"dark"|"no-preference"|"null">>
Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See
Emulates [prefers-colors-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) media feature, supported values are `'light'` and `'dark'`. See
[`method: Page.emulateMedia`] for more details. Passing `'null'` resets emulation to system defaults. Defaults to `'light'`.
## context-option-reducedMotion
@ -673,6 +673,18 @@ Emulates `'forced-colors'` media feature, supported values are `'active'`, `'non
Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See [`method: Page.emulateMedia`] for more details. Passing `'null'` resets emulation to system defaults. Defaults to `'none'`.
## context-option-contrast
* langs: js, java
- `contrast` <null|[Contrast]<"no-preference"|"more">>
Emulates `'prefers-contrast'` media feature, supported values are `'no-preference'`, `'more'`. See [`method: Page.emulateMedia`] for more details. Passing `null` resets emulation to system defaults. Defaults to `'no-preference'`.
## context-option-contrast-csharp-python
* langs: csharp, python
- `contrast` <[Contrast]<"no-preference"|"more"|"null">>
Emulates `'prefers-contrast'` media feature, supported values are `'no-preference'`, `'more'`. See [`method: Page.emulateMedia`] for more details. Passing `'null'` resets emulation to system defaults. Defaults to `'no-preference'`.
## context-option-logger
* langs: js
- `logger` <[Logger]>
@ -973,6 +985,8 @@ between the same pixel in compared images, between zero (strict) and one (lax),
- %%-context-option-reducedMotion-csharp-python-%%
- %%-context-option-forcedColors-%%
- %%-context-option-forcedColors-csharp-python-%%
- %%-context-option-contrast-%%
- %%-context-option-contrast-csharp-python-%%
- %%-context-option-logger-%%
- %%-context-option-videospath-%%
- %%-context-option-videosize-%%
@ -1001,7 +1015,11 @@ Additional arguments to pass to the browser instance. The list of Chromium flags
## browser-option-channel
- `channel` <[string]>
Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", "msedge-canary". Read more about using [Google Chrome and Microsoft Edge](../browsers.md#google-chrome--microsoft-edge).
Browser distribution channel.
Use "chromium" to [opt in to new headless mode](../browsers.md#chromium-new-headless-mode).
Use "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", or "msedge-canary" to use branded [Google Chrome and Microsoft Edge](../browsers.md#google-chrome--microsoft-edge).
## browser-option-chromiumsandbox
- `chromiumSandbox` <[boolean]>
@ -1043,7 +1061,7 @@ Close the browser process on SIGHUP. Defaults to `true`.
Whether to run browser in headless mode. More details for
[Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and
[Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode). Defaults to `true` unless the
[Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true` unless the
[`option: BrowserType.launch.devtools`] option is `true`.
## js-python-browser-option-firefoxuserprefs
@ -1136,6 +1154,11 @@ Note that outer and inner locators must belong to the same frame. Inner locator
Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When passed a [string], matching is case-insensitive and searches for a substring.
## locator-option-visible
- `visible` <[boolean]>
Only matches visible or invisible elements.
## locator-options-list-v1.14
- %%-locator-option-has-text-%%
- %%-locator-option-has-%%
@ -1186,6 +1209,7 @@ Specify screenshot type, defaults to `png`.
Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with
a pink box `#FF00FF` (customized by [`option: maskColor`]) that completely covers its bounding box.
The mask is also applied to invisible elements, see [Matching only visible elements](../locators.md#matching-only-visible-elements) to disable that.
## screenshot-option-mask-color
* since: v1.35
@ -1488,19 +1512,19 @@ page.get_by_text(re.compile("^hello$", re.IGNORECASE))
```java
// Matches <span>
page.getByText("world")
page.getByText("world");
// Matches first <div>
page.getByText("Hello world")
page.getByText("Hello world");
// Matches second <div>
page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
page.getByText("Hello", new Page.GetByTextOptions().setExact(true));
// Matches both <div>s
page.getByText(Pattern.compile("Hello"))
page.getByText(Pattern.compile("Hello"));
// Matches second <div>
page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE));
```
```csharp
@ -1754,7 +1778,9 @@ await Expect(Page.GetByTitle("Issues count")).toHaveText("25 issues");
- `type` ?<[string]>
* langs: js
This option configures a template controlling location of snapshots generated by [`method: PageAssertions.toHaveScreenshot#1`] and [`method: SnapshotAssertions.toMatchSnapshot#1`].
This option configures a template controlling location of snapshots generated by [`method: PageAssertions.toHaveScreenshot#1`], [`method: LocatorAssertions.toMatchAriaSnapshot#2`] and [`method: SnapshotAssertions.toMatchSnapshot#1`].
You can configure templates for each assertion separately in [`property: TestConfig.expect`].
**Usage**
@ -1763,7 +1789,19 @@ import { defineConfig } from '@playwright/test';
export default defineConfig({
testDir: './tests',
// Single template for all assertions
snapshotPathTemplate: '{testDir}/__screenshots__/{testFilePath}/{arg}{ext}',
// Assertion-specific templates
expect: {
toHaveScreenshot: {
pathTemplate: '{testDir}/__screenshots__{/projectName}/{testFilePath}/{arg}{ext}',
},
toMatchAriaSnapshot: {
pathTemplate: '{testDir}/__snapshots__/{testFilePath}/{arg}{ext}',
},
},
});
```
@ -1794,22 +1832,22 @@ test.describe('suite', () => {
The list of supported tokens:
* `{arg}` - Relative snapshot path **without extension**. These come from the arguments passed to the `toHaveScreenshot()` and `toMatchSnapshot()` calls; if called without arguments, this will be an auto-generated snapshot name.
* `{arg}` - Relative snapshot path **without extension**. This comes from the arguments passed to `toHaveScreenshot()`, `toMatchAriaSnapshot()` or `toMatchSnapshot()`; if called without arguments, this will be an auto-generated snapshot name.
* Value: `foo/bar/baz`
* `{ext}` - snapshot extension (with dots)
* `{ext}` - Snapshot extension (with the leading dot).
* Value: `.png`
* `{platform}` - The value of `process.platform`.
* `{projectName}` - Project's file-system-sanitized name, if any.
* Value: `''` (empty string).
* `{snapshotDir}` - Project's [`property: TestConfig.snapshotDir`].
* `{snapshotDir}` - Project's [`property: TestProject.snapshotDir`].
* Value: `/home/playwright/tests` (since `snapshotDir` is not provided in config, it defaults to `testDir`)
* `{testDir}` - Project's [`property: TestConfig.testDir`].
* Value: `/home/playwright/tests` (absolute path is since `testDir` is resolved relative to directory with config)
* `{testDir}` - Project's [`property: TestProject.testDir`].
* Value: `/home/playwright/tests` (absolute path since `testDir` is resolved relative to directory with config)
* `{testFileDir}` - Directories in relative path from `testDir` to **test file**.
* Value: `page`
* `{testFileName}` - Test file name with extension.
* Value: `page-click.spec.ts`
* `{testFilePath}` - Relative path from `testDir` to **test file**
* `{testFilePath}` - Relative path from `testDir` to **test file**.
* Value: `page/page-click.spec.ts`
* `{testName}` - File-system-sanitized test title, including parent describes but excluding file name.
* Value: `suite-test-should-work`

574
docs/src/aria-snapshots.md Normal file
View File

@ -0,0 +1,574 @@
---
id: aria-snapshots
title: "Snapshot testing"
---
import LiteYouTube from '@site/src/components/LiteYouTube';
## Overview
With Playwright's Snapshot testing you can assert the accessibility tree of a page against a predefined snapshot template.
```js
await page.goto('https://playwright.dev/');
await expect(page.getByRole('banner')).toMatchAriaSnapshot(`
- banner:
- heading /Playwright enables reliable end-to-end/ [level=1]
- link "Get started"
- link "Star microsoft/playwright on GitHub"
- link /[\\d]+k\\+ stargazers on GitHub/
`);
```
```python sync
page.goto('https://playwright.dev/')
expect(page.query_selector('banner')).to_match_aria_snapshot("""
- banner:
- heading /Playwright enables reliable end-to-end/ [level=1]
- link "Get started"
- link "Star microsoft/playwright on GitHub"
- link /[\\d]+k\\+ stargazers on GitHub/
""")
```
```python async
await page.goto('https://playwright.dev/')
await expect(page.query_selector('banner')).to_match_aria_snapshot("""
- banner:
- heading /Playwright enables reliable end-to-end/ [level=1]
- link "Get started"
- link "Star microsoft/playwright on GitHub"
- link /[\\d]+k\\+ stargazers on GitHub/
""")
```
```java
page.navigate("https://playwright.dev/");
assertThat(page.locator("banner")).matchesAriaSnapshot("""
- banner:
- heading /Playwright enables reliable end-to-end/ [level=1]
- link "Get started"
- link "Star microsoft/playwright on GitHub"
- link /[\\d]+k\\+ stargazers on GitHub/
""");
```
```csharp
await page.GotoAsync("https://playwright.dev/");
await Expect(page.Locator("banner")).ToMatchAriaSnapshotAsync(@"
- banner:
- heading ""Playwright enables reliable end-to-end testing for modern web apps."" [level=1]
- link ""Get started""
- link ""Star microsoft/playwright on GitHub""
- link /[\\d]+k\\+ stargazers on GitHub/
");
```
<LiteYouTube
id="P4R6hnsE0UY"
title="Getting started with ARIA Snapshots"
/>
## Assertion testing vs Snapshot testing
Snapshot testing and assertion testing serve different purposes in test automation:
### Assertion testing
Assertion testing is a targeted approach where you assert specific values or conditions about elements or components. For instance, with Playwright, [`method: LocatorAssertions.toHaveText`]
verifies that an element contains the expected text, and [`method: LocatorAssertions.toHaveValue`]
confirms that an input field has the expected value.
Assertion tests are specific and generally check the current state of an element or property
against an expected, predefined state.
They work well for predictable, single-value checks but are limited in scope when testing the
broader structure or variations.
**Advantages**
- **Clarity**: The intent of the test is explicit and easy to understand.
- **Specificity**: Tests focus on particular aspects of functionality, making them more robust
against unrelated changes.
- **Debugging**: Failures provide targeted feedback, pointing directly to the problematic aspect.
**Disadvantages**
- **Verbose for complex outputs**: Writing assertions for complex data structures or large outputs
can be cumbersome and error-prone.
- **Maintenance overhead**: As code evolves, manually updating assertions can be time-consuming.
### Snapshot testing
Snapshot testing captures a “snapshot” or representation of the entire
state of an element, component, or data at a given moment, which is then saved for future
comparisons. When re-running tests, the current state is compared to the snapshot, and if there
are differences, the test fails. This approach is especially useful for complex or dynamic
structures, where manually asserting each detail would be too time-consuming. Snapshot testing
is broader and more holistic than assertion testing, allowing you to track more complex changes over time.
**Advantages**
- **Simplifies complex outputs**: For example, testing a UI component's rendered output can be tedious with traditional assertions. Snapshots capture the entire output for easy comparison.
- **Quick Feedback loop**: Developers can easily spot unintended changes in the output.
- **Encourages consistency**: Helps maintain consistent output as code evolves.
**Disadvantages**
- **Over-Reliance**: It can be tempting to accept changes to snapshots without fully understanding
them, potentially hiding bugs.
- **Granularity**: Large snapshots may be hard to interpret when differences arise, especially
if minor changes affect large portions of the output.
- **Suitability**: Not ideal for highly dynamic content where outputs change frequently or
unpredictably.
### When to use
- **Snapshot testing** is ideal for:
- UI testing of whole pages and components.
- Broad structural checks for complex UI components.
- Regression testing for outputs that rarely change structure.
- **Assertion testing** is ideal for:
- Core logic validation.
- Computed value testing.
- Fine-grained tests requiring precise conditions.
By combining snapshot testing for broad, structural checks and assertion testing for specific functionality, you can achieve a well-rounded testing strategy.
## Aria snapshots
In Playwright, aria snapshots provide a YAML representation of the accessibility tree of a page.
These snapshots can be stored and compared later to verify if the page structure remains consistent or meets defined
expectations.
The YAML format describes the hierarchical structure of accessible elements on the page, detailing **roles**, **attributes**, **values**, and **text content**.
The structure follows a tree-like syntax, where each node represents an accessible element, and indentation indicates
nested elements.
Each accessible element in the tree is represented as a YAML node:
```yaml
- role "name" [attribute=value]
```
- **role**: Specifies the ARIA or HTML role of the element (e.g., `heading`, `list`, `listitem`, `button`).
- **"name"**: Accessible name of the element. Quoted strings indicate exact values, `/patterns/` are used for regular expression.
- **[attribute=value]**: Attributes and values, in square brackets, represent specific ARIA attributes, such
as `checked`, `disabled`, `expanded`, `level`, `pressed`, or `selected`.
These values are derived from ARIA attributes or calculated based on HTML semantics. To inspect the accessibility tree
structure of a page, use the [Chrome DevTools Accessibility Tab](https://developer.chrome.com/docs/devtools/accessibility/reference#tab).
## Snapshot matching
The [`method: LocatorAssertions.toMatchAriaSnapshot`] assertion method in Playwright compares the accessible
structure of the locator scope with a predefined aria snapshot template, helping validate the page's state against
testing requirements.
For the following DOM:
```html
<h1>title</h1>
```
You can match it using the following snapshot template:
```js
await expect(page.locator('body')).toMatchAriaSnapshot(`
- heading "title"
`);
```
```python sync
expect(page.locator("body")).to_match_aria_snapshot("""
- heading "title"
""")
```
```python async
await expect(page.locator("body")).to_match_aria_snapshot("""
- heading "title"
""")
```
```java
assertThat(page.locator("body")).matchesAriaSnapshot("""
- heading "title"
""");
```
```csharp
await Expect(page.Locator("body")).ToMatchAriaSnapshotAsync(@"
- heading ""title""
");
```
When matching, the snapshot template is compared to the current accessibility tree of the page:
* If the tree structure matches the template, the test passes; otherwise, it fails, indicating a mismatch between
expected and actual accessibility states.
* The comparison is case-sensitive and collapses whitespace, so indentation and line breaks are ignored.
* The comparison is order-sensitive, meaning the order of elements in the snapshot template must match the order in the
page's accessibility tree.
### Partial matching
You can perform partial matches on nodes by omitting attributes or accessible names, enabling verification of specific
parts of the accessibility tree without requiring exact matches. This flexibility is helpful for dynamic or irrelevant
attributes.
```html
<button>Submit</button>
```
*aria snapshot*
```yaml
- button
```
In this example, the button role is matched, but the accessible name ("Submit") is not specified, allowing the test to
pass regardless of the button's label.
<hr/>
For elements with ARIA attributes like `checked` or `disabled`, omitting these attributes allows partial matching,
focusing solely on role and hierarchy.
```html
<input type="checkbox" checked>
```
*aria snapshot for partial match*
```yaml
- checkbox
```
In this partial match, the `checked` attribute is ignored, so the test will pass regardless of the checkbox state.
<hr/>
Similarly, you can partially match children in lists or groups by omitting specific list items or nested elements.
```html
<ul>
<li>Feature A</li>
<li>Feature B</li>
<li>Feature C</li>
</ul>
```
*aria snapshot for partial match*
```yaml
- list
- listitem: Feature B
```
Partial matches let you create flexible snapshot tests that verify essential page structure without enforcing
specific content or attributes.
### Strict matching
By default, a template containing the subset of children will be matched:
```html
<ul>
<li>Feature A</li>
<li>Feature B</li>
<li>Feature C</li>
</ul>
```
*aria snapshot for partial match*
```yaml
- list
- listitem: Feature B
```
The `/children` property can be used to control how child elements are matched:
- `contain` (default): Matches if all specified children are present in order
- `equal`: Matches if the children exactly match the specified list in order
- `deep-equal`: Matches if the children exactly match the specified list in order, including nested children
```html
<ul>
<li>Feature A</li>
<li>Feature B</li>
<li>Feature C</li>
</ul>
```
*aria snapshot will fail due to Feature C not being in the template*
```yaml
- list
- /children: equal
- listitem: Feature A
- listitem: Feature B
```
### Matching with regular expressions
Regular expressions allow flexible matching for elements with dynamic or variable text. Accessible names and text can
support regex patterns.
```html
<h1>Issues 12</h1>
```
*aria snapshot with regular expression*
```yaml
- heading /Issues \d+/
```
## Generating snapshots
Creating aria snapshots in Playwright helps ensure and maintain your application's structure.
You can generate snapshots in various ways depending on your testing setup and workflow.
### Generating snapshots with the Playwright code generator
If you're using Playwright's [Code Generator](./codegen.md), generating aria snapshots is streamlined with its
interactive interface:
- **"Assert snapshot" Action**: In the code generator, you can use the "Assert snapshot" action to automatically create
a snapshot assertion for the selected elements. This is a quick way to capture the aria snapshot as part of your
recorded test flow.
- **"Aria snapshot" Tab**: The "Aria snapshot" tab within the code generator interface visually represents the
aria snapshot for a selected locator, letting you explore, inspect, and verify element roles, attributes, and
accessible names to aid snapshot creation and review.
### Updating snapshots with `@playwright/test` and the `--update-snapshots` flag
* langs: js
When using the Playwright test runner (`@playwright/test`), you can automatically update snapshots with the `--update-snapshots` flag, `-u` for short.
Running tests with the `--update-snapshots` flag will update snapshots that did not match. Matching snapshots will not be updated.
```bash
npx playwright test --update-snapshots
```
Updating snapshots is useful when application structure changes require new snapshots as a baseline. Note that Playwright will wait for the maximum expect timeout specified in the test runner configuration to ensure the page is settled before taking the snapshot. It might be necessary to adjust the `--timeout` if the test hits the timeout while generating snapshots.
#### Empty template for snapshot generation
Passing an empty string as the template in an assertion generates a snapshot on-the-fly:
```js
await expect(locator).toMatchAriaSnapshot('');
```
Note that Playwright will wait for the maximum expect timeout specified in the test runner configuration to ensure the
page is settled before taking the snapshot. It might be necessary to adjust the `--timeout` if the test hits the timeout
while generating snapshots.
#### Snapshot patch files
When updating snapshots, Playwright creates patch files that capture differences. These patch files can be reviewed,
applied, and committed to source control, allowing teams to track structural changes over time and ensure updates are
consistent with application requirements.
The way source code is updated can be changed using the `--update-source-method` flag. There are several options available:
- **"patch"** (default): Generates a unified diff file that can be applied to the source code using `git apply`.
- **"3way"**: Generates merge conflict markers in your source code, allowing you to choose whether to accept changes.
- **"overwrite"**: Overwrites the source code with the new snapshot values.
```bash
npx playwright test --update-snapshots --update-source-method=3way
```
#### Snapshots as separate files
To store your snapshots in a separate file, use the `toMatchAriaSnapshot` method with the `name` option, specifying a `.aria.yml` file extension.
```js
await expect(page.getByRole('main')).toMatchAriaSnapshot({ name: 'main.aria.yml' });
```
By default, snapshots from a test file `example.spec.ts` are placed in the `example.spec.ts-snapshots` directory. As snapshots should be the same across browsers, only one snapshot is saved even if testing with multiple browsers. Should you wish, you can customize the [snapshot path template](./api/class-testconfig#test-config-snapshot-path-template) using the following configuration:
```js
export default defineConfig({
expect: {
toMatchAriaSnapshot: {
pathTemplate: '__snapshots__/{testFilePath}/{arg}{ext}',
},
},
});
```
### Using the `Locator.ariaSnapshot` method
The [`method: Locator.ariaSnapshot`] method allows you to programmatically create a YAML representation of accessible
elements within a locator's scope, especially helpful for generating snapshots dynamically during test execution.
**Example**:
```js
const snapshot = await page.locator('body').ariaSnapshot();
console.log(snapshot);
```
```python sync
snapshot = page.locator("body").aria_snapshot()
print(snapshot)
```
```python async
snapshot = await page.locator("body").aria_snapshot()
print(snapshot)
```
```java
String snapshot = page.locator("body").ariaSnapshot();
System.out.println(snapshot);
```
```csharp
var snapshot = await page.Locator("body").AriaSnapshotAsync();
Console.WriteLine(snapshot);
```
This command outputs the aria snapshot within the specified locator's scope in YAML format, which you can validate
or store as needed.
## Accessibility tree examples
### Headings with level attributes
Headings can include a `level` attribute indicating their heading level.
```html
<h1>Title</h1>
<h2>Subtitle</h2>
```
*aria snapshot*
```yaml
- heading "Title" [level=1]
- heading "Subtitle" [level=2]
```
### Text nodes
Standalone or descriptive text elements appear as text nodes.
```html
<div>Sample accessible name</div>
```
*aria snapshot*
```yaml
- text: Sample accessible name
```
### Inline multiline text
Multiline text, such as paragraphs, is normalized in the aria snapshot.
```html
<p>Line 1<br>Line 2</p>
```
*aria snapshot*
```yaml
- paragraph: Line 1 Line 2
```
### Links
Links display their text or composed content from pseudo-elements.
```html
<a href="#more-info">Read more about Accessibility</a>
```
*aria snapshot*
```yaml
- link "Read more about Accessibility"
```
### Text boxes
Input elements of type `text` show their `value` attribute content.
```html
<input type="text" value="Enter your name">
```
*aria snapshot*
```yaml
- textbox: Enter your name
```
### Lists with items
Ordered and unordered lists include their list items.
```html
<ul aria-label="Main Features">
<li>Feature 1</li>
<li>Feature 2</li>
</ul>
```
*aria snapshot*
```yaml
- list "Main Features":
- listitem: Feature 1
- listitem: Feature 2
```
### Grouped elements
Groups capture nested elements, such as `<details>` elements with summary content.
```html
<details>
<summary>Summary</summary>
<p>Detail content here</p>
</details>
```
*aria snapshot*
```yaml
- group: Summary
```
### Attributes and states
Commonly used ARIA attributes, like `checked`, `disabled`, `expanded`, `level`, `pressed`, and `selected`, represent
control states.
#### Checkbox with `checked` attribute
```html
<input type="checkbox" checked>
```
*aria snapshot*
```yaml
- checkbox [checked]
```
#### Button with `pressed` attribute
```html
<button aria-pressed="true">Toggle</button>
```
*aria snapshot*
```yaml
- button "Toggle" [pressed=true]
```

View File

@ -13,6 +13,11 @@ Regardless of the authentication strategy you choose, you are likely to store au
We recommend to create `playwright/.auth` directory and add it to your `.gitignore`. Your authentication routine will produce authenticated browser state and save it to a file in this `playwright/.auth` directory. Later on, tests will reuse this state and start already authenticated.
:::danger
The browser state file may contain sensitive cookies and headers that could be used to impersonate you or your test account.
We strongly discourage checking them into private or public repositories.
:::
```bash tab=bash-bash
mkdir -p playwright/.auth
echo $'\nplaywright/.auth' >> .gitignore
@ -232,7 +237,7 @@ await page.goto('https://github.com/login')
# Interact with login form
await page.get_by_label("Username or email address").fill("username")
await page.get_by_label("Password").fill("password")
await page.page.get_by_role("button", name="Sign in").click()
await page.get_by_role("button", name="Sign in").click()
# Continue with the test
```
@ -266,9 +271,9 @@ existing authentication state instead.
Playwright provides a way to reuse the signed-in state in the tests. That way you can log
in only once and then skip the log in step for all of the tests.
Web apps use cookie-based or token-based authentication, where authenticated state is stored as [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) or in [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage). Playwright provides [`method: BrowserContext.storageState`] method that can be used to retrieve storage state from authenticated contexts and then create new contexts with prepopulated state.
Web apps use cookie-based or token-based authentication, where authenticated state is stored as [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), in [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage) or in [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API). Playwright provides [`method: BrowserContext.storageState`] method that can be used to retrieve storage state from authenticated contexts and then create new contexts with prepopulated state.
Cookies and local storage state can be used across different browsers. They depend on your application's authentication model: some apps might require both cookies and local storage.
Cookies, local storage and IndexedDB state can be used across different browsers. They depend on your application's authentication model which may require some combination of cookies, local storage or IndexedDB.
The following code snippet retrieves state from an authenticated context and creates a new context with that state.
@ -583,7 +588,7 @@ test('admin and user', async ({ adminPage, userPage }) => {
### Session storage
Reusing authenticated state covers [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage) based authentication. Rarely, [session storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) is used for storing information associated with the signed-in state. Session storage is specific to a particular domain and is not persisted across page loads. Playwright does not provide API to persist session storage, but the following snippet can be used to save/load session storage.
Reusing authenticated state covers [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage) and [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) based authentication. Rarely, [session storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) is used for storing information associated with the signed-in state. Session storage is specific to a particular domain and is not persisted across page loads. Playwright does not provide API to persist session storage, but the following snippet can be used to save/load session storage.
```js
// Get session storage and store as env variable

View File

@ -90,7 +90,7 @@ await page
#### Prefer user-facing attributes to XPath or CSS selectors
Your DOM can easily change so having your tests depend on your DOM structure can lead to failing tests. For example consider selecting this button by its CSS classes. Should the designer change something then the class might change breaking your test.
Your DOM can easily change so having your tests depend on your DOM structure can lead to failing tests. For example consider selecting this button by its CSS classes. Should the designer change something then the class might change, thus breaking your test.
```js
@ -112,10 +112,41 @@ Playwright has a [test generator](./codegen.md) that can generate tests and pick
To pick a locator run the `codegen` command followed by the URL that you would like to pick a locator from.
<Tabs
groupId="js-package-manager"
defaultValue="npm"
values={[
{label: 'npm', value: 'npm'},
{label: 'yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]
}>
<TabItem value="npm">
```bash
npx playwright codegen playwright.dev
```
</TabItem>
<TabItem value="yarn">
```bash
yarn playwright codegen playwright.dev
```
</TabItem>
<TabItem value="pnpm">
```bash
pnpm exec playwright codegen playwright.dev
```
</TabItem>
</Tabs>
This will open a new browser window as well as the Playwright inspector. To pick a locator first click on the 'Record' button to stop the recording. By default when you run the `codegen` command it will start a new recording. Once you stop the recording the 'Pick Locator' button will be available to click.
You can then hover over any element on your page in the browser window and see the locator highlighted below your cursor. Clicking on an element will add the locator into the Playwright inspector. You can either copy the locator and paste into your test file or continue to explore the locator by editing it in the Playwright Inspector, for example by modifying the text, and seeing the results in the browser window.
@ -170,10 +201,41 @@ You can live debug your test by clicking or editing the locators in your test in
You can also debug your tests with the Playwright inspector by running your tests with the `--debug` flag.
<Tabs
groupId="js-package-manager"
defaultValue="npm"
values={[
{label: 'npm', value: 'npm'},
{label: 'yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]
}>
<TabItem value="npm">
```bash
npx playwright test --debug
```
</TabItem>
<TabItem value="yarn">
```bash
yarn playwright test --debug
```
</TabItem>
<TabItem value="pnpm">
```bash
pnpm exec playwright test --debug
```
</TabItem>
</Tabs>
You can then step through your test, view actionability logs and edit the locator live and see it highlighted in the browser window. This will show you which locators match, how many of them there are.
<img width="1350" alt="debugging with the playwright inspector" loading="lazy" src="https://user-images.githubusercontent.com/13063165/212276296-4f5b18e7-2bd7-4766-9aa5-783517bd4aa2.png" />
@ -182,9 +244,40 @@ You can then step through your test, view actionability logs and edit the locato
To debug a specific test add the name of the test file and the line number of the test followed by the `--debug` flag.
<Tabs
groupId="js-package-manager"
defaultValue="npm"
values={[
{label: 'npm', value: 'npm'},
{label: 'yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]
}>
<TabItem value="npm">
```bash
npx playwright test example.spec.ts:9 --debug
```
</TabItem>
<TabItem value="yarn">
```bash
yarn playwright test example.spec.ts:9 --debug
```
</TabItem>
<TabItem value="pnpm">
```bash
pnpm exec playwright test example.spec.ts:9 --debug
```
</TabItem>
</Tabs>
#### Debugging on CI
For CI failures, use the Playwright [trace viewer](./trace-viewer.md) instead of videos and screenshots. The trace viewer gives you a full trace of your tests as a local Progressive Web App (PWA) that can easily be shared. With the trace viewer you can view the timeline, inspect DOM snapshots for each action using dev tools, view network requests and more.
@ -193,14 +286,77 @@ For CI failures, use the Playwright [trace viewer](./trace-viewer.md) instead of
Traces are configured in the Playwright config file and are set to run on CI on the first retry of a failed test. We don't recommend setting this to `on` so that traces are run on every test as it's very performance heavy. However you can run a trace locally when developing with the `--trace` flag.
<Tabs
groupId="js-package-manager"
defaultValue="npm"
values={[
{label: 'npm', value: 'npm'},
{label: 'yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]
}>
<TabItem value="npm">
```bash
npx playwright test --trace on
```
</TabItem>
<TabItem value="yarn">
```bash
yarn playwright test --trace on
```
</TabItem>
<TabItem value="pnpm">
```bash
pnpm exec playwright test --trace on
```
</TabItem>
</Tabs>
Once you run this command your traces will be recorded for each test and can be viewed directly from the HTML report.
<Tabs
groupId="js-package-manager"
defaultValue="npm"
values={[
{label: 'npm', value: 'npm'},
{label: 'yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]
}>
<TabItem value="npm">
```bash
npx playwright show-report
````
```
</TabItem>
<TabItem value="yarn">
```bash
yarn playwright show-report
```
</TabItem>
<TabItem value="pnpm">
```bash
pnpm exec playwright show-report
```
</TabItem>
</Tabs>
<img width="1516" alt="Playwrights HTML report" loading="lazy" src="https://user-images.githubusercontent.com/13063165/212279022-d929d4c0-2271-486a-a75f-166ac231d25f.png" />
@ -246,23 +402,101 @@ export default defineConfig({
By keeping your Playwright version up to date you will be able to test your app on the latest browser versions and catch failures before the latest browser version is released to the public.
<Tabs
groupId="js-package-manager"
defaultValue="npm"
values={[
{label: 'npm', value: 'npm'},
{label: 'yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]
}>
<TabItem value="npm">
```bash
npm install -D @playwright/test@latest
```
</TabItem>
<TabItem value="yarn">
```bash
yarn add --dev @playwright/test@latest
```
</TabItem>
<TabItem value="pnpm">
```bash
pnpm install --save-dev @playwright/test@latest
```
</TabItem>
</Tabs>
Check the [release notes](./release-notes.md) to see what the latest version is and what changes have been released.
You can see what version of Playwright you have by running the following command.
<Tabs
groupId="js-package-manager"
defaultValue="npm"
values={[
{label: 'npm', value: 'npm'},
{label: 'yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]
}>
<TabItem value="npm">
```bash
npx playwright --version
```
</TabItem>
<TabItem value="yarn">
```bash
yarn playwright --version
```
</TabItem>
<TabItem value="pnpm">
```bash
pnpm exec playwright --version
```
</TabItem>
</Tabs>
### Run tests on CI
Setup CI/CD and run your tests frequently. The more often you run your tests the better. Ideally you should run your tests on each commit and pull request. Playwright comes with a [GitHub actions workflow](/ci-intro.md) so that tests will run on CI for you with no setup required. Playwright can also be setup on the [CI environment](/ci.md) of your choice.
Use Linux when running your tests on CI as it is cheaper. Developers can use whatever environment when running locally but use linux on CI. Consider setting up [Sharding](./test-sharding.md) to make CI faster.
#### Optimize browser downloads on CI
Only install the browsers that you actually need, especially on CI. For example, if you're only testing with Chromium, install just Chromium.
```bash title=".github/workflows/playwright.yml"
# Instead of installing all browsers
npx playwright install --with-deps
# Install only Chromium
npx playwright install chromium --with-deps
```
This saves both download time and disk space on your CI machines.
### Lint your tests
We recommend TypeScript and linting with ESLint for your tests to catch errors early. Use [`@typescript-eslint/no-floating-promises`](https://typescript-eslint.io/rules/no-floating-promises/) [ESLint](https://eslint.org) rule to make sure there are no missing awaits before the asynchronous calls to the Playwright API. On your CI you can run `tsc --noEmit` to ensure that functions are called with the right signature.
@ -282,10 +516,41 @@ test('runs in parallel 2', async ({ page }) => { /* ... */ });
Playwright can [shard](./test-parallel.md#shard-tests-between-multiple-machines) a test suite, so that it can be executed on multiple machines.
<Tabs
groupId="js-package-manager"
defaultValue="npm"
values={[
{label: 'npm', value: 'npm'},
{label: 'yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]
}>
<TabItem value="npm">
```bash
npx playwright test --shard=1/3
```
</TabItem>
<TabItem value="yarn">
```bash
yarn playwright test --shard=1/3
```
</TabItem>
<TabItem value="pnpm">
```bash
pnpm exec playwright test --shard=1/3
```
</TabItem>
</Tabs>
## Productivity tips
### Use Soft assertions

View File

@ -338,16 +338,123 @@ dotnet test --settings:webkit.runsettings
For Google Chrome, Microsoft Edge and other Chromium-based browsers, by default, Playwright uses open source Chromium builds. Since the Chromium project is ahead of the branded browsers, when the world is on Google Chrome N, Playwright already supports Chromium N+1 that will be released in Google Chrome and Microsoft Edge a few weeks later.
### Chromium: headless shell
Playwright ships a regular Chromium build for headed operations and a separate [chromium headless shell](https://developer.chrome.com/blog/chrome-headless-shell) for headless mode.
If you are only running tests in headless shell (i.e. the `channel` option is **not** specified), for example on CI, you can avoid downloading the full Chromium browser by passing `--only-shell` during installation.
```bash js
# only running tests headlessly
npx playwright install --with-deps --only-shell
```
```bash java
# only running tests headlessly
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps --only-shell"
```
```bash python
# only running tests headlessly
playwright install --with-deps --only-shell
```
```bash csharp
# only running tests headlessly
pwsh bin/Debug/netX/playwright.ps1 install --with-deps --only-shell
```
### Chromium: new headless mode
You can opt into the new headless mode by using `'chromium'` channel. As [official Chrome documentation puts it](https://developer.chrome.com/blog/chrome-headless-shell):
> New Headless on the other hand is the real Chrome browser, and is thus more authentic, reliable, and offers more features. This makes it more suitable for high-accuracy end-to-end web app testing or browser extension testing.
See [issue #33566](https://github.com/microsoft/playwright/issues/33566) for details.
```js
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'], channel: 'chromium' },
},
],
});
```
```java
import com.microsoft.playwright.*;
public class Example {
public static void main(String[] args) {
try (Playwright playwright = Playwright.create()) {
Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions().setChannel("chromium"));
Page page = browser.newPage();
// ...
}
}
}
```
```bash python
pytest test_login.py --browser-channel chromium
```
```xml csharp
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<Playwright>
<BrowserName>chromium</BrowserName>
<LaunchOptions>
<Channel>chromium</Channel>
</LaunchOptions>
</Playwright>
</RunSettings>
```
```bash csharp
dotnet test -- Playwright.BrowserName=chromium Playwright.LaunchOptions.Channel=chromium
```
With the new headless mode, you can skip downloading the headless shell during browser installation by using the `--no-shell` option:
```bash js
# only running tests headlessly
npx playwright install --with-deps --no-shell
```
```bash java
# only running tests headlessly
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps --no-shell"
```
```bash python
# only running tests headlessly
playwright install --with-deps --no-shell
```
```bash csharp
# only running tests headlessly
pwsh bin/Debug/netX/playwright.ps1 install --with-deps --no-shell
```
### Google Chrome & Microsoft Edge
While Playwright can download and use the recent Chromium build, it can operate against the branded Google Chrome and Microsoft Edge browsers available on the machine (note that Playwright doesn't install them by default). In particular, the current Playwright version will support Stable and Beta channels of these browsers.
Available channels are `chrome`, `msedge`, `chrome-beta`, `msedge-beta` or `msedge-dev`.
Available channels are `chrome`, `msedge`, `chrome-beta`, `msedge-beta`, `chrome-dev`, `msedge-dev`, `chrome-canary`, `msedge-canary`.
:::warning
Certain Enterprise Browser Policies may impact Playwright's ability to launch and control Google Chrome and Microsoft Edge. Running in an environment with browser policies is outside of the Playwright project's scope.
:::
:::warning
Google Chrome and Microsoft Edge have switched to a [new headless mode](https://developer.chrome.com/docs/chromium/headless) implementation that is closer to a regular headed mode. This differs from [chromium headless shell](https://developer.chrome.com/blog/chrome-headless-shell) that is used in Playwright by default when running headless, so expect different behavior in some cases. See [issue #33566](https://github.com/microsoft/playwright/issues/33566) for details.
:::
```js
import { defineConfig, devices } from '@playwright/test';
@ -401,6 +508,23 @@ pytest test_login.py --browser-channel msedge
dotnet test -- Playwright.BrowserName=chromium Playwright.LaunchOptions.Channel=msedge
```
######
* langs: python
Alternatively when using the library directly, you can specify the browser [`option: BrowserType.launch.channel`] when launching the browser:
```python
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
# Channel can be "chrome", "msedge", "chrome-beta", "msedge-beta" or "msedge-dev".
browser = p.chromium.launch(channel="msedge")
page = browser.new_page()
page.goto("https://playwright.dev")
print(page.title())
browser.close()
```
#### Installing Google Chrome & Microsoft Edge
If Google Chrome or Microsoft Edge is not available on your machine, you can install

View File

@ -18,9 +18,6 @@ Using a canary release in production might seem risky, but in practice, it's not
A canary release passes all automated tests and is used to test e.g. the HTML report, Trace Viewer, or Playwright Inspector with end-to-end tests.
:::
```txt
npm install -D @playwright/test@next
```
## Next npm Dist Tag
@ -34,7 +31,7 @@ You can see on [npm](https://www.npmjs.com/package/@playwright/test?activeTab=ve
## Using a Canary Release
```txt
```bash
npm install -D @playwright/test@next
```

View File

@ -9,7 +9,9 @@ title: "Chrome extensions"
Extensions only work in Chrome / Chromium launched with a persistent context. Use custom browser args at your own risk, as some of them may break Playwright functionality.
:::
The following is code for getting a handle to the [background page](https://developer.chrome.com/extensions/background_pages) of a [Manifest v2](https://developer.chrome.com/docs/extensions/mv2/) extension whose source is located in `./my-extension`:
The snippet below retrieves the [background page](https://developer.chrome.com/extensions/background_pages) of a [Manifest v2](https://developer.chrome.com/docs/extensions/mv2/) extension whose source is located in `./my-extension`.
Note the use of the `chromium` channel that allows to run extensions in headless mode. Alternatively, you can launch the browser in headed mode.
```js
const { chromium } = require('playwright');
@ -18,7 +20,7 @@ const { chromium } = require('playwright');
const pathToExtension = require('path').join(__dirname, 'my-extension');
const userDataDir = '/tmp/test-user-data-dir';
const browserContext = await chromium.launchPersistentContext(userDataDir, {
headless: false,
channel: 'chromium',
args: [
`--disable-extensions-except=${pathToExtension}`,
`--load-extension=${pathToExtension}`
@ -44,7 +46,7 @@ user_data_dir = "/tmp/test-user-data-dir"
async def run(playwright: Playwright):
context = await playwright.chromium.launch_persistent_context(
user_data_dir,
headless=False,
channel="chromium",
args=[
f"--disable-extensions-except={path_to_extension}",
f"--load-extension={path_to_extension}",
@ -78,7 +80,7 @@ user_data_dir = "/tmp/test-user-data-dir"
def run(playwright: Playwright):
context = playwright.chromium.launch_persistent_context(
user_data_dir,
headless=False,
channel="chromium",
args=[
f"--disable-extensions-except={path_to_extension}",
f"--load-extension={path_to_extension}",
@ -101,6 +103,8 @@ with sync_playwright() as playwright:
To have the extension loaded when running tests you can use a test fixture to set the context. You can also dynamically retrieve the extension id and use it to load and test the popup page for example.
Note the use of the `chromium` channel that allows to run extensions in headless mode. Alternatively, you can launch the browser in headed mode.
First, add fixtures that will load the extension:
```js title="fixtures.ts"
@ -114,7 +118,7 @@ export const test = base.extend<{
context: async ({ }, use) => {
const pathToExtension = path.join(__dirname, 'my-extension');
const context = await chromium.launchPersistentContext('', {
headless: false,
channel: 'chromium',
args: [
`--disable-extensions-except=${pathToExtension}`,
`--load-extension=${pathToExtension}`,
@ -155,7 +159,7 @@ def context(playwright: Playwright) -> Generator[BrowserContext, None, None]:
path_to_extension = Path(__file__).parent.joinpath("my-extension")
context = playwright.chromium.launch_persistent_context(
"",
headless=False,
channel="chromium",
args=[
f"--disable-extensions-except={path_to_extension}",
f"--load-extension={path_to_extension}",
@ -211,39 +215,3 @@ def test_popup_page(page: Page, extension_id: str) -> None:
page.goto(f"chrome-extension://{extension_id}/popup.html")
expect(page.locator("body")).to_have_text("my-extension popup")
```
## Headless mode
:::danger
`headless=new` mode is not officially supported by Playwright and might result in unexpected behavior.
:::
By default, Chrome's headless mode in Playwright does not support Chrome extensions. To overcome this limitation, you can run Chrome's persistent context with a new headless mode by using the following code:
```js title="fixtures.ts"
// ...
const pathToExtension = path.join(__dirname, 'my-extension');
const context = await chromium.launchPersistentContext('', {
headless: false,
args: [
`--headless=new`,
`--disable-extensions-except=${pathToExtension}`,
`--load-extension=${pathToExtension}`,
],
});
// ...
```
```python title="conftest.py"
path_to_extension = Path(__file__).parent.joinpath("my-extension")
context = playwright.chromium.launch_persistent_context(
"",
headless=False,
args=[
"--headless=new",
f"--disable-extensions-except={path_to_extension}",
f"--load-extension={path_to_extension}",
],
)
```

View File

@ -21,7 +21,7 @@ Playwright tests can be run on any CI provider. This guide covers one way of run
## Introduction
* langs: python, java, csharp
Playwright tests can be ran on any CI provider. In this section we will cover running tests on GitHub using GitHub actions. If you would like to see how to configure other CI providers check out our detailed doc on Continuous Integration.
Playwright tests can be run on any CI provider. In this section we will cover running tests on GitHub using GitHub actions. If you would like to see how to configure other CI providers check out our detailed doc on Continuous Integration.
#### You will learn
* langs: python, java, csharp
@ -69,11 +69,11 @@ jobs:
The workflow performs these steps:
1. Clone your repository
2. Install Node.js
3. Install NPM Dependencies
4. Install Playwright Browsers
5. Run Playwright tests
6. Upload HTML report to the GitHub UI
1. Install Node.js
1. Install NPM Dependencies
1. Install Playwright Browsers
1. Run Playwright tests
1. Upload HTML report to the GitHub UI
To learn more about this, see ["Understanding GitHub Actions"](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions).
@ -169,10 +169,10 @@ To learn more about this, see ["Understanding GitHub Actions"](https://docs.gith
Looking at the list of steps in `jobs.test.steps`, you can see that the workflow performs these steps:
1. Clone your repository
2. Install language dependencies
3. Install project dependencies and build
4. Install Playwright Browsers
5. Run tests
1. Install language dependencies
1. Install project dependencies and build
1. Install Playwright Browsers
1. Run tests
## Create a Repo and Push to GitHub
@ -291,7 +291,7 @@ Downloading the HTML report as a zip file is not very convenient. However, we ca
- `AZCOPY_SPA_CLIENT_SECRET`
- `AZCOPY_TENANT_ID`
For a detailed guide on how to authorize a service principal using a client secret, refer to [this Microsoft documentation](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-authorize-azure-active-directory#authorize-a-service-principal-by-using-a-client-secret-1).
For a detailed guide on how to authorize a service principal using a client secret, refer to [this Microsoft documentation](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-authorize-azure-active-directory#authorize-a-service-principal-by-using-a-client-secret).
1. Add a step that uploads the HTML report to Azure Storage.
```yaml title=".github/workflows/playwright.yml"
@ -312,7 +312,7 @@ Downloading the HTML report as a zip file is not very convenient. However, we ca
The contents of the `$web` storage container can be accessed from a browser by using the [public URL](https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website-how-to?tabs=azure-portal#portal-find-url) of the website.
:::note
This step will not work for pull requests created from a forked repository because such workflow [doesn't have access to the secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow).
This step will not work for pull requests created from a forked repository because such workflow [doesn't have access to the secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#using-secrets-in-a-workflow).
:::

View File

@ -208,7 +208,7 @@ jobs:
name: 'Playwright Tests'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
image: mcr.microsoft.com/playwright:v%%VERSION%%-noble
options: --user 1001
steps:
- uses: actions/checkout@v4
@ -233,7 +233,7 @@ jobs:
name: 'Playwright Tests'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
image: mcr.microsoft.com/playwright/python:v%%VERSION%%-noble
options: --user 1001
steps:
- uses: actions/checkout@v4
@ -262,7 +262,7 @@ jobs:
name: 'Playwright Tests'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
image: mcr.microsoft.com/playwright/java:v%%VERSION%%-noble
options: --user 1001
steps:
- uses: actions/checkout@v4
@ -288,7 +288,7 @@ jobs:
name: 'Playwright Tests'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-noble
options: --user 1001
steps:
- uses: actions/checkout@v4
@ -415,7 +415,7 @@ Large test suites can take very long to execute. By executing a preliminary test
This will give you a faster feedback loop and slightly lower CI consumption while working on Pull Requests.
To detect test files affected by your changeset, `--only-changed` analyses your suites' dependency graph. This is a heuristic and might miss tests, so it's important that you always run the full test suite after the preliminary test run.
```yml js title=".github/workflows/playwright.yml" {20-23}
```yml js title=".github/workflows/playwright.yml" {24-26}
name: Playwright Tests
on:
push:
@ -454,19 +454,11 @@ jobs:
### Docker
We have a [pre-built Docker image](./docker.md) which can either be used directly, or as a reference to update your existing Docker definitions.
Suggested configuration
1. Using `--ipc=host` is also recommended when using Chromium. Without it Chromium can run out of memory
and crash. Learn more about this option in [Docker docs](https://docs.docker.com/engine/reference/run/#ipc-settings---ipc).
1. Seeing other weird errors when launching Chromium? Try running your container
with `docker run --cap-add=SYS_ADMIN` when developing locally.
1. Using `--init` Docker flag or [dumb-init](https://github.com/Yelp/dumb-init) is recommended to avoid special
treatment for processes with PID=1. This is a common reason for zombie processes.
We have a [pre-built Docker image](./docker.md) which can either be used directly or as a reference to update your existing Docker definitions. Make sure to follow the [Recommended Docker Configuration](./docker.md#recommended-docker-configuration) to ensure the best performance.
### Azure Pipelines
For Windows or macOS agents, no additional configuration required, just install Playwright and run your tests.
For Windows or macOS agents, no additional configuration is required, just install Playwright and run your tests.
For Linux agents, you can use [our Docker container](./docker.md) with Azure
Pipelines support [running containerized
@ -766,28 +758,28 @@ Running Playwright on CircleCI is very similar to running on GitHub Actions. In
```yml js
executors:
pw-jammy-development:
pw-noble-development:
docker:
- image: mcr.microsoft.com/playwright:v%%VERSION%%-noble
```
```yml python
executors:
pw-jammy-development:
pw-noble-development:
docker:
- image: mcr.microsoft.com/playwright/python:v%%VERSION%%-noble
```
```yml java
executors:
pw-jammy-development:
pw-noble-development:
docker:
- image: mcr.microsoft.com/playwright/java:v%%VERSION%%-noble
```
```yml csharp
executors:
pw-jammy-development:
pw-noble-development:
docker:
- image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-noble
```
@ -801,10 +793,10 @@ Sharding in CircleCI is indexed with 0 which means that you will need to overrid
```yml
playwright-job-name:
executor: pw-jammy-development
executor: pw-noble-development
parallelism: 4
steps:
- run: SHARD="$((${CIRCLE_NODE_INDEX}+1))"; npx playwright test -- --shard=${SHARD}/${CIRCLE_NODE_TOTAL}
- run: SHARD="$((${CIRCLE_NODE_INDEX}+1))"; npx playwright test --shard=${SHARD}/${CIRCLE_NODE_TOTAL}
```
### Jenkins
@ -997,7 +989,7 @@ type: docker
steps:
- name: test
image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
image: mcr.microsoft.com/playwright:v%%VERSION%%-noble
commands:
- npx playwright test
```

View File

@ -34,6 +34,10 @@ The recommended approach is to use `setFixedTime` to set the time to a specific
- `Event.timeStamp`
:::
:::warning
If you call `install` at any point in your test, the call _MUST_ occur before any other clock related calls (see note above for list). Calling these methods out of order will result in undefined behavior. For example, you cannot call `setInterval`, followed by `install`, then `clearInterval`, as `install` overrides the native definition of the clock functions.
:::
## Test with predefined time
Often you only need to fake `Date.now` while keeping the timers going.
@ -164,11 +168,11 @@ await Page.GotoAsync("http://localhost:3333");
await Page.Clock.PauseAtAsync(new DateTime(2024, 2, 2, 10, 0, 0));
// Assert the page state.
await Expect(Page.GetByTestId("current-time")).ToHaveText("2/2/2024, 10:00:00 AM");
await Expect(Page.GetByTestId("current-time")).ToHaveTextAsync("2/2/2024, 10:00:00 AM");
// Close the laptop lid again and open it at 10:30am.
await Page.Clock.FastForwardAsync("30:00");
await Expect(Page.GetByTestId("current-time")).ToHaveText("2/2/2024, 10:30:00 AM");
await Expect(Page.GetByTestId("current-time")).ToHaveTextAsync("2/2/2024, 10:30:00 AM");
```
## Test inactivity monitoring

View File

@ -164,19 +164,19 @@ You can use the test generator to generate tests using emulation so as to genera
Playwright opens a browser window with its viewport set to a specific width and height and is not responsive as tests need to be run under the same conditions. Use the `--viewport` option to generate tests with a different viewport size.
```bash js
npx playwright codegen --viewport-size=800,600 playwright.dev
npx playwright codegen --viewport-size="800,600" playwright.dev
```
```bash java
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen --viewport-size=800,600 playwright.dev"
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen --viewport-size='800,600' playwright.dev"
```
```bash python
playwright codegen --viewport-size=800,600 playwright.dev
playwright codegen --viewport-size="800,600" playwright.dev
```
```bash csharp
pwsh bin/Debug/netX/playwright.ps1 codegen --viewport-size=800,600 playwright.dev
pwsh bin/Debug/netX/playwright.ps1 codegen --viewport-size="800,600" playwright.dev
```
######
* langs: js
@ -325,7 +325,7 @@ pwsh bin/Debug/netX/playwright.ps1 codegen --timezone="Europe/Rome" --geolocatio
### Preserve authenticated state
Run `codegen` with `--save-storage` to save [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) at the end of the session. This is useful to separately record an authentication step and reuse it later when recording more tests.
Run `codegen` with `--save-storage` to save [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) and [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) data at the end of the session. This is useful to separately record an authentication step and reuse it later when recording more tests.
```bash js
npx playwright codegen github.com/microsoft/playwright --save-storage=auth.json
@ -375,7 +375,7 @@ Make sure you only use the `auth.json` locally as it contains sensitive informat
#### Load authenticated state
Run with `--load-storage` to consume the previously loaded storage from the `auth.json`. This way, all [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) will be restored, bringing most web apps to the authenticated state without the need to login again. This means you can continue generating tests from the logged in state.
Run with `--load-storage` to consume the previously loaded storage from the `auth.json`. This way, all [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) and [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) data will be restored, bringing most web apps to the authenticated state without the need to login again. This means you can continue generating tests from the logged in state.
```bash js
npx playwright codegen --load-storage=auth.json github.com/microsoft/playwright

View File

@ -44,6 +44,10 @@ A browser window will open and the test will run and pause at where the breakpoi
<img width="1269" alt="running test in debug mode" src="https://user-images.githubusercontent.com/13063165/212740233-3f278825-13e7-4a88-a118-dd4478d43a16.png" />
### Debug Tests Using Chrome DevTools
Instead of using `Debug Test`, choose `Run Test` in VS Code. With `Show Browser` enabled, the browser session is reused, letting you open Chrome DevTools for continuous debugging of your tests and the web application.
### Debug in different Browsers
By default, debugging is done using the Chromium profile. You can debug your tests on different browsers by right clicking on the debug icon in the testing sidebar and clicking on the 'Select Default Profile' option from the dropdown.
@ -225,7 +229,6 @@ Playwright [Trace Viewer](/trace-viewer.md) is a GUI tool that lets you explore
<video width="100%" height="100%" controls muted>
<source src="https://user-images.githubusercontent.com/13063165/219132713-17b9d75b-71e3-42c4-a43f-3f9e2e15f834.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>
To learn more about how to record traces and use the Trace Viewer, check out the [Trace Viewer](/trace-viewer.md) guide.

View File

@ -5,7 +5,7 @@ title: "Docker"
## Introduction
[Dockerfile.jammy] can be used to run Playwright scripts in Docker environment. This image includes the [Playwright browsers](./browsers.md#install-browsers) and [browser system dependencies](./browsers.md#install-system-dependencies). The Playwright package/dependency is not included in the image and should be installed separately.
[Dockerfile.noble] can be used to run Playwright scripts in Docker environment. This image includes the [Playwright browsers](./browsers.md#install-browsers) and [browser system dependencies](./browsers.md#install-system-dependencies). The Playwright package/dependency is not included in the image and should be installed separately.
## Usage
@ -94,15 +94,102 @@ docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_prof
}
```
:::note
Using `--ipc=host` is recommended when using Chrome ([Docker docs](https://docs.docker.com/engine/reference/run/#ipc-settings---ipc)). Chrome can run out of memory without this flag.
:::
### Recommended Docker Configuration
When running Playwright in Docker, the following configuration is recommended:
1. **Using [`--init`](https://docs.docker.com/reference/cli/docker/container/run/#init)** Docker flag is recommended to avoid special treatment for processes with PID=1. This is a common reason for zombie processes.
1. **Using `--ipc=host`** is recommended when using Chromium. Without it, Chromium can run out of memory and crash. Learn more about this option in [Docker docs](https://docs.docker.com/reference/cli/docker/container/run/#ipc).
1. **If seeing weird errors when launching Chromium**, try running your container with `docker run --cap-add=SYS_ADMIN` when developing locally.
### Using on CI
See our [Continuous Integration guides](./ci.md) for sample configs.
### Remote Connection
You can run Playwright Server in Docker while keeping your tests running on the host system or another machine. This is useful for running tests on unsupported Linux distributions or remote execution scenarios.
#### Running the Playwright Server
Start the Playwright Server in Docker:
```bash
docker run -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v%%VERSION%%-noble /bin/sh -c "npx -y playwright@%%VERSION%% run-server --port 3000 --host 0.0.0.0"
```
#### Connecting to the Server
* langs: js
There are two ways to connect to the remote Playwright server:
1. Using environment variable with `@playwright/test`:
```bash
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:3000/ npx playwright test
```
2. Using the [`method: BrowserType.connect`] API for other applications:
```js
const browser = await playwright['chromium'].connect('ws://127.0.0.1:3000/');
```
#### Connecting to the Server
* langs: python, csharp, java
```python sync
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.connect("ws://127.0.0.1:3000/")
```
```python async
from playwright.async_api import async_playwright
async with async_playwright() as p:
browser = await p.chromium.connect("ws://127.0.0.1:3000/")
```
```csharp
using Microsoft.Playwright;
using var playwright = await Playwright.CreateAsync();
await using var browser = await playwright.Chromium.ConnectAsync("ws://127.0.0.1:3000/");
```
```java
package org.example;
import com.microsoft.playwright.*;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
try (Playwright playwright = Playwright.create()) {
Browser browser = playwright.chromium().connect("ws://127.0.0.1:3000/");
}
}
}
```
#### Network Configuration
If you need to access local servers from within the Docker container:
```bash
docker run --add-host=hostmachine:host-gateway -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v%%VERSION%%-noble /bin/sh -c "npx -y playwright@%%VERSION%% run-server --port 3000 --host 0.0.0.0"
```
This makes `hostmachine` point to the host's localhost. Your tests should use `hostmachine` instead of `localhost` when accessing local servers.
:::note
When running tests remotely, ensure the Playwright version in your tests matches the version running in the Docker container.
:::
## Image tags
See [all available image tags].
@ -111,7 +198,6 @@ We currently publish images with the following tags:
- `:v%%VERSION%%` - Playwright v%%VERSION%% release docker image based on Ubuntu 24.04 LTS (Noble Numbat).
- `:v%%VERSION%%-noble` - Playwright v%%VERSION%% release docker image based on Ubuntu 24.04 LTS (Noble Numbat).
- `:v%%VERSION%%-jammy` - Playwright v%%VERSION%% release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish).
- `:v%%VERSION%%-focal` - Playwright v%%VERSION%% release docker image based on Ubuntu 20.04 LTS (Focal Fossa).
:::note
It is recommended to always pin your Docker image to a specific version if possible. If the Playwright version in your Docker image does not match the version in your project/tests, Playwright will be unable to locate browser executables.
@ -122,7 +208,6 @@ It is recommended to always pin your Docker image to a specific version if possi
We currently publish images based on the following [Ubuntu](https://hub.docker.com/_/ubuntu) versions:
- **Ubuntu 24.04 LTS** (Noble Numbat), image tags include `noble`
- **Ubuntu 22.04 LTS** (Jammy Jellyfish), image tags include `jammy`
- **Ubuntu 20.04 LTS** (Focal Fossa), image tags include `focal`
#### Alpine
@ -134,7 +219,7 @@ Browser builds for Firefox and WebKit are built for the [glibc](https://en.wikip
You can use the [.NET install script](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script) in order to install different SDK versions:
```bash
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --install-dir /usr/share/dotnet --channel 6.0
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --install-dir /usr/share/dotnet --channel 9.0
```
## Build your own image

View File

@ -188,7 +188,7 @@ page.setViewportSize(1600, 1200);
// Emulate high-DPI
BrowserContext context = browser.newContext(new Browser.NewContextOptions()
.setViewportSize(2560, 1440)
.setDeviceScaleFactor(2);
.setDeviceScaleFactor(2));
```
```python async
@ -289,17 +289,17 @@ await using var context = await browser.NewContextAsync(new()
## Locale & Timezone
Emulate the user Locale and Timezone which can be set globally for all tests in the config and then overridden for particular tests.
Emulate the browser Locale and Timezone which can be set globally for all tests in the config and then overridden for particular tests.
```js title="playwright.config.ts"
import { defineConfig } from '@playwright/test';
export default defineConfig({
use: {
// Emulates the user locale.
// Emulates the browser locale.
locale: 'en-GB',
// Emulates the user timezone.
// Emulates the browser timezone.
timezoneId: 'Europe/Paris',
},
});
@ -355,6 +355,13 @@ await using var context = await browser.NewContextAsync(new()
```
<img width="1394" alt="Bing in german lang and timezone" src="https://user-images.githubusercontent.com/13063165/220416571-ccc96ab1-44bb-4579-8430-64502fc24a15.png" />
######
* langs: js
Note that this only affects the browser timezone and locale, not the test runner timezone.
To set the test runner timezone, you can use the [`TZ` environment variable](https://nodejs.org/api/cli.html#tz).
## Permissions
Allow app to show system notifications.
@ -378,7 +385,7 @@ const context = await browser.newContext({
```java
BrowserContext context = browser.newContext(new Browser.NewContextOptions()
.setPermissions(Arrays.asList("notifications"));
.setPermissions(Arrays.asList("notifications")));
```
```python async
@ -558,7 +565,7 @@ await context.SetGeolocationAsync(new Geolocation() { Longitude = 48.858455, Lat
**Note** you can only change geolocation for all pages in the context.
## Color Scheme and Media
Emulate the users `"colorScheme"`. Supported values are 'light', 'dark', 'no-preference'. You can also emulate the media type with [`method: Page.emulateMedia`].
Emulate the users `"colorScheme"`. Supported values are 'light' and 'dark'. You can also emulate the media type with [`method: Page.emulateMedia`].
```js title="playwright.config.ts"
import { defineConfig } from '@playwright/test';

View File

@ -18,7 +18,7 @@ Get started by installing Playwright and generating a test to see it in action.
## Installation
Install the [VS Code extension from the marketplace](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright) or from the extensions tab in VS Code.
Playwright has a VS Code extension which is available when testing with Node.js. Install [it from the VS Code marketplace](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright) or from the extensions tab in VS Code.
![VS Code extension for Playwright](https://github.com/microsoft/playwright/assets/13063165/cab54568-3168-4b3f-bf3d-854976594903)
@ -202,7 +202,7 @@ To run the **setup** test only once, deselect it from the projects section in th
## Global Setup
**Global setup** tests are run when you execute your first test. This runs only once and is useful for setting up a database or starting a server. You can manually run a **global setup** test by clicking the `Run global setup` option from the **Setup** section in the Playwright sidebar. You can also run **global teardown** tests by clicking the `Run global teardown` option.
**Global setup** runs when you execute your first test. It runs only once and is useful for setting up a database or starting a server. You can manually run **global setup** by clicking the `Run global setup` option from the **Setup** section in the Playwright sidebar. **Global teardown** does not run by default; you need to manually initiate it by clicking the `Run global teardown` option.
Global setup will re-run when you debug tests as this ensures an isolated environment and dedicated setup for the test.

View File

@ -217,7 +217,7 @@ await page.getByText('Item').click({ button: 'right' });
// Shift + click
await page.getByText('Item').click({ modifiers: ['Shift'] });
// Ctrl + click or Windows and Linux
// Ctrl + click on Windows and Linux
// Meta + click on macOS
await page.getByText('Item').click({ modifiers: ['ControlOrMeta'] });
@ -241,7 +241,7 @@ page.getByText("Item").click(new Locator.ClickOptions().setButton(MouseButton.RI
// Shift + click
page.getByText("Item").click(new Locator.ClickOptions().setModifiers(Arrays.asList(KeyboardModifier.SHIFT)));
// Ctrl + click or Windows and Linux
// Ctrl + click on Windows and Linux
// Meta + click on macOS
page.getByText("Item").click(new Locator.ClickOptions().setModifiers(Arrays.asList(KeyboardModifier.CONTROL_OR_META)));
@ -265,7 +265,7 @@ await page.get_by_text("Item").click(button="right")
# Shift + click
await page.get_by_text("Item").click(modifiers=["Shift"])
# Ctrl + click or Windows and Linux
# Ctrl + click on Windows and Linux
# Meta + click on macOS
await page.get_by_text("Item").click(modifiers=["ControlOrMeta"])
@ -309,7 +309,7 @@ await page.GetByText("Item").ClickAsync(new() { Button = MouseButton.Right });
// Shift + click
await page.GetByText("Item").ClickAsync(new() { Modifiers = new[] { KeyboardModifier.Shift } });
// Ctrl + click or Windows and Linux
// Ctrl + click on Windows and Linux
// Meta + click on macOS
await page.GetByText("Item").ClickAsync(new() { Modifiers = new[] { KeyboardModifier.ControlOrMeta } });

View File

@ -7,7 +7,7 @@ title: "Installation"
Playwright was created specifically to accommodate the needs of end-to-end testing. Playwright supports all modern rendering engines including Chromium, WebKit, and Firefox. Test on Windows, Linux, and macOS, locally or on CI, headless or headed with native mobile emulation.
You can choose to use [MSTest base classes](./test-runners.md#mstest) or [NUnit base classes](./test-runners.md#nunit) that Playwright provides to write end-to-end tests. These classes support running tests on multiple browser engines, parallelizing tests, adjusting launch/context options and getting a [Page]/[BrowserContext] instance per test out of the box. Alternatively you can use the [library](./library.md) to manually write the testing infrastructure.
You can choose to use MSTest, NUnit, or xUnit [base classes](./test-runners.md) that Playwright provides to write end-to-end tests. These classes support running tests on multiple browser engines, parallelizing tests, adjusting launch/context options and getting a [Page]/[BrowserContext] instance per test out of the box. Alternatively you can use the [library](./library.md) to manually write the testing infrastructure.
1. Start by creating a new project with `dotnet new`. This will create the `PlaywrightTests` directory which includes a `UnitTest1.cs` file:
@ -17,6 +17,7 @@ You can choose to use [MSTest base classes](./test-runners.md#mstest) or [NUnit
values={[
{label: 'MSTest', value: 'mstest'},
{label: 'NUnit', value: 'nunit'},
{label: 'xUnit', value: 'xunit'},
]
}>
<TabItem value="nunit">
@ -34,6 +35,14 @@ dotnet new mstest -n PlaywrightTests
cd PlaywrightTests
```
</TabItem>
<TabItem value="xunit">
```bash
dotnet new xunit -n PlaywrightTests
cd PlaywrightTests
```
</TabItem>
</Tabs>
@ -45,6 +54,7 @@ cd PlaywrightTests
values={[
{label: 'MSTest', value: 'mstest'},
{label: 'NUnit', value: 'nunit'},
{label: 'xUnit', value: 'xunit'},
]
}>
<TabItem value="nunit">
@ -60,6 +70,13 @@ dotnet add package Microsoft.Playwright.NUnit
dotnet add package Microsoft.Playwright.MSTest
```
</TabItem>
<TabItem value="xunit">
```bash
dotnet add package Microsoft.Playwright.Xunit
```
</TabItem>
</Tabs>
@ -87,6 +104,7 @@ Edit the `UnitTest1.cs` file with the code below to create an example end-to-end
values={[
{label: 'MSTest', value: 'mstest'},
{label: 'NUnit', value: 'nunit'},
{label: 'xUnit', value: 'xunit'},
]
}>
<TabItem value="nunit">
@ -164,6 +182,41 @@ public class ExampleTest : PageTest
```
</TabItem>
<TabItem value="xunit">
```csharp title="UnitTest1.cs"
using System.Text.RegularExpressions;
using Microsoft.Playwright;
using Microsoft.Playwright.Xunit;
namespace PlaywrightTests;
public class UnitTest1: PageTest
{
[Fact]
public async Task HasTitle()
{
await Page.GotoAsync("https://playwright.dev");
// Expect a title "to contain" a substring.
await Expect(Page).ToHaveTitleAsync(new Regex("Playwright"));
}
[Fact]
public async Task GetStartedLink()
{
await Page.GotoAsync("https://playwright.dev");
// Click the get started link.
await Page.GetByRole(AriaRole.Link, new() { Name = "Get started" }).ClickAsync();
// Expects page to have a heading with the name of Installation.
await Expect(Page.GetByRole(AriaRole.Heading, new() { Name = "Installation" })).ToBeVisibleAsync();
}
}
```
</TabItem>
</Tabs>
## Running the Example Tests
@ -180,8 +233,8 @@ See our doc on [Running and Debugging Tests](./running-tests.md) to learn more a
- Playwright is distributed as a .NET Standard 2.0 library. We recommend .NET 8.
- Windows 10+, Windows Server 2016+ or Windows Subsystem for Linux (WSL).
- macOS 13 Ventura, or macOS 14 Sonoma.
- Debian 11, Debian 12, Ubuntu 20.04 or Ubuntu 22.04, Ubuntu 24.04, on x86-64 and arm64 architecture.
- macOS 14 Ventura, or later.
- Debian 12, Ubuntu 22.04, Ubuntu 24.04, on x86-64 and arm64 architecture.
## What's next
@ -190,4 +243,4 @@ See our doc on [Running and Debugging Tests](./running-tests.md) to learn more a
- [Generate tests with Codegen](./codegen-intro.md)
- [See a trace of your tests](./trace-viewer-intro.md)
- [Run tests on CI](./ci-intro.md)
- [Learn more about the MSTest and NUnit base classes](./test-runners.md)
- [Learn more about the MSTest, NUnit, and xUnit base classes](./test-runners.md)

View File

@ -32,7 +32,7 @@ public class App {
try (Playwright playwright = Playwright.create()) {
Browser browser = playwright.chromium().launch();
Page page = browser.newPage();
page.navigate("http://playwright.dev");
page.navigate("https://playwright.dev");
System.out.println(page.title());
}
}
@ -130,8 +130,8 @@ By default browsers launched with Playwright run headless, meaning no browser UI
- Java 8 or higher.
- Windows 10+, Windows Server 2016+ or Windows Subsystem for Linux (WSL).
- macOS 13 Ventura, or macOS 14 Sonoma.
- Debian 11, Debian 12, Ubuntu 20.04 or Ubuntu 22.04, Ubuntu 24.04, on x86-64 and arm64 architecture.
- macOS 14 Ventura, or later.
- Debian 12, Ubuntu 22.04, Ubuntu 24.04, on x86-64 and arm64 architecture.
## What's next

View File

@ -20,6 +20,7 @@ Playwright Test was created specifically to accommodate the needs of end-to-end
Get started by installing Playwright using npm, yarn or pnpm. Alternatively you can also get started and run your tests using the [VS Code Extension](./getting-started-vscode.md).
<Tabs
groupId="js-package-manager"
defaultValue="npm"
values={[
{label: 'npm', value: 'npm'},
@ -80,9 +81,10 @@ The `tests` folder contains a basic example test to help you get started with te
## Running the Example Test
By default tests will be run on all 3 browsers, chromium, firefox and webkit using 3 workers. This can be configured in the [playwright.config file](./test-configuration.md). Tests are run in headless mode meaning no browser will open up when running the tests. Results of the tests and test logs will be shown in the terminal.
By default tests will be run on all 3 browsers, Chromium, Firefox and WebKit using several workers. This can be configured in the [playwright.config file](./test-configuration.md). Tests are run in headless mode meaning no browser will open up when running the tests. Results of the tests and test logs will be shown in the terminal.
<Tabs
groupId="js-package-manager"
defaultValue="npm"
values={[
{label: 'npm', value: 'npm'},
@ -124,6 +126,7 @@ See our doc on [Running Tests](./running-tests.md) to learn more about running t
After your test completes, an [HTML Reporter](./test-reporters.md#html-reporter) will be generated, which shows you a full report of your tests allowing you to filter the report by browsers, passed tests, failed tests, skipped tests and flaky tests. You can click on each test and explore the test's errors as well as each step of the test. By default, the HTML report is opened automatically if some of the tests failed.
<Tabs
groupId="js-package-manager"
defaultValue="npm"
values={[
{label: 'npm', value: 'npm'},
@ -164,6 +167,7 @@ pnpm exec playwright show-report
Run your tests with [UI Mode](./test-ui-mode.md) for a better developer experience with time travel debugging, watch mode and more.
<Tabs
groupId="js-package-manager"
defaultValue="npm"
values={[
{label: 'npm', value: 'npm'},
@ -207,6 +211,7 @@ Check out or [detailed guide on UI Mode](./test-ui-mode.md) to learn more about
To update Playwright to the latest version run the following command:
<Tabs
groupId="js-package-manager"
defaultValue="npm"
values={[
{label: 'npm', value: 'npm'},
@ -250,6 +255,7 @@ pnpm exec playwright install --with-deps
You can always check which version of Playwright you have by running the following command:
<Tabs
groupId="js-package-manager"
defaultValue="npm"
values={[
{label: 'npm', value: 'npm'},
@ -286,10 +292,10 @@ pnpm exec playwright --version
## System requirements
- Node.js 18+
- Latest version of Node.js 18, 20 or 22.
- Windows 10+, Windows Server 2016+ or Windows Subsystem for Linux (WSL).
- macOS 13 Ventura, or macOS 14 Sonoma.
- Debian 11, Debian 12, Ubuntu 20.04 or Ubuntu 22.04, Ubuntu 24.04, on x86-64 and arm64 architecture.
- macOS 14 Ventura, or later.
- Debian 12, Ubuntu 22.04, Ubuntu 24.04, on x86-64 and arm64 architecture.
## What's next

Some files were not shown because too many files have changed in this diff Show More