Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
build
build-module
node_modules
test/e2e/test-plugins
packages/tests-e2e/plugins
vendor
packages/block-serialization-spec-parser/parser.js
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ module.exports = {
},
overrides: [
{
files: [ 'test/e2e/**/*.js' ],
files: [ 'packages/tests-e2e/**/*.js' ],
env: {
browser: true,
},
Expand Down
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,29 +67,29 @@ jobs:
install:
- ./bin/setup-local-env.sh
script:
- $( npm bin )/wp-scripts test-e2e --testPathPattern=/test/e2e/specs/ --listTests > ~/.jest-e2e-tests
- $( npm bin )/wp-scripts test-e2e --testPathPattern=/packages/tests-e2e/specs/ --listTests > ~/.jest-e2e-tests
- npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 0' < ~/.jest-e2e-tests )

- name: E2E tests (Admin with plugins) (2/2)
env: WP_VERSION=latest POPULAR_PLUGINS=true
install:
- ./bin/setup-local-env.sh
script:
- $( npm bin )/wp-scripts test-e2e --testPathPattern=/test/e2e/specs/ --listTests > ~/.jest-e2e-tests
- $( npm bin )/wp-scripts test-e2e --testPathPattern=/packages/tests-e2e/specs/ --listTests > ~/.jest-e2e-tests
- npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 1' < ~/.jest-e2e-tests )

- name: E2E tests (Author without plugins) (1/2)
env: WP_VERSION=latest E2E_ROLE=author
install:
- ./bin/setup-local-env.sh
script:
- $( npm bin )/wp-scripts test-e2e --testPathPattern=/test/e2e/specs/ --listTests > ~/.jest-e2e-tests
- $( npm bin )/wp-scripts test-e2e --testPathPattern=/packages/tests-e2e/specs/ --listTests > ~/.jest-e2e-tests
- npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 0' < ~/.jest-e2e-tests )

- name: E2E tests (Author without plugins) (2/2)
env: WP_VERSION=latest E2E_ROLE=author
install:
- ./bin/setup-local-env.sh
script:
- $( npm bin )/wp-scripts test-e2e --testPathPattern=/test/e2e/specs/ --listTests > ~/.jest-e2e-tests
- $( npm bin )/wp-scripts test-e2e --testPathPattern=/packages/tests-e2e/specs/ --listTests > ~/.jest-e2e-tests
- npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 1' < ~/.jest-e2e-tests )
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ services:
volumes:
- wordpress:/var/www/html
- .:/var/www/html/wp-content/plugins/gutenberg
- ./test/e2e/test-plugins:/var/www/html/wp-content/plugins/gutenberg-test-plugins
- ./test/e2e/test-mu-plugins:/var/www/html/wp-content/mu-plugins
- ./packages/tests-e2e/plugins:/var/www/html/wp-content/plugins/gutenberg-test-plugins
- ./packages/tests-e2e/mu-plugins:/var/www/html/wp-content/mu-plugins
depends_on:
- mysql

Expand Down Expand Up @@ -59,8 +59,8 @@ services:
volumes:
- wordpress_e2e_tests:/var/www/html
- .:/var/www/html/wp-content/plugins/gutenberg
- ./test/e2e/test-plugins:/var/www/html/wp-content/plugins/gutenberg-test-plugins
- ./test/e2e/test-mu-plugins:/var/www/html/wp-content/mu-plugins
- ./packages/tests-e2e/plugins:/var/www/html/wp-content/plugins/gutenberg-test-plugins
- ./test/e2e/mu-plugins:/var/www/html/wp-content/mu-plugins

cli_e2e_tests:
image: wordpress:cli
Expand Down
6 changes: 6 additions & 0 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,12 @@
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/shortcode/README.md",
"parent": "packages"
},
{
"title": "@wordpress/tests-e2e",
"slug": "packages-tests-e2e",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/tests-e2e/README.md",
"parent": "packages"
},
{
"title": "@wordpress/token-list",
"slug": "packages-token-list",
Expand Down
2 changes: 1 addition & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build",
"build-module",
"node_modules",
"test/e2e/test-plugins",
"packages/tests-e2e/plugins",
"vendor"
]
}
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"@wordpress/npm-package-json-lint-config": "file:packages/npm-package-json-lint-config",
"@wordpress/postcss-themes": "file:packages/postcss-themes",
"@wordpress/scripts": "file:packages/scripts",
"@wordpress/tests-e2e": "file:packages/tests-e2e",
"babel-loader": "8.0.0",
"benchmark": "2.1.4",
"browserslist": "3.2.8",
Expand All @@ -86,7 +87,6 @@
"husky": "0.14.3",
"is-plain-obj": "1.1.0",
"is-equal-shallow": "0.1.3",
"jest-puppeteer": "3.2.1",
"jsdom": "11.12.0",
"lerna": "3.4.3",
"lint-staged": "7.3.0",
Expand Down Expand Up @@ -175,7 +175,7 @@
"publish:prod": "npm run build:packages && lerna publish",
"test": "npm run lint && npm run test-unit",
"pretest-e2e": "concurrently \"./bin/reset-e2e-tests.sh\" \"npm run build\"",
"test-e2e": "wp-scripts test-e2e --setupTestFrameworkScriptFile=./test/e2e/support/setup-test-framework.js --testPathPattern=/test/e2e/specs/",
"test-e2e": "wp-scripts test-e2e --setupTestFrameworkScriptFile=./packages/tests-e2e/support/setup-test-framework.js --testPathPattern=/packages/tests-e2e/specs/",
"test-e2e:watch": "npm run test-e2e -- --watch",
"test-php": "npm run lint-php && npm run test-unit-php",
"test-unit": "wp-scripts test-unit-js --config test/unit/jest.config.json",
Expand Down
1 change: 1 addition & 0 deletions packages/tests-e2e/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
13 changes: 13 additions & 0 deletions packages/tests-e2e/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Tests E2E

