-
Notifications
You must be signed in to change notification settings - Fork 177
Tests
Facebook for WooCommerce uses Codeception and WP-Browser for testing.
The first time you want to run the test suites you should create a local configuration for Codeception, as follows:
-
Install all dependencies
composer install -
Create a
codeception.ymlfilecp codeception.local.yml codeception.yml -
Create a
.envfilecp .dist.env .env -
Now edit the
.envfile and update all environment variables to match your local environmentYou'd want to run the tests on a website that you only use for running tests and make sure that the plugin repository is NOT installed directly or symlinked to the
wp-content/pluginsof the test website. Codeception automatically copies (and then removes) the necessary files from the plugin repo to the plugins directory on the test site (see theCopierextension configuration oncodeception.yml) -
Prepare a database dump for the test website
For the acceptance test suite, Codeception expects to find a database dump of the test website at
tests/_data/dump.sql. A database dump generated withwp db exportshould work, but you can also download one that its known to work from https://cloud.skyver.ge/mXu65Kw9.It's good to regenerate those dumps from time to time, as mandatory database upgrades and WordPress screens asking the administrator to confirm the email address start showing up if the dump is outdated and can interfere with tests results.
You can run the test suite as follows:
php vendor/bin/codecept run integration
The acceptance tests requires that your machine has access to a Selenium server that can access your test website. Normally, you can run Selenium on your machine by installing https://www.npmjs.com/package/selenium-standalone.
You can run the test suite as follows:
-
Start Selenium
selenium-standalone start -
Run the acceptance suite
php vendor/bin/codecept run acceptance