Commit graph

1221 commits

Author SHA1 Message Date
Pavel Feldman 7ce2b36489
chore(ui): show load errors (#21843) 2023-03-21 12:03:26 -07:00
Pavel Feldman 0bf406c8aa
chore: sort tracing actions by wall time (#21839) 2023-03-21 10:03:49 -07:00
Pavel Feldman 6015dad9db
chore: remove npx playwright ui (#21823) 2023-03-20 17:12:17 -07:00
Pavel Feldman 543c812d2f
chore(ui): queue watch runs (#21809) 2023-03-20 13:45:35 -07:00
Max Schmitt d641caeb6a
Revert "feat(typescript): allow declare for class properties (#21281)" (#21805)
This reverts commit a1ba6757e0.

https://github.com/microsoft/playwright/issues/21794
2023-03-20 16:37:20 +01:00
Pavel Feldman 294baaeb44
chore: allow watching all tests (#21787) 2023-03-19 14:50:09 -07:00
Andrey Lushnikov 32d33cb8d5
chore: cut 1.32 (#21773) 2023-03-17 19:36:43 -07:00
Pavel Feldman d806c98009
chore(ct): do not clash internals with userland (#21774) 2023-03-17 18:08:28 -07:00
Dmitry Gozman 2a2d6c25a4
feat(deps): inherit environment changes from dependencies (#21771) 2023-03-17 15:46:52 -07:00
Pavel Feldman 6efb383433
chore: fix and test ui mode stop (#21769) 2023-03-17 14:10:25 -07:00
Yury Semikhatsky 95e7d3aabc
chore: hide store from public (#21763) 2023-03-17 11:50:44 -07:00
Pavel Feldman ecd0f927f4
chore: make stacks rendering live in ui mode (#21728)
Co-authored-by: Max Schmitt <max@schmitt.mx>
2023-03-16 18:17:07 -07:00
Dmitry Gozman f37f38e553
chore: decouple test groups from root suite as much as possible (#21731) 2023-03-16 17:11:15 -07:00
Dmitry Gozman 7879cf30f0
fix(reuse): serial mode with tracing should not throw (#21726)
Regressed in #19733.
Fixes #21113.
2023-03-16 14:32:12 -07:00
Dmitry Gozman 2074a51299
docs: fix details about WorkerInfo vs TestInfo availability (#21699)
Fixes #21695.
2023-03-16 12:36:34 -07:00
Max Schmitt 3ceac4bf53
docs: drop duplicate JS code snippets from test-api (#21466)
https://github.com/microsoft/playwright/issues/21385
2023-03-16 19:01:15 +01:00
Dmitry Gozman ea85242941
chore: improve client-side options plumbing (#21697) 2023-03-16 07:03:33 -07:00
Pavel Feldman c45d8749b0
chore: split trace events into phases (#21696) 2023-03-15 22:33:40 -07:00
Dmitry Gozman b149d132a6
chore(test runner): split loadAllTests into parts (#21674) 2023-03-15 13:40:58 -07:00
Pavel Feldman 27048adebe
chore: introduce testInfo.testId (#21670) 2023-03-14 15:58:55 -07:00
Dmitry Gozman 455e11c1d9
fix(shards): shard test groups instead of files (#21638)
Fixes #21497.
2023-03-14 10:41:37 -07:00
Max Schmitt a2c96494e0
chore: throw pretty error if rest parameters is used inside fixtures (#21659)
Fixes https://github.com/microsoft/playwright/issues/21566
2023-03-14 17:35:52 +01:00
Pavel Feldman f5fa18a279
chore: reimplement filters (#21647) 2023-03-13 22:19:31 -07:00
Dmitry Gozman 809725e114
fix(reuse): only reuse the default browser, not explicitly launched ones (#21631)
Fixes #20399.
2023-03-13 16:50:51 -07:00
Pavel Feldman 1d870ac407
chore(ui): start adding ui mode tests (2) (#21608) 2023-03-13 12:14:51 -07:00
Pavel Feldman a12e909a40
chore(ui): start adding ui mode tests (#21601) 2023-03-12 15:18:47 -07:00
Pavel Feldman 493171cb6b
chore: select files to watch explicitly (#21599) 2023-03-12 10:50:21 -07:00
Dmitry Gozman ea8aa63f1a
feat: support PWTEST_PROFILE_DIR in run-server (#21582)
This creates one profile per connection in the specified directory.
2023-03-10 19:07:40 -08:00
Pavel Feldman 0b9c037f36
chore(ui): do not add sources into the zip file (#21588) 2023-03-10 17:01:30 -08:00
Dmitry Gozman 6d27d2c029
fix(test runner): improved fixture teardown timeout error message (#21572)
The new message looks like this:

```
Test finished within timeout of 500ms, but tearing down "playwright configuration" ran out of time.
Please allow more time for the test, since teardown is attributed towards the test timeout budget.·
```

References #21259.
2023-03-10 13:45:47 -08:00
Pavel Feldman 1073e42686
chore: allow running failing (#21569) 2023-03-10 12:41:00 -08:00
Dmitry Gozman 58a23bc7a0
fix(test runner): allow worker-only dynamic imports (#21545)
Fixes #21409.
2023-03-10 08:58:26 -08:00
Pavel Feldman e7b21425f7
chore: support both test --ui and ui clis (#21537) 2023-03-09 13:03:01 -08:00
Pavel Feldman 47a71731f4
chore: add explicit command for gui runner (#21509) 2023-03-09 08:04:02 -08:00
Pavel Feldman 5ef2edb9f7
chore: support suites in the tree (#21508) 2023-03-08 19:50:32 -08:00
Pavel Feldman a2490a8fc8
chore(ui): maintain test order when updating (#21478) 2023-03-07 20:34:57 -08:00
Pavel Feldman f5894ed089
chore: open location in vscode (#21472) 2023-03-07 17:20:41 -08:00
Pavel Feldman e9f94f0346
chore: add ui mode terminal (#21470) 2023-03-07 14:24:50 -08:00
Max Schmitt c9eac69f2b
fix(types): accept string in expect().toMatch() (#21454)
Fixes https://github.com/microsoft/playwright/issues/21453
2023-03-07 17:53:50 +01:00
Pavel Feldman 65117702e7
chore: consistent xterm naming (#21446) 2023-03-06 20:39:52 -08:00
Pavel Feldman b6ff3bad98
chore: split code mirror and xterm modules (#21415) 2023-03-06 10:40:45 -08:00
Pavel Feldman bae9173208
chore: split ui mode toolbar into lines, show progress (#21403) 2023-03-05 13:46:21 -08:00
Pavel Feldman ec056a6312
chore: merge projects in the tree (#21401) 2023-03-04 16:28:30 -08:00
Pavel Feldman f0cd123a45
chore(ui): make ui-side drive things (#21398) 2023-03-04 15:05:41 -08:00
Dmitry Gozman eb3f8bfba8
fix(test runner): do not optimize filtering when sourcemap is present (#21359)
Fixes #21204.
2023-03-03 07:49:19 -08:00
Dmitry Gozman 6769a311ed
feat(test runner): error out when one test file imports another (#21357)
This situation is not supported, and we can now detect it by looking at
collected file dependencies.

Fixes #21270.
2023-03-02 15:09:50 -08:00
Pavel Feldman 57624bc01b
chore: ui mode ui improvements (#21325) 2023-03-02 13:45:15 -08:00
Sander d58d833daf
fix(ct): solid and react JS as child (#20125) 2023-03-02 13:40:51 -08:00
Dmitry Gozman 0b300f455c
fix(test runner): empty dependency should not skip other projects (#21354)
References #21270.
2023-03-02 13:32:23 -08:00
Dmitry Gozman a1ba6757e0
feat(typescript): allow declare for class properties (#21281)
This enables `allowDeclareFields` flag that allows code like:

```ts
class Foo {
  declare prop: string;
}
```

Declaring is a workaround for inheritance vs property initialization
issues.
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier

For `allowDeclareFields` to work, we have to run
plugin-transform-typescript before plugin-proposal-class-properties and
few others, so this change migrates from preset-typescript that always
runs last to individual plugin-transform-typescript, and reorders some
plugins.

References #21119.
2023-03-01 16:43:17 -08:00
Max Schmitt 6a7347f134
chore: have pretty error if CT config has no defineConfig (#21318)
Fixes https://github.com/microsoft/playwright/issues/21312
2023-03-02 00:47:05 +01:00
Pavel Feldman e222874445
chore: ui mode first cut (#21291) 2023-03-01 15:27:23 -08:00
Yury Semikhatsky 60e5a93832
fix(store): support text and binary values (#21006) 2023-03-01 08:49:31 -08:00
Pavel Feldman de3a5e2a91
chore(trace): include expect steps in a trace (#21199) 2023-02-28 13:26:23 -08:00
Dmitry Gozman 27027658dc
chore: fix all Proxy() to account for symbol properties (#21272)
Fixes #20940.
2023-02-28 12:45:14 -08:00
Pavel Feldman 81bd637d94
chore: merge traces into a single zip file (#21242) 2023-02-27 22:31:47 -08:00
Yury Semikhatsky cfdddcf9ba
fix(runner): finish dispatching if remaining tests were skipped (#21238)
Fixes #21226
2023-02-27 17:20:30 -08:00
Leo Sklyut 6c3d35fa58
fix(junit): use the JUnit schema's specified ISO format for timestamp (#21062)
Signed-off-by: Max Schmitt <max@schmitt.mx>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2023-02-27 11:04:22 +01:00
Pavel Feldman 4d91248c1e
chore: simplify the trace collection fixtures (#21203) 2023-02-25 21:21:09 -08:00
Pavel Feldman 09f77c41dd
chore: migrate to protocol's StackFrame type (#21198) 2023-02-24 18:36:15 -08:00
Pavel Feldman 3fa19e80ad
chore: wrap expect call in a zone (#21191) 2023-02-24 12:17:03 -08:00
Gonçalo Basto 7c6630b1a2
docs: add custom reporter options documentation (#21144) 2023-02-24 12:29:08 +01:00
Pavel Feldman 8ccc02a9d3
chore: use client wall time in traces (#21163) 2023-02-23 14:37:53 -08:00
Nowell Strite 000583e048
fix(loader): experimentalLoader with node@18 (#21106)
There is currently a bug when running `node@18.14.2` when running with
experimentalLoader

```
TypeError: The URL must be of scheme file
  at new NodeError (node:internal/errors:399:5)
  at Object.fileURLToPath (node:internal/url:1492:11)
  at resolve (./node_modules/@playwright/test/lib/experimentalLoader.js:39:48)
  at nextResolve (node:internal/modules/esm/loader:163:22)
  at ESMLoader.resolve (node:internal/modules/esm/loader:838:24)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:7)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:21)
```

This came from my test `vrt.spec.ts` which had a non package import
inside of it

```ts
import fs from "node:fs/promises"
```

The test run failed due to node imports not returning fileUrls when
resolved.

---------

Co-authored-by: Nowell Strite <nstrite@nvidia.com>
2023-02-22 14:28:03 -08:00
Max Schmitt ae369144b6
chore: consolidate http/https fetching (#21104)
Fixes https://github.com/microsoft/playwright/issues/20784
Supersedes https://github.com/microsoft/playwright/pull/21076
2023-02-22 17:09:56 +01:00
Pavel Feldman 3f8f2a0fdd
chore: do not use library stack capturer in test runner (#21075) 2023-02-21 19:24:17 -08:00
Max Schmitt 1432c406ad
docs: fix toMatch code snippet typo (#21077)
Fixes https://github.com/microsoft/playwright/issues/21014
2023-02-22 00:38:30 +01:00
Pavel Feldman 06fc72b6ed
revert(#12706): also fix related bugs it introduced (#21070) 2023-02-21 14:15:11 -08:00
Andrey Lushnikov ce692830b3
fix: filter out comments inside fixture destructuring (#20989)
Fixes #20944
2023-02-21 12:51:40 -08:00
Dmitry Gozman 55f4b670a9
fix(test runner types): allow sync step functions (#20996) 2023-02-17 14:26:40 -08:00
Yury Semikhatsky 09be9d6425
feat: key value store backed by filesystem (#20932)
Keys are used as a relative file path without any sanitization assuming
that the underlying fs will throw on error.
2023-02-16 16:48:28 -08:00
Dmitry Gozman 0b7f9055a3
chore: fix docs for python and java (#20962) 2023-02-16 11:48:38 -08:00
Andrey Lushnikov 1db04f2839
fix: simplify protocol for toBeInViewport (#20960) 2023-02-16 11:02:19 -08:00
Dmitry Gozman ffc2477a00
chore: 1.31 release notes for js (#20933) 2023-02-16 09:35:01 -08:00
Pavel Feldman 96050a260e
chore(junit): render project as an agent name / hostname (#20927) 2023-02-16 07:59:05 -08:00
Dmitry Gozman e77e2d8c7f
chore: mark 1.32.0-next (#20929) 2023-02-15 16:15:42 -08:00
Yury Semikhatsky 90c4e6f9b2
chore: revert sharded html report (#20923)
We've decided not to ship it in the current form.

#10437
2023-02-15 12:38:03 -08:00
Pavel Feldman 08be39a80e
fix(watch): fix the tests on win (#20844) 2023-02-14 14:55:49 -08:00
Pavel Feldman 7f0763d789
chore: hide watch mode, it is not ready (#20905) 2023-02-14 13:22:44 -08:00
Andrey Lushnikov 72942e81d5
chore: fixes to toBeInViewport (#20870) 2023-02-13 15:21:40 -08:00
Dmitry Gozman 6d03211439
fix(test runner): --list should ignore '.only' annotations (#20868) 2023-02-13 11:13:30 -08:00
Andrey Lushnikov fdcd7b549d
chore: mark comparator option back as experimental (#20816)
This reverts commit 303c5998f8.

Reason for revert: I tried enabling `ssim-cie94` by default on
ionic-framework test suite, and it proves to be overly strict for their
usecase.
2023-02-13 11:11:44 -08:00
Joel Einbinder 997dfa9274
fix(reporter): properly indent multiline attachments (#20847)
Text attachments were only indented on the first line.
2023-02-13 10:28:34 -08:00
Pavel Feldman e9ca483666
chore: dim watch separator (#20836) 2023-02-12 10:00:40 -08:00
Dmitry Gozman 8a1612ceec
fix(reporters): preserve the order between deferred errors and stdio (#20830) 2023-02-10 14:58:44 -08:00
Pavel Feldman 1ba768bf60
chore: make watch + ct happy (#20804) 2023-02-10 08:33:25 -08:00
Andrey Lushnikov 68e170ef89
feat: implement expect(locator).toBeInViewport() (#20668)
The method accepts a `ratio` option to assert the ratio
of the element in viewport. `ratio` defaults to `Number.MIN_VALUE`.

NOTE: this reverts commit d950f5b6ee and
adds `ratio` option support + does the rename.

Fixes #8740
2023-02-10 04:33:22 -08:00
Dmitry Gozman 778dd20403
chore(docs): beautify generated types, put options always last (#20805) 2023-02-09 20:46:33 -08:00
Dmitry Gozman ab4cd83e44
chore: move testInfo and timeoutManager to worker/ (#20803) 2023-02-09 19:22:17 -08:00
Pavel Feldman 4469e57695
chore: always grow component bundle (#20799)
Fixes https://github.com/microsoft/playwright/issues/20581
2023-02-09 18:39:20 -08:00
Pavel Feldman e1f287f255
chore: more watch tests (#20797) 2023-02-09 16:03:54 -08:00
Dmitry Gozman 8002baf44f
chore: move option overrides logic to FixturePool (#20795) 2023-02-09 14:50:40 -08:00
Dmitry Gozman 4d37491e9b
chore: split FixtureRunner from fixtures (#20787)
It is only used in worker process.
2023-02-09 11:31:54 -08:00
Sander 4a3d79f291
chore(ct): improve internal hook types (#20722) 2023-02-09 08:58:15 -08:00
Pavel Feldman 5112abc1d2
chore: fix a racy time-based test (#20783) 2023-02-09 08:49:51 -08:00
Dmitry Gozman 190c121e66
chore: bundle chokidar, leave fsevents as an optional dependency (#20762) 2023-02-09 08:40:27 -08:00
Pavel Feldman b247bfe153
test(watch): start adding tests (#20764) 2023-02-09 08:31:02 -08:00
Pavel Feldman 6b0a7003c4
chore(watch): run by default again (#20763) 2023-02-08 18:53:07 -08:00
Pavel Feldman 027d6b5239
chore: set filters and run tests separately (#20759) 2023-02-08 14:30:53 -08:00
Pavel Feldman 7a093329fa
chore: do not run all on watch (#20758) 2023-02-08 12:44:51 -08:00
Dmitry Gozman 98e2fe184e
chore(docs): sort members instead of validating (#20755) 2023-02-08 09:59:31 -08:00
Pavel Feldman 0678b6575f
chore(watch): allow toggling browser (#20738) 2023-02-08 08:36:02 -08:00
Yury Semikhatsky a93cf767a1
feat: html reporter sharded option (#20737)
Make sharded report feature an opt-in:

```ts
{
   reporter: [['html', { sharded: true }]]
};
```

#10437
2023-02-07 22:21:50 -08:00
Pavel Feldman 4259d4e1d6
chore: implement repeat last run (#20727) 2023-02-07 15:56:39 -08:00
Pavel Feldman 96f0674e41
chore: calcular pool digests on the loader process side (#20728) 2023-02-07 14:08:17 -08:00
Yury Semikhatsky 8f53bf7b41
feat: sharded html report (#20700)
This implementation is based on the [original
PR](https://github.com/microsoft/playwright/pull/19691) by @kevin940726.
It makes the reporter produce single file when there is no sharding and
multiple out-of-line report-x-of-y.zip reports which are automatically
merged together when put in one folder.

References https://github.com/microsoft/playwright/issues/10437

Co-authored-by: Kai Hao <kevin830726@gmail.com>
2023-02-07 10:21:26 -08:00
Pavel Feldman 98e348d16a
chore(watch): print current filters (#20696) 2023-02-07 09:48:46 -08:00
Andrey Lushnikov 303c5998f8
feat: release "comparator" option from experiment (#20720)
The option defines a comparator to be used to compare images.
Possible values are `"pixelmatch"` and `"ssim-cie94"`.

Note: This reverts commit 8167f8bf54.
2023-02-07 08:51:48 -08:00
Pavel Feldman 361ea949aa
chore: respect deps when watching files (#20695) 2023-02-06 17:09:16 -08:00
Pavel Feldman 430d08f4fb
chore: watch mode first cut (#20647) 2023-02-06 15:52:14 -08:00
Pavel Feldman b6df48758d
chore: collect test dependencies (#20645) 2023-02-06 14:52:40 -08:00
Dmitry Gozman 33a05446d2
fix(expect): update docs to point to GenericAssertions instead of expect library (#20688)
Closes #20432.
2023-02-06 14:51:24 -08:00
Andrey Lushnikov 0a752f3fd6
chore(docker): remove experimental docker integration (#20676)
This removes everything related to docker integration experiments that
we conducted over the last 6 months.

I'll send a follow-up with an alternative suggestion that was demo'ed on
a team meeting in the end of December.
2023-02-06 10:50:45 -08:00
Dmitry Gozman e64c623e61
feat(expect): strip down Expect types (#20601)
This only leaves:
- documented assertions;
- asymmetric matchers;
- `resolves`/`rejects`;
- `expect.extend()`;
- `expect.getState()` with selected properties.

References #20432.
2023-02-03 15:56:31 -08:00
Andrey Lushnikov f45f20a8c9
fix: handle not.toPass() with expect.soft inside (#20596)
Fixes #20518
2023-02-03 09:14:05 -08:00
Pavel Feldman ffb719385b
chore: fix oop loading, prepare to watch (#20618) 2023-02-03 09:11:02 -08:00
Pavel Feldman b0b9b08167
chore: fix plugin reporting, rearrange steps (#20616) 2023-02-03 08:44:01 -08:00
Pavel Feldman 8b5e55d432
chore: implement compilation cache (#20597) 2023-02-02 16:46:54 -08:00
Dmitry Gozman 3180bc9804
fix(types): make most fixtures non-undefined (#20573)
Fixes #20416.
2023-02-02 13:11:50 -08:00
Andrey Lushnikov 4f61105032
fix: swallow expect.soft errors inside successful toPass matcher (#20509)
Fixes #20437
2023-02-02 10:47:20 -08:00
Dmitry Gozman 190b0ab609
fix(options): do not default navigationTimeout to actionTimeout (#20578)
Fixes #20549.
2023-02-02 07:36:16 -08:00
Dmitry Gozman 5fb430a743
fix(test runner): do not print timeout message upon interrupt (#20574)
We should only print "Test was interrupted."

Regressed in #18321.
2023-02-01 19:39:43 -08:00
Dmitry Gozman f46883e58e
feat(expect): add GenericAssertions documentation (#20564)
References #20432.
2023-02-01 16:55:52 -08:00
Pavel Feldman 421dd884a7
chore: implement --no-deps (#20569) 2023-02-01 16:32:13 -08:00
Pavel Feldman cb9ace6035
chore(test): move run options into config (#20568) 2023-02-01 15:25:26 -08:00
Max Schmitt 0edf77fe91
chore: bump json5 dependency (#20560)
Fixes https://github.com/microsoft/playwright/pull/20309
2023-02-01 22:50:50 +01:00
Pavel Feldman a1cdd939f8
chore: load tests file by file (#20557) 2023-02-01 12:33:42 -08:00
Pavel Feldman 635b47025e
chore: expose project dependencies api (#20546) 2023-02-01 08:39:07 -08:00
Pavel Feldman 08e4b50ff6
chore: project deps (#20514) 2023-01-31 15:59:13 -08:00
Dmitry Gozman 9c6c31a442
fix(types): update PlaywrightTestConfig types (#20540)
This makes errors more focused on the custom properties.

References #20416.
2023-01-31 15:02:01 -08:00
Dmitry Gozman b39079b51e
feat(trace viewer): popout snapshot in a new tab (#20475) 2023-01-30 19:07:52 -08:00
Yury Semikhatsky a03f3223c4
fix: trim long expect messages (#20517)
Fixes #20324
2023-01-30 17:24:12 -08:00
Pavel Feldman 0dd090aeab
chore: prepare to deps (#20513) 2023-01-30 14:34:48 -08:00
Max Schmitt 01790c0e19
fix(test-runner): throw error if no port and url is given (#20497)
https://github.com/microsoft/playwright/issues/20476
2023-01-30 16:28:31 +01:00
chimurai f72d400952
chore: fix typos (#20473) 2023-01-30 09:53:28 +01:00
Adi 32724cd5ce
docs: Added types to custom reporter typescript example (#20191) 2023-01-28 09:38:42 -08:00
Pavel Feldman 2b499bd5d6
chore: create tests groups per project (#20463) 2023-01-28 09:30:42 -08:00
Pavel Feldman 2c27bd3b07
chore: remove plugin registration sink (#20460) 2023-01-27 14:36:41 -08:00
Yeison Daza 98a0f98577
chore: ct vite config async (#20288) 2023-01-27 14:13:15 -08:00
Pavel Feldman b91bb1af9a
chore: minimize configLoader use (#20431) 2023-01-27 12:44:15 -08:00
Pavel Feldman 7d7e66f450
chore: group test runner files by process (#20425) 2023-01-26 17:26:47 -08:00
Pavel Feldman 0c84d88127
chore: extract tasks into separate methods (#20413) 2023-01-26 13:20:05 -08:00
Pavel Feldman 5761a62b1c
docs: clarify the null value for the viewport (#20333)
Fixes https://github.com/microsoft/playwright/issues/20284
2023-01-25 17:48:18 -08:00
Pavel Feldman f7ff252455
chore: remove addFatalError (#20383) 2023-01-25 17:26:30 -08:00
Pavel Feldman fe1dd7818d
chore: extract task runner for global setup (#20345) 2023-01-25 15:38:23 -08:00
Dmitry Gozman d1fb3a2384
fix(test runner): do not send entirely skipped test groups to a worker (#20346)
Move TestCase properties calculation from WorkerMain to suite building
phase.

Fixes #20156.
2023-01-25 12:54:50 -08:00
Dmitry Gozman 1f576ff0bc
chore: simplify static test annotations (#20335) 2023-01-24 12:49:47 -08:00
Dmitry Gozman b971dd3417
fix(test runner): show deep strack traces during imports (#20305)
Fixes #20239.
2023-01-24 08:49:06 -08:00
Pavel Feldman 147bb6b292
chore: run global setup before onBegin (#20285) 2023-01-23 17:44:23 -08:00
Pavel Feldman 9f31bcfbab
chore: refactor graceful close, rename to host/main (#20283) 2023-01-22 15:04:29 -08:00
Dmitry Gozman 0cc0d168cd
chore: mark 1.31-next (#20268) 2023-01-20 19:29:14 -08:00
Pavel Feldman 7ff27600b4
chore: experimental oop loader (#20269) 2023-01-20 18:24:15 -08:00
Dmitry Gozman eafa6fda13
fix(expect): poll/toPass should not wait over specified timeout (#20266)
Drive-by: unflake some timeout-dependent tests.
2023-01-20 15:47:24 -08:00
Pavel Feldman 3066ffd577
chore: use fake pool on the runner side (#20241) 2023-01-20 08:36:31 -08:00
Pavel Feldman fdd62f31f1
chore: extract pool builder, simplify project suite cloning (#20235) 2023-01-19 15:56:57 -08:00
Dmitry Gozman d950f5b6ee
chore: remove toIntersectViewport for the next release (#20232)
Mostly reverts #19901.
2023-01-19 15:04:09 -08:00
Pavel Feldman e08168e16e
chore: temporarily remove project and global setup, store (#20181) 2023-01-18 12:56:03 -08:00
Pavel Feldman 3fd0530076
chore: remove worker isolation options (#20176) 2023-01-17 17:38:44 -08:00
Pavel Feldman d9d4070520
chore: split config and test loaders (#20175) 2023-01-17 17:16:36 -08:00
Pavel Feldman 020dcd89fa
chore: prepare to load scripts in subprocess (#20174) 2023-01-17 14:53:11 -08:00
Ben McCann 9ba5a1be38
fix: remove export for file that doesn't exist (#20120) 2023-01-17 22:43:07 +01:00
Max Schmitt df05c00da3
fix: filter out pwt stacks correctly (#20158)
Fixes https://github.com/microsoft/playwright/issues/20155
2023-01-17 22:38:30 +01:00
Pavel Feldman 9a64597d74
chore: extract process and process host (#20166) 2023-01-17 12:43:51 -08:00
Andrey Lushnikov 92375f6333
fix: support import assertions (#20009)
Fixes #19928

Co-authored-by: Max Schmitt <max@schmitt.mx>
2023-01-16 08:26:14 -08:00
Pavel Feldman d1c161ce99
chore: merge the util exports (#20110) 2023-01-13 13:50:38 -08:00
Pavel Feldman 736cf5c585
fix(tsx): resolve .js imports to .tsx as well (#20092)
Fixes: https://github.com/microsoft/playwright/issues/20039
2023-01-13 10:49:10 -08:00
Pavel Feldman e065d608b6
chore: introduce defineConfig for easier JS typing (#20061)
Fixes https://github.com/microsoft/playwright/issues/19694
2023-01-12 13:12:02 -08:00
Yury Semikhatsky 730a197c80
feat: config.globalScripts (#20062)
Introduce config.globalScripts. Tests from the matching files will run
before all projects. We'll only allow beforeAll/afterAll instead of
tests in such files (next PR).

Global scripts are executed as part of 'Global Scripts' project which is
not present in FullConfig.projects but may be referenced by
corresponding global setup Suites.

Signed-off-by: Yury Semikhatsky <yurys@chromium.org>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2023-01-12 13:02:54 -08:00
Dmitry Gozman 9a5df720ff
chore: fix build/watch script for bundles and vite-powered packages (#20055) 2023-01-11 18:36:04 -08:00
Dmitry Gozman 28577afde4
feat(soft expect): mark steps with failed soft expects as failed (#19973)
Fixes #19673.
2023-01-09 16:17:06 -08:00
Yury Semikhatsky a39a97f0ee
chore: setup -> test.projectSetup (#19932)
* Changed `setup` to `test.projectSetup`
* Only `test.projectSetup.only` is supported on the new method
* test.* methods except for before/after/Each/All hooks can be called
inside the project setup files
2023-01-09 11:21:48 -08:00
Pavel Feldman 6083926111
chore: render readable title separator in errors (#19754) 2023-01-09 09:33:09 -08:00
Andrey Lushnikov 2a49c5e498
feat(expect): introduce expect(locator).toIntersectViewport() (#19901)
This is a new web-first assertion that should be used like this:

```ts
test('should work', async ({ page }) => {
  const locator = page.locator('body');
  // New web-first assertion.
  await expect(locator).toIntersectViewport();
  // The same functionality.
  await expect.poll(() => locator.viewportRatio()).toBeGreaterThan(0);
});
```

Fixes #8740
2023-01-06 16:56:24 -08:00
Dmitry Gozman b376110b77
docs: add proper usage for some test apis (#19925) 2023-01-06 10:26:23 -08:00
Dmitry Gozman 31a63b5c2a
fix(reuse): make reuse work with tracing (#19733)
Fixes #19059.
2023-01-05 14:50:47 -08:00
Yury Semikhatsky 2f3db200f6
chore(cli): filter matches against absolute path (#19900)
#19522
2023-01-05 13:39:39 -08:00
Andrey Lushnikov 1afa38d5a7
chore(expect): extract polling from expect.poll and expect().toPass (#19882)
This extracts & unifies polling machinery from `expect.poll` and
`expect.toPass` methods.
2023-01-05 11:14:37 -08:00
Dmitry Gozman 388a3e1f37
fix(test runner): make sure to run afterAll after skipped tests (#19878)
Fixes #19745.
2023-01-04 14:13:49 -08:00
Grant Colestock a30aac5668
fix: make sure jsx fragments are transformed (#19755)
Fixes: #19142
2022-12-31 11:08:36 -08:00
Michael Glass 13c5019ac9
fix(playwright-test): _removeOutputDirs called without await always returns truthy (#19771) 2022-12-31 11:05:10 -08:00
Sander b363902e1b
feat(ct): https (#19697) 2022-12-28 17:04:23 -08:00
Dmitry Gozman 5cdf118a42
fix(reuse): disable trace/video when reusing the context (#19764)
Previously, we disabled reuse when trace/video was on. Component testing
keeps this behavior.

References #19059.
2022-12-28 16:58:34 -08:00
Yury Semikhatsky 137070d889
Revert "chore: hide setup, store, TestProject.setupMatch, storageStat… (#19756)
…eName (#19442)"

This reverts commit 92dd734e04.
2022-12-28 15:39:31 -08:00
Sander c5d9b8d0fb
chore: update to vite 4 (#19690) 2022-12-27 09:14:39 -08:00
Pavel Feldman 233664bd30
chore: report more fatal errors via reporter (#19640) 2022-12-22 17:31:02 -08:00
Dmitry Gozman b8848fb499
fix(test runner): make sure undefined options in config result in default values (#19632)
Note: this keeps existing behavior of `undefined` in `test.use()`
reverting to the config value and not to the original default value.

References #19615.
2022-12-21 14:34:43 -08:00
Dmitry Gozman d12bc0be9a
fix(screenshot): account for screenshot === undefined (#19627) 2022-12-21 10:16:36 -08:00
Pavel Feldman 675f0eb4a0
chore: report error location for fatal errors (#19610) 2022-12-21 09:36:59 -08:00
Ross Wollman 0844394270
feat(html): display overall duration (#19576)
<img width="1390" alt="Screenshot 2022-12-19 at 4 15 33 PM"
src="https://user-images.githubusercontent.com/11915034/208552484-c0127615-d2c6-414f-ae3b-e7836553d890.png">

* Adds duration (time ellapsed from `onBegin` to `onEnd`); roughly
equivalent to `time npx playwright test …`.
* Removes cumulative per-file time

Resolves #19566.
2022-12-20 14:13:10 -08:00
Andrey Lushnikov d7e7cab44a
fix: properly handle negated timed-out toPass matcher (#19580) 2022-12-20 08:41:32 -08:00
Han Yeong-woo 00ffd74727
fix(runner): import export assignment from ts (#19559) 2022-12-19 14:41:29 -08:00
Vladimir Semenov 467d9f37fc
feat(reporter): Add parallelIndex field to TestResult (#19570) 2022-12-19 14:37:04 -08:00
Andrey Lushnikov 0be1fc8559
chore: cut version 1.29 (#19489) 2022-12-15 11:22:35 -08:00
Pavel Feldman 0e2732decf
feat(api): introduce expect().toPass (#19463) 2022-12-14 19:23:13 -08:00
Andrey Lushnikov 8167f8bf54
chore: hide "comparator" option from documentation and types (#19441) 2022-12-14 09:58:19 -08:00
Yury Semikhatsky 92dd734e04
chore: hide setup, store, TestProject.setupMatch, storageStateName (#19442) 2022-12-13 22:48:38 -08:00
Dmitry Gozman ab9602bebf
chore: remove unused PW_TEST_OUT_OF_PROCESS_DRIVER (#19434) 2022-12-13 16:04:44 -08:00
Dmitry Gozman 256e9fd443
feat(connect): allow exposing local network to the remote browser (experimental) (#19372)
`connectOptions: { _exposeNetwork: '*' | 'localhost' }`

References #19287.
2022-12-09 11:16:29 -08:00
Andrey Lushnikov 858c2453b3
feat(containers): implement reverse proxy for novnc and server (#18569)
This patch adds a reverse proxy in front of novnc and playwright
server inside the container.

As a result:
- container exposes a single HTTP port to the host
- all Playwright clients can connect using this exposed port, e.g.
  `http://127.0.0.1:5400`
- navigating to the exposed port in the browser lands on a nice HTML
page
  with a link to view container screen
- users can also manually navigate to `http://127.0.0.1:5400/screen` to
  view screen
2022-12-08 17:17:18 -08:00
Fernando Garcia Llorente cd4ccdfa29
feat: allow options in automatic screenshots (#19143)
Closes #9983 

Allowing Automatic Screenshots in `PlaywrightTestConfig` to have
`fullPage` & `omitBackground` as optional parameters.
2022-12-07 08:45:33 -08:00
Andrey Lushnikov cac67fb94f
chore: do not use "threshold" option for the ssim-cie94 comparator (#19314) 2022-12-06 17:03:13 -08:00
Yury Semikhatsky beb15bb504
chore: rename setup => setupMatch (#19309) 2022-12-06 14:55:22 -08:00
Yury Semikhatsky 1b3e53697b
chore: TestStorage => TestStore (#19308) 2022-12-06 13:33:43 -08:00
Yury Semikhatsky 8660288518
chore: use isProjectSetup instead of set (#19285) 2022-12-06 08:59:28 -08:00
Yury Semikhatsky 3c1b26b9f1
feat: make storage a global variable (#19283) 2022-12-05 21:37:37 -08:00
Yury Semikhatsky f9ef18912d
feat: use setup() instead of test() for project setup (#19281) 2022-12-05 18:15:01 -08:00
Andrey Lushnikov 6d82460a02
feat: implement a new image comparison function (#19166)
This patch implements a new image comparison function, codenamed
"ssim-cie94". The goal of the new comparison function is to cancel out
browser non-determenistic rendering.

To use the new comparison function:

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

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

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

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

[CIE94]: https://en.wikipedia.org/wiki/Color_difference#CIE94
[just-noticeable difference]:
https://en.wikipedia.org/wiki/Just-noticeable_difference
2022-12-02 15:22:05 -08:00
Dmitry Gozman 6471e8536e
feat(test runner): support jsconfig.json's baseUrl+paths (#19219)
Fixes #19129.
2022-12-01 16:42:25 -08:00
Shubham Kanodia 4679cfaeb9
fix: Fixes #19169 Issue with moving up a directory in snapshotPathTemplate (#19170)
Fixes #19169

Note, I'm not sure why it was done this way before — e.g. Why `testDir`
were considered for resolution, but `testFileDir` wasn't.

Looking for guidance on the approach here, because there are still some
template tokens outside `path.resolve`

Co-authored-by: Shubham Kanodia <skanodia@atlassian.com>
2022-12-01 10:05:15 -08:00
Max Schmitt 62b28c89b4
docs(assertions): fix wrong toHaveText param description (#19213)
Fixes https://github.com/microsoft/playwright/issues/19202
2022-12-01 09:14:06 -08:00
Yury Semikhatsky de1fc170b2
docs: TestProject.setup (#19152) 2022-11-30 09:18:47 -08:00
Pavel Feldman 89bdaf2441
chore: rename ScreenshotAssertions to SnapshotAssertions (#19150) 2022-11-29 16:57:03 -08:00
Yury Semikhatsky c9ec8b3e55
docs: clarify what is passed as Test.grep input (#19153)
Fixes https://github.com/microsoft/playwright/issues/18669
2022-11-29 16:03:30 -08:00
Dmitry Gozman b1b21bdac5
fix(shards): zero-sized shard should not include all tests (#19148)
Fixes #19073.
2022-11-29 16:02:11 -08:00
Shubham Kanodia 3d804ff7cd
chore: rewrite error message for missing snapshot (#19104) 2022-11-29 12:51:15 -08:00
Dmitry Gozman 4f72a895e9
fix(inspector): render expect.not correctly (#19125)
Also fixes the same in expect logs.

References #19083.
2022-11-28 20:50:16 -08:00
Dmitry Gozman 65b0fb055d
docs: note assertion methods that only work with playwright test runner (#19116)
Fixes #18963.
2022-11-28 10:32:48 -08:00
Dmitry Gozman bd07a63683
docs: highlight printsToStdio in reporter reference (#19118)
Fixes #18945.
2022-11-28 10:32:01 -08:00
Pavel Feldman be2139f0ac
docs: split assertions list into langs (#19039) 2022-11-24 08:25:24 -08:00
Pavel Feldman f9a32e0927
chore: follow up to deprecation changes (#19025) 2022-11-23 12:32:14 -08:00
Max Schmitt f8355b940e
chore: bump Babel dependencies (#19026) 2022-11-23 09:37:31 -10:00
Yury Semikhatsky 31d45ad4dc
chore(runner): add all setup files in separate pass (#18978) 2022-11-22 16:22:48 -08:00
Yury Semikhatsky 2dc51f6c46
fix(runner): run all setup files when there is test.only (#18967) 2022-11-21 16:33:23 -08:00
Andrey Lushnikov c0daeaa291
Revert "fix(webserver): do not spawn webserver as a new process group (#18564)" (#18968)
This reverts commit 26044c11c0.

Fixes #18865
2022-11-21 14:40:59 -08:00
Pavel Feldman 620e8547d4
chore: generate usage: sections based on snippets (#18965) 2022-11-21 10:40:21 -08:00
Pavel Feldman 3fb4b3bbf9
chore: normalize api markdown (#18942) 2022-11-21 09:30:32 -08:00
Yury Semikhatsky e1189a96b6
feat(runner): run all setup files if none matched the filter (#18922)
The behavior regarding filters (both in config, command line and .only)
is the following:
- if some of tests match and none of setup match then we'll run all
setup files and all matching tests
- otherwise the filters apply to setup files the same way as to regular
tests
2022-11-21 09:23:28 -08:00
Yury Semikhatsky c0d0f54a12
feat(runner): allow filtering setup and tests (#18900)
Running `npx playwright test file:123` will have the following behavior
- if only test files match then only matching subset of tests will run
but all setup files will run as well
- if only setup files match the filter then only those setup tests will
run
- if both setup and test files match an error will be thrown
2022-11-18 11:35:29 -08:00
Yury Semikhatsky 0f4b67bc6d
test(cli): setup files are in list-files and test --list output (#18890) 2022-11-17 16:31:04 -08:00
Pavel Feldman 4e58b0c2ea
chore: render timed out error message when expect timeouts (#18863)
Fixes https://github.com/microsoft/playwright/issues/18859
2022-11-16 17:00:42 -08:00
Yury Semikhatsky 05fb3e6de8
Revert "chore: hide TestProject.setup and TestInfo.storage (#18800)" (#18836)
Now that the patch has been cherry-picked to the release branch
reverting it on main.

This reverts commit 6deba5dc21.
2022-11-16 11:23:10 -08:00
Yury Semikhatsky 6deba5dc21
chore: hide TestProject.setup and TestInfo.storage (#18800) 2022-11-14 17:03:01 -08:00
Pavel Feldman 8e882fdd58
chore: make generated report writable (#18750)
Fixes: https://github.com/microsoft/playwright/issues/18747
2022-11-13 12:46:35 -08:00
Andrey Lushnikov bc78db07df
chore: cut 1.28 branch (#18746) 2022-11-11 15:30:15 -08:00
Andrey Lushnikov 251cc9e229
chore: fix docs (#18751) 2022-11-11 13:44:40 -08:00
sand4rt 46559a37c1
fix(ct): setting ctTemplateDir does not work (#18152)
closes: https://github.com/microsoft/playwright/issues/18116
2022-11-11 09:52:39 -08:00
Andrey Lushnikov 26044c11c0
fix(webserver): do not spawn webserver as a new process group (#18564)
This patch stops using `processLauncher` to launch web servers. Process
Launcher
will spawn a new process group which is separate from test runner.

This might result in unexpected behavior, e.g. `kill -sigkill
-<testrunnerpid>` will orphan web server process.

Instead, this patch simply spawns web server and sends `SIGTERM` to it
when ready.
2022-11-10 22:30:06 -08:00
Andrey Lushnikov f3a99fdd69
chore: address API review comments for the snapshotPathTemplate (#18716)
This patch:
- updates documentation to lead users from `TestConfig.snapshotDir` and
  `testInfo.snapshotSuffix` to `TestConfig.snapshotPathTemplate` as a
  better and more flexible alternative.
- drops `{snapshotSuffix}` from documentation
- stops using `snapshotSuffix = ''` in our own tests and switches us
  to the `snapshotPathTemplate`.
- adds `{testName}` token.
2022-11-10 17:23:57 -08:00
Chris Alley 1ec614bfc4
docs: fix grammar within class test API documentation (#18627) 2022-11-10 15:53:48 -08:00
Dmitry Gozman 194abc35cd
Revert #18561 "feat(test runner): test.reset() to reset options to default/config value" (#18704)
This reverts commit 6fef227f43.

Not shipping in 1.28.
2022-11-10 14:45:05 -08:00
Dmitry Gozman 6d456d30dc
docs: improve test.describe.configure() (#18705) 2022-11-10 12:29:38 -08:00
Andrey Lushnikov f52fa4ceba
chore(snapshotPathTemplate): address review comments (#18702) 2022-11-10 11:37:41 -08:00
Andrey Lushnikov 6d491f928d
feat(playwright-test): introduce snapshotPathTemplate configuration (#18568)
This configuration option allows to set a string with template
values for precise control over snapshot path location.

An example of `snapshotPathTemplate` usage:

```ts
// playwright.config.ts
// Notice the `testDir` configuration!
export default {
  testDir: './tests',
  snapshotPathTemplate: './__screenshots__/{platform}/{projectName}/{testFilePath}/{arg}{ext}',
}
```

Currently supported "magic tokens" inside the `snapshotPathTemplate`
are:

- `{testDir}` - project's `testDir`
- `{snapshotDir}` - project's `snapshotDir`
- `{platform}` - `process.platform`
- `{projectName}` - Project's sanitized name
- `{testFileDir}` - Directories in relative path from `testDir` to test
  file path (e.g. `page/` in the example below)
- `{testFileName}` - Test file name (with extension) (e.g.
  `page-click.spec.ts` in the example below)
- `{testFilePath}` - Relative path from `testDir` to test file path
  (e.g. `page/page-click.spec.ts` in the example below)
- `{ext}` - snapshot extension (with dots)
- `{arg}` - joined snapshot name parts, without extension (e.g.
`foo/bar/baz` in the example below)
- `{snapshotSuffix}` - `testInfo.snapshotSuffix` value.

Consider the following file structure:

```
playwright.config.ts
tests/
└── page/
    └── page-click.spec.ts
```

The following `page-click.spec.ts`:

```ts
// page-click.spec.ts
import { test, expect } from '@playwright/test';

test('should work', async ({ page }) => {
  await expect(page).toHaveScreenshot(['foo', 'bar', 'baz.png']);
});
```

Fixes #7792
2022-11-09 15:29:07 -08:00
Andrey Lushnikov 9bcb28f25a
Revert "feat: send SIGTERM to webserver before SIGKILL'ing it. (#18220)" (#18661)
This reverts commit c63a0b536d.

Reason: https://github.com/microsoft/playwright/pull/18564
2022-11-09 09:18:33 -08:00
Pavel Feldman b8bd4f7a48
chore: serialize config as a part of list-files (#18649) 2022-11-08 12:05:00 -08:00
Yury Semikhatsky d5494edf71
feat(runner): TestOptions.storageStateName (#18587) 2022-11-07 16:27:38 -08:00
Yury Semikhatsky 25dc0bfacb
feat(runner): change storage fixture to TestInfo.storage() (#18584) 2022-11-04 14:28:25 -07:00
Dmitry Gozman 6fef227f43
feat(test runner): test.reset() to reset options to default/config value (#18561) 2022-11-04 09:03:29 -07:00
Yury Semikhatsky c8cd07594c
feat(runner): initialize context.storageState from storage entry (#18549) 2022-11-03 14:20:39 -07:00
Xiaoxing Ye 9338355e47
feat(testinfo): add name to attachment output name (#18440)
Per discussion in #12950, adding sanitized name to the output filename
prefix. This can make debugging easier, and the filename structure more
human friendly.
2022-11-03 13:54:51 -07:00
Andrey Lushnikov 8538f61a72
feat(containers): implement global network tethering for playwright server (#17719)
This patch implements a new mode of network tethering for Playwright
server & its clients.
With this patch:
- playwright server could be launched with the
`--browser-proxy-mode=tether` flag to engage in the new mode
- a new type of client, "Network Tethering Client" can connect to the
server to provide network traffic to the browsers
- all clients that connect to the server with the `x-playwright-proxy:
*` header will get traffic from the "Network Tethering Client"

This patch also adds an environment variable
`PW_OWNED_BY_TETHER_CLIENT`. With this env, playwright server will
auto-close when the network tethering client disconnects. It will also
auto-close if the network client does not connect to the server in the
first 10 seconds of the server existence. This way we can ensure that
`npx playwright docker start` blocks terminal & controls the lifetime of
the started container.
2022-11-03 13:47:51 -07:00
Yury Semikhatsky 45aa82242d
feat(runner): storage fixture (#18522) 2022-11-02 20:22:35 -07:00
Andrey Lushnikov c3cff485d1
feat(html): add --host and --port to the show-report command (#18517)
This enables serving HTML report from inside docker container.

Drive-by: restore default HTML serving port to 9323. This was
accidentally changed in 1.27 and mentioned in

https://github.com/microsoft/playwright/issues/16667#issuecomment-1269861623
2022-11-02 15:12:48 -07:00
Yury Semikhatsky 1d2fc1e963
feat(runner): project.setup (#18486) 2022-11-01 23:44:30 -07:00
Pavel Feldman 2183d9e9a2
chore: use codemirror for editor (#18482) 2022-11-01 15:04:30 -07:00
Yury Semikhatsky 7337dd4e28
chore: revert project.{stage,run} (#18462) 2022-10-31 14:04:24 -07:00
sand4rt fbfec18678
fix(ct): vite base url (#17767) 2022-10-31 12:58:07 -07:00
Pavel Feldman a7f5f2d7a1
chore: allow not overriding media when creating context (#18413) 2022-10-31 09:09:52 -07:00
Dmitry Gozman 2d3b2a0768
feat(test runner): test.describe.configure({ retries, timeout }) (#18388)
References #10825.
2022-10-27 15:53:27 -07:00
Pavel Feldman db456a020c
chore: do not point to node_modules in code frames (#18358)
Fixes https://github.com/microsoft/playwright/issues/18330
2022-10-26 15:18:31 -07:00
Yury Semikhatsky 63c41f88cd
chore: remove stale TODOs (#18331) 2022-10-25 15:21:04 -07:00
Max Schmitt ffc47271f2
fix(junit): escape null control character (#18325)
Fixes https://github.com/microsoft/playwright/issues/18322
2022-10-25 14:39:16 -07:00
Dmitry Gozman caa9c6a597
fix(test runner): make sure soft expect error does not mask a timeout flag (#18321)
We have to reliably know whether test timed out or not, and soft expect
error could have marked it with `status=failed` but it would still time
out. Now we have a separate `_didTimeout` flag for this.

Fixes #18023.
2022-10-25 12:34:15 -07:00
Pavel Feldman ab78865a8d
chore: render steps in list reporter (#18269) 2022-10-24 15:54:53 -07:00
Andrey Lushnikov c63a0b536d
feat: send SIGTERM to webserver before SIGKILL'ing it. (#18220)
We now will send `SIGTERM` to the webserver and wait for the `timeout`
before sending `SIGKILL` to it.

Fixes #18209
2022-10-21 08:55:06 -07:00
Pavel Feldman 5b1e4e08a5
chore: detect browser reuse based on the connection headers (#18230) 2022-10-20 18:30:37 -07:00
Sean Killeen 7ae447ea0f
docs: fix typos (#17919) 2022-10-20 13:46:37 -07:00
Pavel Feldman fb643940e5
chore: resolve filename in the resolution hook (#18221) 2022-10-20 13:30:34 -07:00
Pavel Feldman fb9555fb5d
fix(ts): resolve .js to .ts in non-ESM mode too (#18219)
Fixes https://github.com/microsoft/playwright/issues/18077
2022-10-20 12:21:22 -07:00
Pavel Feldman ad9729f246
chore: respect tsconfig paths in js files (#18191)
Fixes: https://github.com/microsoft/playwright/issues/17804
2022-10-19 19:38:14 -07:00
Max Schmitt af38449f42
fix(pwtest): fix focused line with dirname specified (#18189) 2022-10-19 15:05:59 -07:00
Dmitry Gozman 9fe72a1da8
fix(test runner): remove unused type imports during transform (#18157)
Fixes #18117.
2022-10-19 13:06:11 -07:00
Yury Semikhatsky 11eb719d13
feat(runner): project run: "always" (#18160)
Projects marked with `run: 'always'` are non shard-able and run after
failures.
2022-10-18 17:18:45 -07:00
Pavel Feldman 7ab4c17519
chore: support jsx/tsx syntax in test files (#18123)
Fixes https://github.com/microsoft/playwright/issues/17964
2022-10-18 12:45:33 -07:00
Yury Semikhatsky 08a3a269cd
feat(runner): project.canShard (#18037) 2022-10-12 14:34:22 -07:00
Yury Semikhatsky 3b8f63d703
feat(runner): project.stopOnFailure (#18009) 2022-10-11 17:04:01 -07:00
Pavel Feldman d5c4291a89
chore: don't fail on undefined video/trace (#17999)
Fixes #17396
2022-10-11 10:10:43 -07:00
sand4rt 1a43af3fb6
feat(ct): rerender to update (#17972) 2022-10-10 19:56:33 -07:00
Yury Semikhatsky 3592269caf
feat(runner): project.stage (#17971) 2022-10-10 17:56:18 -07:00
Yury Semikhatsky 2d72d0ba03
chore: remove config.groups (#17974) 2022-10-10 16:42:48 -07:00
sand4rt c889b2ad26
feat(ct): vue3 rerender complete (#17069) 2022-10-06 15:07:32 -07:00
Pavel Feldman c0e4caa604
fix(esm+tsconfig): allow mapped ts files in esm mode (#17862)
Fixes https://github.com/microsoft/playwright/issues/17840
2022-10-05 18:00:49 -07:00
Dmitry Gozman ed6ecbca2a
chore: cut v1.27.0 (#17859) 2022-10-05 15:30:35 -07:00
Dmitry Gozman 6750a02506
fix(api): hide TestConfig.groups (#17853)
Also fix types for `FullConfig.configFile`.
2022-10-05 14:24:14 -07:00
Dmitry Gozman 30179d4d78
fix(tsconfig): remove TS_NODE envs, update docs (#17847)
References #17469.
2022-10-05 12:51:12 -07:00
Dmitry Gozman 2bcd9ce9ae
chore: internal selectors (#17827)
- Rename internal selectors `has`, `control` and `attr` to
`internal:has`, `internal:control` and `internal:attr`.
- Fix `getByLabel()` to respect strictness, by introducing
`internal:label` selector.
- Move tests essential for ports to `selectors-by.spec`.
2022-10-05 08:45:10 -07:00
Pavel Feldman 8810b55504
feat(api): shorted getByLabel, getByPlaceholder (#17816) 2022-10-04 10:29:26 -07:00
Dmitry Gozman b07690f408
docs: use getBy... in documentation (#17795) 2022-10-03 17:02:46 -07:00
Yury Semikhatsky ef32cab423
chore: turn RunPhase in a class with helper methods (#17721) 2022-09-30 09:12:06 -07:00
Han Yeong-woo ce2ded1f7e
docs(assertions): fix wrong link (#17733) 2022-09-30 11:07:14 +02:00
Yury Semikhatsky 51966bc045
fix: --grep and --grep-invert should intersect with config (#17716)
Fixes https://github.com/microsoft/playwright/issues/17405
2022-09-29 16:39:21 -07:00
Pavel Feldman a97deb1600
chore: hide reporter project id (#17710) 2022-09-29 12:51:06 -07:00
Yury Semikhatsky 43ccd7bc96
chore(runner): remove watch mode (#17682) 2022-09-29 10:20:21 -07:00
Yury Semikhatsky 9f17ee6871
feat: group filter (#17646) 2022-09-28 18:45:01 -07:00
Pavel Feldman d8f67eb75d
feat(api): introduce getByTestId (#17645) 2022-09-27 21:06:07 -07:00
Pavel Feldman 8ad201b802
chore: add snippet to the json report (#17567) 2022-09-27 13:23:08 -07:00
Dmitry Gozman 3409a37f77
feat: allow opening multiple html reporters and trace viewers (#17636)
This makes `HttpServer` accept `preferredPort` option that will first
try to listen on that port, and if that port is already in use, listen
on some available port instead.

Fixes #17201.
2022-09-27 12:45:42 -07:00
Pavel Feldman 3a13a897b9
Revert "fix(pwt): compatibility in CWD with wrong casing (#16636)" (#17599) 2022-09-26 18:53:08 -07:00
Ross Wollman e73676d094
fix(reporters): output relative to config (#17518)
Fixes #17412.
Supercedes #17413.

- if configured via playwright.config.ts, relative paths should be
relative to the config.
- if configured via env var, should be relative to `cwd`
2022-09-26 11:01:43 -07:00
Andrey Lushnikov ec40e49978
feat: expose configuration for HTML report serving. (#17560)
Fixes #16667
2022-09-25 20:36:38 -07:00
Yury Semikhatsky 10d7c60abf
feat(runner): project execution schedule (#17548) 2022-09-23 20:01:27 -07:00
Dmitry Gozman f17d345ac9
fix(ct): support empty fragments (#17475)
Currently, we ues `#root` vs `#root > *` selector for component roots
depending on the number of root children. This heuristic detects
fragments that render multiple elements inside the root.

However, this does not work with empty fragments that do not render
anything.

The fix is to make the `#root >> control=component` selector that would
dynamically detect the root. This supports empty fragments and also
allows for dynamic updates of the fragments.
2022-09-21 15:12:18 -07:00
Andrey Lushnikov d431958603
chore: move container integration back to playwright-core (#17487) 2022-09-21 12:45:43 -07:00
Jean-François Greffier a15fe50e7b
feat(test runner): workers as percentage (#17400)
Allows to set workers as a percentage of logical CPUs, for example
"50%".

Examples :
```bash
npx playwright test --workers 3
npx playwright test --workers 50%
```

```js
const config: PlaywrightTestConfig = {
  // ...
  workers: '33%',
}
```
2022-09-21 11:17:36 -07:00
Dmitry Gozman da7feb9cc6
fix(esm): silence warning when running with experimental loader (#17493)
Unfortunately, this silences all warnings, not just the experimental
loader warning.
2022-09-21 10:56:17 -07:00
Pavel Feldman df143031e7
chore: move protocol and trace types into the top-level packages (#17486) 2022-09-20 18:41:51 -07:00
Bastian 29ff00ead2
docs(cli): typo in --debug flag (#17455) 2022-09-20 14:00:59 +02:00
Pavel Feldman e9f926e536
fix(docker): do not sync primary selection into clipboard (#17424) 2022-09-19 06:08:40 -07:00
Yury Semikhatsky ee83694372
chore(runner): remove unnecessary traversal (#17415) 2022-09-16 15:45:52 -07:00
Ross Wollman 8d639ae50e
chore: revert toHaveAttribute type sig and overloads (#17406)
Relates #16517.

Revert "docs(python): add missing NotToHaveAttribute overloads (#17371)"

This reverts commit 2e1ea29614.

Revert "docs(release-notes): add 1.26 release notes for language ports
(#17345)"

This reverts commit 4b8a85e69d.

Revert "test: unflake "should support boolean attribute with options"
(#17024)"

This reverts commit 1dc05bd4c6.

Revert "fix: support toHaveAttribute(name, options) (#16941)"

This reverts commit f30ac1d678.

Revert "feat: expect(locator).toHaveAttribute to assert attribute
presence (#16767)"

This reverts commit 622c73cc1e.
2022-09-16 11:17:35 -07:00
Pavel Feldman a6d9aa8708
fix(docker): use config to set up walpaper (#17399) 2022-09-16 09:27:59 -07:00
Andrey Lushnikov 24d3a23a66
fix(docker): handle container name conflict usecase. (#17379)
Drive-by: typo in the JSON docker status field.
2022-09-15 16:59:41 -07:00
Pavel Feldman 872bcc9734
chore: expose driver protocol on the pw object (#17363) 2022-09-15 15:53:18 -07:00
Andrey Lushnikov b09ea69024
chore(docker): address docker offline comments (#17377)
This patch:
- Removes all `process.exit(1)` from `docker.ts` and instead throws
  errors.
- Drops the `npx playwright docker test` command. We agreed to
  engage docker when `PLAYWRIGHT_DOCKER` environment variable
  is set.
- Introduces hidden `npx playwright docker status` command that
  dumps a JSON with docker status:
  ```sh
  aslushnikov:~/prog/playwright$ npx playwright docker status
  {
    "dockerEngineRunning": true,
    "imageName": "playwright:local-1.27.0-next-focal",
    "imageIsPulled": true,
"containerWSEndpoing":
"ws://127.0.0.1:55077/eafeb84c-571b-4d12-ac51-f6a2b43e9155",
"containerVNCEndpoint":
"http://127.0.0.1:55076/?path=fb6d4add-9adf-4c3c-b335-893bdc235cd7&resize=scale&autoconnect=1"
  }
  ```
2022-09-15 15:48:12 -07:00
Pavel Feldman 30ff27843a
chore: rebuild components on new vite (#17367) 2022-09-15 15:24:01 -07:00
Andrey Lushnikov 8466c436c9
fix(list reporter): properly count new lines for long stdout (#17339) 2022-09-14 15:25:24 -07:00
Pavel Feldman 854c783019
chore: project.id, configFile in reporter apis (#17346) 2022-09-14 14:56:28 -07:00
Max Schmitt 4b8a85e69d
docs(release-notes): add 1.26 release notes for language ports (#17345) 2022-09-14 22:38:19 +02:00
Andrey Lushnikov e295eea450
fix(ignoreSnapshots): print a notice when ignoreSnapshots option is on (#17317)
<img width="1161" alt="image"
src="https://user-images.githubusercontent.com/746130/190032155-ae454c3e-1a7d-4a64-8cd6-bb27f9075ef3.png">
2022-09-14 09:16:41 -07:00
Andrey Lushnikov 210f7b2203
fix(docker): stop containers started with npx playwright docker start (#17316)
This patch makes `npx playwright docker stop` command to stop
containers that were launched with previous playwright version.
2022-09-13 17:08:01 -07:00
Andrey Lushnikov dfcd2a273d
fix(docker): do not pollute stdout when used with JSON reporter (#17315)
This patch moves parts of docker configuration to a plugin so that
it can rely on repoter for stdout.

Drive-by: provide all plugins with reporter in the `setup` callback.
2022-09-13 17:05:37 -07:00
Andrey Lushnikov 881f3101bd
chore(docker): consolidate docker code (#17314)
This patch consolidates all of docker implementation under the
`docker/` folder.
2022-09-13 16:14:49 -07:00
Andrey Lushnikov 4f11a4d5e7
feat(docker): use the __screenshots__ dir for snapshots by default (#17311)
This patch opts into the `__screnshots__` folder snapshot management
for docker.

With this patch, docker-originating snapshots will be stored in the
following folder:

```
{testDir}/__screenshots__/{projectName}/{testFilePath}/{snapshotName}
```

Where `{testFilePath}` is a test file path relative to `testDir`

Drive-by: introduce and document the `PLAYWRIGHT_DOCKER` environment
variable that enables docker integration.
2022-09-13 15:49:04 -07:00
Andrey Lushnikov 705bc28e92
feat(docker): auto-bind container ports to host ports (#17307)
Drive-by: make sure docker container does not expose ports on `0.0.0.0`
and instead registers to localhost. This way websocket and vnc ports
are not exposed to the public internet.
2022-09-13 13:23:04 -07:00
Andrey Lushnikov ebfefefc8e
chore: refactor docker integration code (#17297)
This patch splits out `dockerApi` namespace that is solely
responsible for docker API manipulation.
2022-09-13 10:55:11 -07:00
Andrey Lushnikov 8640d29ce4
chore(docker): address review comments (#17279)
Co-authored-by: Ross Wollman <rwoll@users.noreply.github.com>
2022-09-13 05:55:26 -07:00
Andrey Lushnikov bc942ef9ea
chore: cut v1.26.0 (#17265) 2022-09-12 10:45:27 -07:00
Andrey Lushnikov af042beb13
feat: introduce docker integration (#16382)
This patch introduces the following commands:
- `npx playwright docker build` that builds a VRT docker image
  locally that is based off the `mcr.microsoft.com/playwright:jammy`
- `npx playwright docker start` that launches a docker container with
  browsers.
- `npx playwright docker stop` that stops given docker container.
- `npx playwright docker test` that runs all the tests inside a
  launched docker container.
2022-09-09 15:25:42 -07:00
Dmitry Gozman fa7caf4193
feat(cli): remove -i (#17229) 2022-09-09 15:07:15 -07:00
Dmitry Gozman bca13bc35a
feat(assertions): support toBeVisible({ visible }) (#17207) 2022-09-09 08:33:23 -07:00
Pavel Feldman c91df61ca3
chore: optionally connect instead of launching (#17174) 2022-09-07 15:57:20 -07:00
Pavel Feldman 8d25f2ef59
fix(selectors): allow custom engines in out-of-process (#17139) 2022-09-06 14:15:53 -07:00
Dmitry Gozman f0c5810609
feat(assertions): support toBeEditable({ editable }) (#17065) 2022-09-06 12:50:45 -07:00
Dmitry Gozman 306ab34aa3
feat(assertions): support toBeEnabled({ enabled }) (#17058) 2022-09-06 11:40:34 -07:00
Ross Wollman c58bfd0552
fix(html-reporter): duplicate attachment name (#16929)
Fixes #16456.

The extra span/name was coming from
077b8a9289/packages/html-reporter/src/links.tsx (L72)
(in conjunction with the line above it).

These two lines assume `path` and `body` are mutally exclusive.

Regression likely introduced by the PR that added the now removed line #10778.
2022-09-03 15:25:56 -07:00
Dmitry Gozman 1dc2a33896
docs: clarify that toBeHidden works when nothing matches (#17057) 2022-09-02 16:36:19 -07:00
Andrey Lushnikov fafd9837ba
feat: introduce the --ignore-snapshots option (#17004)
This patch introduces `--ignore-snapshots` Playwright Test CLI option,
and `ignoreSnapshots` configuration argument.
2022-09-01 05:34:36 -07:00
Andrey Lushnikov 38f2a5d5f5
fix: include headlessness as a launch argument to browser (#16898) 2022-08-31 10:26:13 -07:00
nate-ro 409bab59ea
chore: added starting time of test to the base json reporter (#16885) 2022-08-30 20:03:21 -07:00
Yury Semikhatsky f30ac1d678
fix: support toHaveAttribute(name, options) (#16941) 2022-08-30 17:53:00 -07:00
Yury Semikhatsky 11dfd31dd9
feat: --pass-with-no-tests option (#16902) 2022-08-29 15:46:34 -07:00
Andrey Lushnikov 622c73cc1e
feat: expect(locator).toHaveAttribute to assert attribute presence (#16767)
This patch changes `expect(locator).toHaveAttribute()` so that the
`value` argument can be omitted. When done so, the method will
assert attribute existance.

Fixes #16517
2022-08-25 05:28:34 -07:00
Max Schmitt 9341bf12c6
docs(dotnet): enable api response assertions (#16799) 2022-08-24 08:30:47 -07:00
Pavel Feldman 4d892475da
chore: do not use experimental loader for web server (#16733) 2022-08-23 10:22:05 -07:00
Pavel Feldman d7be1fcca8
fix(esm): allow importing ts from esm (#16735) 2022-08-23 10:20:56 -07:00
Max Schmitt e344fe60e7
fix(pwt): compatibility in CWD with wrong casing (#16636) 2022-08-22 21:45:59 +02:00
Sergio Freire abe7cf23a7
fix(junit reporter): remove source location from classname attribute (#16499) 2022-08-19 16:42:21 -07:00
Max Schmitt 7e2aec7454
chore: align more ESLint rules with VSCode formatting (#16647) 2022-08-18 20:12:33 +02:00
sand4rt d9850e0e86
feat(ct): react rerender (#16560) 2022-08-16 10:47:33 -07:00
Pavel Feldman e64b09cc28 Revert "feat(ct): react rerender (#16549)"
This reverts commit a62accf8ae.
I'll reapply them in order.
2022-08-15 13:17:15 -07:00