Commit cc956a89239 for woocommerce

commit cc956a89239596c125ec9553cc6d45e21dfe8f69
Author: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
Date:   Thu Jul 9 20:11:43 2026 +0300

    e2e tests: close two race windows in blocks save helper (#66458)

diff --git a/plugins/woocommerce/changelog/fix-65677-e2e-save-helper-races b/plugins/woocommerce/changelog/fix-65677-e2e-save-helper-races
new file mode 100644
index 00000000000..b76cee59419
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-65677-e2e-save-helper-races
@@ -0,0 +1,3 @@
+Significance: patch
+Type: dev
+Comment: Close two race windows in the blocks E2E saveSiteEditorEntities helper: gate the top-bar button pick on a rendered Save/Publish button, and converge the stale save-notice sweep to zero before saving so a leftover notice cannot report a false save success. Test-only, no changes to shipped code.
diff --git a/plugins/woocommerce/tests/e2e/utils/blocks/editor/editor-utils.page.ts b/plugins/woocommerce/tests/e2e/utils/blocks/editor/editor-utils.page.ts
index ab5a2673ebc..3daac0c4d0f 100644
--- a/plugins/woocommerce/tests/e2e/utils/blocks/editor/editor-utils.page.ts
+++ b/plugins/woocommerce/tests/e2e/utils/blocks/editor/editor-utils.page.ts
@@ -262,14 +262,25 @@ export class Editor extends CoreEditor {
 			.getByRole( 'button', { name: 'Dismiss this notice' } )
 			.filter( { hasText: /(updated|published)\./ } );

-		const staleSaveNoticeCount = await saveNoticeDismissButton.count();
-		for ( let i = 0; i < staleSaveNoticeCount; i++ ) {
-			const staleSaveNotice = saveNoticeDismissButton.first();
-			if ( ! ( await staleSaveNotice.isVisible() ) ) {
-				break;
-			}
-			await staleSaveNotice.click();
+		// Dismiss any save notices left over from earlier saves. The success
+		// assertion at the end reuses this same locator, so a leftover notice
+		// must not survive into it — converge to zero instead of snapshotting
+		// the count once and breaking on the first invisible notice. The loop
+		// is bounded so a notice that regenerates or refuses to dismiss fails
+		// via the assertion below rather than spinning.
+		for (
+			let i = 0;
+			i < 10 && ( await saveNoticeDismissButton.first().isVisible() );
+			i++
+		) {
+			await saveNoticeDismissButton.first().click();
 		}
+		await expect( saveNoticeDismissButton ).toHaveCount( 0 );
+
+		// Wait for the top bar to render its primary action before the
+		// instantaneous pick below; otherwise an unrendered bar falls through
+		// to a Publish button that never exists in the site editor.
+		await expect( saveButton.or( publishButton ).first() ).toBeVisible();

 		const buttonToClick = ( await saveButton.isVisible() )
 			? saveButton