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

[BUG] nix and playwright: install-deps is missing required dependencies #16432

Closed
vai0 opened this issue Aug 11, 2022 · 8 comments
Closed

[BUG] nix and playwright: install-deps is missing required dependencies #16432

vai0 opened this issue Aug 11, 2022 · 8 comments

Comments

@vai0
Copy link

vai0 commented Aug 11, 2022

Context:

  • Playwright Version: 1.25.0
  • Operating System: Linux (Debian 11)
  • Node.js version: v16.1.0
  • Browser: Chromium
  • Extra:
➜ hostnamectl                                                                                                                                                                           
   Static hostname: work-machine
   Pretty hostname: work machine
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: c3a17238f0f0b7f7c73994f3616edc3e
           Boot ID: 87ed44a27c324165a0e5d31e49261133
  Operating System: Debian GNU/Linux 11 (bullseye)
            Kernel: Linux 5.12.0-rc7+
      Architecture: x86-64
➜ npx envinfo --preset playwright --markdown
## System:
 - OS: Linux 5.12 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
 - Memory: 10.78 GB / 46.80 GB
 - Container: Yes
## Binaries:
 - Node: 16.1.0 - /nix/store/2mnn77jly8q0mqaayca5mjfv23f3pks4-bifrost-env/bin/node
 - npm: 7.11.2 - /nix/store/2mnn77jly8q0mqaayca5mjfv23f3pks4-bifrost-env/bin/npm
## Languages:
 - Bash: 5.1.8 - /nix/store/lz9s7v9xxkr3jf4wlah9vw1knmic2nda-bash-interactive-5.1-p8/bin/bash

Describe the bug

Tests are failing with the following error

  140) [Desktop Chrome] › playwright/tests/forms_cms_standard.spec.ts:24:9 › lp-standard cms-generated pages › [140/140] fills and submits form on /resources/workshop-gcp-workshop-2022/

    browserType.launch: 
    ╔══════════════════════════════════════════════════════╗
    ║ Host system is missing dependencies to run browsers. ║
    ║ Missing libraries:                                   ║
    ║     libgobject-2.0.so.0                              ║
    ║     libglib-2.0.so.0                                 ║
    ║     libnss3.so                                       ║
    ║     libnssutil3.so                                   ║
    ║     libsmime3.so                                     ║
    ║     libnspr4.so                                      ║
    ║     libatk-1.0.so.0                                  ║
    ║     libatk-bridge-2.0.so.0                           ║
    ║     libcups.so.2                                     ║
    ║     libgio-2.0.so.0                                  ║
    ║     libdrm.so.2                                      ║
    ║     libdbus-1.so.3                                   ║
    ║     libexpat.so.1                                    ║
    ║     libxcb.so.1                                      ║
    ║     libxkbcommon.so.0                                ║
    ║     libX11.so.6                                      ║
    ║     libXcomposite.so.1                               ║
    ║     libXdamage.so.1                                  ║
    ║     libXext.so.6                                     ║
    ║     libXfixes.so.3                                   ║
    ║     libXrandr.so.2                                   ║
    ║     libgbm.so.1                                      ║
    ║     libpango-1.0.so.0                                ║
    ║     libcairo.so.2                                    ║
    ║     libasound.so.2                                   ║
    ║     libatspi.so.0                                    ║
    ║     libwayland-client.so.0                           ║
    ╚══════════════════════════════════════════════════════╝

yet when running npx playwright install-deps, it's telling me everything's up-to-date and installed

