Skip to content

juanjopb/k8s-selenium-grid

Repository files navigation

k8s-selenium-grid

Contents

In this repository, you will find the Kubernetes files to deploy selenium-grid to k8s, Follow the instructions on This blog

There are also, the artifacts to run an E2E test using nightwatch.js over a remote (or local) selenium grid. You could provide remote selenium grid server Otherwise local selenium will be started (using docker-compose) and the test (using a Dockerfile) will run a test with differents uses cases on the test page http://www.automationpractice.com, if the parameters are set correcly, the results of the tes will be Uploaded to an IBM Cloud Object Storage (COS)

Run a test against Selenium Grid

There are prepared two ways to run the test, with a script to run all the components or manually.

Run Only one Click

This option is a wrap to run all the components of the test from a script, based on a configuration file.

Pre-requisites

  • Docker
  • Docker-compose

Prepare and run the test

Clone the repo and set parameters on the file config.conf

  • selenium_remote_host if you have a Remote selenium, add the ip address or dns (default localhost)
  • selenium_remote_port if you have a Remote selenium, add the port (default 4444)
  • ibmcloud_username user to Log In on IBM Cloud
  • ibmcloud_apikey APIKEY generated on IAM Cloud to allow upload the results.
  • ibmcloud_cos_bucket bucket name to upload the results on IBM Cloud
  • ibmcloud_cos_region Region of the bucket creation.

After set the parameters run the script ./scripts/start.sh The script will be check the parameters file (config.cong) and depends of the configuration, if it's not an remote Selenium grid server set, by defaul will be use the Localhost spinning up the Selenium hub and Node, using docker-compose, next a Dockerfile is built will ran the test inside. after the results are ready, if the parameters to upload the results are set, those will be upload to an IBM Cloud Object Storage

Run Manually

With this option you could run the nightwach.js test on your own workstation.

Pre-requisites

  • Nodejs installed
  • Docker-compose

Prepare install and Run

Clone the repo and set parameters on the file config.conf

  • cd nigthwatch
  • npm install
  • npm install -g nightwatch
  • npm install --save-dev nightwatch-record selenium-webdriver chromedriver

on the file nightwatch.conf.js be sure you have set the parameters host and port

  "selenium": {
      "start_process": false,
      "host" : "localhost",
      "port" : "4444",
      "cli_args" : {
        "webdriver.chrome.driver" : "./bin/chromedriver"
      }
  },

Go to the folder nightwatch cd nightwatch and run docker-compose up after all services show in running state, you are able to run nightwatch

./node_modules/.bin/nightwatch

To build the Dockerfiles

Create Dockerfile

Clone the repository, located on the root of the repo. docker build -t nightwatch-test -f ./nightwatch/Dockerfile .

Run Dockerfile

docker run -it nightwatch-test

About

Examples to deploy selenium-grid to k8s

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published