Commit 949b59b06f for woocommerce

commit 949b59b06f85fbba7c01ee543dd568355605139d
Author: Wesley Rosa <wesleyjrosa@gmail.com>
Date:   Tue Feb 24 15:40:36 2026 -0300

    PayPal Standard e2e tests 1 - enablement (#63068)

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

    This reverts commit c7415a52e7ef4f7ebc8a6096ceda861b006967c1.

    * Adding increased timeout value following existing tests

    * Moving the visibility options to a new constant

    * Removing e2e test definition from package.json

    * Fix waitUntil parameter name

    * Additional timeout configuration

    * Skip test if PayPal is already enabled

    * Applying AI suggestions

    * Moving environment reset to a new test step

    * Moving setup to a new fixture file

    * Attempting coderabbit suggestion to lock tests

    * Changing file path + removing path package

    * Revert older updates

    * Revert older updates

    * Fix lint issue

    * Putting back the standalone runner for PayPal Standard tests

    * Update plugins/woocommerce/tests/e2e-pw/playwright.config.js

    Co-authored-by: daledupreez <dale@automattic.com>

    * Update plugins/woocommerce/package.json

    Co-authored-by: daledupreez <dale@automattic.com>

    * Revert lock file changes

    ---------

    Co-authored-by: daledupreez <dale@automattic.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 dabafc325e..f68ede1ea4 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,27 @@
 						"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",
+						"release-checks",
+						"core-e2e"
+					],
+					"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/fixtures/fixtures.ts b/plugins/woocommerce/tests/e2e-pw/fixtures/fixtures.ts
index 4d49353dd5..ecbd78488d 100644
--- a/plugins/woocommerce/tests/e2e-pw/fixtures/fixtures.ts
+++ b/plugins/woocommerce/tests/e2e-pw/fixtures/fixtures.ts
@@ -97,4 +97,5 @@ export const tags = {
 	TO_BE_REMOVED: '@to-be-removed',
 	NOT_E2E: '@not-e2e',
 	WP_CORE: '@wp-core',
+	PAYPAL: '@paypal',
 } as const;
diff --git a/plugins/woocommerce/tests/e2e-pw/fixtures/paypal-fixtures.js b/plugins/woocommerce/tests/e2e-pw/fixtures/paypal-fixtures.js
new file mode 100644
index 0000000000..1d3b2ac13e
--- /dev/null
+++ b/plugins/woocommerce/tests/e2e-pw/fixtures/paypal-fixtures.js
@@ -0,0 +1,21 @@
+/**
+ * Internal dependencies
+ */
+import { test as baseTest } from './fixtures';
+import { ADMIN_STATE_PATH } from '../playwright.config';
+import { wpCLI } from '../utils/cli';
+
+export const test = baseTest.extend( {
+	page: async ( { page }, use ) => {
+		await wpCLI(
+			"wp option patch update woocommerce_paypal_settings _should_load 'yes'"
+		);
+
+		await use( page );
+
+		await wpCLI(
+			"wp option patch update woocommerce_paypal_settings _should_load 'no'"
+		);
+	},
+	storageState: ADMIN_STATE_PATH,
+} );
diff --git a/plugins/woocommerce/tests/e2e-pw/playwright.config.js b/plugins/woocommerce/tests/e2e-pw/playwright.config.js
index c760026db0..f63a309e7d 100644
--- a/plugins/woocommerce/tests/e2e-pw/playwright.config.js
+++ b/plugins/woocommerce/tests/e2e-pw/playwright.config.js
@@ -130,7 +130,11 @@ export default defineConfig( {
 		...setupProjects,
 		{
 			name: 'e2e',
-			testIgnore: '**/api-tests/**',
+			testIgnore: [
+				'**/api-tests/**',
+				/* Exclude PayPal tests, as they don't run well in parallel - see https://github.com/woocommerce/woocommerce/pull/63068. */
+				'**/tests/paypal/**',
+			],
 			dependencies: [ 'site setup' ],
 		},
 		{
@@ -143,5 +147,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..14e7e12b97
--- /dev/null
+++ b/plugins/woocommerce/tests/e2e-pw/tests/paypal/paypal-enablement.spec.js
@@ -0,0 +1,102 @@
+/**
+ * Internal dependencies
+ */
+import { expect, tags } from '../../fixtures/fixtures';
+import { test } from '../../fixtures/paypal-fixtures';
+import { ADMIN_STATE_PATH } from '../../playwright.config';
+
+test.describe(
+	'PayPal Standard Enablement',
+	{ tag: [ tags.PAYMENTS, tags.PAYPAL ] },
+	() => {
+		test.use( { storageState: ADMIN_STATE_PATH } );
+
+		const visibilityOptions = { timeout: 30000 };
+
+		async function openWCSettings( page ) {
+			await page.goto( '/wp-admin/index.php', {
+				// networkidle is needed to ensure all JS files are loaded and avoid race conditions
+				// eslint-disable-next-line playwright/no-networkidle
+				waitUntil: 'networkidle',
+			} );
+
+			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( visibilityOptions );
+		}
+
+		async function waitForPayPalToLoad( page ) {
+			const paypalDiv = page.locator( '#paypal' );
+			await expect( paypalDiv ).toBeVisible( visibilityOptions );
+
+			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 () => {
+				const enableLink = paypalDiv.getByRole( 'link', {
+					name: 'Enable',
+				} );
+				await expect( enableLink ).toBeVisible( visibilityOptions );
+				await enableLink.click();
+			} );
+
+			const labelActive = paypalDiv.getByText( 'Active' );
+			const labelTestAccount = paypalDiv.getByText( 'Test account' );
+
+			await expect( labelActive.or( labelTestAccount ) ).toBeVisible(
+				visibilityOptions
+			);
+
+			// 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( visibilityOptions );
+			} );
+		} );
+	}
+);