➜ npx playwright install-deps                                                                                                                                                          
Installing dependencies...
Switching to root user to install dependencies...
Hit:1 http://deb.debian.org/debian bullseye InRelease
Hit:2 http://deb.debian.org/debian-security bullseye-security InRelease                                                                                                                                           
Hit:5 https://packages.microsoft.com/repos/vscode stable InRelease                                                                                                                                                
Hit:6 https://deb.beekeeperstudio.io stable InRelease                                                                                                                                                             
Hit:7 http://dl.google.com/linux/chrome/deb stable InRelease                                                                                                                                                      
Hit:8 https://download.docker.com/linux/debian buster InRelease                                                                                                                                                   
Hit:4 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease                                                                                                                                     
Hit:9 http://fai-project.org/download bullseye InRelease                                                                                                                                     
Hit:10 http://deb.debian.org/debian bullseye-backports InRelease                                                               
Hit:11 http://repository.spotify.com stable InRelease               
Hit:3 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libasound2 is already the newest version (1.2.4-1.1).
libatk-bridge2.0-0 is already the newest version (2.38.0-1).
libatspi2.0-0 is already the newest version (2.38.0-4).
libatk1.0-0 is already the newest version (2.36.0-2).
libcairo-gobject2 is already the newest version (1.16.0-5).
libcairo2 is already the newest version (1.16.0-5).
libcups2 is already the newest version (2.3.3op2-3+deb11u2).
libdbus-1-3 is already the newest version (1.12.20-2).
libdbus-glib-1-2 is already the newest version (0.110-6).
libenchant-2-2 is already the newest version (2.2.15-1).
libfontconfig1 is already the newest version (2.13.1-4.2).
fonts-freefont-ttf is already the newest version (20120503-10).
fonts-ipafont-gothic is already the newest version (00303-21).
fonts-liberation is already the newest version (1:1.07.4-11).
fonts-noto-color-emoji is already the newest version (0~20200916-1).
fonts-tlwg-loma-otf is already the newest version (1:0.7.2-1).
fonts-wqy-zenhei is already the newest version (0.9.45-8).
libfreetype6 is already the newest version (2.10.4+dfsg-1+deb11u1).
libatomic1 is already the newest version (10.2.1-6).
libgdk-pixbuf-2.0-0 is already the newest version (2.42.2+dfsg-1).
libglib2.0-0 is already the newest version (2.66.8-1).
gstreamer1.0-libav is already the newest version (1.18.4-3).
gstreamer1.0-plugins-bad is already the newest version (1.18.4-3).
gstreamer1.0-plugins-base is already the newest version (1.18.4-2).
libgstreamer-gl1.0-0 is already the newest version (1.18.4-2).
libgstreamer-plugins-base1.0-0 is already the newest version (1.18.4-2).
libgstreamer1.0-0 is already the newest version (1.18.4-2.1).
libgtk-3-0 is already the newest version (3.24.24-4+deb11u2).
libharfbuzz-icu0 is already the newest version (2.7.4-1).
libharfbuzz0b is already the newest version (2.7.4-1).
libhyphen0 is already the newest version (2.8.8-7).
libicu67 is already the newest version (67.1-7).
liblcms2-2 is already the newest version (2.12~rc1-2).
libdrm2 is already the newest version (2.4.104-1).
libepoxy0 is already the newest version (1.5.5-1).
libevdev2 is already the newest version (1.11.0+dfsg-1).
libegl1 is already the newest version (1.3.2-1).
libgles2 is already the newest version (1.3.2-1).
libglx0 is already the newest version (1.3.2-1).
libopengl0 is already the newest version (1.3.2-1).
libgudev-1.0-0 is already the newest version (234-1).
libjpeg62-turbo is already the newest version (1:2.0.6-4).
libmanette-0.2-0 is already the newest version (0.2.5-1).
libnotify4 is already the newest version (0.7.9-3).
libpng16-16 is already the newest version (1.6.37-3).
libproxy1v5 is already the newest version (0.4.17-1).
libsecret-1-0 is already the newest version (0.20.4-2).
libsoup2.4-1 is already the newest version (2.72.0-2).
libwebp6 is already the newest version (0.6.1-2.1).
libwebpdemux2 is already the newest version (0.6.1-2.1).
libx11-6 is already the newest version (2:1.7.2-1).
libx11-xcb1 is already the newest version (2:1.7.2-1).
libxcb-shm0 is already the newest version (1.14-3).
libxcb1 is already the newest version (1.14-3).
libxcomposite1 is already the newest version (1:0.4.5-1).
libxcursor1 is already the newest version (1:1.2.0-2).
libxdamage1 is already the newest version (1:1.1.5-2).
libxext6 is already the newest version (2:1.3.3-1.1).
libxfixes3 is already the newest version (1:5.0.3-2).
libxi6 is already the newest version (2:1.7.10-1).
libxkbcommon0 is already the newest version (1.0.3-2).
libxml2 is already the newest version (2.9.10+dfsg-6.7+deb11u2).
libxrandr2 is already the newest version (2:1.5.1-1).
libxrender1 is already the newest version (1:0.9.10-1).
libxslt1.1 is already the newest version (1.1.34-4).
libxtst6 is already the newest version (2:1.2.3-1).
libgbm1 is already the newest version (20.3.5-1).
libnspr4 is already the newest version (2:4.29-1).
libnss3 is already the newest version (2:3.61-1+deb11u2).
libopenjp2-7 is already the newest version (2.4.0-3).
libopus0 is already the newest version (1.3.1-0.1).
libpango-1.0-0 is already the newest version (1.46.2-3).
libpangocairo-1.0-0 is already the newest version (1.46.2-3).
fonts-unifont is already the newest version (1:13.0.06-1).
libwayland-client0 is already the newest version (1.18.0-2~exp1.1).
libwayland-egl1 is already the newest version (1.18.0-2~exp1.1).
libwayland-server0 is already the newest version (1.18.0-2~exp1.1).
libwoff1 is already the newest version (1.0.2-1+b1).
xfonts-cyrillic is already the newest version (1:1.0.5).
xfonts-scalable is already the newest version (1:1.0.3-1.2).
gstreamer1.0-plugins-good is already the newest version (1.18.4-2+deb11u1).
xvfb is already the newest version (2:1.20.11-1+deb11u2).
0 upgraded, 0 newly installed, 0 to remove and 18 not upgraded.

