playwright/docs/src
오소현 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
..
api Revert "feat(tracing): add .pwtrace to trace file extension" (#32648) 2024-09-17 15:32:30 +02:00
test-api feat(test runner): allow to pass arbitrary location to test.step (#32504) 2024-09-17 08:11:21 -07:00
test-reporter-api chore: revert the matcherResult in API (#32524) 2024-09-09 16:44:32 -07:00
accessibility-testing-java.md docs: remove redundant TOC usages (#32096) 2024-08-09 12:44:01 +02:00
accessibility-testing-js.md docs: spelling (#31779) 2024-07-22 06:45:22 -07:00
actionability.md docs(actionability.md): fix grammar (#30756) 2024-05-21 12:35:17 -07:00
api-testing-csharp.md docs: remove redundant TOC usages (#32096) 2024-08-09 12:44:01 +02:00
api-testing-java.md docs: remove redundant TOC usages (#32096) 2024-08-09 12:44:01 +02:00
api-testing-js.md docs: remove redundant TOC usages (#32096) 2024-08-09 12:44:01 +02:00
api-testing-python.md docs: remove redundant TOC usages (#32096) 2024-08-09 12:44:01 +02:00
auth.md docs(auth): use abs path, difference between storage locations (#32037) 2024-08-06 11:36:49 -07:00
best-practices-js.md docs(best-practises): add note about tsc (#32245) 2024-08-21 11:37:53 +02:00
browser-contexts.md docs: fix various syntax errors in .NET documentation (#28472) 2023-12-05 09:19:12 -08:00
browsers.md docs: mention variability of media codecs between platforms (#32569) 2024-09-11 13:35:17 -07:00
canary-releases-js.md docs: add intros for all pages (#27480) 2023-10-06 15:08:51 +02:00
chrome-extensions-js-python.md docs: note that custom args are on your own risk (#28656) 2023-12-14 14:37:31 -08:00
ci-intro.md fix(docs): remove todo in ci intro docs (#32643) 2024-09-17 10:36:43 +02:00
ci.md docs(docker): fix Docker container permissions (#32621) 2024-09-16 07:39:36 +02:00
clock.md fix(clock): mock time in Event.prototype.timeStamp (#31986) 2024-08-02 15:27:54 +02:00
codegen-intro.md docs: improve dotnet getting started (#30594) 2024-05-02 12:06:39 +02:00
codegen.md docs: fix grammar and typos in various files (#31678) 2024-07-16 06:15:25 -07:00
debug.md docs: fix grammar and typos in various files (#31678) 2024-07-16 06:15:25 -07:00
dialogs.md docs: add guide for print dialogs (#31340) 2024-06-19 18:04:22 +02:00
docker.md docs: recommend Ubuntu 24.04 in Docker images (#31435) 2024-08-12 16:39:56 +02:00
downloads.md docs: add intros for all pages (#27480) 2023-10-06 15:08:51 +02:00
emulation.md docs(dotnet): fix isMobile in snippet (#30699) 2024-05-07 22:34:55 +01:00
evaluating.md docs(evaluate): improve the guide (#32222) 2024-08-21 01:31:41 -07:00
events.md docs: fix grammar and typos in various files (#31678) 2024-07-16 06:15:25 -07:00
extensibility.md docs: remove the create method from extensibility (#28823) 2024-01-03 09:39:57 -08:00
frames.md docs: add intros for all pages (#27480) 2023-10-06 15:08:51 +02:00
getting-started-vscode-js.md docs: add video on running tests (#31066) 2024-05-29 17:19:49 +02:00
handles.md docs: migrate to newer :::warning syntax (#30089) 2024-03-25 19:22:15 +01:00
input.md docs(input): fix pressSequentially typo (#31333) 2024-06-17 16:27:36 +02:00
intro-csharp.md docs: drop macOS 12 from supported systems (#31283) 2024-06-12 15:26:35 -07:00
intro-java.md docs: drop macOS 12 from supported systems (#31283) 2024-06-12 15:26:35 -07:00
intro-js.md docs: drop macOS 12 from supported systems (#31283) 2024-06-12 15:26:35 -07:00
intro-python.md docs: add missing pytest-playwright installation command (#31645) 2024-07-11 21:27:54 +02:00
junit-java.md docs: remove redundant TOC usages (#32096) 2024-08-09 12:44:01 +02:00
languages.md docs(dotnet): recommend MSTest over NUnit (#31245) 2024-06-11 15:06:03 +02:00
library-csharp.md docs(dotnet): recommend MSTest over NUnit (#31245) 2024-06-11 15:06:03 +02:00
library-js.md docs: fix grammar and typos in various files (#31678) 2024-07-16 06:15:25 -07:00
library-python.md chore: validate markdown links in doclint (#24444) 2023-07-26 16:15:07 -07:00
locators.md docs: fix grammar and typos in various files (#31678) 2024-07-16 06:15:25 -07:00
mock-browser-js.md doc: document mocking read-only browser apis (#30122) 2024-03-26 14:20:20 -07:00
mock.md docs(mock): fix routeFromHAR() arguments for Java (#32409) 2024-09-03 08:57:57 +02:00
navigations.md docs: add intros for all pages (#27480) 2023-10-06 15:08:51 +02:00
network.md chore: fix doclint (#32294) 2024-08-23 16:26:39 +02:00
other-locators.md docs: fix broken anchor links (#31707) 2024-07-16 16:11:20 +02:00
pages.md docs: do not recommend waitForLoadState (#30483) 2024-04-23 09:22:58 -07:00
pom.md docs: add intros for all pages (#27480) 2023-10-06 15:08:51 +02:00
protractor-js.md docs: add intros for all pages (#27480) 2023-10-06 15:08:51 +02:00
puppeteer-js.md docs: remove overloads from test.* APIs (#29376) 2024-02-05 19:03:04 -08:00
release-notes-csharp.md docs: release note fixes for 1.47 (#32589) 2024-09-12 12:51:30 +02:00
release-notes-java.md docs: release note fixes for 1.47 (#32589) 2024-09-12 12:51:30 +02:00
release-notes-js.md docs: update release notes for 1.47 to our changes from yesterday (#32482) 2024-09-06 10:28:17 +02:00
release-notes-python.md docs: release note fixes for 1.47 (#32589) 2024-09-12 12:51:30 +02:00
running-tests-csharp.md docs: remove redundant duplicate headed paragraph (#31298) 2024-06-14 01:20:14 +02:00
running-tests-java.md docs: remove redundant duplicate headed paragraph (#31298) 2024-06-14 01:20:14 +02:00
running-tests-js.md docs: add last failed to running tests (#30730) 2024-05-21 12:37:39 -07:00
running-tests-python.md docs: fix some typo (#28450) 2023-12-02 15:35:51 -08:00
screenshots.md docs: remove redundant TOC usages (#32096) 2024-08-09 12:44:01 +02:00
selenium-grid.md docs: state that grid support is experimental (#28406) 2023-11-29 12:16:10 -08:00
service-workers-experimental-network-events-js.md docs: spelling (#31779) 2024-07-22 06:45:22 -07:00
test-annotations-js.md feat(html-reporter): hide annotations started with "_" (#31489) 2024-07-02 16:46:24 -07:00
test-assertions-csharp-java-python.md docs(dotnet): recommend MSTest over NUnit (#31245) 2024-06-11 15:06:03 +02:00
test-assertions-js.md fix(expect): throw unsupported error when using this.equals() in expect (#31723) 2024-07-17 13:22:00 +02:00
test-cli-js.md feat(test runner): --tsconfig cli option (#31932) 2024-08-06 06:55:15 -07:00
test-components-js.md docs(ct): vue + jsx and general improvements (#32212) 2024-09-09 05:09:18 -07:00
test-configuration-js.md docs: fix parallelism and sharding references (#31134) 2024-06-04 10:31:36 +02:00
test-fixtures-js.md docs: update snippets to fix typescript errors (#32363) 2024-08-28 14:24:01 -07:00
test-global-setup-teardown-js.md Revert "feat(tracing): add .pwtrace to trace file extension" (#32648) 2024-09-17 15:32:30 +02:00
test-parallel-js.md chore: fix typos (#30645) 2024-05-08 19:40:03 +01:00
test-parameterize-js.md docs: fix typos in various documentation files (#31656) 2024-07-12 10:24:52 -07:00
test-projects-js.md docs(test-projects-js.md): fix typo in "Test filtering" section (#30114) 2024-03-26 08:15:02 -07:00
test-reporters-js.md docs: added MS Teams and mail reporter (#31579) 2024-07-24 11:55:45 +02:00
test-retries-js.md docs: remove overloads from test.* APIs (#29376) 2024-02-05 19:03:04 -08:00
test-runners-csharp.md docs(dotnet): recommend MSTest over NUnit (#31245) 2024-06-11 15:06:03 +02:00
test-runners-java.md docs: remove redundant TOC usages (#32096) 2024-08-09 12:44:01 +02:00
test-runners-python.md docs(python): add docs for new_context fixture (#30522) 2024-04-24 22:40:38 +02:00
test-sharding-js.md docs: added more explanation to sharding to make it more understandable. (#31399) 2024-06-21 10:20:56 -07:00
test-snapshots-js.md docs(test-snapshots-js.md): Add link to snapshotPathTemplate (#29727) 2024-03-02 07:28:45 -08:00
test-timeouts-js.md docs: remove overloads from test.* APIs (#29376) 2024-02-05 19:03:04 -08:00
test-typescript-js.md chore(docs): fix typo (#32372) 2024-08-29 14:16:29 -07:00
test-ui-mode-js.md Fix a grammar mistake in ui-mode doc (#30378) 2024-04-15 15:24:04 -07:00
test-use-options-js.md docs: add intros for all pages (#27480) 2023-10-06 15:08:51 +02:00
test-webserver-js.md docs(webServer): add missing options (#29490) 2024-02-14 17:57:40 +01:00
testing-library-js.md docs(ct): update testing library migration guide (#31222) 2024-06-10 17:20:51 -07:00
threading-java.md docs: add intros for all pages (#27480) 2023-10-06 15:08:51 +02:00
trace-viewer-intro-csharp.md docs(dotnet): recommend MSTest over NUnit (#31245) 2024-06-11 15:06:03 +02:00
trace-viewer-intro-java-python.md Revert "feat(tracing): add .pwtrace to trace file extension" (#32648) 2024-09-17 15:32:30 +02:00
trace-viewer-intro-js.md Revert "feat(tracing): add .pwtrace to trace file extension" (#32648) 2024-09-17 15:32:30 +02:00
trace-viewer.md Revert "feat(tracing): add .pwtrace to trace file extension" (#32648) 2024-09-17 15:32:30 +02:00
videos.md docs: add intros for all pages (#27480) 2023-10-06 15:08:51 +02:00
webview2.md docs(dotnet): recommend MSTest over NUnit (#31245) 2024-06-11 15:06:03 +02:00
writing-tests-csharp.md docs(dotnet): recommend MSTest over NUnit (#31245) 2024-06-11 15:06:03 +02:00
writing-tests-java.md docs: add intros for all pages (#27480) 2023-10-06 15:08:51 +02:00
writing-tests-js.md docs: writing tests python merge with node (#26926) 2023-09-08 17:13:00 +02:00
writing-tests-python.md docs: small fix in headings (#27209) 2023-09-20 19:16:19 +02:00