For selenium there is also selenium command runner, called selenium side runner, as I pointed out some tips about how to use NEW Selenium IDE here, here are tips on how to use it with CLI or with some CI/CD.
So you will first try it locally, lets say you use DrupalVM environment which uses vagrant, first you will need to have enabled nodejs under installed_extras(config.yml) and then you will need some extra nodejs packages:
nodejs_version: "10.x"
nodejs_npm_global_packages:
- name: selenium-side-runner
- name: chromedriver
nodejs_install_npm_user: "{{ drupalvm_user }}"
npm_config_prefix: "/home/{{ drupalvm_user }}/.npm-global"
npm_config_unsafe_perm: "true"
we add selenium side runner and chromedriver that will run tests, also there is the last line, this will help with installation when it is set to true (npm_config_unsafe_perm)
Then you need to run vagrant up --provision so that this changes are reflected in your environment.
As we are using chromedriver, you will need to have chrome browser, drupalvm doesnt come with one, so we need to install it, we should have this in ansible recepies so it is installed on each provision but for now lets just install it quickly, log in to remote machine with "vagrant ssh" and do
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
now you have chrome browser you can use with selenium side runner. As this is on our server that is virtual, you wont be able to run chrome as you dont have UI, so we will run it headless. One more tip, to have possibility to run tests, you need to put your tests in test suite, otherwise you will get message "Your test suite must contain at least one test" and testing will fail, so put your tests in default suite and save them.
Lets run tests, run this while logged in remote server:
selenium-side-runner -c "browserName='chrome' chromeOptions.args=[headless]" my_tests.side
this command will use chrome browser but headless version and run your tests. You can also run just some of the tests from suite with --filter options or change url with --base-url, most other info can be found here https://www.seleniumhq.org/selenium-ide/docs/en/introduction/command-line-runner/
All this you can also do on your linux server or on you docker image as well.