CI: boost wp-env setup speed (minor, ~10 seconds). (#50445)

This commit is contained in:
Vladimir Reznichenko 2024-08-07 17:46:57 +02:00 committed by GitHub
parent 0235907b14
commit 169f02009f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 13 deletions

View File

@ -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": {},

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
CI: minor speed boost of wp-env startup.

View File

@ -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'