Code Monkey home page Code Monkey logo

wp-browser's Introduction

wp-browser

CI

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": "^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.

Current Sponsors

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

wp-browser's People

Contributors

barryhughes avatar borkweb avatar brianhenryie avatar cliffordp avatar dale42 avatar dbisso avatar discoinfiltrator avatar egrobler avatar firejdl avatar gabe-connolly avatar galengidman avatar gundamew avatar hendrikroehm avatar ippey avatar jbrinley avatar jcabot avatar kidunot89 avatar kmbt avatar lots0logs avatar luc45 avatar lucatume avatar maxchirkov avatar mboldt avatar mitogh avatar naktibalda avatar sc0ttkclark avatar szepeviktor avatar tangrufus avatar timothybjacobs avatar zdenekca avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.