-
Notifications
You must be signed in to change notification settings - Fork 138
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.yml
filecp codeception.local.yml codeception.yml
-
Create a
.env
filecp .dist.env .env
-
Now edit the
.env
file 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/plugins
of 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 theCopier
extension 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 export
should 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