'Trigger Selenium Automation scripts with gitlab CI/CD

I am trying to trigger python-selenium automation script with gitlab CI/CD pipeline for my project. I have written a simple login automation script to test whether a user is able to login successfully with test credentials. Web driver I downloaded and kept in folder structure and given the path in the script explicitly. Drivers Path - /root/<project_name>/drivers

File .gitlab-ci.yml, for CI/CD automatic tests:

stages:
  - test

image: python:3.6.8

before_script:
  - python3 -V
  - pip3 install virtualenv
  - virtualenv venv
  - source venv/bin/activate
  - pip3 install -r requirements.txt
  - pip3 install selenium
  - pip install pytest
  - pip install requests
   
test:
  image: python
  stage: test
  services:
   - selenium/standalone-firefox:latest
  script:
   - pip install selenium pytest
   - python -m pytest /root/qcf_automation_testing/src/tests/authentication/test_qcf_login.py
  tags:
   - automation


###ymlfile...

On my laptop, the pytest command works fine 100% of time. But with the pipeline it is getting error How exactly can we trigger our automation test script from pipeline.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source