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
67.27k stars 3.7k forks source link

[Bug]: playwright-core logs invalid instructions for missing install #32187

Closed remcohaszing closed 3 months ago

remcohaszing commented 3 months ago

Version

1.46.0

Steps to reproduce

In a clean environment, run the following JavaScript snippet:

import { chromium } from 'playwright-core'
chromium.launch()

Expected behavior

Playwright should instruct to run the following command:

npx playwright-core install

Actual behavior

It instructs to run a command that doesn’t exist.

  ╔═════════════════════════════════════════════════════════════════════════╗
  ║ Looks like Playwright Test or Playwright was just installed or updated. ║
  ║ Please run the following command to download new browsers:              ║
  ║                                                                         ║
  ║     npx playwright install                                              ║
  ║                                                                         ║
  ║ <3 Playwright Team                                                      ║
  ╚═════════════════════════════════════════════════════════════════════════╝

Additional context

The command needed to install playwright was changed somewhere in a minor version.

This is a duplicate of #29710. That issue was closed for unclear reasons as it’s a clear and actionable bug. If you need any more feedback, please ask.

Environment

System:
    OS: Linux 6.9 Pop!_OS 22.04 LTS
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 22.37 GB / 31.06 GB
    Container: Yes
  Binaries:
    Node: 22.6.0 - /usr/bin/node
    Yarn: 1.22.22 - ~/.local/bin/yarn
    npm: 10.8.2 - /usr/bin/npm
    pnpm: 9.4.0 - ~/.local/bin/pnpm
    bun: 1.1.20 - ~/.local/bin/bun
  IDEs:
    VSCode: 1.92.2 - /usr/bin/code
  Languages:
    Bash: 5.1.16 - /usr/bin/bash
  npmPackages:
    playwright-core: ^1.0.0 => 1.46.0
pavelfeldman commented 3 months ago

playwright-core is an implementation detail of Playwright, why are you using playwright-core and not playwright?

pavelfeldman commented 3 months ago

We need more information to act on this report. As long as we can't repro it, it is unlikely with can make progress with it. Allow me to close it, but please file a new one and link to this issue when you get back to it!

remcohaszing commented 3 months ago

Allow me to close it, but please file a new one and link to this issue when you get back to it!

Hi @pavelfeldman. Why was this issue closed so quickly? This feels pretty hostile. This issue was closed within 2 weekdays after opening. This is during a time that’s really busy for me personally. I understand you can’t possibly know this, but 2 days is really short. Asking to report yet another duplicate issue instead of commenting, seems counter productive to both you, the person triaging, and myself, the person reporting.

We need more information to act on this report. As long as we can't repro it, it is unlikely with can make progress with it

The issue contains a script to reproduce the issue without any dependencies, describes actual and expected behaviour, and contains all relevant version information. What’s the part you’re having trouble with reproducing? Please elaborate.

playwright-core is an implementation detail of Playwright, why are you using playwright-core and not playwright?

I use playwright-core as a dependency of a library (mermaid-isomorphic). playwright used to have an install script. I do not want this in a library. I want the user to have to download browsers explicitly. Due to the isomorphic nature of mermaid-isomorphic, not all users even need Playwright.

Apparently a breaking change was made in a minor version of playwright: the install script was removed. I haven’t narrowed down which version exactly.

The playwright script from playwright-core worked fine until version 1.33.0 (see package.json). In version 1.34.0 the bin field was removed (breaking change). In 1.35.0 a new bin field was added, registering the playwright-core executable instead.

The readme of playwright-core contains the following content:

This package contains the no-browser flavor of Playwright.

There is no indication this package shouldn’t be used.

Really this issue is a result of undocumented breaking changes (1.34.0 release notes) on Playwright’s side.

Related issues:

I’ve also seen people complain on Twitter at some point, but I don’t have the sources readily available.


If I understand correctly, I should adjust mermaid-isomorphic to the breaking changes made in Playwright 1.34.0 and change the playwright-core dependency to playwright. That doesn’t change the validity of this issue: playwright-core logs misleading instructions.