Faster WordPress acceptance testing in Codeception - 01

I’ve put together a Codeception module for my needs to use for WordPress acceptance testing. The module extends Codeception own PhpBrowser one to allow writing .cept or .cest tests like

$I = new AcceptanceTester($scenario);

$I->am('an administrator');
$I->wantTo('activate Route Pages with WP Router installed and activated');


// initial condition is all deactivated
// the admin notice

// restore condition

while I have some more work to do the basics of adding a module to Codeception are there and I will dig deeper into the possibilities to allow for stronger test decoupling via direct database access.


The module must be added to the acceptance suite configuration file

# Codeception Test Suite Configuration

# suite for acceptance tests.
# perform tests in browser using the WebDriver or PhpBrowser.
# If you need both WebDriver and PHPBrowser tests - create a separate suite.

class_name: AcceptanceTester
        - AcceptanceHelper
        - WPBrowser
            url: 'http://site.local'
            adminUsername: 'admin'
            adminPassword: 'admin'
            adminUrl: '/wp-admin'

and the four parameter above are required for the module to work. Since the module is an extension of the PhpBrowser class the module adds methods removing none of the originals and only combines methods for quicker test writing. The module is on GitHub and is ideally installed using Composer with a require-dev statement like the one on Packagist:

"lucatume/wp-browser": "dev-master"