Add Selenoid testing setup
What does this MR do and why?
Adds Selenoid setup and required environment variables. This is the infrastructure setup for mobile testing and video recording.
Note this doesn't change any existing pipelines.
gitlab-qa counterpart MR: gitlab-qa!1153 (merged)
Part of: gitlab-org/quality/quality-engineering/team-tasks#1526 (closed) and gitlab-org/quality/quality-engineering/team-tasks#1624
Screenshots or screen recordings
chrome-111.0-2023-04-11_20_57_58_+0000
chrome-mobile-111.0-2023-04-11_21_25_49_+0000
How to set up and validate locally
Note: Using these steps, the recording cannot be validated on ARM architecture and the mobile tests can only be validated on Linux machines.
- Checkout this MR and create a local docker image
docker build -t gitlab/gitlab-ce-qa:your-custom-tag --file ./qa/Dockerfile ./
- Checkout the gitlab-qa counterpart MR gitlab-qa!1153 (merged)
- In gitlab-qa/ branch above, spin up the gitlab and selenoid containers:
USE_SELENOID=true ./exe/gitlab-qa Test::Instance::Image EE --no-tests
- This should create containers for gitlab and the selenoid grid that are on the network
test
- We will need the name of the gitlab nightly container in order to point the browser to it from the test container. (Use
docker ps
)
- Manually kick off the QA image by overriding the entrypoint:
CHROME_DISABLE_DEV_SHM=true docker run -it --entrypoint="/bin/bash" --network=test gitlab/gitlab-ce-qa:your-custom-tag
- Run some tests:
QA_RECORD_VIDEO=true QA_BROWSER="chrome" QA_BROWSER_VERSION="111.0" QA_REMOTE_GRID="selenoid:4444" WEBDRIVER_HEADLESS=false bundle exec bin/qa Test::Instance::All http://<name_of_local_nightly_container>.test -- qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb
- Note: We have to run it with
WEBDRIVER_HEADLESS=false
or we get a blank video.
- Note: We have to run it with
- To run mobile tests,
exit
out of the gitlab-ce container above and rundocker pull registry.gitlab.com/gitlab-org/gitlab-qa/selenoid-chrome-gitlab:mobile-111.0
- Then run
CHROME_DISABLE_DEV_SHM=true docker run -it --entrypoint="/bin/bash" --network=test gitlab/gitlab-ce-qa:your-custom-tag
again - Then run
QA_RECORD_VIDEO=true QA_LAYOUT="phone" QA_BROWSER="chrome" QA_BROWSER_VERSION="mobile-111.0" QA_REMOTE_GRID="selenoid:4444" WEBDRIVER_HEADLESS=false bundle exec bin/qa Test::Instance::All http://<name_of_local_nightly_container>.test -- qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb
- The video is in the volume mount from selenoid -
/opt/selenoid/video/<video>.mp4
- Easiest way to view the video is to visit
localhost:4444/video
- Easiest way to view the video is to visit
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Désirée Chevalier