update folder structure, use WordPress 5.4

This commit is contained in:
Ron Rennick 2020-04-28 17:14:11 -03:00
parent da494be615
commit d41fbc7ff2
57 changed files with 59 additions and 29 deletions

8
.gitignore vendored
View File

@ -42,10 +42,10 @@ tests/cli/vendor
# Unit tests
/tmp
/tests/bin/tmp
/tests/e2e-tests/config/local-*.json
/tests/e2e-tests/config/local.json
/tests/e2e-tests/docker
/tests/e2e-env/docker/wp-cli/initialize.sh
/tests/e2e/config/local-*.json
/tests/e2e/config/local.json
/tests/e2e/docker
/tests/e2e/env/docker/wp-cli/initialize.sh
# Logs
/logs

View File

@ -41,13 +41,14 @@ matrix:
php: 7.4
env: WP_VERSION=latest WP_MULTISITE=0
script:
- bash tests/e2e-env/bin/before-script-CI.sh
- bash tests/e2e/env/bin/before-script-CI.sh
- composer require wp-cli/i18n-command
- npm install
- npm run build
- npm explore @woocommerce/e2e-env -- npm run docker:up
- npm explore @woocommerce/e2e-env -- npm run test:e2e
- npm run docker:up
- npm run test:e2e
after_script:
- npm explore @woocommerce/e2e-env -- npm run docker:down
- npm run docker:down
- name: "Unit tests code coverage"
php: 7.4
env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1

View File

@ -5,10 +5,10 @@ services:
wordpress-www:
volumes:
# This path is relative to the first config file
# which is in tests/e2e-env or node_modules/@woocommerce/e2e-env
- "../../:/var/www/html/wp-content/plugins/woocommerce"
# which is in tests/e2e/env or node_modules/@woocommerce/e2e-env
- "../../../:/var/www/html/wp-content/plugins/woocommerce"
wordpress-cli:
volumes:
- "../../:/var/www/html/wp-content/plugins/woocommerce"
- "../../../:/var/www/html/wp-content/plugins/woocommerce"

33
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "woocommerce",
"version": "4.0.0",
"version": "4.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -5006,7 +5006,7 @@
}
},
"@woocommerce/e2e-env": {
"version": "file:tests/e2e-env",
"version": "file:tests/e2e/env",
"dev": true
},
"@wordpress/e2e-test-utils": {
@ -18277,6 +18277,18 @@
"requires": {
"buffer": "^5.4.3",
"whatwg-url-without-unicode": "8.0.0-1"
},
"dependencies": {
"buffer": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz",
"integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==",
"dev": true,
"requires": {
"base64-js": "^1.0.2",
"ieee754": "^1.1.4"
}
}
}
},
"read-pkg": {
@ -22431,6 +22443,23 @@
"webidl-conversions": "^4.0.2"
}
},
"whatwg-url-without-unicode": {
"version": "8.0.0-1",
"resolved": "https://registry.npmjs.org/whatwg-url-without-unicode/-/whatwg-url-without-unicode-8.0.0-1.tgz",
"integrity": "sha512-0Uy8mjsG5O8Y53327XL+ZqsrMdxO1CL/6m840SmW5iyRWFvU2zlxS2RzpD3pFFVKYOKCmsKn5JKzWxQ+bImnWA==",
"dev": true,
"requires": {
"webidl-conversions": "^5.0.0"
},
"dependencies": {
"webidl-conversions": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz",
"integrity": "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==",
"dev": true
}
}
},
"which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",

View File

@ -28,7 +28,7 @@
"@babel/preset-env": "7.9.0",
"@babel/register": "7.9.0",
"@jest/test-sequencer": "^25.0.0",
"@woocommerce/e2e-env": "file:tests/e2e-env",
"@woocommerce/e2e-env": "file:tests/e2e/env",
"@wordpress/e2e-test-utils": "4.3.1",
"autoprefixer": "9.7.5",
"babel-eslint": "10.1.0",

View File

@ -1 +0,0 @@
FROM wordpress:latest

View File

