playwright/utils
오소현 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
..
build chore(driver): roll driver to recent Node.js LTS version (#32264) 2024-08-22 12:07:44 +02:00
docker docs: recommend Ubuntu 24.04 in Docker images (#31435) 2024-08-12 16:39:56 +02:00
doclint chore: fix api.json serializer for language ports (#32260) 2024-08-22 10:15:47 +02:00
eslint-plugin-internal-playwright chore: use more explicit awaits when returning in client (#28443) 2023-12-07 20:13:35 -08:00
flakiness-dashboard chore: update flakiness metadata for better ui presentation (#31528) 2024-07-03 08:39:53 -07:00
generate_types feat(test runner): allow to pass arbitrary location to test.step (#32504) 2024-09-17 08:11:21 -07:00
linux-browser-dependencies feat: support Ubuntu 24.04 (#30826) 2024-06-03 12:47:16 +02:00
protocol-types-generator fix: protocol generation in monorepo (#9513) 2021-10-14 11:14:50 -07:00
avd_install.sh test: update to android-35 SDK (Android 15) (#32430) 2024-09-06 14:27:56 +02:00
avd_recreate.sh test: update to android-35 SDK (Android 15) (#32430) 2024-09-06 14:27:56 +02:00
avd_start.sh test: update to android-35 SDK (Android 15) (#32430) 2024-09-06 14:27:56 +02:00
avd_stop.sh devops: fix Android tests (#29335) 2024-02-05 20:39:00 +01:00
build_android_driver.sh devops: make Android driver compile (#31360) 2024-06-18 18:23:29 +02:00
check_chromium_cdn.js chore: fixes to helper scripts 2021-11-17 17:02:29 -08:00
check_deps.js chore: roll expect and move it to third party (#32458) 2024-09-09 13:12:20 -07:00
copyright.js chore(eslint): lint for copyrights on files (#2858) 2020-07-07 11:12:45 -07:00
draft_release_notes.sh fix: Allow portable bash paths for systems including NixOS (#23889) 2023-07-03 06:27:06 -07:00
generate_channels.js chore: explicitly control actions with slow mo (#22445) 2023-04-17 16:19:30 -07:00
generate_chromium_default_font_families.js fix(chromium): work around about:blank issue on Chromium (#14068) 2022-05-10 20:32:19 +01:00
generate_clip_paths.js fix(codegen): prevent csp directive violations (#30366) 2024-04-23 07:33:12 -07:00
generate_dotnet_channels.js fix(dotnet): generate bool? correctly in generated transport channel types (#23966) 2023-06-29 22:16:16 +02:00
generate_injected.js chore: rename fakeTimers to clock (#31193) 2024-06-06 15:56:13 -07:00
generate_third_party_notice.js chore: use own socks5 server for tests (#31639) 2024-07-11 14:12:48 +02:00
limits.sh feat(ui): run deps in UI mode if dep projects are checked (#24245) 2023-07-15 15:11:31 -07:00
lint_tests.js chore: add npm run lint-tests (#10252) 2021-11-11 13:27:50 -08:00
list_closed_issues.sh fix: Allow portable bash paths for systems including NixOS (#23889) 2023-07-03 06:27:06 -07:00
markdown.js chore(docs): remove unused generateToc function (#32111) 2024-08-12 10:56:59 +02:00
pack_package.js fix(output): clear output before global setup (#29584) 2024-02-20 14:24:59 -08:00
print_versions.js chore: fix `//utils/print_versions.js` (#9647) 2021-10-20 02:20:46 -07:00
publish_all_packages.sh devops: publish using NPM provenance feature (#27459) 2023-10-05 20:00:18 +00:00
render_release_notes.mjs chore: class link generation in release notes (#30324) 2024-04-10 10:05:54 -07:00
roll_browser.js feat(roll): roll Firefox to r1450 (#30865) 2024-05-19 16:28:32 +02:00
ts_to_java.js chore: add ts_to_java test conversion script (#17914) 2022-10-07 13:16:46 -07:00
upload_flakiness_dashboard.sh devops: updated auth mode follow-ups (#30440) 2024-04-19 21:23:39 +02:00
video_stress.js fix(video): reduce buffering in ffmpeg, avoid overbooking cpu (#8786) 2021-09-09 12:41:06 -07:00
workspace.js fix: don't use git status for workspace consistency (#29224) 2024-01-29 20:13:54 +01:00