title: Configure GitLab CI to run features tests with rspec / selenium / Firefox
body: <p>I am new to gitlab CI and I need help to configure gitlab-ci to run feature tests with Firefox (Ruby 2.7 / Rails 6 / Rspec / Capybara).</p>
  <p>All is ok except feature tests.
  I think I have to configure something with Firefox, or maybe install something.</p>
  <p>Thanks for your help !</p>
  <p>Error message when running tests :</p>
  <pre><code>Failure/Error: visit &quot;/meth/methodologies/#{@meth.id}/edit&quot;
       Selenium::WebDriver::Error::WebDriverError:
         Could not find Firefox binary (os=linux). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path=
  </code></pre>
  <p>File .gitlab-ci.yml</p>
  <pre><code>stages:
    - build
    - test
    - deploy
  
  image: ruby:2.7.1
  
  cache: &amp;global_cache
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - apt-cache/
      - vendor/ruby
      - node_modules
      - .yarn-cache
    policy: pull-push
  
  .base:
    cache:
      # inherit all global cache settings
      &lt;&lt;: *global_cache
    before_script:
      - gem install bundler --no-document
      - bundle install --jobs $(nproc) &quot;${FLAGS[@]}&quot; --path=vendor
  
  .base_db:
    # extends: .base
    services:
      - name: mysql:8.0.21
        command: ['--default-authentication-plugin=mysql_native_password']
      - name: selenium/standalone-firefox
        alias: selenium
    variables:
      MYSQL_ROOT_PASSWORD: xxxx
      DB_USERNAME: xxxx
      DB_PASSWORD: xxxx
      DB_HOST: mysql
      RAILS_ENV: test
      DISABLE_SPRING: 1
      BUNDLE_PATH: vendor/bundle
    cache:
      # inherit all global cache settings
      &lt;&lt;: *global_cache
    before_script:
      # install yarn &amp; dependencies
      - export APT_CACHE_DIR=`pwd`/apt-cache &amp;&amp; mkdir -pv $APT_CACHE_DIR
      - wget -q -O - https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
      - echo &quot;deb https://dl.yarnpkg.com/debian/ stable main&quot; &gt; /etc/apt/sources.list.d/yarn.list
      - apt-get update -qq &amp;&amp; apt-get -o dir::cache::archives=&quot;$APT_CACHE_DIR&quot; install -y yarn
      - yarn config set cache-folder .yarn-cache
      - yarn install
  
      - gem install bundler --no-document
      - bundle install --jobs $(nproc) &quot;${FLAGS[@]}&quot; --path=vendor/ruby
  
      # Setup test database
      - cp config/database.ci.yml config/database.yml
      - RAILS_ENV=test bundle exec rails db:create db:migrate
  
  rubocop:
    extends: .base
    stage: build
    # cache:
    #   policy: pull-push
    script:
      - bundle exec rubocop app --fail-level W
  
  rspec:
    extends: .base_db
    stage: test
    script:
      - bundle exec rspec -t ~type:feature
    artifacts:
      paths:
        - coverage/
  
  features:
    extends: .base_db
    stage: test
    script:
      - bundle exec rspec
    # services:
    #   - name: selenium/standalone-firefox
    #     alias: selenium
    # artifacts:
    #   paths:
    #     - coverage/
  
  pages:
    stage: deploy
    dependencies:
      - rspec
    script:
      - mv coverage/ public/
    artifacts:
      paths:
        - public
      expire_in: 30 days
    # only:
    #   - master
  </code></pre>
  <p>EDIT :</p>
  <p>I added the installation of firefox.
  Tests that use js still don't work. The error is now as follows :</p>
  <pre><code> Failure/Error: visit &quot;/meth/methodologies/#{@meth.id}/edit&quot;
       Selenium::WebDriver::Error::UnknownError:
         Process unexpectedly closed with status 1
  </code></pre>