Wp Browser

wp-browser

Easy acceptance, functional, integration and unit testing for WordPress plugins, themes and sites using Codeception.

Build Status

wp-browser provides a Codeception based solution to test WordPress plugins, themes and whole sites at all levels of testing.

Find out more here in the documentation.

Installation and setup - the really fast version

Using Composer require wp-browser as a development dependency:

cd my-wordrpess-project
composer require --dev lucatume/wp-browser
vendor/bin/codecept init wpbrowser

Answer the questions and you will be ready to test your project. Find out more about the setup in the project documentation.

Using wp-browser with Codeception 4.0

Codeception version 4.0, while still being compatible with PHP 5.6 and wp-browser, did break its structure into discrete modules.

If you want to use wp-browser with Codeception version 4.0+ you will need to make sure you've got all the required packages.
Add the following requirements in your composer.json file, in the require-dev section:

{
  "require-dev": {
    "lucatume/wp-browser": "^2.4",
    "codeception/module-asserts": "^1.0",
    "codeception/module-phpbrowser": "^1.0",
    "codeception/module-webdriver": "^1.0",
    "codeception/module-db": "^1.0",
    "codeception/module-filesystem": "^1.0",
    "codeception/module-cli": "^1.0",
    "codeception/util-universalframework": "^1.0"
  }
}

You might not need all of them depending on the modules you use in your suites, but this will cover all the modules for this project.

Read more here.

Usage

The project provides a number of modules to ease the testing of WordPress projects; you can find out more in the modules section of the documentation.
Here's a quick example acceptance test you can write:

// tests/acceptance/PrivatePostsCept.php
$I->haveManyPostsInDatabase(3, ['post_title' => 'Test post {{n}}', 'post_status' => 'private']);

$I->loginAs('subscriber', 'secret');
$I->amOnPage('/');
$I->see('Nothing found');

$I->loginAs('editor', 'secret');
$I->amOnPage('/');
$I->see('Test post 0');
$I->see('Test post 1');
$I->see('Test post 2');

This is just a bite though, find out more in the documentation.

New
(320)
• Released: May 05, 2020, 10:27 PM

Wp Browser

Author: lucatume
Item was Featured Author was Featured Bought between 100 and 500 items Referred more than 1000 members Author had a Free File of the Month Contributed a Blog Post Helped protect FrontendFun against copyright violations Reviewer FrontendFun Developer Site Administrator Moderator Blog Editor
FREE
Easy acceptance, functional, integration and unit testing for WordPress plugins, themes and sites using Codeception. size
git clone https://github.com/lucatume/wp-browser.git