@ -84,7 +84,7 @@ module.exports = {
};
```
**NOTE:** Your project's Jest config file is expected to found at: `tests/e2e-tests/config/jest.config.js`.
**NOTE:** Your project's Jest config file is expected to found at: `tests/e2e/config/jest.config.js`.
### Webpack Config
@ -109,14 +109,14 @@ module.exports = {
The E2E environment will look for a `docker-compose.yaml` file in your project root. This will be combined with the base Docker config in the package. This is where you'll map your local project files into the Docker container(s).
```yaml
version: '3.3'
version: '3.7'
services:
wordpress-www:
volumes:
# This path is relative to the first config file
# which is in node_modules/@woocommerce/e2e-env
# which is in node_modules/@woocommerce/e2e/env
- "../../../:/var/www/html/wp-content/plugins/your-project-here"
wordpress-cli:
@ -126,7 +126,7 @@ services:
#### Docker Container Initialization Script
You can provide an initialization script that will run in the WP-CLI Docker container. Place an executable file at `tests/e2e-tests/docker/initialize.sh` in your project and it will be copied into the container and executed. While you can run any commands you wish, the intent here is to use WP-CLI to set up your testing environment. E.g.:
You can provide an initialization script that will run in the WP-CLI Docker container. Place an executable file at `tests/e2e/docker/initialize.sh` in your project and it will be copied into the container and executed. While you can run any commands you wish, the intent here is to use WP-CLI to set up your testing environment. E.g.:
```
#!/bin/bash

View File

@ -39,7 +39,7 @@ if ( appPath ) {
if ( 'up' === command ) {
// Look for an initialization script in the dependent app.
const appInitFile = path.resolve( appPath, 'tests/e2e-tests/docker/initialize.sh' );
const appInitFile = path.resolve( appPath, 'tests/e2e/docker/initialize.sh' );
// If found, copy it into the wp-cli Docker context so
// it gets picked up by the entrypoint script.

View File

@ -19,7 +19,7 @@ const nodeConfigDirs = [
if ( appPath ) {
nodeConfigDirs.unshift(
path.resolve( appPath, 'tests/e2e-tests/config' )
path.resolve( appPath, 'tests/e2e/config' )
);
}
@ -55,7 +55,7 @@ let configPath = path.resolve( __dirname, '../config/jest.config.js' );
// Look for a Jest config in the dependent app's path.
if ( appPath ) {
const appConfig = path.resolve( appPath, 'tests/e2e-tests/config/jest.config.js' );
const appConfig = path.resolve( appPath, 'tests/e2e/config/jest.config.js' );
if ( fs.existsSync( appConfig ) ) {
configPath = appConfig;

View File

@ -7,7 +7,7 @@ module.exports = {
moduleNameMapper: {
'@woocommerce/e2e-tests/(.*)':
'<rootDir>/node_modules/woocommerce/tests/e2e-tests/$1',
'<rootDir>/node_modules/woocommerce/tests/e2e/$1',
},
preset: 'jest-puppeteer',

View File

@ -19,7 +19,7 @@ let jestTimeoutInMilliSeconds = 30000;
// Use `await jestPuppeteer.debug()` in test code to pause execution.
if (
process.env.JEST_PUPPETEER_CONFIG ===
'tests/e2e-tests/config/jest-puppeteer.dev.config.js'
'tests/e2e/config/jest-puppeteer.dev.config.js'
) {
jestTimeoutInMilliSeconds = 120000;
}

View File

@ -0,0 +1 @@
FROM wordpress:5.4

View File

@ -2,15 +2,15 @@ const path = require( 'path' );
const getAppRoot = () => {
// Figure out where we're installed.
// Typically will be in node_modules/, but WooCommerce Admin
// uses a local file path (packages/e2e-env).
// Typically will be in node_modules/, but WooCommerce
// uses a local file path (tests/e2e/env).
let appPath = false;
const moduleDir = path.dirname( require.resolve( '@woocommerce/e2e-env' ) );
if ( -1 < moduleDir.indexOf( 'node_modules' ) ) {
appPath = moduleDir.split( 'node_modules' )[ 0 ];
} else if ( -1 < moduleDir.indexOf( 'tests/e2e-env' ) ) {
appPath = moduleDir.split( 'tests/e2e-env' )[ 0 ];
} else if ( -1 < moduleDir.indexOf( 'tests/e2e/env' ) ) {
appPath = moduleDir.split( 'tests/e2e/env' )[ 0 ];
}
return appPath;

View File

@ -6,6 +6,6 @@ const path = require( 'path' );
module.exports = {
'@woocommerce/e2e-tests': path.resolve(
__dirname,
'node_modules/woocommerce/tests/e2e-tests'
'node_modules/woocommerce/tests/e2e'
),
};