diff --git a/plugins/woocommerce/.wp-env.json b/plugins/woocommerce/.wp-env.json index 9dd14efb4be..b2324bbf498 100644 --- a/plugins/woocommerce/.wp-env.json +++ b/plugins/woocommerce/.wp-env.json @@ -16,8 +16,8 @@ "test-data/images/": "./tests/e2e-pw/test-data/images/" }, "lifecycleScripts": { - "afterStart": "./tests/e2e-pw/bin/test-env-setup.sh", - "afterClean": "./tests/e2e-pw/bin/test-env-setup.sh" + "afterStart": "wp-env run tests-cli bash wp-content/plugins/woocommerce/tests/e2e-pw/bin/test-env-setup.sh", + "afterClean": "wp-env run tests-cli bash wp-content/plugins/woocommerce/tests/e2e-pw/bin/test-env-setup.sh" }, "env": { "development": {}, diff --git a/plugins/woocommerce/changelog/dev-speedup-test-env-setup b/plugins/woocommerce/changelog/dev-speedup-test-env-setup new file mode 100644 index 00000000000..8a63c75e1d1 --- /dev/null +++ b/plugins/woocommerce/changelog/dev-speedup-test-env-setup @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +CI: minor speed boost of wp-env startup. diff --git a/plugins/woocommerce/tests/e2e-pw/bin/test-env-setup.sh b/plugins/woocommerce/tests/e2e-pw/bin/test-env-setup.sh index 0eb2963e546..95bff22a0d8 100755 --- a/plugins/woocommerce/tests/e2e-pw/bin/test-env-setup.sh +++ b/plugins/woocommerce/tests/e2e-pw/bin/test-env-setup.sh @@ -1,24 +1,24 @@ #!/usr/bin/env bash echo -e 'Activate default theme \n' -wp-env run tests-cli wp theme activate twentytwentythree +wp theme activate twentytwentythree echo -e 'Update URL structure \n' -wp-env run tests-cli wp rewrite structure '/%postname%/' --hard +wp rewrite structure '/%postname%/' --hard echo -e 'Activate Filter Setter utility plugin \n' -wp-env run tests-cli wp plugin activate filter-setter +wp plugin activate filter-setter # This plugin allows you to process queued scheduled actions immediately. # It's used in the analytics e2e tests so that order numbers are shown in Analytics. echo -e 'Activate Process Waiting Actions utility plugin \n' -wp-env run tests-cli wp plugin activate process-waiting-actions +wp plugin activate process-waiting-actions echo -e 'Activate Test Helper APIs utility plugin \n' -wp-env run tests-cli wp plugin activate test-helper-apis +wp plugin activate test-helper-apis echo -e 'Add Customer user \n' -wp-env run tests-cli wp user create customer customer@woocommercecoree2etestsuite.com \ +wp user create customer customer@woocommercecoree2etestsuite.com \ --user_pass=password \ --role=customer \ --first_name='Jane' \ @@ -26,20 +26,20 @@ wp-env run tests-cli wp user create customer customer@woocommercecoree2etestsuit --user_registered='2022-01-01 12:23:45' echo -e 'Update Blog Name \n' -wp-env run tests-cli wp option update blogname 'WooCommerce Core E2E Test Suite' +wp option update blogname 'WooCommerce Core E2E Test Suite' 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 /var/www/sample.csv +sudo cp /var/www/html/wp-content/plugins/woocommerce/tests/legacy/unit-tests/importer/sample.csv /var/www/sample.csv ENABLE_TRACKING="${ENABLE_TRACKING:-0}" if [ $ENABLE_TRACKING == 1 ]; then echo -e 'Enable tracking\n' - wp-env run tests-cli wp option update woocommerce_allow_tracking 'yes' + wp option update woocommerce_allow_tracking 'yes' fi echo -e 'Disabling coming soon option\n' -wp-env run tests-cli wp option update woocommerce_coming_soon 'no' +wp option update woocommerce_coming_soon 'no' echo -e 'Upload test images \n' -wp-env run tests-cli wp media import './test-data/images/image-01.png' './test-data/images/image-02.png' './test-data/images/image-03.png' +wp media import './test-data/images/image-01.png' './test-data/images/image-02.png' './test-data/images/image-03.png'