Product support

Get help in the plugin support forum.


  • Developer Tools

So you want to write tests in OctoberCMS using Selenium 2?

Using the Ui2TestCase class from this plugin this should be much easier. What is more you do not have to download Selenium bin, since it is included in the package.


  1. Install plugin from OctoberCMS Marketplace or clone the code from GitHub into /plugins/initbiz/selenium2tests directory.
  2. Go to /plugins/initbiz/selenium2tests
  3. Copy selenium.php.example to selenium.php and configure your environment

Testing OctoberCMS basics

It is a good practice not to use the same DB for testing and developing purposes.

In order to configure different database for testing purposes create directory testing in config directory and copy database.php to the newly created directory. Then change the default connection as you wish.

After that if you use APP_ENV=testing in your .env file, configuration from testing directory will be used.

Writing tests in Selenium 2

There are example tests in tests/example directory that use Ui2TestCase class.


There are some useful methods in traits SeleniumHelpers and OctoberSeleniumHelpers. SeleniumHelpers was mostly based on Modelizer/Laravel-Selenium.

Available methods for OctoberCMS:

  • signInToBackend
  • waitForFlashMessage
  • checkFirstRowInBackend
  • getRecordID
  • clickRowInBackendList
  • checkRowIdInBackend
  • typeInBackendSearch

For more information about the methods see traits/OctoberSeleniumHelpers.php file.

Running tests

First of all, you have to run Selenium 2 server. It is included in the package. You have to have Java installed on the local machine. In order to start Selenium 2 server change directory to <project_root>/plugins/initbiz/selenium2tests and run java -jar selenium.jar.

You are ready to run tests using PHPUnit from OctoberCMS's vendor/bin/phpunit.

You can keep test files wherever you want, but .gitignore of the plugin will exclude all files from /tests except those in /tests/examples.


phpunit and phpunit-selenium version

Depending on version of phpunit and phpunit-selenium some typical errors may occur.

While working with the default phpunit and phpunit-selenium in OctoberCMS you can get must be an instance of Exception, instance of Error given error. The problem is with the old version phpunit and phpunit-selenium extension used by OctoberCMS.

It works best when you set in your root composer.json file versions as follows:

"require-dev": {
   "phpunit/phpunit": ">5.7",
   "phpunit/phpunit-selenium": "~4.1"

And run composer update.


Small fixes and features.

Nov 07, 2018


Changed protected methods to public + updated Selenium standalone binary

Nov 07, 2018


Added scrollToElement method

Sep 13, 2018


Fixed notSee method

Jul 06, 2018


Added select2 method

Jul 03, 2018


Added timeout to waitForFlashMessage method

Jul 03, 2018


Updated README file

Apr 05, 2018


!!! Traits namespaced, updated Selenium standalone server

Jan 17, 2018


October Selenium 2 helpers updated

Sep 22, 2017


Added Selenium 2 Helpers methods

Sep 21, 2017


Beta, some features might not work, but hey, you can contribute :)

Sep 20, 2017


Initialize plugin.

Sep 20, 2017