我在 Gitlab 上运行 Microsoft Playwright 时遇到问题。 当我开始测试时,在拉取图像后出现shell not found错误。
YML 文件
stages:
- test
tests:
rules:
- when: manual
stage: test
image: mcr.microsoft.com/playwright:v1.41.1-jammy
script:
- npm ci
- npx playwright test
artifacts:
paths:
- playwright-report
- test-results
- results.xml/
when: always
expire_in: 120 days
reports:
junit: results.xml
下面突出显示的错误
有人可以让我知道我做错了什么吗?
谢谢
您的问题可能有两种解决方法。
config.toml
文件:config.toml
...
executor = "docker"
shell = "bash" ## <- add this line
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.docker]
tls_verify = false
image = "ruby:2.7"
privileged = true ## <- and this to true
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
/bin/sh
或 /bin/bash
入口点将管道中的图像关键字更改为此:stages: - test tests: ... stage: test image: name: mcr.microsoft.com/playwright:v1.41.1-jammy entrypoint: [ '/bin/sh', '-c' ] # or entrypoint: [ '/bin/bash', '-c' ] script: - npm ci - npx playwright test ...
我通过使用 tsconfig 路径映射弄清楚了。 在我的根目录中添加了 tsconfig.json 文件,然后使用下面的映射
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@pages/*": ["pages/*"]
}
}
}
感谢@EnergY您对原始问题的建议 我希望这可以帮助别人