64 Commits

Author SHA1 Message Date
Max Schmitt
b25cb7f3d1
chore: use 'Clear' step name for locator.clear() (#36208) 2025-06-05 13:23:11 +01:00
Pavel Feldman
c9d329155d
chore: remove Step prefix from trace and reports (#36149) 2025-06-02 13:40:22 -07:00
Pavel Feldman
9a53dc2d07
chore: two-line trace view (4) (#36070) 2025-05-23 16:03:50 -07:00
Pavel Feldman
e0365747ce
chore: two-line trace view (2) (#36055) 2025-05-22 14:50:54 -07:00
Pavel Feldman
6a2a70619a
chore: two-line trace view (1) (#36025) 2025-05-22 09:49:37 -07:00
Pavel Feldman
0e9cf0a3ad
chore: annotate protocol methods with internal & titles (#35979) 2025-05-16 14:01:09 -07:00
Pavel Feldman
313de29fab
feat(locator): introduce locator.describe() (#35969) 2025-05-16 13:40:47 -07:00
Simon Knott
1206ef64e7
chore(html): render locator.fill value (#35457) 2025-04-02 15:40:37 +02:00
Pavel Feldman
85c6405093
chore: differentiate test.skip and step.skip (#35002) 2025-03-03 15:27:56 -08:00
Simon Knott
6dcb7d2bf5
chore: remove pageSnapshot option (#34962)
Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2025-02-28 13:16:58 +01:00
Simon Knott
9e38473309
fix(runner): hide APIResponse.* calls from results (#34909) 2025-02-25 14:26:54 +01:00
Simon Knott
8ed2f4319e
chore: add pageSnapshot option (#34669) 2025-02-11 11:04:57 -08:00
Yury Semikhatsky
a1451c75f8
feat: conditional step.skip() (#34578) 2025-01-31 15:45:57 -08:00
Yury Semikhatsky
372d4196d7
chore: step timeout improvements (#34386) 2025-01-17 21:15:47 -08:00
Dmitry Gozman
be6caed8df
chore: remove expectZone (#34312) 2025-01-16 18:53:32 +00:00
Yury Semikhatsky
275f334b58
chore(step): remove step.fail and step.fixme, add step.skip (#34326) 2025-01-14 17:43:47 -08:00
Dmitry Gozman
f0a3a15e93
chore: explicitly reset apiZone instead of everything (#34265) 2025-01-10 20:15:05 +00:00
Yury Semikhatsky
7ed60ccf7f
feat(test): step.fail and step.fixme modifiers (#34042) 2024-12-17 11:17:22 -08:00
Simon Knott
5e8b469c1c
fix(test): hide response.* calls from reports (#33620) 2024-11-18 13:59:40 +01:00
Yury Semikhatsky
5203c780ae
feat: step timeout option (#33560) 2024-11-13 11:17:54 -08:00
Yury Semikhatsky
50775698ae
fix: parent step for API calls inside waitForEvent callback (#33409) 2024-11-06 17:35:16 -08:00
Yury Semikhatsky
523e50088a
test: do not rely on http://localhost2 dns resolution failure (#33479) 2024-11-06 14:20:38 -08:00
Dmitry Gozman
9b2ca93a50
chore: followup to tracing.group (#33450) 2024-11-05 04:45:54 -08: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
Max Schmitt
523ec83cad
chore: move Location type from testReporter.d.ts to test.d.ts (#32687) 2024-09-18 16:57:11 +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
Dmitry Gozman
268357238a
fix(expect): respect custom message in expect.poll (#32603)
Fixes #32582.
2024-09-16 00:10:06 -07: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
Yury Semikhatsky
fef27395a5
chore(trace): do not nest API actions based on time (#31990)
They should be properly nested based on Node.js zones now.
2024-08-05 10:06:14 -07:00
Dmitry Gozman
b9e5a934ee
test: make expectations readable for more step reporting tests (#30468) 2024-04-22 15:30:51 -07:00
Yury Semikhatsky
cda1c945af
test: web assertion inside expect.poll (#30391)
Reference https://github.com/microsoft/playwright/issues/30322
2024-04-16 17:37:25 -07:00
Yury Semikhatsky
3bdbe4284e
fix(steps): make expect.toPass and expect.poll step containers (#30389)
Fixes https://github.com/microsoft/playwright/issues/30322
2024-04-16 16:18:37 -07:00
Yury Semikhatsky
73fce8fb98
chore: replace Zones with AsyncLocalStorage (#30381)
Reference https://github.com/microsoft/playwright/issues/30322
2024-04-16 12:51:20 -07:00
Yury Semikhatsky
6ad48fb594
chore: make step test expectations readable (#30362)
Reference https://github.com/microsoft/playwright/issues/30322
2024-04-13 20:07:18 -07:00
Yury Semikhatsky
c4418875d3
chore: do skip failing test (#30361) 2024-04-12 15:47:13 -07:00
Yury Semikhatsky
dc1077c5a2
test: steps inside expect.toPass (#30359)
Reference https://github.com/microsoft/playwright/issues/30322
2024-04-12 14:51:10 -07:00
Dmitry Gozman
d214778548
chore(test runner): move timeout handling to the top, stop inheriting runnable (#29857) 2024-03-08 15:19:36 -08:00
Dmitry Gozman
08afb34c14
chore(test runner): make timeout error an Error (#29515) 2024-02-15 11:38:13 -08:00
Dmitry Gozman
bc2d4302f5
test: fix a broken reporter test (#29514)
It failed to print an error with missing stack, e.g. a timeout error.
2024-02-15 09:45:48 -08:00
Pavel Feldman
eeb9e06d5e
chore: box step w/o modifying runtime errors (#28762) 2023-12-22 12:00:17 -08:00
Pavel Feldman
5d9e08ac61
chore: box soft steps (#28749)
Fixes https://github.com/microsoft/playwright/issues/28259
2023-12-21 12:16:03 -08:00
Pavel Feldman
afe90d648e
fix: do not generate api call steps inside named expects (#28609)
Fixes: https://github.com/microsoft/playwright/issues/28528
2023-12-13 09:06:02 -08:00
Pavel Feldman
d136b0aeb6
feat(step): allow boxing steps (#27334) 2023-09-29 09:44:00 -07:00
Pavel Feldman
566b277ce8
fix(steps): only propagate soft errors up the hierarchy (#24054)
Fixes https://github.com/microsoft/playwright/issues/23979
2023-07-05 15:30:53 -07:00
Pavel Feldman
84942aa992
chore: render successful toPass as such (#23411)
Fixes https://github.com/microsoft/playwright/issues/23302
2023-06-01 13:22:08 -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
Pavel Feldman
4c4085e105
chore: partially hide built-in fixture steps (#23005) 2023-05-12 19:15:31 -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
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
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