• Stars
    star
    569
  • Rank 78,369 (Top 2 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 10 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The easy and reliable way to test WordPress with Codeception. 10 years of proven success.

test

wp-browser

wp-browser provides easy acceptance, functional, integration and unit testing for WordPress plugins, themes and whole sites using Codeception.

Find out more 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": "^3.0",
    "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.

Current Sponsors

My sincere thanks to my sponsors: you make maintaining this project easier.

More Repositories

1

wp-routes

Custom routing in WordPress.
PHP
53
star
2

di52

The dependency injection container for streamlined WordPress development. Easily manage and inject dependencies for efficient and hassle-free app creation.
PHP
46
star
3

local-addon-xdebug-control

A Local by Flywheel addon to manage XDebug settings through the UI.
JavaScript
42
star
4

wp-routing

Laravel-like routing in WordPress
PHP
33
star
5

function-mocker

A Patchwork powered function mocker.
PHP
18
star
6

idlikethis

Add an "I'd like this" button anywhere in a WordPress post and get user feedback on your ideas, proposals and plans.
PHP
18
star
7

multi-image-control

A Theme Customizer control allowing selection and sorting of multiple images.
CSS
14
star
8

CMB2-Pipes

Easy meta writing redirection for the CMB2 plugin.
PHP
13
star
9

wp-customizer

A set of custom controls by paulund, a multi-image control and a theme customizer section wrapper.
PHP
9
star
10

wpcli-wpbrowser-tests

PHP
7
star
11

cmb2-tad-fields

CMB2 additional fields
PLSQL
7
star
12

grunt-headway-block-template

A grunt-init template to generate Headway Themes blocks.
JavaScript
6
star
13

wp-handlebars.php

PHP
5
star
14

travis-apache-setup

Shell
4
star
15

rest-query

PHP
4
star
16

klein52

A PHP 5.2 compatible fork of klein.php 1.2.0
PHP
4
star
17

cmb2-meta-split

A WordPress plugin that will take care of saving parallel meta when using the CMB2 plugin.
PHP
4
star
18

codeception-snapshot-assertions

Leverage Codeception snapshot support to make snapshot testing in Codeception projects easier.
PHP
4
star
19

codeception-setup-local

Additional commands to make Codeception local setup easy across teams.
PHP
4
star
20

codeception-steppify

Generate step definitions from Codeception modules.
PHP
4
star
21

rest-query-demo-theme

PHP
3
star
22

word-counter

PHP
3
star
23

dockerfiles

Shell
3
star
24

testify

A Sublime Text plugin aimed at making writing PHPUnit tests less painful.
Python
3
star
25

reading-time-blocks

A WordPress plugin that adds Gutenberg blocks to display the remaining reading time in a post.
PHP
3
star
26

composerpress

Composer-managed WordPress installation.
PHP
3
star
27

function-mocker-le

PHP
3
star
28

wp-browser-commons

PHP
2
star
29

dotfiles

Shell
2
star
30

ppplan

A PHP script to help estimating and planning the work to do.
PHP
2
star
31

todo-mvc

TodoMVC app implementation with WordPress and intercooler.js
PHP
2
star
32

wp-utils

WordPress utility classes.
PHP
2
star
33

front-to-back

A template based WordPress development experiment
HTML
2
star
34

htblock-header-logo

An Headway block that displays the site logo, title and tagline and allows for some user customisation.
PHP
2
star
35

htblock-backstretch

An Headway theme block plugin to use the Backstretch plugin for the site background.
PHP
2
star
36

adr-wp

An Action-Domain-Responder WordPress plugin implementation
PHP
2
star
37

qa-thing

JavaScript
2
star
38

acme

WordPress integration testing example plugin
PHP
2
star
39

rest-calculator

PHP
1
star
40

coding-standards

PHP
1
star
41

gattiny

PHP
1
star
42

args

A PHP 5.2 compatible arguments handling library.
PHP
1
star
43

headway-themes-custom-code-blocks

A collection of my custom code blocks for the Headway Themes "drag and drop website builder"
1
star
44

plugin-sample-project

A basic, container-based, setup to test a WordPress plugin using Codeception and wp-browser.
PHP
1
star
45

htblock-ajax-search

An AJAX-powered search block for Headway Themes
PHP
1
star
46

tad-reschedule

Easy cron event rescheduling
PHP
1
star
47

ffi-path-mapping

Proof-of-concept setup-less path mappings for containerized PHP projects.
C
1
star
48

tad-post

WordPress post object utility classes.
PHP
1
star
49

wp-intercooler

Intercooler.js for WordPress
JavaScript
1
star
50

wp-script-utils

Script and style utilities for WordPress projects.
PHP
1
star