mirror of
https://github.com/microsoft/playwright.git
synced 2024-11-28 09:23:42 +03:00
8761dafc73
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> |
||
---|---|---|
.. | ||
build | ||
docker | ||
doclint | ||
eslint-plugin-internal-playwright | ||
flakiness-dashboard | ||
generate_types | ||
linux-browser-dependencies | ||
protocol-types-generator | ||
avd_install.sh | ||
avd_recreate.sh | ||
avd_start.sh | ||
avd_stop.sh | ||
build_android_driver.sh | ||
check_chromium_cdn.js | ||
check_deps.js | ||
copyright.js | ||
draft_release_notes.sh | ||
generate_channels.js | ||
generate_chromium_default_font_families.js | ||
generate_clip_paths.js | ||
generate_dotnet_channels.js | ||
generate_injected.js | ||
generate_third_party_notice.js | ||
limits.sh | ||
lint_tests.js | ||
list_closed_issues.sh | ||
markdown.js | ||
pack_package.js | ||
print_versions.js | ||
publish_all_packages.sh | ||
render_release_notes.mjs | ||
roll_browser.js | ||
ts_to_java.js | ||
upload_flakiness_dashboard.sh | ||
video_stress.js | ||
workspace.js |