Commit a624a521e5 for woocommerce

commit a624a521e53ebf9b65d5293a8b12240fd3e49f29
Author: Wesley Rosa <wesleyjrosa@gmail.com>
Date:   Fri Jan 30 23:16:26 2026 -0300

    PayPal Standard e2e tests 1 - enablement (#62981)

    * Revert "Revert "PayPal Standard e2e tests 1 - enablement" (#62977)"

    This reverts commit 3e596189f19d41b946d27df7fb69b2d93af8f071.

    * Add changefile(s) from automation for the following project(s): woocommerce

    * Simplifying logic

    * Removing duplicate changelog entry

    * Add changefile(s) from automation for the following project(s): woocommerce

    * Removing duplicate changelog entry

    ---------

    Co-authored-by: woocommercebot <woocommercebot@users.noreply.github.com>

diff --git a/plugins/woocommerce/changelog/62602-add-paypal-standard-e2e-tests b/plugins/woocommerce/changelog/62602-add-paypal-standard-e2e-tests
new file mode 100644
index 0000000000..812ed7342c
--- /dev/null
+++ b/plugins/woocommerce/changelog/62602-add-paypal-standard-e2e-tests
@@ -0,0 +1,4 @@
+Significance: minor
+Type: dev
+
+Introduce end-to-end tests for PayPal Standard (enablement flow).
\ No newline at end of file
diff --git a/plugins/woocommerce/package.json b/plugins/woocommerce/package.json
index 15d21fb460..515e1de515 100644
--- a/plugins/woocommerce/package.json
+++ b/plugins/woocommerce/package.json
@@ -70,6 +70,7 @@
 		"ci:legacy-minicart-flag-off": "node ./bin/set-legacy-minicart-flag.js && php bin/generate-feature-config.php",
 		"test:e2e:legacy-mini-cart": "pnpm ci:legacy-minicart-flag-off && pnpm test:e2e:default --project=legacy-mini-cart",
 		"test:e2e:blocks:legacy-mini-cart": "pnpm ci:legacy-minicart-flag-off && pnpm --filter='@woocommerce/block-library' test:e2e:legacy-mini-cart",
+		"test:e2e:paypal-standard": "pnpm test:e2e:default --project=paypal-standard",
 		"test:php:legacy-mini-cart": "pnpm ci:legacy-minicart-flag-off && pnpm test:php:env",
 		"test:env:start": "pnpm env:test",
 		"test:perf": "./tests/performance/bin/k6 run ./tests/performance/tests/main.js",
@@ -873,6 +874,25 @@
 						"resultsPath": "tests/e2e-pw/test-results",
 						"allure": true
 					}
+				},
+				{
+					"name": "Core e2e tests - PayPal Standard",
+					"testType": "e2e",
+					"command": "test:e2e:paypal-standard",
+					"shardingArguments": [],
+					"changes": [],
+					"events": [
+						"pull_request",
+						"push"
+					],
+					"testEnv": {
+						"start": "env:test"
+					},
+					"report": {
+						"resultsBlobName": "core-e2e-report",
+						"resultsPath": "tests/e2e-pw/test-results",
+						"allure": true
+					}
 				}
 			]
 		}
diff --git a/plugins/woocommerce/tests/e2e-pw/bin/test-env-setup.sh b/plugins/woocommerce/tests/e2e-pw/bin/test-env-setup.sh
index e28ed4a890..082cd392f7 100755
--- a/plugins/woocommerce/tests/e2e-pw/bin/test-env-setup.sh
+++ b/plugins/woocommerce/tests/e2e-pw/bin/test-env-setup.sh
@@ -30,6 +30,9 @@ wp-env run tests-cli wp plugin activate process-waiting-actions
 echo -e 'Activate Test Helper APIs utility plugin \n'
 wp-env run tests-cli wp plugin activate test-helper-apis

+echo -e 'Activate PayPal Standard plugin \n'
+wp-env run tests-cli wp option patch update woocommerce_paypal_settings _should_load 'yes'
+
 echo -e 'Install Plugin-check utility plugin \n'
 wp-env run tests-cli wp plugin install plugin-check --activate

