Commit Graph

1062 Commits

Author SHA1 Message Date
Dmitry Gozman
73b20bc876
chore: roll stable-test-runner to 1.33.0-alpha-mar-20-2023 (#21817) 2023-03-20 13:42:22 -07:00
Dmitry Gozman
8accabdb59
test: gardening (#21814)
Notable changes:
- `page-event-crash` is not a page test, moving out of page/.
- One of the expect tests is directly covered by another, merging them.
2023-03-20 12:52:52 -07:00
Max Schmitt
4f43db686d
test: class properties with |this| don't work anymore (#21796)
https://github.com/microsoft/playwright/issues/21794
2023-03-20 16:38:51 +01: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
001df3a495
chore(ui): follow up to watch, fix win (#21792) 2023-03-19 22:52:48 -07:00
Pavel Feldman
754e6edb95
chore: show folders in the tree (#21789) 2023-03-19 18:51:09 -07:00
Pavel Feldman
294baaeb44
chore: allow watching all tests (#21787) 2023-03-19 14:50:09 -07:00
Pavel Feldman
8a65cf9aac
chore(ui): ui polish / nits (#21781) 2023-03-19 12:04:19 -07:00
Pavel Feldman
0728d0f7fb
chore(ui): show test source before running (#21776) 2023-03-17 21:34:40 -07:00
Pavel Feldman
22e11a12ab
chore: show snapshots for sync assertions (#21775) 2023-03-17 20:20:35 -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
Dmitry Gozman
e856344235
chore: increase timeout for flaky "should stop tracing on requestContext.dispose()" (#21767) 2023-03-17 13:33:44 -07:00
Yury Semikhatsky
95e7d3aabc
chore: hide store from public (#21763) 2023-03-17 11:50:44 -07:00
Pavel Feldman
49ce561244
chore(ui): add hover-based run test (#21758) 2023-03-17 09:43:54 -07:00
Max Schmitt
53d341be01
test: do not pollute stderr with trace-viewer wsEndpoint (#21748) 2023-03-17 16:15:20 +01:00
Pavel Feldman
e066ca0713
chore: use test project output dir when showing live trace (#21735) 2023-03-16 20:09:09 -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
7879cf30f0
fix(reuse): serial mode with tracing should not throw (#21726)
Regressed in #19733.
Fixes #21113.
2023-03-16 14:32:12 -07:00
Pavel Feldman
c45d8749b0
chore: split trace events into phases (#21696) 2023-03-15 22:33:40 -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
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
b85d670491
chore(ui): show output on demand (#21592) 2023-03-11 11:43:33 -08:00
Dmitry Gozman
21950bc8ce
feat(html reporter): render multiple annotations of the same type together (#21580)
Multiple annotations are rendered as comma-separated lists. Fixes
#21253.

![IMAGE 2023-03-10
14:24:10](https://user-images.githubusercontent.com/9881434/224439435-3bf8e4f4-d874-4595-931d-ea5ff33ea374.jpg)
2023-03-10 15:26:02 -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
Dmitry Gozman
58a23bc7a0
fix(test runner): allow worker-only dynamic imports (#21545)
Fixes #21409.
2023-03-10 08:58:26 -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
cffb6ac269
chore: move sever/isomorphic to utils/ to use it in client (#21445) 2023-03-06 18:49:14 -08:00
Sebastian Silbermann
fbaf56a13f
feat(ct-react): Support React 18 only (#19814)
BREAKING CHANGE: Drop support for React 17 and earlier
Support for React 17 an earlier is provided by
`@playwright/experimental-ct-react-17`

Closes #19923
2023-03-03 14:28:33 -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
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
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
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
Pavel Feldman
ed41fd0643
chore: use listview to render stack trace (#21197) 2023-02-24 15:31:10 -08:00
Max Schmitt
f3a46f7405
feat(html): render annotations as links if needed (#21165)
Fixes https://github.com/microsoft/playwright/issues/20584
2023-02-23 21:57:02 +01: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
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
24c8d45c70
chore: enable tsc for ttest sources (#21018) 2023-02-19 11:18:07 -08:00
Dmitry Gozman
595502ac46
chore: remove unnecessary args in ttest (#21012) 2023-02-18 13:08:17 -08:00
Dmitry Gozman
56dbd1fcb0
chore: remove usesCustomOutputDir from tests (#21011) 2023-02-18 11:41:41 -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
Pavel Feldman
96050a260e
chore(junit): render project as an agent name / hostname (#20927) 2023-02-16 07:59:05 -08:00
Dmitry Gozman
6f140d79d4
chore: do not create dummy config file in tests (#20935) 2023-02-16 06:56:52 -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
Dmitry Gozman
91da67fab1
test: remove magic headers in ttest (#20867)
Instead, explicitly import from '@playwright/test'.
2023-02-14 19:20:56 -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
Pavel Feldman
798696a18a
chore: fix context reuse disposal (#20876)
Fixes: https://github.com/microsoft/playwright/issues/20409
2023-02-14 12:56:47 -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
Dmitry Gozman
de69b766d9
test: code health in ttest (#20837)
- Remove duplicate tests.
- Remove unused test helpers.
- Print full watch output on failures.
- Unflake some tests.
2023-02-10 20:26:19 -08:00
Dmitry Gozman
789b1c75e6
fix(expect): report received when timedOut during oneShot (#20806) 2023-02-10 14:59:21 -08:00
Pavel Feldman
1ba768bf60
chore: make watch + ct happy (#20804) 2023-02-10 08:33:25 -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
69c4653c6b
chore: speculative windows cli fix (#20801) 2023-02-09 16:04:07 -08:00
Pavel Feldman
e1f287f255
chore: more watch tests (#20797) 2023-02-09 16:03:54 -08:00
Pavel Feldman
596ed97791
chore: add more watch tests (#20793) 2023-02-09 13:57:00 -08:00
Pavel Feldman
5112abc1d2
chore: fix a racy time-based test (#20783) 2023-02-09 08:49:51 -08:00
Pavel Feldman
b247bfe153
test(watch): start adding tests (#20764) 2023-02-09 08:31:02 -08:00
Pavel Feldman
7a093329fa
chore: do not run all on watch (#20758) 2023-02-08 12:44:51 -08:00
Pavel Feldman
11168efb0e
chore: roll stable-test-runner to ToT (#20754) 2023-02-08 10:02:20 -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
1b941bcf2e
chore: simplify ttests (#20733) 2023-02-07 15:11:44 -08:00
Yury Semikhatsky
f10b29fd5e
feat: show warning when some report shards are missing (#20731)
When some of the report shards are missing still show the report but
display an error in the status line:

![image](https://user-images.githubusercontent.com/9798949/217371112-2317a307-204e-4c11-8d01-42e91fe6ca7a.png)

#10437
2023-02-07 14:22:10 -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
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
b6df48758d
chore: collect test dependencies (#20645) 2023-02-06 14:52:40 -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
Sam Chen
340cacf4fd
feat: show diff tab by default (#19820)
Close https://github.com/microsoft/playwright/issues/19803

I had to manually inject `window.playwrightReportBase64` data into
`playwright/packages/html-reporter/index.html` when developing,
wondering if there's any method I don't know.
2023-02-03 10:32:23 -08:00
Andrey Lushnikov
f45f20a8c9
fix: handle not.toPass() with expect.soft inside (#20596)
Fixes #20518
2023-02-03 09:14:05 -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
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
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
Yury Semikhatsky
a03f3223c4
fix: trim long expect messages (#20517)
Fixes #20324
2023-01-30 17:24:12 -08:00
chimurai
f72d400952
chore: fix typos (#20473) 2023-01-30 09:53:28 +01:00
Pavel Feldman
2c27bd3b07
chore: remove plugin registration sink (#20460) 2023-01-27 14:36:41 -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
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
b700c08dc5
feat(screenshots): when actual and expected have different sizes, pad and produce the diff image (#20208)
Also show sizes in the html report to easier spot the size mismatch
issue.

<img width="1030" alt="diff"
src="https://user-images.githubusercontent.com/9881434/213327632-b8fcd69c-8d08-460c-9de1-b5f4f8c56359.png">

Fixes #15802.
2023-01-20 19:41:43 -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
e08168e16e
chore: temporarily remove project and global setup, store (#20181) 2023-01-18 12:56:03 -08:00
Max Schmitt
0656ab4811
chore: roll stable test-runner to 1.30.0-alpha-jan-16-2023 (#20139) 2023-01-17 19:23:24 +01: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
Max Schmitt
e2a2196e6a
chore(html-reporter): show project name always for the test file (#19905)
Fixes https://github.com/microsoft/playwright/issues/19874
2023-01-10 17:11:38 +01: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
Dmitry Gozman
31a63b5c2a
fix(reuse): make reuse work with tracing (#19733)
Fixes #19059.
2023-01-05 14:50:47 -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
Dmitry Gozman
6193e6d8ea
fix(reuse): reset tracing (#19876)
References #19059.
2023-01-04 13:19:05 -08:00
Grant Colestock
a30aac5668
fix: make sure jsx fragments are transformed (#19755)
Fixes: #19142
2022-12-31 11:08:36 -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
Pavel Feldman
233664bd30
chore: report more fatal errors via reporter (#19640) 2022-12-22 17:31:02 -08:00
Ross Wollman
06c7f1fb6c
fix(html): test and fix reporter timing display (#19670)
#19576 introduced a regression where the CLI reporters displayed some
times with way too many decimals. e.g. 7.123456789ms.

Prior to #19576, there were two monotonicTime implementations; that PR
updated the reporters to use the common definition that had existed in
utils.ts. However, that introduced a regression in the base.ts reporters
which used the ms duration humanizing package which did not account for
the more precise decimals used by the shared monotonicTime function.

This fix removes the dependency on the third-party ms package and now
consistently uses Pavel's humanize function which the HTML reporter had
been using and proved to have better defaults for decimals.
Additionally, we add more test coverage to limit future regressions
since this was caught in passing.

Closes #19556.
Relates #19576.
2022-12-22 15:57:55 -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
eaae8ebbf3
chore: throw InvalidSelectorError from selector parser, add some tests (#19636) 2022-12-21 14:27:35 -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
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
Fernando Garcia Llorente
cd4ccdfa29
feat: allow options in automatic screenshots (#19143)
Closes #9983 

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

```

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

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

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

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

```
2022-12-06 15:46:19 -08:00
Yury Semikhatsky
beb15bb504
chore: rename setup => setupMatch (#19309) 2022-12-06 14:55:22 -08:00
Yury Semikhatsky
1b3e53697b
chore: TestStorage => TestStore (#19308) 2022-12-06 13:33:43 -08:00
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
Dmitry Gozman
b1b21bdac5
fix(shards): zero-sized shard should not include all tests (#19148)
Fixes #19073.
2022-11-29 16:02:11 -08:00
Dmitry Gozman
23e02dd006
test: unflake some timeout-dependent tests (#19139) 2022-11-29 12:54:53 -08:00
Shubham Kanodia
3d804ff7cd
chore: rewrite error message for missing snapshot (#19104) 2022-11-29 12:51:15 -08:00
Yury Semikhatsky
31d45ad4dc
chore(runner): add all setup files in separate pass (#18978) 2022-11-22 16:22:48 -08:00
Dmitry Gozman
503f8f51dc
fix(reuse): stop pending operations upon reuse/disconnect (#18997) 2022-11-22 15:21:20 -08:00
Yury Semikhatsky
2dc51f6c46
fix(runner): run all setup files when there is test.only (#18967) 2022-11-21 16:33:23 -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
Dmitry Gozman
1ec0bb277d
feat(expect): ensure at least one expectation check, no matter the timeout (#18895)
References #18859.
2022-11-17 19:43:10 -08:00
Yury Semikhatsky
0f4b67bc6d
test(cli): setup files are in list-files and test --list output (#18890) 2022-11-17 16:31:04 -08:00
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
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
Andrey Lushnikov
db826c9c8c
chore: drive-by fixes for the snapshotPathTemplate (#18715)
- Use `snapshotPathTemplate` for docker screenshots in html-reporter
- Mark the snapshot path template test as slow since it re-spawns
  worker for each project.
- Fix docker smoke tests
2022-11-10 15:50:13 -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
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
Yury Semikhatsky
d5494edf71
feat(runner): TestOptions.storageStateName (#18587) 2022-11-07 16:27:38 -08:00
Dmitry Gozman
9172a2ca5a
test: use strict png comparator in tests (#18622) 2022-11-07 13:32:46 -08:00
Dmitry Gozman
6a65a43e9a
chore: use consistent asLocator() in all logs (#18586)
References #18524.
2022-11-04 15:19:16 -07:00
Yury Semikhatsky
25dc0bfacb
feat(runner): change storage fixture to TestInfo.storage() (#18584) 2022-11-04 14:28:25 -07:00
Yury Semikhatsky
a9c15a25f8
test: storageState from config key (#18581) 2022-11-04 13:10:33 -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
Yury Semikhatsky
45aa82242d
feat(runner): storage fixture (#18522) 2022-11-02 20:22:35 -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
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
Pavel Feldman
1505a952fe
chore: make handle beforeunload when reusing the context (#18357)
Fixes: https://github.com/microsoft/playwright/issues/17903
2022-10-26 15:17:40 -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
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
sand4rt
4ed2a01d9c
core(ct): import paths (#18131) 2022-10-19 19:41:21 -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
739b64a09a
chore: render typed locators in the recorder (#18162) 2022-10-18 16:39:58 -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
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
Dmitry Gozman
b64457d8ce
fix(locators): make regex escape work when multiple spaces are present (#17893) 2022-10-06 16:23:40 -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
Pavel Feldman
5424c8c385
fix(test): unflake workers test (#17728) 2022-09-30 08:07:20 -07: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
Yury Semikhatsky
9f17ee6871
feat: group filter (#17646) 2022-09-28 18:45:01 -07:00
Pavel Feldman
cadd4d1dd0
chore: migrate http server to ts (#17677) 2022-09-28 17:01:13 -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
50d4a5844f
test: mark "should cache build" as slow (#17637)
Frequently timing out on the bots.
2022-09-27 13:09:05 -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
Yury Semikhatsky
10d7c60abf
feat(runner): project execution schedule (#17548) 2022-09-23 20:01:27 -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
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
30ff27843a
chore: rebuild components on new vite (#17367) 2022-09-15 15:24:01 -07:00
Pavel Feldman
016883602d
chore: roll test runner to tot (#17351) 2022-09-14 19:51:22 -07:00
Andrey Lushnikov
8466c436c9
fix(list reporter): properly count new lines for long stdout (#17339) 2022-09-14 15:25:24 -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
Dmitry Gozman
48ac918cec
test: unflake "should load web server w/o esm loader in ems module" (#17269) 2022-09-12 11:42:04 -07:00
sand4rt
72a18754ef
core(ct): rename tests (#17216) 2022-09-12 09:27:53 -07:00
Dmitry Gozman
bca13bc35a
feat(assertions): support toBeVisible({ visible }) (#17207) 2022-09-09 08:33:23 -07:00
Pavel Feldman
80e9c5dc55
fix(reuse): restore storage state (#17175) 2022-09-07 19:15:04 -07:00
Pavel Feldman
c91df61ca3
chore: optionally connect instead of launching (#17174) 2022-09-07 15:57:20 -07:00
Max Schmitt
14ec71b905
chore: roll stable test-runner to 1.26.0-alpha-sep-7-2022 (#17166) 2022-09-07 20:11:09 +02: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
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
Yury Semikhatsky
5d6253f743
fix: stop har recording when APIRequestContext is disposed (#17007) 2022-08-31 21:51:38 -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
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
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
Pavel Feldman
bd06d1604f
chore: render original exception location in error frame (#16515) 2022-08-15 09:28:55 -07:00
Pavel Feldman
e1d3246d1c
fix(ct): pass local config to preview (#16481) 2022-08-12 10:37:35 -07:00
Dmitry Gozman
7acbd052e4
test: migrate some expect() tests to be more readable (#16394)
This moves some expect() matchers tests from test runner tests to page tests,
because these are implemented through a library call anyway.

Makes tests more readbable, faster and easier to test specific details.
2022-08-10 15:10:25 -07:00
Johannes Loher
3e67a7c836
feat(plugins): send accept header in webServer url checking (#16251) 2022-08-10 12:48:37 -07:00
Dmitry Gozman
baa2ef2700
fix(test runner): show interrupted as yellow (#16396)
Drive-by: fix unreadable character in "duplicate titles" error.
2022-08-09 21:17:30 -07:00
Dmitry Gozman
f58c376443
fix(test runner): do not resolve relative imports through baseUrl (#16395) 2022-08-09 21:16:27 -07:00
Denis Sokolov
92aacb9345
test: another test for baseUrl/relative imports (#16338)
#15891
2022-08-10 01:05:48 +02:00
Ross Wollman
a3d99f1b4a
chore: trace viewer fallback error (#16365)
Fixes #16349.
2022-08-09 15:53:11 -07:00
Ross Wollman
36b92d8847
fix: toBeFocused should match shadow elements (#16362)
Fixes #16268.
2022-08-08 15:34:58 -07:00
Dmitry Gozman
f6d94f0ac9
chore: update "X fatal errors" message (#16325)
Also, exlude certain errors from triggering this message:
- `no tests found`
- `duplicate test titles are not allowed`
- `--forbid-only found a focused test`
- `Timed out waiting 3600s for the entire test run`
2022-08-05 21:21:43 -07:00
Dmitry Gozman
7a86e140f5
chore: remove TestProject.projectSetup (#16321)
There are better ideas to address this issue in more general manner.
2022-08-05 15:24:30 -07:00
Dmitry Gozman
cb30cb4eb7
feat(test runner): add --trace cli option (#16277) 2022-08-05 09:20:39 -07:00
Dmitry Gozman
919b1cbb22
fix(test runner): do not swallow afterEach errors after skipped tests (#16276)
Drive-by: add more test runner logging.
2022-08-04 18:49:23 -07:00
Pavel Feldman
97fa2518e9
fix(reuse): clear storage after stopping all scripts (#16275) 2022-08-04 16:39:18 -07:00
Pavel Feldman
b3d30a808f
fix(reuse): reset sw, db, storages (#16265) 2022-08-04 15:01:34 -07:00
Dmitry Gozman
2fa48483af
test: unflake "should retain traces for interrupted tests" (#16235)
Ensure both tests start before one of them finishes.
2022-08-04 09:18:18 -07:00
Pavel Feldman
74f7005c02
chore: preserve window while reusing window (#16225) 2022-08-03 16:14:28 -07:00
Dmitry Gozman
03fe75251b
fix(test runner): show tests as interrupted when maxFailures stops them (#16178)
Previously, we marked these tests as skipped, and it was sometimes
confusing, because they did actually run and produce some output/artifacts.
2022-08-03 15:25:25 -07:00
Dmitry Gozman
445fe032f5
feat(test runner): separate interrupted status from skipped (#16124) 2022-08-02 12:55:43 -07:00
Dmitry Gozman
3112edb4ca
feat(test runner): TestProject.projectSetup (#16063)
`projectSetup` is a project-scoped alternative to `globalSetup`.
It is only executed if at least one test from the project is scheduled to run.
2022-08-01 09:01:23 -07:00
Yury Semikhatsky
7d306bbc66
feat: return value from step (#16060) 2022-07-29 15:16:07 -07:00
Dmitry Gozman
e830fe821d
feat(test runner): introduce test.describe.fixme (#16059) 2022-07-29 12:44:22 -07:00
Yury Semikhatsky
af8e3e7afa
feat: print response text when toBeOK fails (#16040) 2022-07-29 11:46:48 -07:00
Dmitry Gozman
62e4e80599
feat(test runner): show the number of fatal errors at the end (#15975) 2022-07-28 14:46:21 -07:00
Max Schmitt
a089bf3df5
chore(test-runner): better error message if page gets used inside beforeAll (#16012) 2022-07-28 23:07:28 +02:00
Dmitry Gozman
3d89506704
fix(fixtures): make undefined option mean "default value" (#16026)
In the following example, `locale` inside the `describe`
would be reverted to the default value:

```js
test.use({ locale: 'en-GB' });

test.decsribe(() => {
  test.use({ locale: undefined });
});
```
2022-07-28 12:57:05 -07:00
Pavel Feldman
8c190c3e09
feat(testId): expose persistent test id (#16003) 2022-07-27 20:17:19 -07:00
Dmitry Gozman
a94fe361a2
test: unflake a few tests (#15959) 2022-07-27 11:27:53 -07:00
Dmitry Gozman
6009804e0e
Revert "fix(test runner): ignore undefined values in fixtures definit…ions (#15119)" (#15979)
Revert "fix(test runner): ignore undefined values in fixtures definitions (#15119)"

Revert commit d7b63fa0b4.
Add a test for the broken behavior.
2022-07-27 08:51:45 -07:00
Dmitry Gozman
cd9dccbe27
fix(test runner): serial suites inside parallel suite should run in parallel (#15769) 2022-07-26 13:38:25 -07:00
Dmitry Gozman
c0d78c5642
fix(runner): friendly error message instead of "digests do not match" (#15939) 2022-07-26 08:53:32 -07:00
Pavel Feldman
6fcc916f00
test: passing test for issue 15891 (#15930) 2022-07-25 15:28:14 -07:00
Dmitry Gozman
9ce727c936
feat(list reporter): number test runs to see testing progress (#15693)
Drive-by: replace a few colors.gray with colors.dim for better contrast.
2022-07-25 13:22:25 -07:00
Max Schmitt
004cd9273c
fix(test-runner): multiple webServer types (#15901) 2022-07-25 10:39:06 +02:00
Dmitry Gozman
f954891491
fix(runner): globalTeardown without globalSetup should work (#15814) 2022-07-20 12:41:35 -07:00
Dmitry Gozman
6a60de1b2f
test: add failing test for traces after interruption (#15796) 2022-07-19 13:50:52 -07:00
Dmitry Gozman
a56d801352
fix(test runner): show fixture name when worker times out (#15724) 2022-07-15 13:05:48 -07:00
Max Schmitt
4bba41ab8f
Revert "feat(matchers): add toContainClass (#15491)" (#15670)
This reverts commit e4debd0bf6.
2022-07-14 22:03:37 +02:00
Pavel Feldman
d02914fa3a
chore: relax transpilation criteria to allow ems imports of .vue files (#15592) 2022-07-13 16:11:38 -07:00
Dmitry Gozman
22ead7b5ab
Revert "fix(test runner): handle istty in line reporter (#15455)" (#15633)
This reverts commit 767babc3a2.
2022-07-13 15:11:56 -07:00
Dmitry Gozman
51c3ea55ed
Revert "feat(line reporter): show testing progress (#15547)" (#15631)
This reverts commit e76d9b3b28.
2022-07-13 13:54:26 -07:00
Pavel Feldman
00848b1bcf
fix(ct): restore public folder deployment (#15594) 2022-07-12 16:14:48 -07:00
Yury Semikhatsky
a6daf600a9
fix: support hasColors and getColorDepth in worker (#15590) 2022-07-12 14:47:14 -07:00
Pavel Feldman
3939b9f36e
chore: migrate component testing to server-side page reuse (#15477) 2022-07-12 14:30:24 -07:00
Max Schmitt
e4debd0bf6
feat(matchers): add toContainClass (#15491) 2022-07-12 23:17:10 +02:00
Max Schmitt
7e1801bd30
fix(matchers): repeating values lead to no error (#15559) 2022-07-12 20:03:27 +02:00
Dmitry Gozman
64353c4b96
fix(test runner): make sure worker cleans up if last test was skipped (#15552) 2022-07-11 21:33:56 -07:00
Dmitry Gozman
e76d9b3b28
feat(line reporter): show testing progress (#15547)
Line reporter now shows stats in addition to the test name:
```
[chromium] › page/page-click-react.spec.ts:108:1 › should not retarget when element changes on hover
[21/93] Passed: 17 Flaky: 0 Failed: 0 Skipped: 4 (7s)
```
2022-07-11 20:44:50 -07:00
Max Schmitt
98ea418124
fix(expect): expect.not types (#15487) 2022-07-11 18:31:53 +02:00
Dmitry Gozman
6dc4a51c92
fix(test runner): more friendly test duration (#15476)
fix(test runner): more firendly test duration

Reported test duration now does not include time spent in
`beforeAll`, `afterAll` and fixtures that have a separate timeout.

This is to avoid different reported test execution time,
depending on the test execution order.
2022-07-08 11:45:44 -07:00
Dmitry Gozman
894ead5198
fix(test runner): mention fixture in worker teardown timeout error message (#15499) 2022-07-08 11:44:37 -07:00
Yury Semikhatsky
51aa5fea78
fix: colors in console output from worker (#15421)
Color highlights regressed in #14455

Fixes #15366
2022-07-07 17:56:41 -07:00
Ross Wollman
799d4703bc
feature(test-runner): multiple web servers (#15388)
Fixes #8206.

Since #8206 is a long-awaited (~ 1 year old), popular (~ 45 reactions, frequently requested in community channels, etc.), this PR aims to unblock folks.

Notably, we do not innovate on the `webServer` API, despite knowing we're not in love with it. We'll save the innovation for either Plugins or a new `LaunchConfigs` option. (We haven't yet arrived at a Plugin API we like, and instead of launching a new option guessing what the "better" launchConfig API would be, let's wait and see how folks use this new Array-variant of `webServer` which—despite its name—can be used for non-Web Server launches!
2022-07-07 15:27:21 -07:00
Dmitry Gozman
767babc3a2
fix(test runner): handle istty in line reporter (#15455)
When running without tty, line reporter outputs a line for each
percent of the tests, thus limiting the output to ~100 lines.

In addition, reporters now support PLAYWRIGHT_LIVE_TERMINAL
env variable to force tty mode.
2022-07-07 09:55:12 -07:00
Dmitry Gozman
89c16cbc8b
feat(runner): anonymous describes (#15424)
Useful to set some options without coming up with an artificial name.

```js
test.describe(() => {
  test.use({ colorScheme: 'dark' });

  test('my test', () => {});
})
```
2022-07-06 13:54:11 -07:00
Dmitry Gozman
c02d83fb11
fix(runner): filter only after duplicate titles check (#15401) 2022-07-06 12:51:26 -07:00
Dmitry Gozman
ee82837fb5
fix(fixtures): do not run user function when required fixture has failed (#15385)
Currently, it is possible to run a function, e.g. a second `beforeEach` hook,
that will receive `null` for the fixture that has already failed before.

This PR skips running any user function that uses a fixture that has already
failed, just like if the fixture would be initialized again and failing for
the second time.
2022-07-05 17:15:28 -07:00
Ross Wollman
981f5ab8c1
fix(test-runner): apply fixme v. skip annotations (#15277)
Currently, if `text.fixme()` or `test.skip()` is used within a test, we
add a `fixme` or `skip` annotation. However, if the wrapper style is
used:

```
test.fixme('should work', () => {…})
```

the annotations were missing. This change adds annotations for the
above.

These annotations are important for reporting purposes and knowing
exactly what flavor of "skipped" was used.

Fixes #15239.
2022-07-05 10:46:30 -07:00
Dmitry Gozman
2a805c1f1c
fix(line reporter): print currently running test (#15339) 2022-07-05 09:07:55 -07:00
Pavel Feldman
295ea7a3cb
fix(config): fall back to context options (#15309) 2022-07-01 10:20:13 -07:00
Pavel Feldman
c4d2342339
fix(config): fall back to launch options (#15293) 2022-07-01 08:12:57 -07:00
Dmitry Gozman
5083da9d98
test: unflake "should truncate long test names" (#15286) 2022-06-30 20:24:00 -07:00
Dmitry Gozman
b86926e691
fix(test runner): update timeout error messages (#15117)
Some of the current timeout error messages are confusing, because they do not suggest that the issue is most likely a slow test. This PR updates timeout messages as follows:
- Test timeout of 30000ms exceeded.
- Test timeout of 30000ms exceeded while setting up "browser".
- Test timeout of 30000ms exceeded while tearing down "context".
- Test timeout of 30000ms exceeded while setting up "playwright configuration".
- Test timeout of 30000ms exceeded while running "beforeEach" hook.
- Test timeout of 30000ms exceeded while running "afterEach" hook.
- "beforeAll" hook timeout of 30000ms exceeded.
- "afterAll" hook timeout of 30000ms exceeded.
- Worker teardown timeout of 30000ms exceeded.
- "skip" modifier timeout of 30000ms exceeded.
- Fixture "myCustomFixture" timeout of 5000ms exceeded.
2022-06-30 17:05:08 -07:00
Dmitry Gozman
dc1d8dc3da
test: improve a few test runner tests that time out (#15287) 2022-06-30 17:03:01 -07:00
Max Schmitt
3d1d723c56
fix(esm): show codeframe when errors get reported (#15262) 2022-06-30 21:17:08 +02:00
Dmitry Gozman
f0b3b280a5
test: increase small timeouts to accomodate two workers (#15257) 2022-06-30 09:05:39 -07:00
Max Schmitt
71fc53bbf8
fix(matchers): toHaveClass on SVG elements (#15267)
Fixes #15260
2022-06-30 07:01:26 -07:00
Ross Wollman
9fb80c905b
test: match more of output to ensure source map support is good (#15206)
Co-authored-by: Max Schmitt <max@schmitt.mx>
2022-06-29 22:26:48 +02:00
Dmitry Gozman
79163e802a
fix(test runner): screenshot immediately after failure (#15159)
Previously, screenshot was taken after hooks and fixtures teardown.
However, hooks can easily modify the state of the page, and
screenshot would not reflect the moment of failure.

Instead, we take screenshots immediately after the test function
finishes with an error.
2022-06-27 17:46:39 -07:00
Dmitry Gozman
d7b63fa0b4
fix(test runner): ignore undefined values in fixtures definitions (#15119)
These mean "I don't want to specify this fixture/option"
instead of "I want the value of undefined", aligned with how TypeScript works.
We already do similar things in the config.
2022-06-27 11:31:41 -07:00
Dmitry Gozman
a93db3cf11
fix(reporter): line reporter should not swallow half-line stdout (#15114) 2022-06-27 11:25:42 -07:00
Pavel Feldman
1ce1246a0e
test: stress runners (#15078) 2022-06-23 15:55:12 -07:00