playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[BUG] Cannot start playwright test v1.16 if installed using Yarn

Open Evilweed opened this issue 5 years ago β€’ 8 comments

Context:

  • Playwright Version: 1.16.1
  • Operating System: Mac
  • Node.js version: 12.18.2
  • Browser: Chromium
  • Extra: -
CleanShot 2021-10-27 at 16 38 51@2x

CleanShot 2021-10-27 at 16 46 00@2x

➜  e2e-tests git:(test-controller-api-client) βœ— yarn add @playwright/test --save
yarn add v1.22.15
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
[4/4] πŸ”¨  Building fresh packages...
success Saved lockfile.
success Saved 86 new dependencies.
info Direct dependencies
└─ @playwright/[email protected]
info All dependencies
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @babel/[email protected]
β”œβ”€ @playwright/[email protected]
β”œβ”€ @types/[email protected]
β”œβ”€ @types/[email protected]
β”œβ”€ @types/[email protected]
β”œβ”€ @types/[email protected]
β”œβ”€ @types/[email protected]
β”œβ”€ @types/[email protected]
β”œβ”€ @types/[email protected]
β”œβ”€ @types/[email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
└─ [email protected]
✨  Done in 2.74s.
➜  e2e-tests git:(test-controller-api-client) βœ— yarn run playwright test -g "Login"
yarn run v1.22.15
$ /e2e-tests/node_modules/.bin/playwright test -g Login
Please install @playwright/test package to use Playwright Test.
  npm install -D @playwright/test
error Command failed with exit code 1.
npx: installed 1 in 0.988s

## System:
 - OS: macOS 11.6
 - Memory: 27.58 MB / 16.00 GB
## Binaries:
 - Node: 12.18.2 - ~/.nvm/versions/node/v12.18.2/bin/node
 - Yarn: 1.22.15 - /usr/local/bin/yarn
 - npm: 6.14.5 - ~/.nvm/versions/node/v12.18.2/bin/npm
## Languages:
 - Bash: 3.2.57 - /bin/bash

Code Snippet Test code not needed - framework does not start at all, so i am just leaving commands to recreate issue.

yarn install @playwright/test --save
yarn run playwright test

Describe the bug

In latest version 1.16 it is impossible to start framework using Yarn as it does not detect being installed after successful installation.

Evilweed avatar Oct 27 '21 14:10 Evilweed

Do you maybe have an old version of playwright installed? You don't need playwright when using @playwright/test.

The following worked for me:

yarn init -y
yarn add @playwright/test
# create some test file
npx playwright test

mxschmitt avatar Oct 27 '21 14:10 mxschmitt

@mxschmitt I have upgraded currently installed v15 using yarn upgrade @playwright/test --latest

I've also tried yarn remove @playwright/test and then yarn add @playwright/test --save - still does not work.

In your example, you are using npx playwright test - we are using yarn to install packages, and we are using yarn run .... That being said npx playwright test throws the same error.

{
  "name": "e2e-tests",
  "version": "1.0.0",
  "main": "index.js",
  "license": "CLOSED SOURCE",
  "private": true,
  "scripts": {
    "test:all": "yarn run playwright test --headed"
  },
  "dependencies": {
    "@playwright/test": "^1.16.1",
    "axios": "^0.24.0",
    "chalk": "^4.1.2",
    "nyc": "^15.1.0"
  },
  "devDependencies": {
    "prettier": "^2.4.1"
  }
}

Evilweed avatar Oct 27 '21 15:10 Evilweed

Can you verify if there is a node_modules/playwright/package.json? (and if so, which version this is?)

Or create a small repro in form of a small GitHub repository?

mxschmitt avatar Oct 27 '21 16:10 mxschmitt

I am facing the same issue: getting following message : Please install @playwright/test package to use Playwright Test. What else I need to try now ?

image

OS: Windows 10 Home Node version: v12.18.4 Playwright version : ^1.16.1

Please find my Package.json

{
  "name": "test",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "test": "npx playwright test/test.js"
  },
  "devDependencies": {
    "@playwright/test": "^1.16.1"
  }
}

Test is my root folder and I have installed Playwright at this location. Now I have nested into below folder path, not sure if that is of any help ?

image

scrumvisualize avatar Oct 28 '21 04:10 scrumvisualize

Do you have a C://Test//node_modules//playwright folder? If so, which version is there? C://Test//node_modules//playwright//package.json?

Could you provide full reproducible steps? I tried the following which worked for me:

yarn init -y
yarn add @playwright/test
# create some test file
npx playwright test
# or
yarn run playwright test

mxschmitt avatar Oct 28 '21 10:10 mxschmitt

@mxschmitt Thank you, I have provided all my version details in my details above, I will mention again below...

OS: Windows 10 Home
Node version: v12.18.4
Playwright version : ^1.16.1

Please find my Package.json

{
  "name": "test",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "test": "npx playwright test/test.js"
  },
  "devDependencies": {
    "@playwright/test": "^1.16.1"
  }
}

scrumvisualize avatar Nov 01 '21 05:11 scrumvisualize

npm install --global yarn
mkdir test
cd test
yarn init -y
yarn add @playwright/test
// add some test file
yarn run playwright test

I tried the following which works for me on Windows, please try to delete your Β΄node_modulesΒ΄ folder and install your dependencies again. Also make sure that you don't have an old playwright or playwright-core dependency somewhere.

mxschmitt avatar Nov 01 '21 12:11 mxschmitt

Closing since it seems stale and solved. If you still encounter issues, please create a new issue with a full repro (Docker preferred to have it isolated).

mxschmitt avatar Nov 05 '21 11:11 mxschmitt