Selenium Hub Gitlab CI/CD

418 views
Skip to first unread message

Robin Sebastian Matz

unread,
Feb 21, 2021, 11:58:09 PM2/21/21
to Selenium Users
Hi,

I am having some issues running selenium tests on multiple browsers in Gitlab-CI, you can find the project here:
https://gitlab.com/robinmatz/selenium-server-tests/-/tree/create-ci

My .gitlab-ci.yml looks like this:

variables:
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true -DHUB_URL=http://hub:4444/wd/hub"

image: maven:3.6.3-jdk-11-slim

cache:
paths:
- .m2/repository

Run Tests:
stage: test
script:
- 'mvn $MAVEN_CLI_OPTS test'
artifacts:
when: always
paths:
- target/surefire-reports/**
services:
- name: selenium/hub:latest
alias: hub
- name: selenium/node-chrome-debug:latest
- name: selenium/node-firefox-debug:latest
variables:
HUB_HOST: hub


What I am running is cucumber tests via src/test/java/runner/TestRunner.java class. The testng.xml (src/test/resources/testng.xml) file contains one test suite with two tests. Each tests has a different value for the 'browser' variable, one is chrome, the other is firefox.

In src/test/stepdefinitions/Hooks.java, a different RemoteWebDriver instance is started according to the value for the 'browser' variable. Locally, this setup works

However, when running with Gitlab Runner with the above .gitlab-ci.yml, I keep getting the following error in my pipeline (e.g. https://gitlab.com/robinmatz/selenium-server-tests/-/jobs/1044801375 lines 896, 897)

896 09:37:20.908 [main] INFO stepdefinitions.Hook - Running Selenium Grid Server on HUB_URL: http://hub:4444/wd/hub
897 org.openqa.selenium.WebDriverException: Error forwarding the new session Empty pool of VM for setup Capabilities {browserName: chrome, goog:chromeOptions: {args: [--launch-maximized, --lang=en-US], extensions: []}}

I think, it might be due to the nodes not connecting to the hub. I am not quite sure where changes need to be made. 

I would be thankful for any suggestions.

Best regards,
Robin
Reply all
Reply to author
Forward
0 new messages