Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
renzoserra opened this issue Nov 29, 2024 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@renzoserra
Copy link

renzoserra commented Nov 29, 2024

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 renzoserra added the bug Issue identified by VS Code Team member as probable bug label Nov 29, 2024
@connor4312
Copy link
Member

What version of VS Code are you using?

@renzoserra
Copy link
Author

renzoserra commented Dec 2, 2024 via email

@connor4312
Copy link
Member

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

@connor4312 connor4312 added the info-needed Issue requires more information from poster label Dec 3, 2024
@renzoserra
Copy link
Author

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.

@connor4312
Copy link
Member

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]

@renzoserra
Copy link
Author

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

@connor4312
Copy link
Member

What version of Node.js are you using?

@renzoserra
Copy link
Author

v22.11.0

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants