Commit f1c6cd4635c for woocommerce

commit f1c6cd4635cd959eb3eced0f84272da14009080f
Author: Vlad Olaru <vlad.olaru@automattic.com>
Date:   Tue Nov 3 00:01:25 2026 +0200

    [tests] Rename test titles, provider keys and helpers to match what each test asserts (#68887)

    * test(e2e): Rename Playwright titles and steps to match their assertions

    Several titles and test.step labels in the e2e suite claimed a behaviour
    or timing the test body did not actually assert (a condition never
    checked, a UI element never named, or a mocked call described as a real
    install). Rename them to state what each test body verifies.

    Renames (old -> new, file):
    - Products page redirects to add product task when no products exist -> Products page redirects to the add product task until a product exists, tests/e2e/tests/onboarding/add-product-task.spec.ts
    - Merchant must accept T&S before checkout -> Merchant can require the T&S checkbox before an order can be placed, tests/e2e/tests/blocks/checkout/checkout-block.merchant.block_theme.spec.ts
    - Confirm the selection was installed and the profiler finished -> Confirm the selection reached the install requests and the profiler finished, tests/e2e/tests/onboarding/onboarding-wizard.spec.ts
    - Save Changes button is disabled by default and enabled only after changes. -> Save Changes button enables on change and the selling location settings persist., tests/e2e/tests/settings/settings-general.spec.ts
    - Category offset persists into frontend review results -> offset setting applies in the editor and on the frontend, tests/e2e/tests/blocks/reviews-by-category/reviews-by-category.block_theme.spec.ts
    - can apply a coupon -> can apply and remove a coupon, tests/e2e/tests/order/order-coupon.spec.ts
    - Logged in user can apply single-use coupon and place order -> Logged in user can apply and remove a single-use coupon, then place the order, tests/e2e/tests/blocks/cart/cart-checkout-block-coupons.shopper.block_theme.spec.ts
    - Cart data can be modified by extensions -> Unpushed customer data is kept or overwritten depending on overwriteDirtyCustomerData, tests/e2e/tests/blocks/checkout/checkout-block-extensibility.shopper.block_theme.spec.ts
    - Check the setting present only when Jetpack onboarding is complete -> Check the Enable PayPal Buttons setting is present after saving, tests/e2e/tests/paypal/paypal.spec.ts
    - colour swatch is correctly sized with WP 7.0 body class -> colour swatch paints 32px without the WP 7.0 body class and 40px with it, tests/e2e/tests/settings/colour-picker-swatch-height.spec.ts
    - Products are displayed on frontend -> Selected products survive save and reload and are displayed on frontend, tests/e2e/tests/blocks/product-collection/collection-pickers.block_theme.spec.ts
    - can use the "Add new product" command -> can use the "Add new product" command and find the analytics command, tests/e2e/tests/editor/command-palette.spec.ts
    - Switching to a non-picker collection displays products immediately -> Switching collections swaps the picker and then displays products immediately, tests/e2e/tests/blocks/product-collection/collection-pickers.block_theme.spec.ts
    - can filter the reviews by product -> can filter the reviews by product and read the review row, tests/e2e/tests/product/product-reviews.spec.ts
    - renders current product counts for every attribute -> renders product counts next to every Color attribute term, tests/e2e/tests/blocks/product-filters/attribute-filter-frontend.block_theme.spec.ts
    - that tax calculation stays on, and scoping would mean reassigning -> that tax rows follow the option, and scoping would mean reassigning (docblock), tests/e2e/tests/blocks/cart/cart-checkout-block-taxes.shopper.block_theme.spec.ts

    Refs TESTOPS-234
    Refs TESTOPS-288

    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

    * test(blocks): Rename Jest titles and provider keys to match their assertions

    Several describe/it titles and it.each provider keys in the blocks
    client named the wrong subject: a raw list-option label instead of
    the filter under test, a row id instead of the reference context it
    drives, a method name, or a sibling naming convention the title
    didn't follow. Rename them to name what each test body actually
    checks.

    Renames (old -> new, file):
    - describe 'renders cart row price' -> 'CartLineItemRow — price display', assets/js/base/components/cart-checkout/cart-line-items-table/test/cart-line-item-row.tsx
    - provider key 'extension-filtered price above its regular price without sale markup' -> 'price above its regular price without sale markup', assets/js/base/components/cart-checkout/cart-line-items-table/test/cart-line-item-row.tsx
    - renders the default sorting option without a visual label -> renders the default sorting option in the disabled editor preview, assets/js/blocks/catalog-sorting/test/index.tsx
    - resolves category location into taxonomy request -> resolves a category template slug into a numeric taxonomy location, assets/js/blocks/product-template/test/utils.tsx
    - preserves a positive manual value for validation by the parent store -> passes a below-minimum positive value through unchanged on blur, assets/js/blocks/add-to-cart-with-options/quantity-selector/test/frontend.ts
    - title 'maps $listOption display and Apply controls to preview behavior' -> 'maps $caseName display and Apply controls to preview behavior', plus a caseName field ('Rating filter' / 'Stock filter') added to the two data rows, assets/js/blocks/filter-wrapper/test/edit.tsx
    - describe 'generic archive previews' -> 'Product Collection generic archive previews', assets/js/blocks/product-collection/test/editor-contracts.tsx
    - describe 'default catalog order control' -> 'Product Collection default catalog order control', assets/js/blocks/product-collection/test/editor-contracts.tsx
    - provider key id -> caseName across all five rows and the title 'routes $id ...' -> 'routes $caseName ...', packages/public-api/blocks-registry/product-collection/test/register-product-collection.tsx
    - clamps variation quantity $current to $expected when the input is idle -> clamps variation quantity $current to $expected to the variation bounds, assets/js/blocks/add-to-cart-with-options/variation-selector/test/frontend.ts
    - accepts or rejects %s -> writes %s only when it is a valid offset, assets/js/blocks/reviews/test/review-contracts.test.tsx
    - describe 'Offset control' -> 'offset control', assets/js/blocks/reviews/test/review-contracts.test.tsx

    Refs TESTOPS-234
    Refs TESTOPS-288

    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

    * test(admin): Rename Jest titles to match their assertions

    Two titles in the admin client described the wrong action: a title
    said the test selects options that are already checked on render, and
    another named the two buttons a color change reveals while omitting
    the auto-sync toggle the body checks first. Rename them to state what
    each test body verifies.

    Renames (old -> new, file):
    - selects each default inactive recommendation -> checks every inactive recommendation by default and marks the installed one, client/core-profiler/pages/Plugins/test/Plugins.test.tsx
    - shows sync and undo controls after a color change -> turns off auto-sync and offers Sync and Undo after a color change, client/settings-email/__tests__/settings-email-color-palette-control.test.tsx

    Refs TESTOPS-234
    Refs TESTOPS-288

    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

    * test(email-editor): Rename Jest title to match its assertion

    The title read 'that recipient', which only resolves by reading the
    preceding test. Name the recipient the body actually configures.

    Renames (old -> new, file):
    - opens with that recipient already filled in and a usable send button -> opens with the configured recipient filled in and a usable send button, src/components/preview/test/send-preview-email.spec.tsx

    Refs TESTOPS-234
    Refs TESTOPS-288

    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

    * test(php): Rename PHPUnit methods, docblocks and a data key to match their assertions

    Several @testdox docblocks, test method names, a data-provider key and
    two helper methods in the PHPUnit suite claimed a behaviour or upheld
    a naming convention the test body did not follow: a docblock that
    described a rendered section the code never renders, a method that
    named the action under test rather than its outcome, an array key
    that promised a restoration where the value is only cleared, and two
    assertion helpers in camelCase inside otherwise snake_case files.
    Rename them to match the body and the surrounding convention.

    Renames (old -> new, file):
    - @testdox The classic product save keeps upsells and cross-sells distinct and renders each in its own section. -> ...renders the upsells section, and offers the cross-sells in the cart., tests/php/includes/admin/meta-boxes/class-wc-meta-box-product-data-linked-products-test.php
    - @testdox Omitting both linked-product fields clears their IDs and hides both classic sections. -> ...hides the classic upsells section, and leaves the cart with no cross-sells., tests/php/includes/admin/meta-boxes/class-wc-meta-box-product-data-linked-products-test.php
    - assertLinkedProductNamesAbsent -> assert_linked_product_names_absent, tests/php/includes/admin/meta-boxes/class-wc-meta-box-product-data-linked-products-test.php
    - test_remove_order_coupon -> test_remove_order_coupon_restores_the_total_and_records_an_internal_note, tests/php/includes/class-wc-ajax-test.php
    - @testdox Calculating line taxes persists the tax class, rate, and totals for each supported product type. -> ...for simple, variation, and external line items., tests/php/includes/class-wc-ajax-test.php
    - assertSelectedExportStructure -> assert_selected_export_structure, tests/php/includes/admin/views/class-wc-admin-product-export-view-test.php
    - data key 'empty change-to restoration' -> 'empty change-to clearing', tests/php/includes/admin/class-wc-admin-post-types-test.php
    - test_missing_order_notice -> test_missing_order_notice_offers_email_and_account_paths, tests/php/src/Blocks/BlockTypes/OrderConfirmation/StatusTest.php
    - test_update_passes_default_id -> test_update_uses_default_id_to_rewrite_the_row_in_place, tests/php/src/Utilities/MetaDataUtilTest.php
    - test_legacy_form_fields_for_product_types -> test_legacy_form_exposes_required_fields_for_each_product_type, tests/php/src/Blocks/BlockTypes/AddToCartWithOptions.php

    Refs TESTOPS-234
    Refs TESTOPS-288

    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

    * test(e2e): Name the disabled checks and base location in the general settings title

    The general settings test asserts that the Save changes button is
    disabled before any change and again after saving and reloading, and it
    sets the base location (country and state) rather than the full store
    address. The previous title dropped the disabled checks and overstated
    the address coverage.

    Rename it to "Save Changes button stays disabled until a change, and the
    selling location and base location settings persist.", as suggested in
    review on the PR.

    Refs TESTOPS-234

    Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

    ---------

    Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

diff --git a/packages/js/email-editor/changelog/testops-234-test-naming-sweep b/packages/js/email-editor/changelog/testops-234-test-naming-sweep
new file mode 100644
index 00000000000..3fd90ddb40e
--- /dev/null
+++ b/packages/js/email-editor/changelog/testops-234-test-naming-sweep
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Rename a test title to match what the test asserts
diff --git a/packages/js/email-editor/src/components/preview/test/send-preview-email.spec.tsx b/packages/js/email-editor/src/components/preview/test/send-preview-email.spec.tsx
index 80c604f0c99..55adfe95e19 100644
--- a/packages/js/email-editor/src/components/preview/test/send-preview-email.spec.tsx
+++ b/packages/js/email-editor/src/components/preview/test/send-preview-email.spec.tsx
@@ -176,7 +176,7 @@ describe( 'SendPreviewEmail', () => {
 		);
 	} );

-	it( 'opens with that recipient already filled in and a usable send button', () => {
+	it( 'opens with the configured recipient filled in and a usable send button', () => {
 		renderWithPreviewState( { toEmail: 'shopkeeper@example.com' } );

 		expect( screen.getByTestId( 'text-control' ) ).toHaveValue(
diff --git a/plugins/woocommerce/changelog/testops-234-test-naming-sweep b/plugins/woocommerce/changelog/testops-234-test-naming-sweep
new file mode 100644
index 00000000000..49eb2c8be00
--- /dev/null
+++ b/plugins/woocommerce/changelog/testops-234-test-naming-sweep
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Rename test titles, provider keys and helpers to match what each test asserts
diff --git a/plugins/woocommerce/client/admin/client/settings-email/__tests__/settings-email-color-palette-control.test.tsx b/plugins/woocommerce/client/admin/client/settings-email/__tests__/settings-email-color-palette-control.test.tsx
index c7d90d58862..9d0733d53a8 100644
--- a/plugins/woocommerce/client/admin/client/settings-email/__tests__/settings-email-color-palette-control.test.tsx
+++ b/plugins/woocommerce/client/admin/client/settings-email/__tests__/settings-email-color-palette-control.test.tsx
@@ -157,7 +157,7 @@ describe( 'ResetStylesControl', () => {
 			.jQuery;
 	} );

-	it( 'shows sync and undo controls after a color change', () => {
+	it( 'turns off auto-sync and offers Sync and Undo after a color change', () => {
 		renderWithThemeDefaults();
 		changeAccent();

diff --git a/plugins/woocommerce/tests/e2e/tests/blocks/cart/cart-checkout-block-taxes.shopper.block_theme.spec.ts b/plugins/woocommerce/tests/e2e/tests/blocks/cart/cart-checkout-block-taxes.shopper.block_theme.spec.ts
index 16aced00d60..f2d10d3b1ef 100644
--- a/plugins/woocommerce/tests/e2e/tests/blocks/cart/cart-checkout-block-taxes.shopper.block_theme.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/blocks/cart/cart-checkout-block-taxes.shopper.block_theme.spec.ts
@@ -30,8 +30,8 @@ test.describe( 'Shopper → Taxes', () => {
 	} ) => {
 		// The rate has to be global. This test's subject is the store-wide
 		// "Enable tax rate calculations" option, and it shops with shared
-		// fixture products, so `withScopedTaxClass` does not apply: it asserts
-		// that tax calculation stays on, and scoping would mean reassigning
+		// fixture products, so `withScopedTaxClass` does not apply: it throws
+		// unless tax calculation is on, and scoping would mean reassigning
 		// products other specs also use. Both the rate and the option are put
 		// back in `finally` instead, so neither follows later specs.
 		const { id: taxRateId } = await requestUtils.rest< { id: number } >( {
diff --git a/plugins/woocommerce/tests/e2e/tests/editor/command-palette.spec.ts b/plugins/woocommerce/tests/e2e/tests/editor/command-palette.spec.ts
index 863b7c7ebc5..8bd232b6ec0 100644
--- a/plugins/woocommerce/tests/e2e/tests/editor/command-palette.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/editor/command-palette.spec.ts
@@ -125,7 +125,9 @@ const test = baseTest.extend( {
 	},
 } );

-test( 'can use the "Add new product" command', async ( { page } ) => {
+test( 'can use the "Add new product" command and find the analytics command', async ( {
+	page,
+} ) => {
 	const searchBox = await openCommandPalette( page );

 	// Analytics commands come from a separate bundle fed by PHP, so check that one reached the palette too.
diff --git a/plugins/woocommerce/tests/e2e/tests/paypal/paypal.spec.ts b/plugins/woocommerce/tests/e2e/tests/paypal/paypal.spec.ts
index e8d58f9b1f5..5995a172e5e 100644
--- a/plugins/woocommerce/tests/e2e/tests/paypal/paypal.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/paypal/paypal.spec.ts
@@ -178,7 +178,7 @@ test.describe(
 					await page.reload();
 				} );

-				await test.step( 'Check the setting present only when Jetpack onboarding is complete', async () => {
+				await test.step( 'Check the Enable PayPal Buttons setting is present after saving', async () => {
 					const paypalButtonsSetting = page.getByText(
 						'Enable PayPal Buttons',
 						{ exact: true }
diff --git a/plugins/woocommerce/tests/e2e/tests/product/product-reviews.spec.ts b/plugins/woocommerce/tests/e2e/tests/product/product-reviews.spec.ts
index a4604e919b9..0438e62ed2b 100644
--- a/plugins/woocommerce/tests/e2e/tests/product/product-reviews.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/product/product-reviews.spec.ts
@@ -72,7 +72,7 @@ const test = baseTest.extend( {

 test.describe( 'Product Reviews', () => {
 	test.describe( 'Merchant manages reviews', () => {
-		test( 'can filter the reviews by product', async ( {
+		test( 'can filter the reviews by product and read the review row', async ( {
 			page,
 			reviews,
 		} ) => {
diff --git a/plugins/woocommerce/tests/e2e/tests/settings/colour-picker-swatch-height.spec.ts b/plugins/woocommerce/tests/e2e/tests/settings/colour-picker-swatch-height.spec.ts
index 4bfb7e9d6db..9e8a10b75a3 100644
--- a/plugins/woocommerce/tests/e2e/tests/settings/colour-picker-swatch-height.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/settings/colour-picker-swatch-height.spec.ts
@@ -10,7 +10,7 @@ test.describe(
 	() => {
 		test.use( { storageState: ADMIN_STATE_PATH } );

-		test( 'colour swatch is correctly sized with WP 7.0 body class', async ( {
+		test( 'colour swatch paints 32px without the WP 7.0 body class and 40px with it', async ( {
 			page,
 		} ) => {
 			await page.goto( 'wp-admin/admin.php?page=wc-settings&tab=email' );
diff --git a/plugins/woocommerce/tests/e2e/tests/settings/settings-general.spec.ts b/plugins/woocommerce/tests/e2e/tests/settings/settings-general.spec.ts
index 1e25dcd63b4..4005ef9aaa0 100644
--- a/plugins/woocommerce/tests/e2e/tests/settings/settings-general.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/settings/settings-general.spec.ts
@@ -41,7 +41,7 @@ test.describe( 'WooCommerce General Settings', { tag: tags.SERVICES }, () => {
 	} );

 	test(
-		'Save Changes button is disabled by default and enabled only after changes.',
+		'Save Changes button stays disabled until a change, and the selling location and base location settings persist.',
 		{
 			tag: [ tags.NON_CRITICAL, tags.NOT_E2E ],
 		},
diff --git a/plugins/woocommerce/tests/php/includes/admin/class-wc-admin-post-types-test.php b/plugins/woocommerce/tests/php/includes/admin/class-wc-admin-post-types-test.php
index 5f7e885bc57..499ad769f5e 100644
--- a/plugins/woocommerce/tests/php/includes/admin/class-wc-admin-post-types-test.php
+++ b/plugins/woocommerce/tests/php/includes/admin/class-wc-admin-post-types-test.php
@@ -484,7 +484,7 @@ class WC_Admin_Post_Types_Test extends WC_Unit_Test_Case {
 				'100',
 				'0',
 			),
-			'empty change-to restoration'        => array(
+			'empty change-to clearing'           => array(
 				'100',
 				'80',
 				array(
diff --git a/plugins/woocommerce/tests/php/includes/admin/meta-boxes/class-wc-meta-box-product-data-linked-products-test.php b/plugins/woocommerce/tests/php/includes/admin/meta-boxes/class-wc-meta-box-product-data-linked-products-test.php
index 79fcf096177..6889f29003c 100644
--- a/plugins/woocommerce/tests/php/includes/admin/meta-boxes/class-wc-meta-box-product-data-linked-products-test.php
+++ b/plugins/woocommerce/tests/php/includes/admin/meta-boxes/class-wc-meta-box-product-data-linked-products-test.php
@@ -93,7 +93,7 @@ class WC_Meta_Box_Product_Data_Linked_Products_Test extends WC_Unit_Test_Case {
 	}

 	/**
-	 * @testdox The classic product save keeps upsells and cross-sells distinct and renders each in its own section.
+	 * @testdox The classic product save keeps upsells and cross-sells distinct, renders the upsells section, and offers the cross-sells in the cart.
 	 */
 	public function test_save_persists_and_renders_distinct_linked_products(): void {
 		$products = $this->create_linked_product_fixtures();
@@ -147,7 +147,7 @@ class WC_Meta_Box_Product_Data_Linked_Products_Test extends WC_Unit_Test_Case {
 	}

 	/**
-	 * @testdox Omitting both linked-product fields clears their IDs and hides both classic sections.
+	 * @testdox Omitting both linked-product fields clears their IDs, hides the classic upsells section, and leaves the cart with no cross-sells.
 	 */
 	public function test_save_clears_and_hides_linked_products(): void {
 		$products = $this->create_linked_product_fixtures();
@@ -181,7 +181,7 @@ class WC_Meta_Box_Product_Data_Linked_Products_Test extends WC_Unit_Test_Case {

 		$upsell_output = $this->render_upsells( $fresh_main );
 		$this->assertStringNotContainsString( 'section class="up-sells upsells products"', $upsell_output, 'An empty upsell collection should not render its section.' );
-		$this->assertLinkedProductNamesAbsent( $products, $upsell_output, 'upsell' );
+		$this->assert_linked_product_names_absent( $products, $upsell_output, 'upsell' );

 		$this->assertSame(
 			array(),
@@ -320,7 +320,7 @@ class WC_Meta_Box_Product_Data_Linked_Products_Test extends WC_Unit_Test_Case {
 	 * @param string                    $output Rendered output.
 	 * @param string                    $family Human-readable family label.
 	 */
-	private function assertLinkedProductNamesAbsent( array $products, string $output, string $family ): void {
+	private function assert_linked_product_names_absent( array $products, string $output, string $family ): void {
 		foreach ( $products as $key => $product ) {
 			if ( 'main' === $key ) {
 				continue;
diff --git a/plugins/woocommerce/tests/php/includes/admin/views/class-wc-admin-product-export-view-test.php b/plugins/woocommerce/tests/php/includes/admin/views/class-wc-admin-product-export-view-test.php
index f5b91b6a5d5..e669bd7a45c 100644
--- a/plugins/woocommerce/tests/php/includes/admin/views/class-wc-admin-product-export-view-test.php
+++ b/plugins/woocommerce/tests/php/includes/admin/views/class-wc-admin-product-export-view-test.php
@@ -38,7 +38,7 @@ class WC_Admin_Product_Export_View_Test extends WC_Unit_Test_Case {

 			$this->assertStringContainsString( 'You are about to export 1 product.', $singular_output );
 			$this->assertSame( (string) $first_product->get_id(), $this->get_hidden_product_ids( $singular_output ) );
-			$this->assertSelectedExportStructure( $singular_output );
+			$this->assert_selected_export_structure( $singular_output );

 			$plural_output = $this->render_export_view( array( $first_product->get_id(), $second_product->get_id() ) );

@@ -47,7 +47,7 @@ class WC_Admin_Product_Export_View_Test extends WC_Unit_Test_Case {
 				$first_product->get_id() . ',' . $second_product->get_id(),
 				$this->get_hidden_product_ids( $plural_output )
 			);
-			$this->assertSelectedExportStructure( $plural_output );
+			$this->assert_selected_export_structure( $plural_output );
 		} finally {
 			foreach ( array_reverse( $product_ids ) as $product_id ) {
 				WC_Helper_Product::delete_product( $product_id );
@@ -73,7 +73,7 @@ class WC_Admin_Product_Export_View_Test extends WC_Unit_Test_Case {
 	 *
 	 * @param string $output Rendered view output.
 	 */
-	private function assertSelectedExportStructure( string $output ): void {
+	private function assert_selected_export_structure( string $output ): void {
 		$this->assertStringContainsString( 'id="selected-product-export-notice"', $output );
 		$this->assertStringContainsString( 'clear your selection', $output );
 		$this->assertStringContainsString( 'containing the selected products', $output );
diff --git a/plugins/woocommerce/tests/php/src/Utilities/MetaDataUtilTest.php b/plugins/woocommerce/tests/php/src/Utilities/MetaDataUtilTest.php
index 3a58140b854..a3c792b4530 100644
--- a/plugins/woocommerce/tests/php/src/Utilities/MetaDataUtilTest.php
+++ b/plugins/woocommerce/tests/php/src/Utilities/MetaDataUtilTest.php
@@ -182,7 +182,7 @@ class MetaDataUtilTest extends WC_Unit_Test_Case {
 	/**
 	 * @testdox `update` uses default_id for entries without an id, updating that metadata row in place.
 	 */
-	public function test_update_passes_default_id(): void {
+	public function test_update_uses_default_id_to_rewrite_the_row_in_place(): void {
 		$order = wc_create_order();
 		$order->add_meta_data( 'original_key', 'original_value' );
 		$order->save();