From 393240a0f36a5e40d0f75346deec133ed24a8b5a Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Tue, 7 Apr 2020 05:43:11 -0300 Subject: [PATCH] move e2e-env to tests/e2e-env --- .gitignore | 2 +- .travis.yml | 9 +-------- docker-compose.yaml | 6 +++--- package-lock.json | 2 +- package.json | 2 +- {assets/components => tests}/e2e-env/.env | 0 .../components => tests}/e2e-env/.eslintrc.js | 0 {assets/components => tests}/e2e-env/.npmrc | 0 .../components => tests}/e2e-env/.travis.yml | 0 .../components => tests}/e2e-env/CHANGELOG.md | 0 .../components => tests}/e2e-env/README.md | 0 .../e2e-env/babel.config.js | 0 .../e2e-env/bin/docker-compose.js | 0 .../e2e-env/bin/e2e-test-integration.js | 0 .../e2e-env/bin/install-wp-tests.sh | 0 .../e2e-env/config/default.json | 0 .../e2e-env/config/env.setup.js | 0 .../e2e-env/config/jest-custom-sequencer.js | 0 .../e2e-env/config/jest-puppeteer.config.js | 0 .../config/jest-puppeteer.dev.config.js | 0 .../e2e-env/config/jest.config.js | 0 .../e2e-env/config/jest.setup.js | 0 .../e2e-env/config/test:e2e.json | 0 .../e2e-env/docker-compose.yaml | 0 .../e2e-env/docker/wordpress/Dockerfile | 0 .../e2e-env/docker/wp-cli/Dockerfile | 0 .../e2e-env/docker/wp-cli/entrypoint.sh | 0 .../e2e-env/docker/wp-cli/wait-for-it.sh | 0 {assets/components => tests}/e2e-env/index.js | 0 .../components => tests}/e2e-env/package.json | 6 +++--- .../e2e-env/utils/app-root.js | 4 ++-- .../e2e-env/utils/index.js | 0 .../e2e-env/webpack-alias.js | 0 tests/e2e-tests/config/jest.config.js | 20 +++++++------------ webpack.config.js | 9 +++++++++ 35 files changed, 28 insertions(+), 32 deletions(-) rename {assets/components => tests}/e2e-env/.env (100%) rename {assets/components => tests}/e2e-env/.eslintrc.js (100%) rename {assets/components => tests}/e2e-env/.npmrc (100%) rename {assets/components => tests}/e2e-env/.travis.yml (100%) rename {assets/components => tests}/e2e-env/CHANGELOG.md (100%) rename {assets/components => tests}/e2e-env/README.md (100%) rename {assets/components => tests}/e2e-env/babel.config.js (100%) rename {assets/components => tests}/e2e-env/bin/docker-compose.js (100%) rename {assets/components => tests}/e2e-env/bin/e2e-test-integration.js (100%) rename {assets/components => tests}/e2e-env/bin/install-wp-tests.sh (100%) rename {assets/components => tests}/e2e-env/config/default.json (100%) rename {assets/components => tests}/e2e-env/config/env.setup.js (100%) rename {assets/components => tests}/e2e-env/config/jest-custom-sequencer.js (100%) rename {assets/components => tests}/e2e-env/config/jest-puppeteer.config.js (100%) rename {assets/components => tests}/e2e-env/config/jest-puppeteer.dev.config.js (100%) rename {assets/components => tests}/e2e-env/config/jest.config.js (100%) rename {assets/components => tests}/e2e-env/config/jest.setup.js (100%) rename {assets/components => tests}/e2e-env/config/test:e2e.json (100%) rename {assets/components => tests}/e2e-env/docker-compose.yaml (100%) rename {assets/components => tests}/e2e-env/docker/wordpress/Dockerfile (100%) rename {assets/components => tests}/e2e-env/docker/wp-cli/Dockerfile (100%) rename {assets/components => tests}/e2e-env/docker/wp-cli/entrypoint.sh (100%) rename {assets/components => tests}/e2e-env/docker/wp-cli/wait-for-it.sh (100%) rename {assets/components => tests}/e2e-env/index.js (100%) rename {assets/components => tests}/e2e-env/package.json (84%) rename {assets/components => tests}/e2e-env/utils/app-root.js (77%) rename {assets/components => tests}/e2e-env/utils/index.js (100%) rename {assets/components => tests}/e2e-env/webpack-alias.js (100%) create mode 100644 webpack.config.js diff --git a/.gitignore b/.gitignore index 62d889ee067f9..4a049bd4d19b2 100644 --- a/.gitignore +++ b/.gitignore @@ -45,7 +45,7 @@ tests/cli/vendor /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 +/tests/e2e-env/docker/wp-cli/initialize.sh # Logs /logs diff --git a/.travis.yml b/.travis.yml index b3d59d61213d0..17430239e30d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ version: ~> 1.0 import: # This path will differ for projects using the published package. - - source: assets/components/e2e-env/.travis.yml + - source: tests/e2e-env/.travis.yml # Merge the package config first. mode: deep_merge_prepend @@ -45,13 +45,6 @@ matrix: env: WP_VERSION=latest WP_MULTISITE=0 RUN_PHPCS=1 - name: "E2E tests" php: 7.4 - script: - - composer require wp-cli/i18n-command - - npm run build - - npm explore @woocommerce/e2e-env -- npm run docker:up - - bash tests/bin/run-e2e-CI.sh - after_script: - - 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 diff --git a/docker-compose.yaml b/docker-compose.yaml index d4c132ee99e7b..cbb25e81840fe 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -5,10 +5,10 @@ services: wordpress-www: volumes: # 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" + # 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" diff --git a/package-lock.json b/package-lock.json index bdf6acace44e3..0fac200d87862 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4830,7 +4830,7 @@ } }, "@woocommerce/e2e-env": { - "version": "file:assets/components/e2e-env", + "version": "file:tests/e2e-env", "dev": true }, "@wordpress/e2e-test-utils": { diff --git a/package.json b/package.json index 7977123edac4d..957c7e4f8ced9 100644 --- a/package.json +++ b/package.json @@ -26,7 +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", + "@woocommerce/e2e-env": "file:tests/e2e-env", "@wordpress/e2e-test-utils": "4.3.1", "autoprefixer": "9.7.5", "babel-eslint": "10.1.0", diff --git a/assets/components/e2e-env/.env b/tests/e2e-env/.env similarity index 100% rename from assets/components/e2e-env/.env rename to tests/e2e-env/.env diff --git a/assets/components/e2e-env/.eslintrc.js b/tests/e2e-env/.eslintrc.js similarity index 100% rename from assets/components/e2e-env/.eslintrc.js rename to tests/e2e-env/.eslintrc.js diff --git a/assets/components/e2e-env/.npmrc b/tests/e2e-env/.npmrc similarity index 100% rename from assets/components/e2e-env/.npmrc rename to tests/e2e-env/.npmrc diff --git a/assets/components/e2e-env/.travis.yml b/tests/e2e-env/.travis.yml similarity index 100% rename from assets/components/e2e-env/.travis.yml rename to tests/e2e-env/.travis.yml diff --git a/assets/components/e2e-env/CHANGELOG.md b/tests/e2e-env/CHANGELOG.md similarity index 100% rename from assets/components/e2e-env/CHANGELOG.md rename to tests/e2e-env/CHANGELOG.md diff --git a/assets/components/e2e-env/README.md b/tests/e2e-env/README.md similarity index 100% rename from assets/components/e2e-env/README.md rename to tests/e2e-env/README.md diff --git a/assets/components/e2e-env/babel.config.js b/tests/e2e-env/babel.config.js similarity index 100% rename from assets/components/e2e-env/babel.config.js rename to tests/e2e-env/babel.config.js diff --git a/assets/components/e2e-env/bin/docker-compose.js b/tests/e2e-env/bin/docker-compose.js similarity index 100% rename from assets/components/e2e-env/bin/docker-compose.js rename to tests/e2e-env/bin/docker-compose.js diff --git a/assets/components/e2e-env/bin/e2e-test-integration.js b/tests/e2e-env/bin/e2e-test-integration.js similarity index 100% rename from assets/components/e2e-env/bin/e2e-test-integration.js rename to tests/e2e-env/bin/e2e-test-integration.js diff --git a/assets/components/e2e-env/bin/install-wp-tests.sh b/tests/e2e-env/bin/install-wp-tests.sh similarity index 100% rename from assets/components/e2e-env/bin/install-wp-tests.sh rename to tests/e2e-env/bin/install-wp-tests.sh diff --git a/assets/components/e2e-env/config/default.json b/tests/e2e-env/config/default.json similarity index 100% rename from assets/components/e2e-env/config/default.json rename to tests/e2e-env/config/default.json diff --git a/assets/components/e2e-env/config/env.setup.js b/tests/e2e-env/config/env.setup.js similarity index 100% rename from assets/components/e2e-env/config/env.setup.js rename to tests/e2e-env/config/env.setup.js diff --git a/assets/components/e2e-env/config/jest-custom-sequencer.js b/tests/e2e-env/config/jest-custom-sequencer.js similarity index 100% rename from assets/components/e2e-env/config/jest-custom-sequencer.js rename to tests/e2e-env/config/jest-custom-sequencer.js diff --git a/assets/components/e2e-env/config/jest-puppeteer.config.js b/tests/e2e-env/config/jest-puppeteer.config.js similarity index 100% rename from assets/components/e2e-env/config/jest-puppeteer.config.js rename to tests/e2e-env/config/jest-puppeteer.config.js diff --git a/assets/components/e2e-env/config/jest-puppeteer.dev.config.js b/tests/e2e-env/config/jest-puppeteer.dev.config.js similarity index 100% rename from assets/components/e2e-env/config/jest-puppeteer.dev.config.js rename to tests/e2e-env/config/jest-puppeteer.dev.config.js diff --git a/assets/components/e2e-env/config/jest.config.js b/tests/e2e-env/config/jest.config.js similarity index 100% rename from assets/components/e2e-env/config/jest.config.js rename to tests/e2e-env/config/jest.config.js diff --git a/assets/components/e2e-env/config/jest.setup.js b/tests/e2e-env/config/jest.setup.js similarity index 100% rename from assets/components/e2e-env/config/jest.setup.js rename to tests/e2e-env/config/jest.setup.js diff --git a/assets/components/e2e-env/config/test:e2e.json b/tests/e2e-env/config/test:e2e.json similarity index 100% rename from assets/components/e2e-env/config/test:e2e.json rename to tests/e2e-env/config/test:e2e.json diff --git a/assets/components/e2e-env/docker-compose.yaml b/tests/e2e-env/docker-compose.yaml similarity index 100% rename from assets/components/e2e-env/docker-compose.yaml rename to tests/e2e-env/docker-compose.yaml diff --git a/assets/components/e2e-env/docker/wordpress/Dockerfile b/tests/e2e-env/docker/wordpress/Dockerfile similarity index 100% rename from assets/components/e2e-env/docker/wordpress/Dockerfile rename to tests/e2e-env/docker/wordpress/Dockerfile diff --git a/assets/components/e2e-env/docker/wp-cli/Dockerfile b/tests/e2e-env/docker/wp-cli/Dockerfile similarity index 100% rename from assets/components/e2e-env/docker/wp-cli/Dockerfile rename to tests/e2e-env/docker/wp-cli/Dockerfile diff --git a/assets/components/e2e-env/docker/wp-cli/entrypoint.sh b/tests/e2e-env/docker/wp-cli/entrypoint.sh similarity index 100% rename from assets/components/e2e-env/docker/wp-cli/entrypoint.sh rename to tests/e2e-env/docker/wp-cli/entrypoint.sh diff --git a/assets/components/e2e-env/docker/wp-cli/wait-for-it.sh b/tests/e2e-env/docker/wp-cli/wait-for-it.sh similarity index 100% rename from assets/components/e2e-env/docker/wp-cli/wait-for-it.sh rename to tests/e2e-env/docker/wp-cli/wait-for-it.sh diff --git a/assets/components/e2e-env/index.js b/tests/e2e-env/index.js similarity index 100% rename from assets/components/e2e-env/index.js rename to tests/e2e-env/index.js diff --git a/assets/components/e2e-env/package.json b/tests/e2e-env/package.json similarity index 84% rename from assets/components/e2e-env/package.json rename to tests/e2e-env/package.json index ff443e05b87fe..01953ccbe9389 100644 --- a/assets/components/e2e-env/package.json +++ b/tests/e2e-env/package.json @@ -10,13 +10,13 @@ "e2e", "puppeteer" ], - "homepage": "https://github.com/woocommerce/woocommerce-admin/tree/master/packages/e2e-env/README.md", + "homepage": "https://github.com/woocommerce/woocommerce/tree/master/tests/e2e-env/README.md", "repository": { "type": "git", - "url": "https://github.com/woocommerce/woocommerce-admin.git" + "url": "https://github.com/woocommerce/woocommerce.git" }, "bugs": { - "url": "https://github.com/woocommerce/woocommerce-admin/issues" + "url": "https://github.com/woocommerce/woocommerce/issues" }, "main": "index.js", "devDependencies": { diff --git a/assets/components/e2e-env/utils/app-root.js b/tests/e2e-env/utils/app-root.js similarity index 77% rename from assets/components/e2e-env/utils/app-root.js rename to tests/e2e-env/utils/app-root.js index a829a0eec892d..f0a681796aafd 100644 --- a/assets/components/e2e-env/utils/app-root.js +++ b/tests/e2e-env/utils/app-root.js @@ -9,8 +9,8 @@ const getAppRoot = () => { if ( -1 < moduleDir.indexOf( 'node_modules' ) ) { appPath = moduleDir.split( 'node_modules' )[ 0 ]; - } else if ( -1 < moduleDir.indexOf( 'assets/components/e2e-env' ) ) { - appPath = moduleDir.split( 'assets/components/e2e-env' )[ 0 ]; + } else if ( -1 < moduleDir.indexOf( 'tests/e2e-env' ) ) { + appPath = moduleDir.split( 'tests/e2e-env' )[ 0 ]; } return appPath; diff --git a/assets/components/e2e-env/utils/index.js b/tests/e2e-env/utils/index.js similarity index 100% rename from assets/components/e2e-env/utils/index.js rename to tests/e2e-env/utils/index.js diff --git a/assets/components/e2e-env/webpack-alias.js b/tests/e2e-env/webpack-alias.js similarity index 100% rename from assets/components/e2e-env/webpack-alias.js rename to tests/e2e-env/webpack-alias.js diff --git a/tests/e2e-tests/config/jest.config.js b/tests/e2e-tests/config/jest.config.js index 96ea52f490776..b09817aeddfff 100644 --- a/tests/e2e-tests/config/jest.config.js +++ b/tests/e2e-tests/config/jest.config.js @@ -1,14 +1,8 @@ -/** - * External dependencies - */ -const { jestConfig } = require( 'puppeteer-utils' ); -const modifiedConfig = jestConfig; -const afterEnvSetup = modifiedConfig.setupFilesAfterEnv; +const path = require( 'path' ); +const { jestConfig: baseE2Econfig } = require( '@woocommerce/e2e-env' ); -afterEnvSetup.push( '/tests/e2e-tests/config/jest.setup.js'); -modifiedConfig.setupFilesAfterEnv = afterEnvSetup; - -// Sort test path alphabetically. This is needed so that `activate-and-setup` tests run first -modifiedConfig.testSequencer = '/tests/e2e-tests/config/jest-custom-sequencer.js'; - -module.exports = modifiedConfig; +module.exports = { + ...baseE2Econfig, + // Specify the path of your project's E2E tests here. + roots: [ path.resolve( __dirname, '../specs' ) ], +}; diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000000000..a4d39295d63ad --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,9 @@ +const { webpackAlias: coreE2EAlias } = require( '@woocommerce/e2e-env' ); + +module.exports = { + resolve: { + alias: { + ...coreE2EAlias, + }, + }, +};