Commit 642a20c9c5e for woocommerce
commit 642a20c9c5e4cee5e389abc51f07fef405cec9ef
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date: Thu Mar 12 17:25:03 2026 +0000
Prevent Site Editor welcome guide showing in E2E tests (#63623)
Fix: Dismiss site editor welcome guide in blocks e2e test setup
WP 7.0 shows an "Edit your site" welcome guide modal on first visit to
the site editor. Since the DB is reset and localStorage is cleared
between tests, the dismissal preference is lost each time, causing the
modal to block Save button interactions and fail template customization
tests.
Fix: set the welcomeGuide preferences in wp_persisted_preferences user
meta during test env setup, before the DB snapshot is taken. This way
the preference persists across test resets.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
diff --git a/plugins/woocommerce/client/blocks/tests/e2e/bin/test-env-setup.sh b/plugins/woocommerce/client/blocks/tests/e2e/bin/test-env-setup.sh
index 0c90b443709..11042e79ac0 100755
--- a/plugins/woocommerce/client/blocks/tests/e2e/bin/test-env-setup.sh
+++ b/plugins/woocommerce/client/blocks/tests/e2e/bin/test-env-setup.sh
@@ -7,6 +7,19 @@ wp-env run tests-cli -- rm -f blocks_e2e.sql
wp-env run tests-cli -- bash wp-content/plugins/woocommerce/blocks-bin/playwright/scripts/index.sh
# Disable the LYS Coming Soon banner.
wp-env run tests-cli -- wp option update woocommerce_coming_soon 'no'
+# Dismiss the site editor welcome guide for the admin user so it does not
+# block interactions during tests. The preference is stored in user meta and
+# will be included in the database snapshot that is restored between tests.
+wp-env run tests-cli -- wp eval '
+$prefs = get_user_meta( 1, "wp_persisted_preferences", true );
+if ( ! is_array( $prefs ) ) { $prefs = array(); }
+if ( ! isset( $prefs["core/edit-site"] ) ) { $prefs["core/edit-site"] = array(); }
+$prefs["core/edit-site"]["welcomeGuide"] = false;
+$prefs["core/edit-site"]["welcomeGuideStyles"] = false;
+$prefs["core/edit-site"]["welcomeGuidePage"] = false;
+$prefs["core/edit-site"]["welcomeGuideTemplate"] = false;
+update_user_meta( 1, "wp_persisted_preferences", $prefs );
+'
# Activate the Test Helper APIs utility plugin.
wp-env run tests-cli -- wp plugin activate woocommerce-test-plugins/test-helper-apis