TestProject Forum
Powered by leading experts in the test automation community

Integration of Test Project with Gitlab CI

Hi,

Is anyone know about how we can integrate Test Project with Gitlab CI? What configurations we need to mention in .gitlab-ci.yml file and how we can install agent? Also we don’t have an image of testproject/agent:latest in our shared runners list of Gitlab. Below is the .gitlab-ci.yml file :-

image:
name: selenium/standalone-chrome:latest

stages:

  • test

variables:
MAVEN_OPTS: “-Dmaven.repo.local=.m2/repository”

cache:
paths:
- .m2/repository/
- target/

test:
stage: test
before_script:
- cat /etc/*-release
- java -version
- sudo http_proxy=http://194.145.60.1:9400 apt-get update
- sudo http_proxy=http://194.145.60.1:9400 apt-get install maven -qq --yes
- sudo http_proxy=http://194.145.60.1:9400 apt-get install default-jdk -qq --yes
- pwd
- echo $JAVA_HOME
script:

  • echo “$CODE_PROXY”
  • export http_proxy="$CODE_PROXY"
  • export https_proxy="$CODE_PROXY"
  • export
  • export HTTP_PROXY="$http_proxy"
  • export HTTPS_PROXY="$http_proxy"
  • export NO_PROXY="$no_proxy"
  • cd “Automation Framework/SeleniumAutomation”
  • sudo cp ./settings.xml /usr/share/maven/conf/
  • mvn install compile -Djava.awt.headless=true
  • curl -Is http://132.186.106.12:8200 | head -1
  • curl -vs http://132.186.106.12:8200 2>&1
  • Xvfb :89 -ac -noreset
  • export DISPLAY=:89
  • whereis xvfb-run
  • mvn test
  • ls

artifacts:
when: always
paths:
- Automation Framework/SeleniumAutomation/Reports
- Automation Framework/SeleniumAutomation/Screenshots
expire_in: 1 day

Hi, this article might be helpful for you :slight_smile: