From 0a3c4dde650afe2b96957f821e40c3fbaffc3510 Mon Sep 17 00:00:00 2001 From: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com> Date: Thu, 29 Aug 2024 09:17:31 +0100 Subject: [PATCH] [tests] Execute test env setup on host instead of wp-env container (reverts #50445) (#51021) --- plugins/woocommerce/.wp-env.json | 4 ++-- plugins/woocommerce/changelog/revert-50445 | 4 ++++ .../tests/e2e-pw/bin/test-env-setup.sh | 20 +++++++++---------- 3 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 plugins/woocommerce/changelog/revert-50445 diff --git a/plugins/woocommerce/.wp-env.json b/plugins/woocommerce/.wp-env.json index 3cbe6bd12c5..333f1fdd26a 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": "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" + "afterStart": "./tests/e2e-pw/bin/test-env-setup.sh", + "afterClean": "./tests/e2e-pw/bin/test-env-setup.sh" }, "env": { "development": { diff --git a/plugins/woocommerce/changelog/revert-50445 b/plugins/woocommerce/changelog/revert-50445 new file mode 100644 index 00000000000..158f41689a7 --- /dev/null +++ b/plugins/woocommerce/changelog/revert-50445 @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +Execute test env setup on host instead of wp-env container 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 52ed55e49fa..4f71a820241 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 theme activate twentytwentythree +wp-env run tests-cli wp theme activate twentytwentythree echo -e 'Update URL structure \n' -wp rewrite structure '/%postname%/' --hard +wp-env run tests-cli wp rewrite structure '/%postname%/' --hard echo -e 'Activate Filter Setter utility plugin \n' -wp plugin activate filter-setter +wp-env run tests-cli 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 plugin activate process-waiting-actions +wp-env run tests-cli wp plugin activate process-waiting-actions echo -e 'Activate Test Helper APIs utility plugin \n' -wp plugin activate test-helper-apis +wp-env run tests-cli wp plugin activate test-helper-apis echo -e 'Add Customer user \n' -wp user create customer customer@woocommercecoree2etestsuite.com \ +wp-env run tests-cli wp user create customer customer@woocommercecoree2etestsuite.com \ --user_pass=password \ --role=customer \ --first_name='Jane' \ @@ -26,17 +26,17 @@ wp user create customer customer@woocommercecoree2etestsuite.com \ --user_registered='2022-01-01 12:23:45' echo -e 'Update Blog Name \n' -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' -sudo cp /var/www/html/wp-content/plugins/woocommerce/tests/legacy/unit-tests/importer/sample.csv /var/www/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 ENABLE_TRACKING="${ENABLE_TRACKING:-0}" if [ $ENABLE_TRACKING == 1 ]; then echo -e 'Enable tracking\n' - wp option update woocommerce_allow_tracking 'yes' + wp-env run tests-cli wp option update woocommerce_allow_tracking 'yes' fi echo -e 'Upload test images \n' -wp media import './test-data/images/image-01.png' './test-data/images/image-02.png' './test-data/images/image-03.png' +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'