diff --git a/plugins/woocommerce/tests/e2e-pw/fixtures/fixtures.js b/plugins/woocommerce/tests/e2e-pw/fixtures/fixtures.js
index 70cddc55c2..b135ce3e6b 100644
--- a/plugins/woocommerce/tests/e2e-pw/fixtures/fixtures.js
+++ b/plugins/woocommerce/tests/e2e-pw/fixtures/fixtures.js
@@ -97,4 +97,5 @@ export const tags = {
 	TO_BE_REMOVED: '@to-be-removed',
 	NOT_E2E: '@not-e2e',
 	WP_CORE: '@wp-core',
+	PAYPAL: '@paypal',
 };
diff --git a/plugins/woocommerce/tests/e2e-pw/playwright.config.js b/plugins/woocommerce/tests/e2e-pw/playwright.config.js
index b8f028deeb..7b5e6aa120 100644
--- a/plugins/woocommerce/tests/e2e-pw/playwright.config.js
+++ b/plugins/woocommerce/tests/e2e-pw/playwright.config.js
@@ -143,5 +143,10 @@ export default defineConfig( {
 			testMatch: [ '**/tests/cart/**', '**/tests/checkout/**' ],
 			dependencies: [ 'site setup' ],
 		},
+		{
+			name: 'paypal-standard',
+			testMatch: [ '**/tests/paypal/**' ],
+			dependencies: [ 'site setup' ],
+		},
 	],
 } );
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/paypal/paypal-enablement.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/paypal/paypal-enablement.spec.js
new file mode 100644
index 0000000000..acd7756483
--- /dev/null
+++ b/plugins/woocommerce/tests/e2e-pw/tests/paypal/paypal-enablement.spec.js
@@ -0,0 +1,96 @@
+/**
+ * Internal dependencies
+ */
+import { expect, tags, test } from '../../fixtures/fixtures';
+import { ADMIN_STATE_PATH } from '../../playwright.config';
+
+test.describe(
+	'PayPal Standard Enablement',
+	{ tag: [ tags.PAYMENTS, tags.PAYPAL ] },
+	() => {
+		test.use( { storageState: ADMIN_STATE_PATH } );
+
+		async function openWCSettings( page ) {
+			await page.goto( '/wp-admin/index.php', {
+				waitUntil: 'networkidle0',
+			} );
+
+			await page
+				.locator( '#adminmenu' )
+				.getByRole( 'link', { name: 'WooCommerce', exact: true } )
+				.click();
+
+			const wcMenu = page.locator(
+				'#toplevel_page_woocommerce .wp-submenu'
+			);
+			await expect( wcMenu ).toBeVisible();
+
+			await wcMenu
+				.getByRole( 'link', { name: 'Settings', exact: true } )
+				.click();
+		}
+
+		async function openPayments( page ) {
+			await openWCSettings( page );
+
+			await page
+				.locator( '.woo-nav-tab-wrapper' )
+				.getByRole( 'link', {
+					name: 'Payments',
+					exact: true,
+				} )
+				.click();
+
+			await expect(
+				page.locator( '.settings-payment-gateways__header-title' )
+			).toBeVisible();
+		}
+
+		async function waitForPayPalToLoad( page ) {
+			const paypalDiv = page.locator( '#paypal' );
+			await expect( paypalDiv ).toBeVisible();
+
+			return paypalDiv;
+		}
+
+		test( 'PayPal Standard can be enabled', async ( { page } ) => {
+			await openPayments( page );
+
+			const paypalDiv = await waitForPayPalToLoad( page );
+
+			await test.step( 'Enable PayPal Standard', async () => {
+				await paypalDiv
+					.getByRole( 'link', {
+						name: 'Enable',
+					} )
+					.click();
+			} );
+
+			const labelActive = paypalDiv.getByText( 'Active' );
+			const labelTestAccount = paypalDiv.getByText( 'Test account' );
+
+			// Confirm the status label is present with any of the expected texts.
+			await expect( labelActive.or( labelTestAccount ) ).toBeVisible();
+
+			// Clean up by disabling PayPal again.
+			await test.step( 'Disable PayPal Standard', async () => {
+				await paypalDiv
+					.getByRole( 'button', {
+						name: 'Payment provider options',
+					} )
+					.click();
+
+				await page
+					.getByRole( 'button', {
+						name: 'Disable',
+					} )
+					.click();
+
+				// Confirm the Enable button is present again.
+				await expect(
+					paypalDiv.getByRole( 'link', { name: 'Enable' } )
+				).toBeVisible();
+			} );
+		} );
+	}
+);