vscode-js-debug icon indicating copy to clipboard operation
vscode-js-debug copied to clipboard

I am unable to execute tests with the Playwright test runner in debug mode

Open renzoserra opened this issue 1 year ago • 8 comments

I am unable to execute tests with the Playwright test runner in debug mode under the following conditions:

Debugging with Breakpoints:

When I run tests in debug mode and set a breakpoint, the execution does not start and becomes unresponsive. (Refer to the attached image for reference: "See Image"). Image

Frozen Execution: The test execution remains frozen, as shown in the image. (Refer to the attached image for reference: "See Image"). Image

Console Error Message: If I stop the execution manually, I see the following message in the console: arduino Copiar código Process exited with code 1 Despite the error message, the execution timer continues to run, and the only way to fully terminate the process is by closing VSCode entirely. (Refer to the attached image for reference: "See Image"). Image

Workaround with Debugging: The only way I have managed to debug tests is by: Starting the debug execution without breakpoints. Adding the breakpoint after the browser instance has launched. (Refer to the attached image for reference: "See Image"). Image Image

Configuration Details Below is my tsconfig.json configuration: { "compilerOptions": { "target": "es2016", "module": "commonjs", "sourceMap": true, "outDir": "./dist", "resolveJsonModule": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": false, "noImplicitAny": false, "skipLibCheck": true }, "include": ["tests//*.ts", "pages//*.ts", "run-tests-by-tags.js"], "exclude": ["node_modules"] } And here is my launch.json configuration: { "name": "Debug Playwright Tests with ts-node", "type": "node", "request": "launch", "program": "${workspaceFolder}/node_modules/ts-node/dist/bin.js", "args": ["${workspaceFolder}/tests/Administracion.spec.ts"], "console": "integratedTerminal", "skipFiles": ["<node_internals>/**"] }

Bug Report for VSCode Issue Description I am unable to execute tests with the Playwright test runner in debug mode under the following conditions:

Debugging with Breakpoints:

When I run tests in debug mode and set a breakpoint, the execution does not start and becomes unresponsive. (Refer to the attached image for reference: "See Image"). Frozen Execution:

The test execution remains frozen, as shown in the image. (Refer to the attached image for reference: "See Image"). Console Error Message:

If I stop the execution manually, I see the following message in the console: arduino

Process exited with code 1 Despite the error message, the execution timer continues to run, and the only way to fully terminate the process is by closing VSCode entirely. (Refer to the attached image for reference: "See Image"). Workaround with Debugging:

The only way I have managed to debug tests is by: Starting the debug execution without breakpoints. Adding the breakpoint after the browser instance has launched. (Refer to the attached image for reference: "See Image"). Configuration Details Below is my tsconfig.json configuration:

json

{ "compilerOptions": { "target": "es2016", "module": "commonjs", "sourceMap": true, "outDir": "./dist", "resolveJsonModule": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": false, "noImplicitAny": false, "skipLibCheck": true }, "include": ["tests//*.ts", "pages//*.ts", "run-tests-by-tags.js"], "exclude": ["node_modules"] } And here is my launch.json configuration:

json

{ "name": "Debug Playwright Tests with ts-node", "type": "node", "request": "launch", "program": "${workspaceFolder}/node_modules/ts-node/dist/bin.js", "args": ["${workspaceFolder}/tests/Administracion.spec.ts"], "console": "integratedTerminal", "skipFiles": ["<node_internals>/**"] }

Expected Behavior

  • The test execution should begin and pause at the specified breakpoints in debug mode without freezing.
  • Upon stopping the test execution, all processes should terminate properly, and the console should stop logging execution time. Actual Behavior
  • Tests freeze when starting execution with breakpoints.
  • Manual stopping of execution leaves the timer running indefinitely.
  • Proper debug functionality is only achieved through a workaround (starting execution first, then adding breakpoints).

Steps to Reproduce

  • Configure VSCode with the provided tsconfig.json and launch.json.
  • Start a test in debug mode with a breakpoint set before the execution.
  • Observe that the test execution does not start and remains frozen.
  • Attempt to manually stop the process and note the error message and timer behavior.

Additional Notes

  • This issue significantly disrupts the workflow for debugging Playwright tests.
  • The workaround is functional but cumbersome and time-consuming.
  • Attached images provide visual references for the issue and the configurations. (See Images)

renzoserra avatar Nov 29 '24 15:11 renzoserra

What version of VS Code are you using?

connor4312 avatar Nov 29 '24 22:11 connor4312

Version: 1.95.3 (system setup) Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813 Date: 2024-11-13T14:50:04.152Z Electron: 32.2.1 ElectronBuildId: 10427718 Chromium: 128.0.6613.186 Node.js: 20.18.0 V8: 12.8.374.38-electron.0 OS: Windows_NT x64 10.0.19045

El vie, 29 nov 2024 a las 19:08, Connor Peet @.***>) escribió:

What version of VS Code are you using?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-js-debug/issues/2137#issuecomment-2508698342, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTZI3HJQZGINFDCWDTICVD2DDQUPAVCNFSM6AAAAABSXKY76OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMBYGY4TQMZUGI . You are receiving this because you authored the thread.Message ID: @.***>

renzoserra avatar Dec 02 '24 12:12 renzoserra

Please collect a log file using the instructions in the issue template, thanks!

connor4312 avatar Dec 03 '24 17:12 connor4312

I don't understand what you mean specifically with the log. I have provided all the information above. When running in debug mode with a breakpoint, the execution does not continue and what you see in the image is the only thing that is displayed in the console.

Image

I told you that I tried to run the same project on another notebook with the same version of Vscode and it works perfectly. I assume it is something related to the notebook configuration, permissions and firewall.

renzoserra avatar Dec 04 '24 02:12 renzoserra

These are the instructions on how to capture a trace log:

If you're able to, add "trace": true to your launch.json and reproduce the issue. The location of the log file on your disk will be written to the Debug Console. Share that with us.

⚠️ This log file will not contain source code, but will contain file paths. You can drop it into https://microsoft.github.io/vscode-pwa-analyzer/index.html to see what it contains. If you'd rather not share the log publicly, you can email it to [email protected]

connor4312 avatar Dec 10 '24 23:12 connor4312

I have done what you requested. However, the result is still the same. Look at the image, the debug console does not progress from there.

Image

renzoserra avatar Dec 17 '24 14:12 renzoserra

What version of Node.js are you using?

connor4312 avatar Dec 17 '24 16:12 connor4312

v22.11.0

Image

renzoserra avatar Dec 17 '24 16:12 renzoserra