Gutenberg on WPCOM e2e Tests
Manual e2e suite for Gutenberg v4.5.1 running in a WPCOM Sandbox.
Instructions
Note: These tests will wipe out all posts and comments from the site!
- Install the dependencies:
npm install
-
Copy the
config-example.json
file asconfig.json
and fill thesandbox
object with the URL of a WPCOM Sandbox site and the credentials of an editor (or higher role) user.
To observe the tests visually, setpuppeteer.headless = false
inconfig.json
, and increasepuppeteer.slowMo
until the tests are slow enough (I've found50
to be my sweet spot). -
Obtain the e2e tests from a Gutenberg release (e.g.
v4.5.1
):
npm run update-e2e v4.5.1
-
Update
/e2e-overrides
if needed. -
Turn on the Sandbox.
-
Finally start testing! (This will also automatically merge
/e2e-overrides
into/e2e
).
npm run test
Note: to test a single spec, please update the Jest config (/e2e-overrides/jest.config.json
) before running npm run test
:
"testMatch": [
- "<rootDir>/e2e/specs/**/(*.)test.js"
+ "<rootDir>/e2e/specs/foo-bar.test.js"
],
Sync with Gutenberg
As of 2018-11-23, this uses Gutenberg 4.5.1 as it's the version used by the WPCOM Sandbox.
To update it as needed:
-
Run
npm run update-e2e
with the tag of a new Gutenberg release (e.g.npm run update-e2e v5.0.0
). -
Check if there are big changes between
/e2e-overrides
and the new/e2e
folder, and update the overrides as needed. (IMPORTANT: keep the same folder structure!)
E.g. currently, most overrides are in/support/utils.js
, but in future versions, all the utils functions will be moved into their own files. -
Run
npm run overwrite-e2e
to copy the overrides in the/e2e
folder.