你好,
我想在 Jenkins 机器上使用 Firefox 运行我的 PW 测试。虽然在 Chrome 上运行时一切正常,但在 FF 上运行时出现错误。
Env:Jenkins:在 Linux 从属设备上运行测试 Playwright:1.30.0 Docker 文件:mcr.microsoft.com/playwright:v1.30.0-focal
詹金斯管道片段:
stages {
stage("Setup") {
steps {
script {
env.DOCKER_PLAYWRIGHT_NAME = "${env.BRANCH_NAME}".replaceAll('/', '-')
sh "(docker stop ${env.DOCKER_PLAYWRIGHT_NAME} && docker rm ${env.DOCKER_PLAYWRIGHT_NAME}) || true"
sh "docker run -d --name ${env.DOCKER_PLAYWRIGHT_NAME} -it --rm --ipc=host ${env.DOCKER_PLAYWRIGHT_IMAGE} /bin/bash"
sh "docker logs -f ${env.DOCKER_PLAYWRIGHT_NAME} &> docker.log &"
sh "docker exec -d -i ${env.DOCKER_PLAYWRIGHT_NAME} npm i playwright-firefox"
sh "docker exec -d -i ${env.DOCKER_PLAYWRIGHT_NAME} npx playwright install firefox"
sh "npm install"
sh 'npx playwright install'
}
}
}
stage('UI tests') {
steps {
catchError(buildResult: "UNSTABLE", stageResult: "FAILURE") {
sh "npm run firefox" // behind is npx playwright test --config=playwright.config.ts --project=Firefox
}
}
}
我得到的错误是:
browserType.launch: Browser.enable): Browser closed.
==================== Browser output: ====================
<launching> /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-kMNCB9 -juggler-pipe -silent
<launched> pid=21608
[pid=21608][err] /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox)
[pid=21608][err] /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox)
[pid=21608] <process did exit: exitCode=1, signal=null>
[pid=21608] starting temporary directories cleanup
=========================== logs ===========================
<launching> /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-kMNCB9 -juggler-pipe -silent
<launched> pid=21608
[pid=21608][err] /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox)
[pid=21608][err] /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox)
[pid=21608] <process did exit: exitCode=1, signal=null>
[pid=21608] starting temporary directories cleanup
============================================================
它说/usr/data/jenkins-home/.cache/ms-playwright/firefox-1372/firefox/firefox: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found所以这就是为什么我使用命令再次强制将其安装到此 docker 容器内
sh "docker exec -d -i ${env.DOCKER_PLAYWRIGHT_NAME} npm i playwright-firefox"
sh "docker exec -d -i ${env.DOCKER_PLAYWRIGHT_NAME} npx playwright install firefox"
但这没有效果。
你能帮忙吗?