Commit d2e70c23dc0 for woocommerce

commit d2e70c23dc02f88a9f570f8608cb6abce709d31e
Author: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
Date:   Mon Aug 3 16:15:40 2026 +0300

    e2e tests: Normalize IS_MULTISITE env var handling (#67339)

diff --git a/plugins/woocommerce/changelog/testops-257-normalize-is-multisite b/plugins/woocommerce/changelog/testops-257-normalize-is-multisite
new file mode 100644
index 00000000000..cd25b7e8ebe
--- /dev/null
+++ b/plugins/woocommerce/changelog/testops-257-normalize-is-multisite
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+E2E tests: normalize the IS_MULTISITE env var to '1'/unset so multisite skips behave consistently regardless of how the system status endpoint reports wp_multisite.
diff --git a/plugins/woocommerce/tests/e2e/fixtures/site.setup.ts b/plugins/woocommerce/tests/e2e/fixtures/site.setup.ts
index c9738b1b10f..9aef9137c0b 100644
--- a/plugins/woocommerce/tests/e2e/fixtures/site.setup.ts
+++ b/plugins/woocommerce/tests/e2e/fixtures/site.setup.ts
@@ -91,12 +91,23 @@ setup( 'setup site', async ( { baseURL, restApi } ) => {
 		const response = await restApi.get( `${ WC_API_PATH }/system_status` );
 		const { environment } = response.data;

-		if ( environment.wp_multisite === false ) {
-			delete process.env.IS_MULTISITE;
+		// `wp_multisite` is a boolean (`is_multisite()`, schema `type: boolean`),
+		// but the response is untyped here and these suites also run against
+		// remote hosts on arbitrary WooCommerce versions, where a filter on
+		// `woocommerce_rest_prepare_system_status` could return a stringy value.
+		// Comparing the stringified value resolves either form. IS_MULTISITE is
+		// presence-based: '1' on multisite, unset otherwise — never '0'.
+		const rawMultisite = String( environment.wp_multisite ).toLowerCase();
+		const isMultisite = rawMultisite === 'true' || rawMultisite === '1';
+
+		if ( isMultisite ) {
+			process.env.IS_MULTISITE = '1';
 		} else {
-			process.env.IS_MULTISITE = environment.wp_multisite;
-			console.log( `IS_MULTISITE: ${ process.env.IS_MULTISITE }` );
+			delete process.env.IS_MULTISITE;
 		}
+		console.log(
+			`IS_MULTISITE: ${ process.env.IS_MULTISITE ?? '(unset)' }`
+		);
 	} );

 	await setup.step( 'general settings', async () => {
diff --git a/plugins/woocommerce/tests/e2e/tests/api-tests/customers/customers-crud.test.ts b/plugins/woocommerce/tests/e2e/tests/api-tests/customers/customers-crud.test.ts
index 117e83024c5..53d7ecc75b6 100644
--- a/plugins/woocommerce/tests/e2e/tests/api-tests/customers/customers-crud.test.ts
+++ b/plugins/woocommerce/tests/e2e/tests/api-tests/customers/customers-crud.test.ts
@@ -344,7 +344,7 @@ test.describe( 'Customers API tests: CRUD', () => {
 	test.describe( 'Delete a customer', () => {
 		test( 'can permanently delete an customer', async ( { request } ) => {
 			test.skip(
-				process.env.IS_MULTISITE === 'true',
+				!! process.env.IS_MULTISITE,
 				'Skip tests on deleting a customer on multisites until bug #384 in private repo is resolved.'
 			);

@@ -518,7 +518,7 @@ test.describe( 'Customers API tests: CRUD', () => {

 		test( 'can batch delete customers', async ( { request } ) => {
 			test.skip(
-				process.env.IS_MULTISITE === 'true',
+				!! process.env.IS_MULTISITE,
 				'Skip tests on deleting a customer on multisites until bug #384 in private repo is resolved.'
 			);

diff --git a/plugins/woocommerce/tests/e2e/tests/email/account-emails.spec.ts b/plugins/woocommerce/tests/e2e/tests/email/account-emails.spec.ts
index cf98f56c43f..df509508a66 100644
--- a/plugins/woocommerce/tests/e2e/tests/email/account-emails.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/email/account-emails.spec.ts
@@ -35,7 +35,7 @@ test.beforeEach( async ( { baseURL } ) => {
 } );

 test.skip(
-	process.env.IS_MULTISITE,
+	!! process.env.IS_MULTISITE,
 	'Test not working on a multisite setup, see https://github.com/woocommerce/woocommerce/issues/55082'
 );

diff --git a/plugins/woocommerce/tests/e2e/tests/onboarding/onboarding-wizard.spec.ts b/plugins/woocommerce/tests/e2e/tests/onboarding/onboarding-wizard.spec.ts
index 77ba7e35962..2125ca8d964 100644
--- a/plugins/woocommerce/tests/e2e/tests/onboarding/onboarding-wizard.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/onboarding/onboarding-wizard.spec.ts
@@ -45,7 +45,7 @@ test.describe(
 			page,
 		} ) => {
 			test.skip(
-				process.env.IS_MULTISITE,
+				!! process.env.IS_MULTISITE,
 				'Test not working on a multisite setup, see https://github.com/woocommerce/woocommerce/issues/55066'
 			);
 			await page.goto(
@@ -206,7 +206,7 @@ test.describe(
 			page,
 		} ) => {
 			test.skip(
-				process.env.IS_MULTISITE,
+				!! process.env.IS_MULTISITE,
 				'Test not working on a multisite setup, see https://github.com/woocommerce/woocommerce/issues/55066'
 			);
 			await page.goto(
diff --git a/plugins/woocommerce/tests/e2e/tests/user/users-create.spec.ts b/plugins/woocommerce/tests/e2e/tests/user/users-create.spec.ts
index a42fdf4ec30..cbbff527dc2 100644
--- a/plugins/woocommerce/tests/e2e/tests/user/users-create.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/user/users-create.spec.ts
@@ -40,7 +40,7 @@ const test = baseTest.extend( {
 for ( const userData of users ) {
 	test( `can create a new ${ userData.role }`, async ( { page, user } ) => {
 		test.skip(
-			process.env.IS_MULTISITE,
+			!! process.env.IS_MULTISITE,
 			'Test not working on a multisite setup, see https://github.com/woocommerce/woocommerce/issues/55082'
 		);
 		await page.goto( `wp-admin/user-new.php` );
diff --git a/plugins/woocommerce/tests/e2e/tests/user/users-manage.spec.ts b/plugins/woocommerce/tests/e2e/tests/user/users-manage.spec.ts
index 5a21e5d99a7..be7b296f239 100644
--- a/plugins/woocommerce/tests/e2e/tests/user/users-manage.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/user/users-manage.spec.ts
@@ -304,7 +304,7 @@ test( `can update customer data`, async ( { page, customer } ) => {

 test( `can update shop manager data`, async ( { page, manager } ) => {
 	test.skip(
-		process.env.IS_MULTISITE,
+		!! process.env.IS_MULTISITE,
 		'Test not working on a multisite setup'
 	);
 	await page.goto( `wp-admin/user-edit.php?user_id=${ manager.id }` );
@@ -337,7 +337,7 @@ test( `can update shop manager data`, async ( { page, manager } ) => {

 test( `can delete a customer`, async ( { page, customer } ) => {
 	test.skip(
-		process.env.IS_MULTISITE,
+		!! process.env.IS_MULTISITE,
 		'Test not working on a multisite setup, see https://github.com/woocommerce/woocommerce/issues/55082'
 	);
 	expect( await userDeletionTest( page, customer.username ) ).toBeTruthy();
@@ -345,7 +345,7 @@ test( `can delete a customer`, async ( { page, customer } ) => {

 test( `can delete a shop manager`, async ( { page, manager } ) => {
 	test.skip(
-		process.env.IS_MULTISITE,
+		!! process.env.IS_MULTISITE,
 		'Test not working on a multisite setup, see https://github.com/woocommerce/woocommerce/issues/55082'
 	);
 	expect( await userDeletionTest( page, manager.username ) ).toBeTruthy();