When i run the build in Jenkins i got this Error : Cannot find firefox binary in PATH. Make sure firefox is installed

When i run the build in Jenkins i got this Error : Cannot find firefox binary in PATH. Make sure firefox is installed

我在 Jenkins 中创建了一个工作 Maven 项目,目的是编译和执行我所有的自动测试,但是当我构建这个工作时我得到了这个错误:

我在所有情况下都收到相同的消息错误

我应该创建一个管道来代替项目 Maven 吗?

我用 link ssh GitLab 恢复了我的项目,我在代理服务器后面工作

Thnaks(y)

这是一个 docker-compose 文件,它将打开 FF 的 7 个实例和 chrome 上的 1 个实例。我将它与 azure pipeline 一起使用,但你可以将它与 jenkins 集成。您将不得不添加一个 运行s docker-compose

的 jenkins 任务

要尝试命令行,只需安装 docker 桌面(我将其与 mac 一起使用)和 运行 命令下方

docker-compose -f /path/of/file up

version: "3"
services:
  selenium-hub:
    image: selenium/hub:3.141.59-20210607
    container_name: selenium-hub
    ports:
      - "65299:4444"

  chrome:
    image: selenium/node-chrome:3.141.59-20210607
    depends_on:
      - selenium-hub
    environment:
      - HUB_HOST=selenium-hub
      - HUB_PORT=4444


  firefox:
    image: selenium/node-firefox:3.141.59-20210607
    depends_on:
      - selenium-hub
    environment:
      - HUB_HOST=selenium-hub
      - HUB_PORT=4444
    deploy:
      mode: replicated
      replicas: 7

为了将 docker-compose 与 azure pipeline 一起使用,我正在使用以下内容。 确保你有 dockerRegistryEndpoint 设置(在下面的示例中:Dockerhub)。我用它来 运行 我的黄瓜测试并在管道

中集成第三方黄瓜报告 (PublishCucumberReport@1)
trigger:
- master
resources:
- repo: self
variables:
  tag: '$(Build.BuildId)'
stages:
- stage: Build
  displayName: Build and Push image
  jobs:
   - job: Build
     displayName: Build and Push
     pool:
        vmImage: 'ubuntu-latest'
     steps:
     - task: DockerCompose@0
       displayName: open browser instances
       inputs:
         containerregistrytype: 'Container Registry'
         dockerRegistryEndpoint: Dockerhub
         dockerComposeFile: '**/docker-compose.yml'
         action: 'Run a Docker Compose command'
         dockerComposeCommand: 'up -d'
         detached: true

     - task: Maven@3
       inputs:
         mavenPomFile: 'pom.xml'
         mavenOptions: '-Xmx3072m'
         jdkArchitectureOption: 'x64'
         publishJUnitResults: true
         testResultsFiles: '**/target/cucumber.html'
         goals: 'clean verify -P acceptanceTests -e -X'
         
     - task: PublishPipelineArtifact@1
       displayName: Publish cucumber report
       inputs:
         pathToPublish: $(System.DefaultWorkingDirectory)/s/target/cucumber-report/
         artifactName: 'cucumber.html'

     - task: PublishCucumberReport@1
       inputs:
         jsonDir: ./target/cucumber-report/
         outputPath: ./target/

有关文档,请参阅 - https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/docker-compose?view=azure-devops