配置Angular以使用剧作家

时间:2020-02-15 20:51:26

标签: angular protractor karma-jasmine puppeteer playwright

我将通过说我不太了解puppeteer来作为开头,但似乎playwright是其继任者,因此我想我将直接跳过使用它。

使用此guide,我试图配置Karma和Protractor,就像我puppeteer那样,只在我被告知放置playwright的地方替换了puppeteer

此行

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

但是不起作用,因为playwright本身没有exectablePath()函数

我尝试了

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

这似乎可以满足我的要求。但是我仍然收到以下错误消息。尝试运行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.

任何人都有更好的资源来了解如何使用playwright设置Angular吗?

1 个答案:

答案 0 :(得分:2)

错误字符串显示Chromium无法找到共享库(libx11)。这通常意味着您的系统缺少系统依赖性。如果您使用的是Ubuntu,则可以将this list of system dependencies用于3个捆绑的浏览器。