Skip to content

Commit

Permalink
merge config from from woocommerce/woocommerce-admin#3717
Browse files Browse the repository at this point in the history
  • Loading branch information
rrennick authored and jeffstieler committed Apr 14, 2020
1 parent c8d643b commit c414edd
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 104 deletions.
40 changes: 0 additions & 40 deletions .eslintrc

This file was deleted.

35 changes: 35 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ tests/cli/vendor
/tests/bin/tmp
/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
Expand Down
12 changes: 10 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
dist: xenial

Expand Down Expand Up @@ -40,10 +48,10 @@ matrix:
script:
- composer require wp-cli/i18n-command
- npm run build
- docker-compose up --build -d
- npm explore @woocommerce/e2e-env -- npm run docker:up
- bash tests/bin/run-e2e-CI.sh
after_script:
- docker-compose down -v
- npm explore @woocommerce/e2e-env -- npm run docker:down
- name: "Unit tests code coverage"
php: 7.4
env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1
Expand Down
2 changes: 1 addition & 1 deletion assets/components/e2e-env/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.3'
version: '3.7'

services:

Expand Down
4 changes: 2 additions & 2 deletions assets/components/e2e-env/utils/app-root.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const getAppRoot = () => {

if ( -1 < moduleDir.indexOf( 'node_modules' ) ) {
appPath = moduleDir.split( 'node_modules' )[ 0 ];
} else if ( -1 < moduleDir.indexOf( 'packages/e2e-env' ) ) {
appPath = moduleDir.split( 'packages/e2e-env' )[ 0 ];
} else if ( -1 < moduleDir.indexOf( 'assets/components/e2e-env' ) ) {
appPath = moduleDir.split( 'assets/components/e2e-env' )[ 0 ];
}

return appPath;
Expand Down
19 changes: 8 additions & 11 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
const e2eBabelConfig = require( '@woocommerce/e2e-env' ).babelConfig;

module.exports = function( api ) {
api.cache( true );

return {
...e2eBabelConfig,
};
};
53 changes: 5 additions & 48 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,13 @@ version: '3.7'

services:

db:
image: mariadb:10.5
restart: on-failure
environment:
MYSQL_DATABASE: testdb
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
wordpress-www:
volumes:
- db:/var/lib/mysql

wordpress-woocommerce-dev:
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
# This path is relative to the first config file
# which is in assets/components/e2e-env or node_modules/@woocommerce/e2e-env
- "../../../:/var/www/html/wp-content/plugins/woocommerce"

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 [email protected] --path=/var/www/html --skip-email;
wp plugin activate woocommerce;
wp theme install twentynineteen --activate;
wp user create customer [email protected] --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:
- "./:/var/www/html/wp-content/plugins/woocommerce"
- wordpress:/var/www/html
- "../../../:/var/www/html/wp-content/plugins/woocommerce"

volumes:
db:
wordpress:
4 changes: 4 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@babel/preset-env": "7.9.0",
"@babel/register": "7.9.0",
"@jest/test-sequencer": "^25.0.0",
"@woocommerce/e2e-env": "file:assets/components/e2e-env",
"@wordpress/e2e-test-utils": "4.3.1",
"autoprefixer": "9.7.5",
"babel-eslint": "10.1.0",
Expand Down
8 changes: 8 additions & 0 deletions tests/e2e-tests/docker/initialize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

echo "Initializing WooCommerce E2E"

wp plugin install woocommerce --activate
wp theme install twentynineteen --activate
wp user create customer [email protected] --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.'

0 comments on commit c414edd

Please sign in to comment.