Here's my playwright.config.ts

import { devices, PlaywrightTestConfig } from "@playwright/test";

const config: PlaywrightTestConfig = {
    forbidOnly: Boolean(process.env.CI),
    reporter: "list",
    fullyParallel: true,
    workers: 4,
    maxFailures: process.env.CI ? 10 : undefined,
    use: {
        trace: "on-first-retry",
        viewport: { width: 1440, height: 720 },
    },
    outputDir: "./playwright-test-results",
    projects: [
        {
            name: "Desktop Chrome",
            use: {
                ...devices["Desktop Chrome"],
                browserName: "chromium",
            },
        },
    ],
};

export default config;

Ideally install-deps should be installing those missing deps, and I don't need to manually sudo apt install every single one.

@rwoll rwoll added the triaging label Aug 11, 2022
@rwoll
Copy link
Member

rwoll commented Aug 11, 2022

I tried reproducing, but was unable to at this time:

$ npx playwright install-deps
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
root@19087155230c:/# npx playwright screenshot https://example.com example.png
Navigating to https://example.com
Capturing screenshot into example.png

What directory are you running npx playwright install-deps in? How about npx playwright test? Do you have a package.json/package-lock.json and which directory is it in?

@vai0
Copy link
Author

vai0 commented Aug 11, 2022

i do have a package.json and package-lock.json.

file struct looks something like this

frontend/
    package.json
    package-lock.json
    playwright.config.ts
    tsconfig.json
    playwright/
        tests/
            forms_cms_standard.spec.ts
        utils.ts
    src/
        [repo code]
    ...

running npx playwright install-deps in the frontend dir

@rwoll
Copy link
Member

rwoll commented Aug 11, 2022

🤔 Can you paste the parts of your package.json and package-lock.jons that reference Playwright here?

And also include the output of:

$ npx playwright --version

as well as:

$ npm ls @playwright/test

and

$ npm ls playwright

Thanks!

@vai0
Copy link
Author

vai0 commented Aug 11, 2022

oops my apologies, i'm still on 1.24.0.

// package.json
...
"devDependencies": {
    ...
    "@playwright/test": "1.24.0",
    ...
}
...
// package-lock.json
    ...
    "dependencies": {
        ...
        "@playwright/test": {
            "version": "1.24.0",
            "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.24.0.tgz",
            "integrity": "sha512-sZLH2N6aWN9TtG+vMjNSomSfX0dSVHwWE+GhHQPV+ZeGcuZ/6CgMCGFuGjobgq/hNF9ZkuVOjeyoceZ0owKnHQ==",
            "dev": true,
            "requires": {
                "@types/node": "*",
                "playwright-core": "1.24.0"
            },
            "dependencies": {
                "playwright-core": {
                    "version": "1.24.0",
                    "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.24.0.tgz",
                    "integrity": "sha512-BkDWdVsoEEC8m2glQlfNu1EN2qvjBsLIg5bD0wjrfwv9zVHktIsp80yYFObAcWreLNYhfRP4PlXE04lr5R4DFQ==",
                    "dev": true
                }
            }
        },
        ...
    }
    ...

one thing that i noticed is that the tests succeed if I don't run them in nix-shell. I assume the deps are being installed on my machine, but maybe they also need to be avail in nix?

@rwoll

This comment was marked as outdated.

@rwoll
Copy link
Member

rwoll commented Aug 11, 2022

Hid my last comment, as it's no longer relevant.

one thing that i noticed is that the tests don't fail with missing deps if I don't run them in nix-shell. I assume the deps are being installed on my machine, but maybe they also need to be avail in nix?

I'm not a nix user, but it sounds like some interaction with nix and Playwright is not happy. For now, I recommend running outside of nix-shell since that works 😄 .

If you sort out the nix issue, please file a new issue and we can address, otherwise we'll have to continue recommending running outside nix since I don't have the expertise to troubleshoot nix.

Thanks!

@rwoll rwoll closed this as completed Aug 11, 2022
@vai0
Copy link
Author

vai0 commented Aug 11, 2022

yep it seems like i'm running into an issue similar to this: #5501

@rwoll
Copy link
Member

rwoll commented Aug 11, 2022

👍 Yeah, I'm not a nix user, but looks like the info in #5806 will help (either the code or some community user comments in that PR).

If you're open to it, feel free to contribute a PR doc page of how to use PW and nix!

@rwoll rwoll changed the title [BUG] install-deps is missing required dependencies [BUG] nix and playwright: install-deps is missing required dependencies Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants