Running e2e tests requires Node 7.6 or later and a dedicated test database. It uses mocha, selenium-webdriver and phantomjs.
These e2e tests have to be performed against predefined resources (e.g. lists, users, etc.) and therefore a dedicated test database and test config is required.
Both can be created by running sudo sh test/e2e/install.sh
from within your mailtrain directory. This creates a MYSQL user and database called mailtrain_test
, and generates the required config/test.toml
.
For tests to succeed Mailtrian must be started in test
mode on port 3000 (as http://localhost:3000/ is the predefined service url). The tests itself have to be started in a second Terminal window.
- Start Mailtrain with
npm run starttest
- Start e2e tests with
npm run e2e
By default e2e tests use phantomjs
. If you want to use a different browser you need to install its driver and adjust your config/test.toml
.
- Install the
firefox
driver withnpm install geckodriver
- Install the
chrome
driver withnpm install chromedriver
- Other drivers can be found here
Then adjust your config:
[seleniumwebdriver]
browser="firefox"
Current Firefox issue (and patch): mozilla/geckodriver#683
You should spend your time on features rather than writing tests, yet in some cases, like for example the subscription process, manual testing is just silly. You best get started by reading the current test suites, or just open an issue describing the scenario you want to get tested.
Available commands:
npm run sqldumptest
- exports the test DB tosetup/sql/mailtrain-test.sql
npm run sqlresettest
- drops all tables then loadssetup/sql/mailtrain-test.sql
npm run _e2e
- just runs e2e testsnpm run e2e
- runssqlresettest
then_e2e