I want to test a website using pytest selenium on gitlab CI what should I write in .gitlab-ci.yml file order to run the test on firefox?

.gitlab-ci.yml:

Test:
  image: python:3.7
  stage: Test
  services:
    - name: "selenium/standalone-firefox"
    - alias: selenium
  variables:
      selenium_remote_url: "http://selenium__standalone-firefox:4444/wd/hub/"
  script:
    - echo "testing"
    - docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-firefox:3.141.59-neon
    - pip install selenium
    - pip install pytest
    - wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
    - tar -xvzf geckodriver-v0.24.0-linux64.tar.gz
    - chmod +x geckodriver
    - pytest sample.py

sample.py file :

from selenium import webdriver
import pytest
import re
def test_setup():

    driver = webdriver.Firefox(executable_path="./geckodriver")

what should I change?

0 Answers