Commit graph

1230 commits

Author SHA1 Message Date
Pavel Feldman 969e5ff1aa
test: add attachment tests (#23143) 2023-05-18 11:48:53 -07:00
Pavel Feldman 2501bbb715
test(ui-mode): make retries (#23136) 2023-05-18 11:28:28 -07:00
Yury Semikhatsky a1fc8ff07d
fix: preserve steps in merged report (#23120) 2023-05-18 09:38:49 -07:00
Max Schmitt 0c032eb7be
chore: do not read browserslist file (#23127)
Fixes https://github.com/microsoft/playwright/issues/23125
2023-05-18 18:11:08 +02:00
Andrey Lushnikov e6bc32b022
chore: more tree gardening (#23119)
https://github.com/microsoft/playwright/issues/23114
https://github.com/microsoft/playwright/issues/23115
https://github.com/microsoft/playwright/issues/23116
https://github.com/microsoft/playwright/issues/23117
https://github.com/microsoft/playwright/issues/23118
2023-05-17 18:57:35 -07:00
Yury Semikhatsky 52feff39b3
chore: run primary tests with blob reporter (#23076) 2023-05-17 09:10:31 -07:00
Pavel Feldman 04070a59e1
chore: remove expect.configure({poll}) (#23060) 2023-05-16 18:45:03 -07:00
Dmitry Gozman fc2e0e76bd
feat(teardown): allow the same project to be a teardown for multiple (#23074) 2023-05-16 18:26:06 -07:00
Yury Semikhatsky 2d3ab74d22
chore: roll stable test runner (#23075) 2023-05-16 18:02:53 -07:00
Dmitry Gozman fec5059fee
feat(connect): print debug log when remote connection failed (#23069) 2023-05-16 16:46:02 -07:00
Max Schmitt 89f1940509
chore: be able to hide webServer stderr (#23063)
Follow-up to https://github.com/microsoft/playwright/pull/22564.
2023-05-17 00:46:59 +02:00
Yury Semikhatsky ed19e5403b
feat: merge config properties (#23071) 2023-05-16 15:15:11 -07:00
Pavel Feldman 2fc6341841
chore: remove node version checks from esm tests (#23031) 2023-05-16 11:07:34 -07:00
Dmitry Gozman f469e4b1eb
fix(expect): mark step as failed when async custom matcher throws (#23035)
Fixes #23021.
2023-05-15 19:37:12 -07:00
Max Schmitt edd003c230
chore: validate expected image buffer when comparing images (#23030)
Fixes https://github.com/microsoft/playwright/issues/23012
2023-05-15 23:32:16 +02:00
Pavel Feldman 4c4085e105
chore: partially hide built-in fixture steps (#23005) 2023-05-12 19:15:31 -07:00
Yury Semikhatsky 576d91fe80
fix: unique resource names between shards (#23004) 2023-05-12 18:21:43 -07:00
Pavel Feldman 083d13a13d
chore: surface syntax error in ui mode (#22982)
Fixes https://github.com/microsoft/playwright/issues/22863
2023-05-12 14:23:22 -07:00
Yury Semikhatsky 3ccec7eae5
feat(merge): generate html report with links to remote resources (#22968) 2023-05-12 09:26:04 -07:00
Pavel Feldman e6d8cf9693
chore: include plugin list into the cache digest (#22946)
Fixes https://github.com/microsoft/playwright/issues/22931
2023-05-11 21:09:15 -07:00
Dmitry Gozman 9ffe33fae8
feat(test runner): support tsconfig.extends array (#22975)
Fixes #22151.
2023-05-11 19:18:13 -07:00
Pavel Feldman 59b9a39740
chore: add string attachments to trace (#22921) 2023-05-11 16:32:32 -07:00
Dmitry Gozman 44a934c160
feat(test runner): support .cjs and .cts files (#22971)
Fixes #22579.
2023-05-11 15:41:50 -07:00
Yury Semikhatsky c9dad439cd
chore: write uncompressed blob report (#22945) 2023-05-10 15:08:53 -07:00
Pavel Feldman 5e0574dc44
chore: list attachments in the trace (#22919)
Fixes https://github.com/microsoft/playwright/issues/22736
2023-05-09 17:53:01 -07:00
Dmitry Gozman cd49f5c466
feat(typescript): align with --moduleResolution=bundler (#22887)
This relaxes import requirements and allows importing `.ts` files
without an extension in CJS and ESM modes.

Fixes #22169.
2023-05-09 16:26:29 -07:00
Pavel Feldman 0bf297f523
fix(trace): merge step hierarchies (#22916) 2023-05-09 14:50:28 -07:00
Alex Neo 5bd5cea705
feat(html): describe labels (#22870) 2023-05-08 18:59:01 -07:00
Pavel Feldman b10cc03314
chore: render parse errors in the UI mode (#22888)
Fixes: https://github.com/microsoft/playwright/issues/22863
2023-05-08 18:51:27 -07:00
Pavel Feldman 9771b1ee74
chore: show steps for fixtures (#22860)
Fixes https://github.com/microsoft/playwright/issues/22565
2023-05-06 10:25:32 -07:00
Dmitry Gozman 03616e976e
fix(deps): --repeat-each should not apply to dependencies (#22858)
Fixes #21778.
2023-05-05 16:59:39 -07:00
Pavel Feldman efad19b332
chore: render test steps in the trace (#22837) 2023-05-05 15:12:18 -07:00
Pavel Feldman 9c25a04267
chore: use custom JSX runtime to stub-out erroneous JSX usage (#22827)
Fixes https://github.com/microsoft/playwright/issues/22789
2023-05-04 11:44:59 -07:00
Pavel Feldman 78203bf48d
chore: ensure error location is present (#22804)
Partial fix for https://github.com/microsoft/playwright/issues/22782
2023-05-03 18:45:33 -07:00
Dmitry Gozman 4edd023644
fix(tsconfig): fallback to default *:* path mapping when baseUrl is present (#22802)
According to
https://www.typescriptlang.org/docs/handbook/module-resolution.html#base-url,
`baseUrl` affects all non-relative imports. Additional `paths` mapping
can be specified for more control. However, if none of the `paths`
matches, it still falls back to the default `*:*` mapping. Confirmed by
invoking `tsc` with different configs.

Fixes #22663.
2023-05-03 16:08:06 -07:00
Pavel Feldman 9a61a55ea1
chore: nest api steps by time (#22801)
Fixes https://github.com/microsoft/playwright/issues/22786
2023-05-03 16:04:20 -07:00
Yury Semikhatsky 2233b352b6
fix(merger): pass onError to the reporter (#22775) 2023-05-03 09:08:09 -07:00
Dmitry Gozman 10ce7af411
fix(steps): step should not get an unrelated error (#22773)
Previously, we would use any error that was added during the step
execution as an error for this particular step.

This produces false positives, for example failing `page.click` call
that happened during `context` teardown was producing an error and
marking teardown is failed. However, in reality, the test itself has
failed, while teardown has not.

New approach uses test step hierarchy to inherit errors from child steps
to the parent step. This does not regress the original fix where
`expect.soft` errors are surfaced in the parent step.

See also #19973 that introduced the original logic.
2023-05-02 18:50:00 -07:00
Dmitry Gozman dee0f2791e
test: unflake "should give enough time for fixture teardown" (#22763) 2023-05-02 17:40:10 -07:00
Dmitry Gozman 8f09935e81
fix(test runner): separate test fixture scope for beforeAll/afterAll hooks (#22746)
There was a single test fixture scope that covers all hooks, modifiers
and test function. Now beforeAll-like modifiers, beforeAll and afterAll
hooks get a scope each.

Fixes #22256.
2023-05-02 11:04:51 -07:00
Pavel Feldman 5ad75f92f7
test: unflake basic timeout test (#22745) 2023-05-02 09:14:57 -07:00
Sander 5b69c4cf52
chore: bump vite to 4.3.3 (#22711) 2023-05-01 15:19:49 -07:00
Pavel Feldman 70011c82f7
chore: unflake ui tests (3) (#22741) 2023-05-01 15:18:34 -07:00
Yury Semikhatsky a4e90f20dc
fix(runner): do not hang on worker exit before tests (#22742) 2023-05-01 14:54:48 -07:00
Dmitry Gozman fcd966c4e5
chore: make _setupArtifacts a worker-scoped fixture (#22739)
This should unblock having separate test-fixture scopes for hooks and
test.
2023-05-01 13:53:15 -07:00
Yury Semikhatsky 59079d94ca
fix: call onExit when merging reports (#22718) 2023-05-01 12:58:40 -07:00
Pavel Feldman 297fea0826
chore: purify the junit reporter (#22624) 2023-05-01 09:15:08 -07:00
Alex Neo 26cad0b31f
feat(html): matching labels with dash&spec symbol (#22709)
Fixes #22700
2023-05-01 09:13:30 -07:00
Pavel Feldman a01df2ff5b
chore: render live trace for the serial mode (#22715)
Fixes https://github.com/microsoft/playwright/issues/22655
2023-04-28 17:47:57 -07:00
Dmitry Gozman dbb218a9d5
feat: project.teardown that runs after all dependents have finished (#22696)
This replicates globalTeardown in the deps world.

Fixes #21914.
2023-04-28 14:27:08 -07:00
Pavel Feldman 2a675026de
chore: add image diff test to ui mode (#22637) 2023-04-28 14:18:46 -07:00
Pavel Feldman e9373dfb6e
chore: make client-side instrumentation non-nullable (#22694) 2023-04-28 08:57:43 -07:00
Pavel Feldman b555d33e38
chore: roll the stable test runner (#22701) 2023-04-28 08:57:19 -07:00
Alex Neo 7937699b28
fix(html): label not matched if first with describe (#22680) 2023-04-27 20:04:54 -07:00
Yury Semikhatsky f37f5fc61c
chore: comma separated reporter names, reporter arg from config (#22693) 2023-04-27 15:16:18 -07:00
Dmitry Gozman 223baa3393
fix(html): keep tests in the declaration order (#22690)
Fixes #22143.
2023-04-27 13:54:15 -07:00
Yury Semikhatsky 82670147b4
chore: support multiple merged reports (#22672) 2023-04-27 09:15:24 -07:00
Max Schmitt 7b27d70d8a
feat(web-server): add stdout: "pipe"|"ignore" option (#22564)
Fixes https://github.com/microsoft/playwright/issues/22454
2023-04-26 23:39:42 +02:00
Pavel Feldman 7fdd7a20fb
chore: fix soft after poll (#22642) 2023-04-26 08:50:10 -07:00
Pavel Feldman 6b487ff49d
chore: remove cli from playwright-core (#22612)
Fixes https://github.com/microsoft/playwright/issues/22599
2023-04-25 11:19:37 -07:00
Pavel Feldman a1007bbe2c
chore: introduce expect.configure (#22533) 2023-04-25 10:29:56 -07:00
Yury Semikhatsky 24478be565
feat: preserve attachments in blob reports (#22605)
Attachments with `path` are stored as `resources/sha1.ext` zip entries
and extracted under `report-dir/tmp` when merging. This way normal
fs.readFile keeps working as before even thought the file path is
different. The clients should rely on `attachment.name` instead of
`attachment.path` when deriving user visible titles in the UI. If this
turns out not to be the case we can reconsider later.

#10437
2023-04-24 17:34:09 -07:00
Pavel Feldman bbc47ba315
chore: ensure web assertions are merged in trace (#22544) 2023-04-21 10:07:23 -07:00
Pavel Feldman d95268ffc0
chore: remove refined title (#22541) 2023-04-20 20:34:07 -07:00
Pavel Feldman d9a7aa584c
chore: bump timeouts in ui mode tests (#22526) 2023-04-20 16:47:08 -07:00
Yury Semikhatsky 9ea9adf8ff
test: mark reporter-blob tests as slow (#22530)
They run several playwright instances for each shard and then open
merged html report which takes considerable time
2023-04-20 09:36:38 -07:00
Pavel Feldman 0c70f6900e
chore: fix ui mode w/ multiple contexts (#22514)
Fixes: https://github.com/microsoft/playwright/issues/21895
2023-04-20 08:19:00 -07:00
Pavel Feldman cdaccdeaf7
chore: speculative change to fix the ui mode tests stress (#22510) 2023-04-20 08:18:09 -07:00
Pavel Feldman 8f14517de2
chore: allow collapsing all (#22512)
Fixes https://github.com/microsoft/playwright/issues/21915
2023-04-19 18:16:18 -07:00
Dmitry Gozman 957ec0067f
chore: separate concerns of testinfo helpers (#22491) 2023-04-19 17:31:07 -07:00
Pavel Feldman a45f04568b
chore: rename watchmode to uimode tsx (#22511) 2023-04-19 16:51:42 -07:00
Pavel Feldman e7b9c08833
chore: should not spill toPass between tests (#22473) 2023-04-19 14:45:58 -07:00
Dmitry Gozman bf0fab4927
fix(ui mode): ignore repeatEach (#22505)
Fixes #22498.
2023-04-19 14:16:12 -07:00
Max Schmitt 49c9284bc7
Revert "feat(html reporter): render multiple annotations of the same type together (#21580)" (#22466)
Fixes https://github.com/microsoft/playwright/issues/22323
2023-04-18 20:43:07 +02:00
mindaugasm be79ee0450
feat(html-report): add attachmentsBaseURL option (#22212)
Fixes https://github.com/microsoft/playwright/issues/21636
2023-04-18 11:25:11 -07:00
Yury Semikhatsky 2ea214d6f0
fix: preserve trace if context if closed manually during test run (#22442)
Reference #22122, #22120
2023-04-18 09:02:33 -07:00
Pavel Feldman 8d69fbacf7
chore: introduce ct-core to hard-depend on vite (#22437)
Fixes https://github.com/microsoft/playwright/issues/22233
2023-04-17 16:19:21 -07:00
Dmitry Gozman bf661535a6
fix(testMatch): do not count test.ts and spec.ts as test files by default (#22440) 2023-04-17 12:57:33 -07:00
Andrey Lushnikov 8bb708be70
test: unflake inspector-cli tests (#22347)
This patch:
- changes the `childProcess` fixture to reliably SIGKILL all descendants
  (children and grand-children, regardless of their process group).
This is achieved using the `ps` command to build the process tree, and
then send
  `SIGKILL` to the descendant process groups.
- changes the `runCLI` fixture to **not** auto-close codegen by default;
  the `childProcess` fixture will clean up all processes. This makes
sure that all `runCLI.waitFor()` commands actually wait until the
necessary
  output.
- for a handful of tests that do actually want to auto-close codegen,
  introduce an optional `autoCloseWhen` flag for the `runCLI` fixture
that makes sure to close the codegen once a certain output was reached.
2023-04-12 09:37:24 -07:00
Pavel Feldman c5aeab4d7e
revert(20509, 20596): expect.toPass is broken with these (#22254)
Reverts https://github.com/microsoft/playwright/pull/20509 and
https://github.com/microsoft/playwright/pull/20596
Fixes #22215
2023-04-10 17:39:49 -07:00
Yury Semikhatsky 2af3f486c4
fix: do not load trace data for passing tests (#22311)
Fixes #22122
Fixes #22120
2023-04-10 13:29:55 -07:00
Yury Semikhatsky 1efa8de526
test: fix reporter blob tests on bots (#22281) 2023-04-07 17:48:54 -07:00
Yury Semikhatsky 8d2502ee62
test: make page-leaks tests pass in electron (#22277)
They've been failing
https://devops.playwright.dev/flakiness.html#filter_spec=page%2Fpage-leaks.spec.ts&test_parameter_filters=%5B%5D&timestamp=1680901928195
2023-04-07 17:20:49 -07:00
Pavel Feldman eed5b4c83b
chore: process stdio buffers (#22270)
Fixes https://github.com/microsoft/playwright/issues/22265
2023-04-07 13:50:15 -07:00
Yury Semikhatsky d59e0e10ce
feat: blob reporter (#22244)
#10437
2023-04-07 13:47:52 -07:00
Pavel Feldman 159e71982e
chore: render failed steps in the basic reporters (#22200)
Fixes #20532
2023-04-05 13:03:42 -07:00
Johannes Loher bd698efaef
fix(webServer): follow relative redirects when checking the url (#22035)
Fixes https://github.com/microsoft/playwright/issues/22144
2023-04-05 10:39:35 +02:00
Pavel Feldman 3608425d57
chore: allow reusing browser between the tests (#22191) 2023-04-04 12:31:42 -07:00
Pavel Feldman f8f9ee6a25
chore: introduce Reporter.onExit (#22176)
Fixes https://github.com/microsoft/playwright/issues/22173
2023-04-04 10:50:40 -07:00
Pavel Feldman 87acda74ff
chore: respect source map sources when filtering in CLI (#22180)
Fixes #22123
2023-04-03 19:49:01 -07:00
Dmitry Gozman ab85b23e67
fix(expect): report expect "Timed out" when it actually does (#22174)
Previously, it would say "Timed out" when page was closed at test
timeout, or not say "Timed out" when at least one element matched.

Fixes #21664.
2023-04-03 15:06:13 -07:00
Dmitry Gozman 82e52004c9
fix(ui mode): preserve manually selected action in live trace (#22131) 2023-03-31 18:34:51 -07:00
Dmitry Gozman 41e3e6d13f
fix(tracing): avoid clashing network file names (#22126)
With two contexts in the same test, we can get:
- `<testId>.network` and `<testId>-1.network` files;
- for export, we can copy `<testId>.network` into `<testId>-1.network`
and try to copy into a file when another trace is reading from it.

Fixes #22089.
2023-03-31 17:29:39 -07:00
MarcNum fbdafc5fe3
feat: Adding trace option 'on-all-retries' (#21985)
Fixes: #21860
2023-03-31 13:04:24 -07:00
Dmitry Gozman 37d1659508
feat(connect): support special headers for debug/attachments (#22106)
`x-playwright-debug-log: value` headers are printed to `pw:browser`
debug log.
`x-playwright-attachment: name=value` headers are attached to each test.

Fixes #21619.
2023-03-31 08:57:07 -07:00
Pavel Feldman b1fdf0bcb6
chore: nest test steps based on zones (#22108)
Fixes: #21423
2023-03-30 21:05:07 -07:00
Pavel Feldman eacaf5fc89
chore(ui): update expected state on test end (#22104)
Fixes https://github.com/microsoft/playwright/issues/22096
2023-03-30 16:17:34 -07:00
Pavel Feldman a4f67c64e3
chore: allow ts decorators (#22080) 2023-03-29 20:43:08 -07:00
Pavel Feldman d39ff3dc5a
chore: update typescript to 5.0.2 (#22079) 2023-03-29 17:13:09 -07:00
Yury Semikhatsky 026e49b076
chore: add snippet to the error message (#21991) 2023-03-29 14:07:14 -07:00
Pavel Feldman 8b7dc2cf7a
test: add a ui teardown test (#22010) 2023-03-29 13:57:19 -07:00
Dmitry Gozman f7244a7e34
fix(tracing): allow disabling tracing through env (#22050)
We point `tracesDir` inside `test-results`, so it is removed between
test runs, while reused context is still writing there.
    To fix the issue, we can now pass `env.PW_TEST_REUSE_CONTEXT`.

References #21993.
2023-03-29 13:35:31 -07:00
Dmitry Gozman 47e5c02a21
fix(test runner): update default testMatch (#22006)
The intent of default test match is allowing `example.spec.ts` and
`example.test.ts` files. However, it was also matching `test.example.ts`
that should not be considered a test by default.

Fixes #21979.
2023-03-27 14:28:44 -07:00
Pavel Feldman c3d7ffb773
chore(ui): do not print global setup epilogue (#21976) 2023-03-24 20:56:45 -07:00
Pavel Feldman add948cdd0
chore: allow sibling describes with the same name (#21967)
Fixes https://github.com/microsoft/playwright/issues/21953
2023-03-24 17:09:11 -07:00
Pavel Feldman 79d55b959b
Revert "chore: remove legacy watch mode (#21944)" (#21973)
This reverts commit 86af908fa7.
2023-03-24 16:41:20 -07:00
Dmitry Gozman 120aaa777e
fix(test runner): do not show TimeoutError for unhandled rejection (#21971)
Unhandled error/rejection interrupts current test and produces a
TimeoutError for it that should be ignored.
2023-03-24 15:03:49 -07:00
Pavel Feldman 86af908fa7
chore: remove legacy watch mode (#21944) 2023-03-23 16:30:42 -07:00
Pavel Feldman 31e70c17be
chore: filter skipped tests (#21938)
Fixes https://github.com/microsoft/playwright/issues/21918
2023-03-23 13:29:52 -07:00
Max Schmitt e621e52f89
chore: support TypeScript 5 in TS transformer (#21925)
Fixes https://github.com/microsoft/playwright/issues/21900
2023-03-23 18:07:02 +01:00
Alex Neo 6947f47f05
feat(html): added labels to test cases and test files (#21468) 2023-03-22 14:35:58 -07:00
Pavel Feldman d9a9bb5a8c
chore: pack codemirror on resize (#21856) 2023-03-21 18:20:48 -07:00
Pavel Feldman 1bbe2b4b6a
chore: update test locations when merging (#21844) 2023-03-21 12:13:20 -07:00
Pavel Feldman 7ce2b36489
chore(ui): show load errors (#21843) 2023-03-21 12:03:26 -07:00
Dmitry Gozman bea6fa15b2
feat(snapshots): use double-buffer to avoid white flash on hover (#21828) 2023-03-21 07:40:54 -07:00
Pavel Feldman 6015dad9db
chore: remove npx playwright ui (#21823) 2023-03-20 17:12:17 -07:00
Pavel Feldman a33cf10696
chore(ui): decorate pending, add time spent (#21821) 2023-03-20 17:12:02 -07:00
Pavel Feldman 543c812d2f
chore(ui): queue watch runs (#21809) 2023-03-20 13:45:35 -07:00
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