0

I am trying to do some tests using GitLab CI/CD and Robot Framework, I have this simple .robot file:

*** Settings ***
# Declare Libraries
Library  SeleniumLibrary

# Declare Suite Setup and Teardown
Suite Setup Open Browser    ${site_to_open}  ${browser_to_use}
Suite Teardown  Close Browser

*** Variables ***
${site_to_open}  https://example.com/
${browser_to_use}   chrome

*** Test Cases ***

Open webpage and check for text
    Page Should Contain  Check for existence of this text!!!
    Log  OK

In my .gitlab-ci.yml I have this

stages:
  - deploy
  - tests1

pages:
  stage: deploy
  script:
  - mkdir .public
  - cp test_website/index.html .public
  - mv .public public
  artifacts:
    paths:
    - public
  only:
  - master

tests1:
  stage: tests1
  services:
    - selenium/standalone-chrome
  script:
  - python3 -V
  - apt-get update
  - apt-get install -y python3-pip
  - pip3 -V
  - pip3 install robotframework
  - pip3 install robotframework-seleniumlibrary
  - apt-get install -y chromium-chromedriver
  - export PATH=$PATH:$HOME/bin
  - robot --output NONE --report NONE --log NONE cases/Test/test.robot
  only:
  - master

However when I try to run the pipeline it gives me this error:

$ apt-get install -y chromium-chromedriver
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package chromium-chromedriver
Cleaning up file based variables
ERROR: Job failed: exit code 1

Whatever I am doing, I am failing to sucessfully instal the chromium-webdriver to run the Robot Framework test as in headless Chrome.

Could you suggest how to edit the files to make it work?

1

Solved by this yaml:

stages:
  - deploy
  - tests1

pages:
  stage: deploy
  script:
  - mkdir .public
  - cp test_website/index.html .public
  - mv .public public
  artifacts:
    paths:
    - public
  only:
  - master

tests1:
  stage: tests1
  script:
  # Update apt-get and install pip
  - apt-get update
  - apt-get install -y python3-pip
  # Install robot framework and the selenium library
  - pip3 install robotframework
  - pip3 install robotframework-seleniumlibrary
  # Install the chrome and chrome webdriver
  - apt-get install -y xvfb
  - apt-get install -y zip
  - apt-get install -y wget
  - apt-get install -y ca-certificates
  - apt-get install -y libnss3-dev libasound2 libxss1 libappindicator3-1 libindicator7 gconf-service libgconf-2-4 libpango1.0-0 xdg-utils fonts-liberation libgbm1
  - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 
  - dpkg -i google-chrome*.deb 
  - rm google-chrome*.deb
  - wget -N http://chromedriver.storage.googleapis.com/89.0.4389.23/chromedriver_linux64.zip
  - unzip chromedriver_linux64.zip
  - chmod +x chromedriver
  - cp chromedriver /usr/local/bin
  - rm chromedriver_linux64.zip
  - rm chromedriver
  # Run the test case
  - robot --output NONE --report NONE --log NONE cases/Test/test.robot
  only:
  - master

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.