At Codeship, we’re pleased to be able to integrate with several third-party products across a variety of areas to ensure your CI/CD workflows are that much smoother. For example, Selenium, according to Wikipedia, "is a portable software-testing framework for web applications," providing a "playback tool for authoring tests without the need to learn a test scripting language."
Let's walk through the requirements for running browser testing with Selenium in your CI/CD pipeline with Codeship Basic and Codeship Pro.
Browser Testing for Codeship Basic
Codeship Basic uses fast, performant VMs with preinstalled technology stacks to make it super easy and fast to get started running a CI/CD pipeline.
Chrome and Firefox both work with Selenium. To support Selenium with Chrome, be sure to update ChromeDriver to the desired version for your application. Please provide your own Selenium driver in your application and keep it current.
Selenium standalone server
If there are no packages available for your framework or you want to use the standalone version, there is a script available for installing a custom version.
Browser Testing For Codeship Pro
Codeship Pro uses containers built from Docker images to let you define and build your own completely flexible CI/CD environment. To use the standalone Selenium server, you need to download the Selenium jar file in your Dockerfile.
# Starting from Ubuntu Xenial FROM ubuntu:xenial # We need wget to download Selenium Server and openjdk-8-jdk RUN apt-get update RUN apt-get install -y wget openjdk-8-jdk # Set up Selenium environment variables ENV SELENIUM_PORT 4444 ENV SELENIUM_WAIT_TIME 10 # Download Selenium Server RUN wget -q --continue --output-document /selenium-server.jar "http://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar"
Then as part of your build script, you simply start the Selenium server with the jar file and wait a few seconds for it to properly load.
java -jar /selenium-server.jar -port "${SELENIUM_PORT}" ${SELENIUM_OPTIONS} 2>&1 & sleep "${SELENIUM_WAIT_TIME}" echo "Selenium is now ready to connect on port ${SELENIUM_PORT}"