End-To-End (E2E) tests for WordPress.

## Installation

Install the module

```bash
npm install @wordpress/tests-e2e --save-dev
```

<br/><br/><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
36 changes: 36 additions & 0 deletions packages/tests-e2e/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "@wordpress/tests-e2e",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other thought on this, I was wondering if tests-e2e might be too much of a generic name. I'm not sure if we'd consider having more than just gutenberg/block-editor tests in this package.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree that we should have more granular control on what tests can be run. I expect this to grow past the editor only. At some point we'd be able to run phase2 tests, core editor tests, ... separately. It could be just . import { editorTests } from "@wordpress/tests-e2e".

I don't have a strong opinion or a perfect solution at the moment though, this is probably something we'd have to iterate on.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jest support projects, so we can split it into smaller groups using this feature:

https://jestjs.io/docs/en/configuration#projects-array-string-projectconfig

"private": true,
"version": "1.0.0-alpha.0",
"description": "End-To-End (E2E) tests for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
"keywords": [
"wordpress",
"tests",
"e2e"
],
"homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/tests-e2e/README.md",
"repository": {
"type": "git",
"url": "https://github.com/WordPress/gutenberg.git"
},
"bugs": {
"url": "https://github.com/WordPress/gutenberg/issues"
},
"dependencies": {
"@wordpress/jest-console": "file:../jest-console",
"@wordpress/keycodes": "file:../keycodes",
"@wordpress/url": "file:../url",
"expect-puppeteer": "^3.2.0",
"lodash": "^4.17.10",
"node-fetch": "^1.7.3"
},
"peerDependencies": {
"jest": ">=23.0.0",
"puppeteer": ">=1.6.0"
},
"publishConfig": {
"access": "public"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Node dependencies
* Internal dependencies
*/
import { switchUserToAdmin } from './switch-user-to-admin';
import { switchUserToTest } from './switch-user-to-test';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Node dependencies
* Internal dependencies
*/
import { switchUserToAdmin } from './switch-user-to-admin';
import { switchUserToTest } from './switch-user-to-test';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Node dependencies
* Internal dependencies
*/
import { switchUserToAdmin } from './switch-user-to-admin';
import { switchUserToTest } from './switch-user-to-test';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* Switches editor mode.
* @param {string} mode String editor mode.
*
* @param {string} mode String editor mode.
*/
export async function switchEditorModeTo( mode ) {
await page.click(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Node dependencies
* Internal dependencies
*/
import { switchUserToAdmin } from './switch-user-to-admin';
import { switchUserToTest } from './switch-user-to-test';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"testURL": "http://localhost",
"testPathIgnorePatterns": [
"/node_modules/",
"/test/e2e",
"/packages/tests-e2e",
"<rootDir>/.*/build/",
"<rootDir>/.*/build-module/"
],
Expand Down