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

I created a job Maven Project in Jenkins for the purpose to Compile and execute all my automatic tests, but when i build the job i got this error :

enter image description here

i got the same message error for all the scenarios

should i create a pipeline in place of project maven ?

i recupare my project with the link ssh GitLab and im working behind a proxy

Thnaks(y)

Answer

Here is a docker-compose file that will open 7 instances of FF and 1 instance on chrome. I use it with azure pipeline but you can integrate it with jenkins. You’ll will have to add a jenkins task that runs docker-compose

To try on command line , just install docker desktop ( i use it with mac) and run below command

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

For using docker-compose with azure pipeline , I am using the below. Make sure you have dockerRegistryEndpoint setup (in below ex: Dockerhub) . I use this to run my cucumber tests and integrate third party cucumber report (PublishCucumberReport@1)in pipeline

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/

For documentation , refer – https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/docker-compose?view=azure-devops