51 Commits

Author SHA1 Message Date
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
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
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
Pavel Feldman
e9373dfb6e
chore: make client-side instrumentation non-nullable (#22694) 2023-04-28 08:57:43 -07:00
Dmitry Gozman
957ec0067f
chore: separate concerns of testinfo helpers (#22491) 2023-04-19 17:31:07 -07:00
Pavel Feldman
b1fdf0bcb6
chore: nest test steps based on zones (#22108)
Fixes: #21423
2023-03-30 21:05:07 -07: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
1b941bcf2e
chore: simplify ttests (#20733) 2023-02-07 15:11:44 -08:00
Dmitry Gozman
28577afde4
feat(soft expect): mark steps with failed soft expects as failed (#19973)
Fixes #19673.
2023-01-09 16:17:06 -08:00
Yury Semikhatsky
7d306bbc66
feat: return value from step (#16060) 2022-07-29 15:16:07 -07:00
Pavel Feldman
f3bd910820
chore(test-runner): rewrite poll, soft, wrap (#13335) 2022-04-05 17:47:35 -07:00
Pavel Feldman
2d4db7a6f0
fix(stack): hide test runner stack frames (#9735) 2021-10-25 11:49:59 -07:00
Pavel Feldman
e37660b068
feat(api): expose step location (#9602) 2021-10-18 21:06:18 -07:00
Dmitry Gozman
43213614a1
fix(test runner): after hooks step should not be nested (#8969) 2021-09-16 15:51:27 -07:00