I am trying to run cucumber maven tests on gitlab ci using selenium grid, from the output I have observed that containers for grid setup are up and running.
But I am not able to run my cucumber tests using maven.
Below is my docker-compose.yml
version: "3"
services:
chrome:
image: selenium/node-chrome:110.0
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
edge:
image: selenium/node-edge:110.0
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
firefox:
image: selenium/node-firefox:110.0
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
selenium-hub:
image: selenium/hub:latest
container_name: selenium-hub
depends_on:
- java-maven
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
java-maven:
image: maven:3.8-openjdk-11
When I tried with below gitlab-ci.yml
variables:
MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
stages:
- test
services:
- docker:20.10.16-dind
test:
stage: test
image: docker:latest
before_script:
- docker-compose up -d
- sleep 10
script:
- mvn ${MAVEN_OPTS} test -Dcucumber.filter.tags=${FEATURE_TAG}
artifacts:
when: always
name: "report"
paths:
- test-output/*
expire_in: 1 h
I got "mvn: not found" error.
So I tried to run it inside the java-maven service by changing snippet of script section in the above yml with the below snippet:
docker run -it --rm -v "$(pwd)":/opt/maven -w /opt/maven maven:3.8-openjdk-11 mvn ${MAVEN_OPTS} test -Dcucumber.filter.tags=${FEATURE_TAG}
When I tried to run it like that, the job got stuck for a while and afterwards it responded with "the input device is not a TTY".
Kindly requesting to help me resolve the issue and run the tests successfully.