microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
65.71k stars 3.58k forks source link

[Feature] Add Support for Partial Test Execution in Playwright VSCode Extension #23068

Open loop-automation opened 1 year ago

loop-automation commented 1 year ago

Feature Request: Add Support for Partial Test Execution in Playwright VSCode Extension

Description: Users are currently facing a challenge where they need to re-run an entire Playwright test case every time they make a small adjustment to their code. This is particularly problematic when debugging issues in the middle or end of the test case, as it becomes time-consuming and inefficient.

The feature request is to add support for maintaining the test context open, allowing users to update their code and re-run the test from a specific line. This would mean they could re-run the same lines of code without having to execute the entire test from the start.

Example: Let's say a user is testing a multi-step process on a webpage using Playwright. At one step, they need to retrieve data from a specific element and transform it into an array. If the test returns an unexpected result (e.g., an empty array), they would currently need to re-run the entire test after making adjustments to the code.

With this proposed feature, they could simply make the necessary adjustments and re-run the test from that specific step, saving considerable time and effort.

Possible Implementation: To implement this feature, there could be a debug state that does not tear the context down after a run. Instead, when the test is rebooted from a specific line (after changes have been implemented), it just uses the open debug context. The user would need to make sure the context is set to the proper page for the test to pick up from.

A new UI element could be added to the Playwright VSCode extension interface, allowing users to select the starting line for their test. Maybe using start from a specific breakpoint? Alternatively, a command could be implemented to facilitate this process.

While this feature might seem to deviate from the traditional flow of JavaScript execution and the design of Playwright, it would undoubtedly provide a more efficient debugging process for developers.

We understand that implementing this feature might come with its own challenges and complexities, but it's worth exploring to improve the efficiency of the debugging process with Playwright.

loop-automation commented 1 year ago

Hey @dgozman - I was asked to clarify, certainly doesn't need to be implemented in the vscode extension. Wherever you feel has the best debug support is.