Skip to content

Commit 5f9d58b

Browse files
Specify the --user argument to wp wc CLI calls before wc (#4272)
* Specify the --user argument to wp wc CLI calls before wc * Make the option setup more robust against a pre-existing woocommerce_stripe_settings option * Changelog --------- Co-authored-by: Malith Senaweera <[email protected]>
1 parent 81cbf30 commit 5f9d58b

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

bin/docker-setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ cli wp option set woocommerce_allow_tracking "no"
103103
cli wp option set woocommerce_coming_soon "no"
104104

105105
echo "Importing WooCommerce shop pages..."
106-
cli wp wc --user=admin tool run install_pages
106+
cli wp --user=admin wc tool run install_pages
107107

108108
echo "Installing and activating the WordPress Importer plugin..."
109109
cli wp plugin install wordpress-importer --activate

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* Fix - Prevents fatal errors for cases where we fail to load product details
2121
* Fix - Address an edge case with webhook URL comparisons
2222
* Fix - Show correct gateway name in non payments settings pages.
23+
* Dev - Minor fix to e2e setup code
2324

2425
= 9.4.1 - 2025-04-17 =
2526
* Dev - Forces rollback of version 9.4.0.

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,6 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
130130
* Fix - Prevents fatal errors for cases where we fail to load product details
131131
* Fix - Address an edge case with webhook URL comparisons
132132
* Fix - Show correct gateway name in non payments settings pages.
133+
* Dev - Minor fix to e2e setup code
133134

134135
[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).

tests/e2e/bin/setup.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ redirect_output cli wp option set woocommerce_coming_soon "no"
111111
echo " - Installing Storefront theme"
112112
redirect_output cli wp theme install storefront --activate
113113

114-
redirect_output cli wp wc --user=${ADMIN_USER} tool run install_pages
114+
redirect_output cli wp --user=${ADMIN_USER} wc tool run install_pages
115115

116116
echo " - Configuring Shipping and Taxes"
117-
redirect_output cli wp wc shipping_zone create --name="Everywhere" --order=1 --user=${ADMIN_USER}
118-
redirect_output cli wp wc shipping_zone_method create 1 --method_id="flat_rate" --user=${ADMIN_USER}
119-
redirect_output cli wp wc shipping_zone_method create 1 --method_id="free_shipping" --user=${ADMIN_USER}
117+
redirect_output cli wp --user=${ADMIN_USER} wc shipping_zone create --name="Everywhere" --order=1
118+
redirect_output cli wp --user=${ADMIN_USER} wc shipping_zone_method create 1 --method_id="flat_rate"
119+
redirect_output cli wp --user=${ADMIN_USER} wc shipping_zone_method create 1 --method_id="free_shipping"
120120
redirect_output cli wp option update --format=json woocommerce_flat_rate_1_settings '{"title":"Flat rate","tax_status":"taxable","cost":"10"}'
121121

122122
echo " - Creating Cart and Checkout shortcode pages"
@@ -135,7 +135,7 @@ echo " - Activating plugin"
135135
redirect_output cli wp plugin activate woocommerce-gateway-stripe
136136

137137
echo " - Updating WooCommerce Gateway Stripe settings"
138-
redirect_output cli wp option add woocommerce_stripe_settings --format=json "{\"enabled\":\"yes\",\"title\":\"Credit Card (Stripe)\",\"description\":\"Pay with your credit card via Stripe.\",\"api_credentials\":\"\",\"testmode\":\"yes\",\"test_publishable_key\":\"${STRIPE_PUB_KEY}\",\"test_secret_key\":\"${STRIPE_SECRET_KEY}\",\"publishable_key\":\"\",\"secret_key\":\"\",\"webhook\":\"\",\"test_webhook_secret\":\"\",\"webhook_secret\":\"\",\"inline_cc_form\":\"no\",\"statement_descriptor\":\"\",\"short_statement_descriptor\":\"\",\"capture\":\"yes\",\"payment_request\":\"yes\",\"payment_request_button_type\":\"buy\",\"payment_request_button_theme\":\"dark\",\"payment_request_button_locations\":[\"product\",\"cart\",\"checkout\"],\"payment_request_button_size\":\"default\",\"saved_cards\":\"yes\",\"logging\":\"no\",\"upe_checkout_experience_enabled\":\"yes\"}"
138+
redirect_output cli wp option update woocommerce_stripe_settings --format=json "{\"enabled\":\"yes\",\"title\":\"Credit Card (Stripe)\",\"description\":\"Pay with your credit card via Stripe.\",\"api_credentials\":\"\",\"testmode\":\"yes\",\"test_publishable_key\":\"${STRIPE_PUB_KEY}\",\"test_secret_key\":\"${STRIPE_SECRET_KEY}\",\"publishable_key\":\"\",\"secret_key\":\"\",\"webhook\":\"\",\"test_webhook_secret\":\"\",\"webhook_secret\":\"\",\"inline_cc_form\":\"no\",\"statement_descriptor\":\"\",\"short_statement_descriptor\":\"\",\"capture\":\"yes\",\"payment_request\":\"yes\",\"payment_request_button_type\":\"buy\",\"payment_request_button_theme\":\"dark\",\"payment_request_button_locations\":[\"product\",\"cart\",\"checkout\"],\"payment_request_button_size\":\"default\",\"saved_cards\":\"yes\",\"logging\":\"no\",\"upe_checkout_experience_enabled\":\"yes\"}"
139139

140140
echo " - Enabling the ACH feature flag"
141141
redirect_output cli wp option update _wcstripe_feature_lpm_ach 'yes'

tests/e2e/utils/playwright-setup.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,12 @@ export const setupWoo = async () => {
255255
'wp option set woocommerce_product_type "both"',
256256
'wp option set woocommerce_allow_tracking "no"',
257257
'wp option set woocommerce_coming_soon "no"',
258-
`wp wc --user=${ ADMIN_USER } tool run install_pages`,
258+
`wp --user=${ ADMIN_USER } wc tool run install_pages`,
259259
'wp plugin install wordpress-importer --activate',
260260
'wp import wp-content/plugins/woocommerce/sample-data/sample_products.xml --authors=skip',
261-
`wp wc shipping_zone create --name="Everywhere" --order=1 --user=${ ADMIN_USER }`,
262-
`wp wc shipping_zone_method create 1 --method_id="flat_rate" --user=${ ADMIN_USER }`,
263-
`wp wc shipping_zone_method create 1 --method_id="free_shipping" --user=${ ADMIN_USER }`,
261+
`wp --user=${ ADMIN_USER } wc shipping_zone create --name="Everywhere" --order=1`,
262+
`wp --user=${ ADMIN_USER } wc shipping_zone_method create 1 --method_id="flat_rate"`,
263+
`wp --user=${ ADMIN_USER } wc shipping_zone_method create 1 --method_id="free_shipping"`,
264264
`wp option update --format=json woocommerce_flat_rate_1_settings '{"title":"Flat rate","tax_status":"taxable","cost":"10"}'`,
265265
`wp post create --post_type=page --post_title='Cart Shortcode' --post_name='cart-shortcode' --post_status=publish --page_template='template-fullwidth.php' --post_content='${ shortcodeCartPostContent }'`,
266266
`wp post create --post_type=page --post_title='Checkout Shortcode' --post_name='checkout-shortcode' --post_status=publish --page_template='template-fullwidth.php' --post_content='${ shortcodeCheckoutPostContent }'`,

0 commit comments

Comments
 (0)