Skip to content
Example how to write E2E tests for a Gutenberg block in WordPress
JavaScript PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
build
e2e-tests
src
.browserslistrc
.editorconfig
.eslintignore
.gitignore
.stylelintrc.json
README.md
docker-compose.override.yml
e2e-tests-example.php
package-lock.json
package.json

README.md

Example how to write E2E tests for a Gutenberg block in WordPress

This is a WordPress plugin which shows how to write E2E tests for a Gutenberg block in WordPress. This blog post explains how it works: https://www.liip.ch/en/blog/how-to-test-your-gutenberg-blocks

Feel free to use this plugin as a starting point to write your own E2E tests for your Gutenberg block.

Developer information

Installation

  1. Clone this repository

  2. Install Node dependencies

    $ npm install
    

Code style

Run eslint with the following command:

$ npm run lint

Compile assets

The build process is based on the official @wordpress/scripts package.

  • npm start: Compiles the block in development mode. Watches for any changes and reports back any errors in your code.
  • npm run lint: Lints JavaScript, CSS and package.json files.
  • npm run build: Use to build production code for your block inside build folder.

Puppeteer E2E Tests

The Puppeteer E2E Tests are stored in the e2e-tests directory.

To run the tests use the following command:

$ npm run test:e2e

or the following command to run a specific test:

$ npm run test:e2e -- -t 'my test'
You can’t perform that action at this time.