Commit Graph

1400 Commits

Author SHA1 Message Date
Dmitry Gozman
25dd9b5cd4
feat: config.build.tsconfig (#33026)
Allows to specify `tsconfig` in the configuration file, which applies to
test files but not the config file itself.

Fixes #32808.
2024-10-10 01:37:46 -07:00
Simon Knott
892d67ffef
feat(test runner): allow stopping testrun with escape (#32584)
Closes https://github.com/microsoft/playwright/issues/32579
2024-10-08 11:39:54 -07:00
Max Schmitt
d0f2170e21
Revert "fix(test): do not allow mixing tests from different types (#29284)" (#33002)
This reverts commit 4784139bb0.

Closes https://github.com/microsoft/playwright/issues/29734
2024-10-08 16:00:40 +02:00
Max Schmitt
47a889ac48
chore: roll stable-test-runner to 1.48.0-beta-1728384960000 (#33008) 2024-10-08 14:01:45 +02:00
Dmitry Gozman
814f7eb556
test: fix/fixme/update a few tests (#33006) 2024-10-08 03:59:35 -07:00
Mark
04bf425268
feat(base-reporter): Add tags to test output (#32930) 2024-10-07 17:14:46 -07:00
Yury Semikhatsky
6ba5ee3a83
chore(ui-mode): expand all button (#32994)
<img width="230" alt="image"
src="https://github.com/user-attachments/assets/dd7fa3a1-39ec-4b88-9279-d664c9c4e5cd">


Reference https://github.com/microsoft/playwright/issues/32825
2024-10-07 15:42:12 -07:00
Max Schmitt
dfa4ab8726
test: speed up only-changed CT test (#32947) 2024-10-04 10:06:56 +02:00
Simon Knott
29ffcdfc4e
test(html reporter): filtering by type works (#32931)
The folks who opened
https://github.com/microsoft/playwright/issues/32925 would benefit from
filtering by annotation existence. Turns out we already have it! This PR
adds a test to ensure it stays that way.
2024-10-02 16:29:27 +02:00
Simon Knott
c67a7335ab
chore(ui): ensure that --ignore-snapshots is respected (#32875)
Closes https://github.com/microsoft/playwright/issues/32868.

The actual fix was already delivered in
https://github.com/microsoft/playwright/pull/32798/files#diff-98ff2ff92b08ca7e8b274abb3ba6b2eec9bab332e340d062cc18ad1dfe505bf2R299,
this PR adds a test to ensure we don't regress.
2024-09-30 15:12:37 +02:00
Yury Semikhatsky
728b4814b4
test: fix recently added junit tests (#32844) 2024-09-26 19:32:54 -07:00
Yury Semikhatsky
5b85c71722
fix(junit): env variable should take precedence over config (#32842)
Fixes https://github.com/microsoft/playwright/issues/32826
2024-09-26 15:29:09 -07:00
Dmitry Gozman
6465f0b1bd
test: make sure custom asymmetric matchers work (#32829)
This adds a test for a regression introduced by #32366 and fixed by
#32795.
2024-09-26 06:27:37 -07:00
Dmitry Gozman
ff954b58eb
fix(test runner): cleanup DEBUG_COLORS usage (#32764)
`DEBUG_COLORS` we default to `1`, but we should not do that when it is
already defined to some value supplied by the user.

Closes #32543.
2024-09-26 03:15:46 -07:00
Yury Semikhatsky
b6783bb18b
fix(ui-mode): respect --tsconfig option (#32798)
Fixes https://github.com/microsoft/playwright/issues/32797
2024-09-24 19:59:15 -07:00
Pavel Feldman
755edfba5b
chore: fallback expect.extend to legacy (#32795) 2024-09-24 14:00:13 -07:00
Max Schmitt
8557b98aee
test: fix CR/LF warning on only-changed tests (#32772) 2024-09-24 01:32:36 +02:00
Dmitry Gozman
b3a82bef46
feat: do not record route calls in the trace (#32723)
These are represented in the network pane instead.
2024-09-21 10:17:59 -07:00
Dmitry Gozman
ace8cb2427
fix(test runner): page.pause() should enable debug mode (#32714)
Fixes #32706.
2024-09-20 00:41:16 -07:00
Max Schmitt
2b2a57abad
chore: enable @babel/plugin-syntax-import-attributes all the time (#32713) 2024-09-19 16:51:35 +02:00
Max Schmitt
48030a4eff
test: fix test expecations after Node.js 22.9.0 (#32695) 2024-09-19 10:52:29 +02:00
Max Schmitt
523ec83cad
chore: move Location type from testReporter.d.ts to test.d.ts (#32687) 2024-09-18 16:57:11 +02:00
Simon Knott
443f72dcbe
feat(watch): hide show-report prompt (#32666)
Closes https://github.com/microsoft/playwright/issues/32665
2024-09-18 08:17:13 +02:00
오소현
8761dafc73
feat(test runner): allow to pass arbitrary location to test.step (#32504)
Fixes https://github.com/microsoft/playwright/issues/30160

### Description:
This pull request introduces the ability to specify custom locations for
test steps in Playwright. By enabling the provision of arbitrary
locations to the test.step method, it resolves the limitation where
helper methods obfuscate the original call site, providing more accurate
and meaningful location data in test reports.

### Motivation:
To enhance the utility and clarity of test reports in Playwright.
Specifically, it addresses the need to trace test steps back to their
precise location in the code, which is especially important when steps
are abstracted in helper functions. This feature is crucial for
maintaining accurate documentation and facilitating debugging processes.

### Changes:
Added functionality to pass a custom location object to test.step.

### Expected Outcome:
This PR is expected to significantly improve the precision and
usefulness of diagnostic data in test reports by allowing specific
locations within helper functions to be accurately documented. It
facilitates better tracking of test executions and simplifies the
debugging process, making it easier for developers to understand and
address issues within complex tests.

### References:
Closes https://github.com/microsoft/playwright/issues/30160 -
"[Feature]: allow to pass arbitrary location to test.step"

**Code Check**
I conducted tests on this new feature by integrating it into some
existing test codes, and it worked well. I will attach the code used for
testing and a screenshot showing the successful outcome.

<details>
<summary>toggle dropdown</summary>
<div markdown="1">

```
import type { Location } from '../../../packages/playwright/types/testReporter'
...
test('should respect the back button', async ({ page }) => {
    await page.locator('.todo-list li .toggle').nth(1).check();
    await checkNumberOfCompletedTodosInLocalStorage(page, 1);
...
    await test.step('Showing active items', async () => {
      await page.getByRole('link', { name: 'Active' }).click();
    }, {location});
```

<img width="1109" alt="image"
src="https://github.com/user-attachments/assets/359feafa-0949-4c71-9426-46debef21bdd">
</div>
</details>
2024-09-17 08:11:21 -07:00
Simon Knott
f6219e6e79
Revert "feat(tracing): add .pwtrace to trace file extension" (#32648)
Reverts microsoft/playwright#32581
Relates
https://github.com/microsoft/playwright/issues/32226#issuecomment-2351164727
2024-09-17 15:32:30 +02:00
Simon Knott
ec2ae1ed2d
feat(watch mode): buffer mode (#32631)
Closes https://github.com/microsoft/playwright/issues/32578.

Adds a buffer mode that can be toggled by pressing <kbd>b</kbd>. When
engaged, changed test files are collected and shown on screen. The test
run is then kicked off by pressing <kbd>Enter</kbd>.

This changes the signal to start a test run from <kbd>Cmd+s</kbd> to a
<kbd>Enter</kbd> press in the test terminal. It should help users with
auto-save and make it easier to run on long-running tests. It feels very
similar to running `npx playwright test`, but without having to write a
filter.



https://github.com/user-attachments/assets/71e16139-9427-4e90-b523-8d218f09ed9d
2024-09-17 08:45:44 +02:00
Dmitry Gozman
268357238a
fix(expect): respect custom message in expect.poll (#32603)
Fixes #32582.
2024-09-16 00:10:06 -07:00
Simon Knott
aeb4d182f7
feat(tracing): add .pwtrace to trace file extension (#32581)
Closes https://github.com/microsoft/playwright/issues/32226

I've updated every mention of `.trace.zip` except for the release notes.
2024-09-14 10:17:07 +02:00
Simon Knott
9bb1c86f93
feat(test runner): don't run tests on --watch start (#32583)
Closes https://github.com/microsoft/playwright/issues/32580.
2024-09-13 17:24:38 +02:00
Simon Knott
ef4be6afff
feat(test runner): make expect.extend immutable (#32366)
Changes `expect.extend` behaviour so that it doesn't mutate the global
instance and behaves closer to what users expect. This is formally a
breaking change, and I had to remove a test that asserts the breaking
behaviour.

TODO:
- [x] decide wether this is a separate method or a flag for
`expect.extend`
- [x] figure out if we need to change docs
2024-09-12 19:56:38 +02:00
Max Schmitt
7458c3292c
fix(test-runner): do not consider retries for maxFailures (#32533)
Fixes https://github.com/microsoft/playwright/issues/26350
2024-09-11 20:35:26 +02:00
Pavel Feldman
6d5889a52c
chore: revert the matcherResult in API (#32524) 2024-09-09 16:44:32 -07:00
Dmitry Gozman
ae118674b8
fix(test runner): allow directory imports with path mapping (#32491)
We now hopefully align with `moduleResolution: bundler` tsconfig option,
allowing directory imports in every scenario, and allowing proper module
imports when not going through the type mapping.

This regressed in #32078. Fixes #32480, fixes #31811.
2024-09-09 14:01:20 -07:00
Dmitry Gozman
6bb005db85
fix(test runner): improve error message when not able to parse tsconfig (#32526) 2024-09-09 14:01:02 -07:00
Dmitry Gozman
e6c5b6054d
test: fix project filter test (#32525)
It was erroneously passing projects separate by comma, which never
worked.
2024-09-09 14:00:51 -07:00
Pavel Feldman
9a313eecc9
chore: roll expect and move it to third party (#32458) 2024-09-09 13:12:20 -07:00
Dmitry Gozman
1402dee9e6
Revert "fix(test runner): align with typescript behaviour for resolving index.js and package.json through path mapping (#32078)" (#32492)
This reverts commit effb1ae234.

This broke path mapping into directories in ESM mode. References #32480.
2024-09-06 12:08:10 -07:00
Simon Knott
0e3f4736cc
fix(test runner): always show all projects in selection (#32450)
Follow-up to
https://github.com/microsoft/playwright/pull/32156#discussion_r1741628770,
alternative solution to
https://github.com/microsoft/playwright/pull/32425.

Ensures we always show all projects in the watch mode project selector
by performing the initial `listTests` without any filters, and using its
result for the project selector.
2024-09-06 11:35:20 +02:00
Pavel Feldman
a52eb0c9a0
chore: expose matcherResult on TestError (#32455) 2024-09-05 21:36:51 -07:00
Dmitry Gozman
1ba3db6864
chore: implement clear-cache through plugins (#32471)
Also switches it to task runner.
2024-09-05 13:50:16 -07:00
Dmitry Gozman
d4c77ce260
chore: make find-related-test-files work through plugins (#32465)
Also switches it to the task runner.
2024-09-05 06:52:11 -07:00
Simon Knott
29f1541b14
chore: roll stable test runner to 1.47 beta (#32469) 2024-09-05 13:44:22 +02:00
Dmitry Gozman
91012833c6
chore: move 'dev-server' extensibility point to plugin (#32448)
Instead of plumbing it through a custom unspecified config field, make
it a part of plugin interface.

Additionally, use task runner for starting/stopping dev server.
2024-09-05 02:22:27 -07:00
Kuba Janik
ee91bdc585
feat(ui-mode): display list of query params in request tab (#32443) 2024-09-04 07:54:44 -07:00
Dmitry Gozman
60631409d6
chore: make dev server only use public config (#32441)
In preparation to make it a part of a plugin.
2024-09-04 01:29:55 -07:00
Yury Semikhatsky
565aed6c39
Revert "chore: enforce tags format via typescript types (#32384)" (#32431)
After API review we decided to revert it:
* VSCode extension and UI mode users already get the (runtime) error if
the tag is not prefixed
* The typescript error message is not very nice
* The type change would break those clients that generate tests with
tags passed as string

This reverts commit 90e7b9ebac.
2024-09-03 10:07:08 -07:00
Simon Knott
201bad75d3
chore(test runner): rebase watch mode onto TestServerConnection (#32156)
Closes https://github.com/microsoft/playwright/issues/32076.

This PR rewrites `watchMode.ts` to use `TestServer` under the hood. It's
essentially a complete rewrite, so don't pay too much attention on the
old implementation. Note that there's no changes to tests, so all
behaviour we have specced out there still works.

To make this work without a superfluous WebSocket connection, I had to
refactor `TestServerConnection` a little. Originally, I pulled this into
a [separate PR](https://github.com/microsoft/playwright/pull/32132), but
then realised how small the refactoring is. So it's in this PR now. Let
me know if you'd like to land it separately.
2024-09-03 15:15:44 +02:00
Simon Knott
f62f85ba51
fix(test runner): fix types to allow calling custom matchers on expect.poll (#32407)
The `'should support custom matchers'` test asserts that the
functionality works, but it was a type error. This PR updates the types
so that it's allowed.

Closes https://github.com/microsoft/playwright/issues/32408

---------

Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2024-09-02 13:42:15 +02:00
Simon Knott
cf8c14f884
feat(html reporter): open html attachments in new tab (#32389)
Closes https://github.com/microsoft/playwright/issues/32281.

HTML attachments get a linkified name that opens the attachment in a new
tab.
2024-09-02 08:35:53 +02:00
Kuba Janik
a6b320e362
fix(ui-mode): format request body when headers are lower case (#32395)
Resolves https://github.com/microsoft/playwright/issues/32396

Currently, the request body is not formatted when content type header is
lower case (`content-type`). Even though the value is
`application/json`.

It happens because we are looking only for `Content-Type` header
ignoring headers that are lower case.

<img width="674" alt="363197933-5178ec23-b9cf-46b5-8284-e8d4d730b036"
src="https://github.com/user-attachments/assets/0ef01b52-7dd8-4f33-b836-9adb86f94cc9">
2024-08-30 16:21:51 +02:00