【问题标题】:Playwright failed in the Gitlab pipeline with browserType.launch: Host system is missing dependenciesPlaywright 在 Gitlab 管道中使用 browserType.launch 失败:主机系统缺少依赖项
【发布时间】:2022-02-01 18:03:09
【问题描述】:

我知道我的问题与one 类似,但希望有人可以帮助我在 Gitlab 管道中执行 Playwright 测试。

我的 .gitlab-ci.yaml 包含下一行:

image: node:16.13.0
...
test e2e:
  stage: test
  script:
    - npx playwright install
    - npm run test-e2e

我能以某种方式设置一个正确的 docker 映像或操作系统,is supported..?

【问题讨论】:

  • 不确定,但在大多数情况下,您将在项目的根级别声明一个 package.json 文件,并在那里声明所有依赖项。所以你不会运行 npm install playwright,而是运行 npm install
  • 来自官方文档 (playwright.dev/docs/intro):npm i -D @playwright/test # install supported browsers npx playwright install。只有@playwright/test 会被添加到package.json 并与npm i 一起安装。

标签: gitlab pipeline playwright cicd


【解决方案1】:

在官方文档https://playwright.dev/docs/ci#gitlab-ci中有描述

您可以像我一样为每个作业设置图像:

test e2e:
  stage: test
  **image: mcr.microsoft.com/playwright:v1.16.3-focal**
  script:
   - npx playwright install
   - npm run test-e2e

【讨论】:

  • 我使用的 mcr.microsoft.com/playwright:bionic 图像对我有用,但这给了我这个想法,谢谢!
猜你喜欢
  • 2021-05-28
  • 2021-04-24
  • 1970-01-01
  • 2021-11-23
  • 2021-12-08
  • 2018-10-12
  • 2012-08-18
  • 2017-07-19
  • 1970-01-01
相关资源
最近更新 更多