This commit is contained in:
Ron Rennick 2020-04-02 14:34:00 -03:00 committed by Jeff Stieler
parent c8d643b4ac
commit c414eddf59
11 changed files with 76 additions and 104 deletions

View File

@ -1,40 +0,0 @@
{
"root": true,
"env": {
"browser": true,
"es6": true,
"node": true,
"jest/globals": true
},
"globals": {
"wp": true,
"wpApiSettings": true,
"wcSettings": true,
"es6": true,
"page": true,
"browser": true,
"context": true,
"jestPuppeteer": true
},
"rules": {
"camelcase": 0,
"indent": 0,
"max-len": [ 2, { "code": 140 } ],
"no-console": 1
},
"plugins": [
"jest"
],
"extends": [
"plugin:jest/recommended"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 8,
"ecmaFeatures": {
"modules": true,
"experimentalObjectRestSpread": true,
"jsx": true
}
}
}

35
.eslintrc.js Normal file
View File

@ -0,0 +1,35 @@
/** @format */
const baseConfig = require( '@woocommerce/e2e-env' ).esLintConfig;
module.exports = {
...baseConfig,
root: true,
env: {
...baseConfig.env,
browser: true,
es6: true,
node: true
},
globals: {
...baseConfig.globals,
wp: true,
wpApiSettings: true,
wcSettings: true,
es6: true
},
rules: {
camelcase: 0,
indent: 0,
'max-len': [ 2, { 'code': 140 } ],
'no-console': 1
},
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 8,
ecmaFeatures: {
modules: true,
experimentalObjectRestSpread: true,
jsx: true
}
},
};

2
.gitignore vendored
View File

@ -44,6 +44,8 @@ tests/cli/vendor
/tests/bin/tmp /tests/bin/tmp
/tests/e2e-tests/config/local-*.json /tests/e2e-tests/config/local-*.json
/tests/e2e-tests/config/local.json /tests/e2e-tests/config/local.json
/tests/e2e-tests/docker
/assets/components/e2e-env/docker/wp-cli/initialize.sh
# Logs # Logs
/logs /logs

View File

@ -1,3 +1,11 @@
version: ~> 1.0
import:
# This path will differ for projects using the published package.
- source: assets/components/e2e-env/.travis.yml
# Merge the package config first.
mode: deep_merge_prepend
language: php language: php
dist: xenial dist: xenial
@ -40,10 +48,10 @@ matrix:
script: script:
- composer require wp-cli/i18n-command - composer require wp-cli/i18n-command
- npm run build - npm run build
- docker-compose up --build -d - npm explore @woocommerce/e2e-env -- npm run docker:up
- bash tests/bin/run-e2e-CI.sh - bash tests/bin/run-e2e-CI.sh
after_script: after_script:
- docker-compose down -v - npm explore @woocommerce/e2e-env -- npm run docker:down
- name: "Unit tests code coverage" - name: "Unit tests code coverage"
php: 7.4 php: 7.4
env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1 env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1

View File

@ -1,4 +1,4 @@
version: '3.3' version: '3.7'
services: services:

View File

@ -9,8 +9,8 @@ const getAppRoot = () => {
if ( -1 < moduleDir.indexOf( 'node_modules' ) ) { if ( -1 < moduleDir.indexOf( 'node_modules' ) ) {
appPath = moduleDir.split( 'node_modules' )[ 0 ]; appPath = moduleDir.split( 'node_modules' )[ 0 ];
} else if ( -1 < moduleDir.indexOf( 'packages/e2e-env' ) ) { } else if ( -1 < moduleDir.indexOf( 'assets/components/e2e-env' ) ) {
appPath = moduleDir.split( 'packages/e2e-env' )[ 0 ]; appPath = moduleDir.split( 'assets/components/e2e-env' )[ 0 ];
} }
return appPath; return appPath;

View File

@ -1,12 +1,9 @@
module.exports = { const e2eBabelConfig = require( '@woocommerce/e2e-env' ).babelConfig;
presets: [
[ module.exports = function( api ) {
'@babel/preset-env', api.cache( true );
{
targets: { return {
node: 'current', ...e2eBabelConfig,
}, };
},
],
],
}; };

View File

@ -2,56 +2,13 @@ version: '3.7'
services: services:
db: wordpress-www:
image: mariadb:10.5
restart: on-failure
environment:
MYSQL_DATABASE: testdb
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
volumes: volumes:
- db:/var/lib/mysql # This path is relative to the first config file
# which is in assets/components/e2e-env or node_modules/@woocommerce/e2e-env
wordpress-woocommerce-dev: - "../../../:/var/www/html/wp-content/plugins/woocommerce"
depends_on:
- db
build:
context: .
dockerfile: Dockerfile
ports:
- 8084:80
restart: on-failure
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: testdb
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_TABLE_PREFIX: "wp_"
WORDPRESS_DEBUG: 1
volumes:
- "./:/var/www/html/wp-content/plugins/woocommerce"
- wordpress:/var/www/html
wordpress-cli: wordpress-cli:
depends_on:
- db
- wordpress-woocommerce-dev
image: wordpress:cli
restart: on-failure
user: xfs
command: >
/bin/sh -c '
wp core install --url=http://localhost:8084 --title="WooCommerce Core E2E Test Suite" --admin_user=admin --admin_password=password --admin_email=admin@woocommercecoree2etestsuite.com --path=/var/www/html --skip-email;
wp plugin activate woocommerce;
wp theme install twentynineteen --activate;
wp user create customer customer@woocommercecoree2etestsuite.com --user_pass=password --role=customer --path=/var/www/html;
wp post create --post_type=page --post_status=publish --post_title='Ready' --post_content='E2E-tests.';
'
volumes: volumes:
- "./:/var/www/html/wp-content/plugins/woocommerce" - "../../../:/var/www/html/wp-content/plugins/woocommerce"
- wordpress:/var/www/html
volumes:
db:
wordpress:

4
package-lock.json generated
View File

@ -4829,6 +4829,10 @@
} }
} }
}, },
"@woocommerce/e2e-env": {
"version": "file:assets/components/e2e-env",
"dev": true
},
"@wordpress/e2e-test-utils": { "@wordpress/e2e-test-utils": {
"version": "4.3.1", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@wordpress/e2e-test-utils/-/e2e-test-utils-4.3.1.tgz", "resolved": "https://registry.npmjs.org/@wordpress/e2e-test-utils/-/e2e-test-utils-4.3.1.tgz",

View File

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

View File

@ -0,0 +1,8 @@
#!/bin/bash
echo "Initializing WooCommerce E2E"
wp plugin install woocommerce --activate
wp theme install twentynineteen --activate
wp user create customer customer@woocommercecoree2etestsuite.com --user_pass=password --role=customer --path=/var/www/html
wp post create --post_type=page --post_status=publish --post_title='Ready' --post_content='E2E-tests.'