Updated `wp-env` To 8.0.0 (#38440)
This commit is contained in:
parent
f3a515889c
commit
230bc04050
|
@ -21,7 +21,7 @@ jobs:
|
||||||
- name: Install prerequisites
|
- name: Install prerequisites
|
||||||
run: |
|
run: |
|
||||||
npm install -g pnpm
|
npm install -g pnpm
|
||||||
npm -g i @wordpress/env@5.1.0
|
npm -g i @wordpress/env@8.0.0
|
||||||
pnpm install --filter code-analyzer --filter monorepo-utils
|
pnpm install --filter code-analyzer --filter monorepo-utils
|
||||||
- name: Run analyzer
|
- name: Run analyzer
|
||||||
id: run
|
id: run
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
cd $GITHUB_WORKSPACE/plugins/woocommerce
|
cd $GITHUB_WORKSPACE/plugins/woocommerce
|
||||||
ACTUAL_PHP_VERSION=$(pnpm exec wp-env run tests-cli "wp --info | grep 'PHP version:'")
|
ACTUAL_PHP_VERSION=$(pnpm exec wp-env run tests-cli wp --info | grep 'PHP version:')
|
||||||
EXIT_CODE=''
|
EXIT_CODE=''
|
||||||
|
|
||||||
echo "PHP version found in WP Env environment: \"$ACTUAL_PHP_VERSION\""
|
echo "PHP version found in WP Env environment: \"$ACTUAL_PHP_VERSION\""
|
||||||
|
|
|
@ -385,16 +385,16 @@ jobs:
|
||||||
- name: Downgrade WordPress version to ${{ matrix.version.number }}
|
- name: Downgrade WordPress version to ${{ matrix.version.number }}
|
||||||
working-directory: plugins/woocommerce
|
working-directory: plugins/woocommerce
|
||||||
run: |
|
run: |
|
||||||
pnpm exec wp-env run tests-cli "wp core update --version=${{ matrix.version.number }} --force"
|
pnpm exec wp-env run tests-cli -- wp core update --version=${{ matrix.version.number }} --force
|
||||||
pnpm exec wp-env run tests-cli "wp core update-db"
|
pnpm exec wp-env run tests-cli wp core update-db
|
||||||
|
|
||||||
- name: Verify environment details
|
- name: Verify environment details
|
||||||
working-directory: plugins/woocommerce
|
working-directory: plugins/woocommerce
|
||||||
run: |
|
run: |
|
||||||
pnpm exec wp-env run tests-cli "wp core version"
|
pnpm exec wp-env run tests-cli wp core version
|
||||||
pnpm exec wp-env run tests-cli "wp plugin list"
|
pnpm exec wp-env run tests-cli wp plugin list
|
||||||
pnpm exec wp-env run tests-cli "wp theme list"
|
pnpm exec wp-env run tests-cli wp theme list
|
||||||
pnpm exec wp-env run tests-cli "wp user list"
|
pnpm exec wp-env run tests-cli wp user list
|
||||||
|
|
||||||
- name: Run API tests
|
- name: Run API tests
|
||||||
id: run-api-composite-action
|
id: run-api-composite-action
|
||||||
|
|
|
@ -122,7 +122,7 @@
|
||||||
"packages": [
|
"packages": [
|
||||||
"**"
|
"**"
|
||||||
],
|
],
|
||||||
"pinVersion": "^7.0.0"
|
"pinVersion": "^8.0.0"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.17.5",
|
"@babel/core": "^7.17.5",
|
||||||
"@testing-library/react": "^12.1.3",
|
"@testing-library/react": "^12.1.3",
|
||||||
"@types/string-similarity" : "4.0.0",
|
"@types/string-similarity": "4.0.0",
|
||||||
"@types/wordpress__components": "^19.10.3",
|
"@types/wordpress__components": "^19.10.3",
|
||||||
"@types/wordpress__data": "^6.0.0",
|
"@types/wordpress__data": "^6.0.0",
|
||||||
"@types/jest": "^27.4.1",
|
"@types/jest": "^27.4.1",
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
"@types/wordpress__components": "^19.10.3",
|
"@types/wordpress__components": "^19.10.3",
|
||||||
"@woocommerce/dependency-extraction-webpack-plugin": "workspace:*",
|
"@woocommerce/dependency-extraction-webpack-plugin": "workspace:*",
|
||||||
"@woocommerce/eslint-plugin": "workspace:*",
|
"@woocommerce/eslint-plugin": "workspace:*",
|
||||||
"@wordpress/env": "^7.0.0",
|
"@wordpress/env": "^8.0.0",
|
||||||
"@wordpress/prettier-config": "^2.5.0",
|
"@wordpress/prettier-config": "^2.5.0",
|
||||||
"@wordpress/scripts": "^19.2.4",
|
"@wordpress/scripts": "^19.2.4",
|
||||||
"eslint": "^8.32.0",
|
"eslint": "^8.32.0",
|
||||||
|
|
|
@ -12,7 +12,10 @@
|
||||||
"mappings": {
|
"mappings": {
|
||||||
"wp-cli.yml": "./tests/wp-cli.yml"
|
"wp-cli.yml": "./tests/wp-cli.yml"
|
||||||
},
|
},
|
||||||
"afterSetup": "./tests/e2e-pw/bin/test-env-setup.sh",
|
"lifecycleScripts": {
|
||||||
|
"afterStart": "./tests/e2e-pw/bin/test-env-setup.sh",
|
||||||
|
"afterClean": "./tests/e2e-pw/bin/test-env-setup.sh"
|
||||||
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"development": {},
|
"development": {},
|
||||||
"tests": {
|
"tests": {
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
|
@ -31,13 +31,13 @@
|
||||||
"docker:up": "pnpm exec wc-e2e docker:up",
|
"docker:up": "pnpm exec wc-e2e docker:up",
|
||||||
"env:dev": "pnpm wp-env start --update",
|
"env:dev": "pnpm wp-env start --update",
|
||||||
"update-wp-env": "php ./tests/e2e-pw/bin/update-wp-env.php",
|
"update-wp-env": "php ./tests/e2e-pw/bin/update-wp-env.php",
|
||||||
"env:test": "WP_ENV_AFTER_SETUP='./tests/e2e-pw/bin/test-env-setup.sh' && pnpm run env:dev",
|
"env:test": "WP_ENV_LIFECYCLE_SCRIPT_AFTER_START='./tests/e2e-pw/bin/test-env-setup.sh' && pnpm run env:dev",
|
||||||
"test:e2e-pw": "USE_WP_ENV=1 pnpm playwright test --config=tests/e2e-pw/playwright.config.js",
|
"test:e2e-pw": "USE_WP_ENV=1 pnpm playwright test --config=tests/e2e-pw/playwright.config.js",
|
||||||
"test:api-pw": "USE_WP_ENV=1 pnpm playwright test --config=tests/api-core-tests/playwright.config.js",
|
"test:api-pw": "USE_WP_ENV=1 pnpm playwright test --config=tests/api-core-tests/playwright.config.js",
|
||||||
"env:start": "pnpm wp-env start",
|
"env:start": "pnpm wp-env start",
|
||||||
"env:restart": "pnpm wp-env destroy && pnpm wp-env start --update",
|
"env:restart": "pnpm wp-env destroy && pnpm wp-env start --update",
|
||||||
"env:stop": "pnpm wp-env stop",
|
"env:stop": "pnpm wp-env stop",
|
||||||
"env:test:cot": "WP_ENV_AFTER_SETUP='ENABLE_HPOS=1 ./tests/e2e-pw/bin/test-env-setup.sh' && ENABLE_HPOS=1 pnpm run env:dev",
|
"env:test:cot": "WP_ENV_LIFECYCLE_SCRIPT_AFTER_START='ENABLE_HPOS=1 ./tests/e2e-pw/bin/test-env-setup.sh' && ENABLE_HPOS=1 pnpm run env:dev",
|
||||||
"env:performance-init": "./tests/performance/bin/init-sample-products.sh",
|
"env:performance-init": "./tests/performance/bin/init-sample-products.sh",
|
||||||
"env:down": "pnpm wp-env stop",
|
"env:down": "pnpm wp-env stop",
|
||||||
"env:destroy": "pnpm wp-env destroy",
|
"env:destroy": "pnpm wp-env destroy",
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
"@woocommerce/woocommerce-rest-api": "^1.0.1",
|
"@woocommerce/woocommerce-rest-api": "^1.0.1",
|
||||||
"@wordpress/babel-plugin-import-jsx-pragma": "1.1.3",
|
"@wordpress/babel-plugin-import-jsx-pragma": "1.1.3",
|
||||||
"@wordpress/babel-preset-default": "3.0.2",
|
"@wordpress/babel-preset-default": "3.0.2",
|
||||||
"@wordpress/env": "^7.0.0",
|
"@wordpress/env": "^8.0.0",
|
||||||
"@wordpress/stylelint-config": "19.1.0",
|
"@wordpress/stylelint-config": "19.1.0",
|
||||||
"allure-commandline": "^2.17.2",
|
"allure-commandline": "^2.17.2",
|
||||||
"allure-playwright": "^2.0.0-beta.16",
|
"allure-playwright": "^2.0.0-beta.16",
|
||||||
|
|
|
@ -5,37 +5,36 @@ ENABLE_NEW_PRODUCT_EDITOR="${ENABLE_NEW_PRODUCT_EDITOR:-0}"
|
||||||
ENABLE_TRACKING="${ENABLE_TRACKING:-0}"
|
ENABLE_TRACKING="${ENABLE_TRACKING:-0}"
|
||||||
|
|
||||||
echo -e 'Activate twentynineteen theme \n'
|
echo -e 'Activate twentynineteen theme \n'
|
||||||
wp-env run tests-cli "wp theme activate twentynineteen"
|
wp-env run tests-cli wp theme activate twentynineteen
|
||||||
|
|
||||||
echo -e 'Update URL structure \n'
|
echo -e 'Update URL structure \n'
|
||||||
wp-env run tests-cli "wp rewrite structure '/%postname%/' --hard"
|
wp-env run tests-cli wp rewrite structure '/%postname%/' --hard
|
||||||
|
|
||||||
echo -e 'Add Customer user \n'
|
echo -e 'Add Customer user \n'
|
||||||
wp-env run tests-cli "wp user create customer customer@woocommercecoree2etestsuite.com \
|
wp-env run tests-cli wp user create customer customer@woocommercecoree2etestsuite.com \
|
||||||
--user_pass=password \
|
--user_pass=password \
|
||||||
--role=subscriber \
|
--role=subscriber \
|
||||||
--first_name='Jane' \
|
--first_name='Jane' \
|
||||||
--last_name='Smith' \
|
--last_name='Smith' \
|
||||||
--user_registered='2022-01-01 12:23:45'"
|
--user_registered='2022-01-01 12:23:45'
|
||||||
|
|
||||||
echo -e 'Update Blog Name \n'
|
echo -e 'Update Blog Name \n'
|
||||||
wp-env run tests-cli "wp option update blogname 'WooCommerce Core E2E Test Suite'"
|
wp-env run tests-cli wp option update blogname 'WooCommerce Core E2E Test Suite'
|
||||||
|
|
||||||
echo -e 'Preparing Test Files \n'
|
echo -e 'Preparing Test Files \n'
|
||||||
wp-env run tests-cli "sudo cp /var/www/html/wp-content/plugins/woocommerce/tests/legacy/unit-tests/importer/sample.csv \
|
wp-env run tests-cli sudo cp /var/www/html/wp-content/plugins/woocommerce/tests/legacy/unit-tests/importer/sample.csv /var/www/sample.csv
|
||||||
/var/www/sample.csv"
|
|
||||||
|
|
||||||
if [ $ENABLE_HPOS == 1 ]; then
|
if [ $ENABLE_HPOS == 1 ]; then
|
||||||
echo -e 'Enable High-Performance Order Tables\n'
|
echo -e 'Enable High-Performance Order Tables\n'
|
||||||
wp-env run tests-cli "wp plugin install https://gist.github.com/vedanshujain/564afec8f5e9235a1257994ed39b1449/archive/b031465052fc3e04b17624acbeeb2569ef4d5301.zip --activate"
|
wp-env run tests-cli wp plugin install https://gist.github.com/vedanshujain/564afec8f5e9235a1257994ed39b1449/archive/b031465052fc3e04b17624acbeeb2569ef4d5301.zip --activate
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $ENABLE_NEW_PRODUCT_EDITOR == 1 ]; then
|
if [ $ENABLE_NEW_PRODUCT_EDITOR == 1 ]; then
|
||||||
echo -e 'Enable the new product editor feature\n'
|
echo -e 'Enable the new product editor feature\n'
|
||||||
wp-env run tests-cli "wp plugin install https://github.com/woocommerce/woocommerce-experimental-enable-new-product-editor/releases/download/0.1.0/woocommerce-experimental-enable-new-product-editor.zip --activate"
|
wp-env run tests-cli wp plugin install https://github.com/woocommerce/woocommerce-experimental-enable-new-product-editor/releases/download/0.1.0/woocommerce-experimental-enable-new-product-editor.zip --activate
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $ENABLE_TRACKING == 1 ]; then
|
if [ $ENABLE_TRACKING == 1 ]; then
|
||||||
echo -e 'Enable tracking\n'
|
echo -e 'Enable tracking\n'
|
||||||
wp-env run tests-cli "wp option update woocommerce_allow_tracking 'yes'"
|
wp-env run tests-cli wp option update woocommerce_allow_tracking 'yes'
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -238,7 +238,7 @@ export const getLatestReleaseZipUrl = async ( {
|
||||||
export const installPluginThruWpCli = async ( pluginPath ) => {
|
export const installPluginThruWpCli = async ( pluginPath ) => {
|
||||||
const runWpCliCommand = async ( command ) => {
|
const runWpCliCommand = async ( command ) => {
|
||||||
const { stdout, stderr } = await execAsync(
|
const { stdout, stderr } = await execAsync(
|
||||||
`pnpm exec wp-env run tests-cli "${ command }"`
|
`pnpm exec wp-env run tests-cli -- ${ command }`
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log( stdout );
|
console.log( stdout );
|
||||||
|
|
|
@ -47,9 +47,6 @@ class WC_Unit_Tests_Bootstrap {
|
||||||
ini_set( 'display_errors', 'on' ); // phpcs:ignore WordPress.PHP.IniSet.display_errors_Blacklisted
|
ini_set( 'display_errors', 'on' ); // phpcs:ignore WordPress.PHP.IniSet.display_errors_Blacklisted
|
||||||
error_reporting( E_ALL ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_error_reporting, WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_error_reporting
|
error_reporting( E_ALL ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_error_reporting, WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_error_reporting
|
||||||
|
|
||||||
// Ensure theme install tests use direct filesystem method.
|
|
||||||
define( 'FS_METHOD', 'direct' );
|
|
||||||
|
|
||||||
// Ensure server variable is set for WP email functions.
|
// Ensure server variable is set for WP email functions.
|
||||||
// phpcs:disable WordPress.VIP.SuperGlobalInputUsage.AccessDetected
|
// phpcs:disable WordPress.VIP.SuperGlobalInputUsage.AccessDetected
|
||||||
if ( ! isset( $_SERVER['SERVER_NAME'] ) ) {
|
if ( ! isset( $_SERVER['SERVER_NAME'] ) ) {
|
||||||
|
@ -83,6 +80,11 @@ class WC_Unit_Tests_Bootstrap {
|
||||||
// load the WP testing environment.
|
// load the WP testing environment.
|
||||||
require_once $this->wp_tests_dir . '/includes/bootstrap.php';
|
require_once $this->wp_tests_dir . '/includes/bootstrap.php';
|
||||||
|
|
||||||
|
// Ensure theme install tests use direct filesystem method.
|
||||||
|
if ( ! defined( 'FS_METHOD' ) ) {
|
||||||
|
define( 'FS_METHOD', 'direct' );
|
||||||
|
}
|
||||||
|
|
||||||
// load WC testing framework.
|
// load WC testing framework.
|
||||||
$this->includes();
|
$this->includes();
|
||||||
|
|
||||||
|
|
|
@ -4,37 +4,37 @@ ENABLE_HPOS="${ENABLE_HPOS:-0}"
|
||||||
|
|
||||||
echo "Initializing WooCommerce E2E"
|
echo "Initializing WooCommerce E2E"
|
||||||
|
|
||||||
wp-env run tests-cli "wp plugin activate woocommerce"
|
wp-env run tests-cli wp plugin activate woocommerce
|
||||||
|
|
||||||
wp-env run tests-cli "wp user create customer customer@woocommercecoree2etestsuite.com --user_pass=password --role=subscriber --path=/var/www/html"
|
wp-env run tests-cli wp user create customer customer@woocommercecoree2etestsuite.com --user_pass=password --role=subscriber --path=/var/www/html
|
||||||
|
|
||||||
# Installing and activating the WordPress Importer plugin to import sample products"
|
# Installing and activating the WordPress Importer plugin to import sample products"
|
||||||
wp-env run tests-cli "wp plugin install wordpress-importer --activate"
|
wp-env run tests-cli wp plugin install wordpress-importer --activate
|
||||||
|
|
||||||
# Adding basic WooCommerce settings"
|
# Adding basic WooCommerce settings"
|
||||||
wp-env run tests-cli "wp option set woocommerce_store_address 'Example Address Line 1'"
|
wp-env run tests-cli wp option set woocommerce_store_address 'Example Address Line 1'
|
||||||
wp-env run tests-cli "wp option set woocommerce_store_address_2 'Example Address Line 2'"
|
wp-env run tests-cli wp option set woocommerce_store_address_2 'Example Address Line 2'
|
||||||
wp-env run tests-cli "wp option set woocommerce_store_city 'Example City'"
|
wp-env run tests-cli wp option set woocommerce_store_city 'Example City'
|
||||||
wp-env run tests-cli "wp option set woocommerce_default_country 'US:CA'"
|
wp-env run tests-cli wp option set woocommerce_default_country 'US:CA'
|
||||||
wp-env run tests-cli "wp option set woocommerce_store_postcode '94110'"
|
wp-env run tests-cli wp option set woocommerce_store_postcode '94110'
|
||||||
wp-env run tests-cli "wp option set woocommerce_currency 'USD'"
|
wp-env run tests-cli wp option set woocommerce_currency 'USD'
|
||||||
wp-env run tests-cli "wp option set woocommerce_product_type 'both'"
|
wp-env run tests-cli wp option set woocommerce_product_type 'both'
|
||||||
wp-env run tests-cli "wp option set woocommerce_allow_tracking 'no'"
|
wp-env run tests-cli wp option set woocommerce_allow_tracking 'no'
|
||||||
wp-env run tests-cli "wp option set woocommerce_enable_checkout_login_reminder 'yes'"
|
wp-env run tests-cli wp option set woocommerce_enable_checkout_login_reminder 'yes'
|
||||||
wp-env run tests-cli "wp option set --format=json woocommerce_cod_settings '{\"enabled\":\"yes\"}'"
|
wp-env run tests-cli wp option set --format=json woocommerce_cod_settings '{"enabled":"yes"}'
|
||||||
|
|
||||||
# WooCommerce shop pages
|
# WooCommerce shop pages
|
||||||
wp-env run tests-cli "wp wc --user=admin tool run install_pages"
|
wp-env run tests-cli wp wc --user=admin tool run install_pages
|
||||||
|
|
||||||
# Importing WooCommerce sample products"
|
# Importing WooCommerce sample products"
|
||||||
wp-env run tests-cli "wp import wp-content/plugins/woocommerce/sample-data/sample_products.xml --authors=skip"
|
wp-env run tests-cli wp import wp-content/plugins/woocommerce/sample-data/sample_products.xml --authors=skip
|
||||||
|
|
||||||
# install Storefront
|
# install Storefront
|
||||||
wp-env run tests-cli "wp theme install storefront --activate"
|
wp-env run tests-cli wp theme install storefront --activate
|
||||||
|
|
||||||
echo "Success! Your E2E Test Environment is now ready."
|
|
||||||
|
|
||||||
if [ $ENABLE_HPOS == 1 ]; then
|
if [ $ENABLE_HPOS == 1 ]; then
|
||||||
echo "Enable the COT feature"
|
echo -e 'Enable High-Performance Order Tables\n'
|
||||||
wp-env run tests-cli "wp plugin install https://gist.github.com/vedanshujain/564afec8f5e9235a1257994ed39b1449/archive/b031465052fc3e04b17624acbeeb2569ef4d5301.zip --activate"
|
wp-env run tests-cli wp plugin install https://gist.github.com/vedanshujain/564afec8f5e9235a1257994ed39b1449/archive/b031465052fc3e04b17624acbeeb2569ef4d5301.zip --activate
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Success! Your E2E Test Environment is now ready."
|
||||||
|
|
835
pnpm-lock.yaml
835
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -32,7 +32,7 @@ export const getSchema = async (
|
||||||
|
|
||||||
// Get the WooCommerce schema from wp cli
|
// Get the WooCommerce schema from wp cli
|
||||||
const schemaOutput = await execAsync(
|
const schemaOutput = await execAsync(
|
||||||
`wp-env run cli "wp eval-file '${ getSchemaPath }'"`,
|
`wp-env run cli wp eval-file '${ getSchemaPath }'`,
|
||||||
{
|
{
|
||||||
cwd: pluginPath,
|
cwd: pluginPath,
|
||||||
encoding: 'utf-8',
|
encoding: 'utf-8',
|
||||||
|
@ -41,7 +41,7 @@ export const getSchema = async (
|
||||||
|
|
||||||
// Get the OrdersTableDataStore schema.
|
// Get the OrdersTableDataStore schema.
|
||||||
const ordersTableOutput = await execAsync(
|
const ordersTableOutput = await execAsync(
|
||||||
'wp-env run cli "wp eval \'echo (new Automattic\\WooCommerce\\Internal\\DataStores\\Orders\\OrdersTableDataStore)->get_database_schema();\'"',
|
'wp-env run cli wp eval \'echo (new Automattic\\WooCommerce\\Internal\\DataStores\\Orders\\OrdersTableDataStore)->get_database_schema();\'',
|
||||||
{
|
{
|
||||||
cwd: pluginPath,
|
cwd: pluginPath,
|
||||||
encoding: 'utf-8',
|
encoding: 'utf-8',
|
||||||
|
|
Loading…
Reference in New Issue