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

<?php 
$I = new AcceptanceTester($scenario);

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

$I->loginAsAdmin();
$I->amOnPluginsPage();

// initial condition is all deactivated
$I->activatePlugin('wp-router');
$I->activatePlugin('route-pages');
// the admin notice
$I->seeMessage();
$I->seePluginActivated('route-pages');

// restore condition
$I->deactivatePlugin('route-pages');
$I->deactivatePlugin('wp-router');

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.

Configuration

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
modules:
    enabled:
        - AcceptanceHelper
        - WPBrowser
    config:
        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"