I’m in need of your help,
What I’m using
I’ve setup Gitlab CI to my Project which is using Angular JS, I’m trying to run test cases through Protractor ( E2E test ), which is internally using Selenium and Web Driver manager.
I’m using Debian machine.
What my intension
I want to use Gitlab CI, which should run my test cases and deploy my code on remote server.
If test cases are failed it shouldn’t deploy on my server.
What I’ve achieved
As I’m new to Gitlab CI, it took some time to setup
gitlab-ci.yaml file, after so many struggles with the help of @stefanvangastel, I’m able to deploy my code on the server through Gitlab CI.
To run test cases I’ve used xvfb to open browsers and able to run test cases through Gitlab CI
Facing issues if I start web driver manager as backend ( Using
$ webdriver-manger start & ), I’m not able to stop it, while I’m trying to run test cases again, it’s showing webdriver manager or Address already in use.
Not moving to next job, still in pending state.
- xvfb-run -a webdriver-manager update
- xvfb-run -a webdriver-manager start &
- xvfb-run -a protractor test/conf.js
- xvfb-run -a webdriver-manager shutdown
- curl -s -L http://localhost:4444/selenium-server/driver?cmd=shutDownSeleniumServer > /dev/null 2>&1
script: echo “Building the app”
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' # run ssh-agent - eval $(ssh-agent -s) # add ssh key stored in SSH_PRIVATE_KEY variable to the agent store - ssh-add <(echo "$SSH_PRIVATE_KEY") # disable host key checking (NOTE: makes you susceptible to man-in-the-middle attacks) # WARNING: use only in docker container, if you use it with shell you will overwrite your user's ssh config - mkdir -p ~/.ssh - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config # try to connect to GitLab - ssh -T firstname.lastname@example.org.*** - echo pwd - pwd # Change the directory to webstation directory - cd /var/www/html/tap # Create folder with the name as current branch, if it not exists - mkdir -p $BRANCH # Gave read and write permissions - chmod 755 $BRANCH # Change the directory to current branch - cd $BRANCH
script: # Clone a git repo if it does not exist, or pull into it if it does exist - > if [ ! -d .git ]; then git clone -b $BRANCH email@example.com:osmosys/tap-portal.git . else git pull origin $BRANCH ; fi; # To know the status and branch - git status - git branch # Setup basic installations - npm install - bower install # Running grunt prod by passing grunt option - grunt prod --production # command to run environment: name: dev url: http://10.0.0.**/tap/$BRANCH/src # deploy job will run only for branches that start with sprint- and master, whereas all branches will be skipped. only: - /^sprint-.*$/ - master`
Gitlab CI - terminal
- Could any please help me out.
- Give me any reference project, which could solve my problem.
- If possible provide me a good YAML file