So you want to write tests in OctoberCMS using Selenium 2?
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.
- Install plugin from OctoberCMS Marketplace or clone the code from GitHub into
- Go to
selenium.phpand 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
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
There are some useful methods in traits
SeleniumHelpers was mostly based on
Available methods for OctoberCMS:
For more information about the methods see
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
You can keep test files wherever you want, but
.gitignore of the plugin will exclude all files from
/tests except those in
must be an instance of Exception, instance of Error given"
The problem is with old version
phpunit-selenium extensions using by OctoberCMS. If you want to get nice error messages you have to update it in OctoberCMS's
require-dev section. It can be the newest one, so you can just change the '~' with '>' in
This plugin has not been reviewed yet.
!!! 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
Sep 20, 2017