I work as a tester in a company that wants to start CI/CD. The plan is to include UI-test automation tests in the CI/CD. We are currently evaluating Selenium WD and Cypress to be dockerised and used on a headless mode.
I locally use selenium WD. I have no clue about how to dockerise it and make it run headless.
I searched the web and found an abundance of articles about how to dockerise selenium WD but I am not sure which one to use since they all mention selenium components that I am not sure that I need.
Is there a definitive guide about how to dockerise selenium WD and run it headless?
Frontend developers in the company prefer Cypress and said that dockerising Cypress was a 15 mins effort. Although I don’t know JS, I am keen on learning JS so that I could start using Cypress.
Has anyone used Selenium WD or Cypress on a headless mode using docker? If yes, please share your experiences.
I would appreciate your help.
Thank you very much!
Can you elaborate more about why you want to run in headless mode ?
I can help you at below places:
1.Running selenium in docker container
2.Creating a docker image so you can run that inside a docker container.
3.Running the browsers in headless mode.
You probably need to learn just enough JS to get things done, don’t do a full course, just start a course and learn only whatever bits you get stuck on? Might let you focus on the goal which seems to by Cypress in a container. I would personally go to the Cypress forums, not many people share technical detail on the MOT sadly, so better luck will be had there. Not used Cypress myself, so no idea , but basically once you specify and pass the WD port number and get docker to expose it, you are almost done.
I have nominally gotten selenium in docker working once almost 2 years ago, but forgot how, biggest pain for me was debugging script errors later and getting all the selenium logs out of the container before it dies. Just do the docker tutorials and read all the docs and you will get that bit. Headless is not a strategy, it’s a tactic, so bear that in mind, you will need other test environments later too.
May want to hook up with @rezaarief , who was doing some similar things in a new job recently.
We want to run in headless mode because in a CI/CD server (e.g., Jenkins) there may not be a browser GUI plus we would like to run the UI automation tests faster (and running them headless could help in running faster)
You can do it by following below steps . I can share you the link. Try that out and reach out to me if you face any problem.
Once you are done with downloading the browser and driver in the docker container .
you need to configure this in chrome options to run in headless.
chrome_service = ChromeService(“/opt/selenium/chromedriver”)
driver = webdriver.Chrome(service=chrome_service, options=chrome_options)