playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Bug]: Can't easily terminate npx playwright show-report

Open vladkrasn opened this issue 1 year ago • 5 comments
trafficstars

Version

1.41.1

Steps to reproduce

  1. Install node.js 20.11
  2. Initialize a playwright project, for example using npm init playwright@latest
  3. Run a test
  4. Run npx playwright show-report
  5. Try to quit report using ctrl+c

Expected behavior

You get a single y/n prompt

Actual behavior

You get two y/n prompts in a row

Additional context

A single prompt is required in node version 19.8.1

I am actually not sure if it's a Playwright issue, but I gotta start somewhere to understand it. Npx nodemon's termination in some other project was working fine, so I am creating an issue in Playwright repo

Here's what I actually do Screenshot 2024-02-09 205721

Environment

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 AMD Ryzen 7 5800X3D 8-Core Processor
    Memory: 11.89 GB / 31.93 GB
  Binaries:
    Node: 20.11.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD
  IDEs:
    VSCode: 1.86.1 - C:\Users\******\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
  npmPackages:
    @playwright/test: ^1.41.2 => 1.41.2
    playwright: ^1.41.2 => 1.41.2

vladkrasn avatar Feb 09 '24 17:02 vladkrasn

@vladkrasn I cannot reproduce this on Windows 11 with Playwright v1.41.2. I guess something's different in your setup, but I am not sure how to help you.

PS C:\Users\dgozman\code\temp> node --version
v18.18.1
PS C:\Users\dgozman\code\temp> nvm use 20
Now using node v20.11.0 (64-bit)
PS C:\Users\dgozman\code\temp> node --version
v20.11.0
PS C:\Users\dgozman\code\temp> npx playwright show-report

  Serving HTML report at http://localhost:9323. Press Ctrl+C to quit.
^C^CTerminate batch job (Y/N)? y
PS C:\Users\dgozman\code\temp> nvm use 18
Now using node v18.18.1 (64-bit)
PS C:\Users\dgozman\code\temp> node --version
v18.18.1
PS C:\Users\dgozman\code\temp> npx playwright show-report

  Serving HTML report at http://localhost:9323. Press Ctrl+C to quit.
^C^CTerminate batch job (Y/N)? y
PS C:\Users\dgozman\code\temp>

dgozman avatar Feb 09 '24 23:02 dgozman

Very weird. 18 and 21 don't work as expected either. Only 19 for whatever mysterious reason

vladkrasn avatar Feb 10 '24 08:02 vladkrasn

@dgozman It seems that this issue is dependant on me using yarn instead of npm. Works fine when I do npm install, bad when I do yarn install. Is this an issue on yarn's side? I delete lockfiles and node-modules between installations

Screenshot 2024-02-10 125701

I deleted and reinstalled all of nvm's node installations, as well as old yarn and node files that were not installed through nvm, then reinstalled everything through nvm. The issue is the same. If yarn install was used (be it yarn install from v19 or v20 or v18), then node v19 task termination works as expected, and node v20 or v18 doesn't

There's a minor difference in behavior even when using npm install. There are ^C on non-19 versions when terminating tasks image

What's even more annoying, is when I use a yarn command to run npx playwright show-report. In node 19 it instantly terminates job without the prompt. In other nodes it bugs out the terminal, and sometimes I need to close it image

No experience with pnpm, but I tried it and it behaves just like yarn in this situation

vladkrasn avatar Feb 10 '24 08:02 vladkrasn

@vladkrasn Yes, this is probably related to the yarn/npm and their versions. Since running npx playwright or yarn report is essentially running npm/yarn that in turn launches playwright, they handle the interrupt signal and forward it to the underlying playwright process. We've encountered bugs in their behavior over time, I can currently see a few sigint issues open.

I'll leave this issue open for prioritization. If it becomes a popular problem, we can look into writing some kind of a workaround.

dgozman avatar Feb 10 '24 16:02 dgozman

Interrupt signal is one thing, but then why is behavior of vanilla npx playwright show-report different when the project is installed through npm and through yarn?

vladkrasn avatar Feb 10 '24 18:02 vladkrasn

Why was this issue closed?

Thank you for your contribution to our project. This issue has been closed due to its limited upvotes and recent activity, and insufficient feedback for us to effectively act upon. Our priority is to focus on bugs that reflect higher user engagement and have actionable feedback, to ensure our bug database stays manageable.

Should you feel this closure was in error, please create a new issue and reference this one. We're open to revisiting it given increased support or additional clarity. Your understanding and cooperation are greatly appreciated.

pavelfeldman avatar Aug 16 '24 00:08 pavelfeldman