cparrish817
cparrish817

Reputation: 371

Configure Angular to use playwright

I'm going to preface this by saying I don't know puppeteer well but as it seems like playwright was created to be its successor so I thought I'd just skip directly to using it.

Using this guide I've attempted to configure Karma and Protractor just as I would puppeteer only substituting playwright wherever I was told to put puppeteer instead.

This line

process.env.CHROME_BIN = require('playwright').executablePath();

Doesn't work however as playwright doesn't have an exectablePath() function itself

Instead I tried

process.env.CHROME_BIN = require('playwright').chromium.executablePath()

Which seemed like it would do what I wanted. however I'm still getting the following error message. when trying to run ng test --watch=false

 40% building 84/84 modules 0 active15 02 2020 20:41:52.310:INFO [launcher]: Trying to start ChromeHeadless again (2/2).
15 02 2020 20:41:52.360:ERROR [launcher]: Cannot start ChromeHeadless
        /workspace/vr2k2/node_modules/playwright-core/.local-chromium/linux-740847/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory

15 02 2020 20:41:52.360:ERROR [launcher]: ChromeHeadless stdout: 
15 02 2020 20:41:52.361:ERROR [launcher]: ChromeHeadless stderr: /workspace/vr2k2/node_modules/playwright-core/.local-chromium/linux-740847/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory

15 02 2020 20:41:52.436:ERROR [launcher]: ChromeHeadless failed 2 times (cannot start). Giving up.

Anyone have a better resource on how to setup Angular with playwright?

Upvotes: 4

Views: 2707

Answers (1)

arjunattam
arjunattam

Reputation: 2819

The error string shows that Chromium is unable to find a shared library (libx11). This typically implies that your system is missing system dependencies. If you are on Ubuntu, you can use this list of system dependencies for the 3 bundled browsers.

Upvotes: 2

Related Questions