Commit 06b9ab4df8 for woocommerce
commit 06b9ab4df8a7084952ff6f86ce93b83f7616ce50
Author: Wesley Rosa <wesleyjrosa@gmail.com>
Date: Fri Jan 23 16:43:48 2026 -0300
PayPal Standard e2e tests 1 - enablement (#62602)
* PayPal Standard e2e tests
* Package json update
* Fix test definitions
* Fix events
* Test env update
* Fix test
* Improve test
* Fix tests
* Fix lint issues
* Fix tests
* Fix tests
* Fix lint issues
* Fix tests
* Moving PayPal setup to sh file
* Fix tests
* Temporarily removing other tests to speed up development
* Fix tests
* Fix tests
* Fix tests
* Fix tests
* Fix tests
* Reducing PR scope
* Add changefile(s) from automation for the following project(s): woocommerce
* Revert tests removal
* fix tests config
* Fix lint
* Add changefile(s) from automation for the following project(s): woocommerce
* Update plugins/woocommerce/tests/e2e-pw/tests/paypal/paypal-installation.spec.js
Co-authored-by: daledupreez <dale@automattic.com>
* Add changefile(s) from automation for the following project(s): woocommerce
* Updating the file name and description
* Checking for alternative status badge text
* Attempt to fix possible test flakiness
* Attempt to fix possible test flakiness
* Applying code rabbit suggestion
* Attempt to fix possible test flakiness
* Fix tests
* Fix tests
* Remove debug code
* Disabling PayPal after the main test is executed
* Fix tests
---------
Co-authored-by: github-actions <github-actions@github.com>
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 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..c5fd76e1b6
--- /dev/null
+++ b/plugins/woocommerce/tests/e2e-pw/tests/paypal/paypal-enablement.spec.js
@@ -0,0 +1,102 @@
+/**
+ * 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',
+ } );
+
+ const adminMenu = page.locator( '#adminmenu' );
+ await 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 );
+
+ const navTabWrapper = page.locator( '.woo-nav-tab-wrapper' );
+
+ await navTabWrapper
+ .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 () => {
+ // Confirm the Enable button is present.
+ const enableButton = paypalDiv.getByRole( 'link', {
+ name: 'Enable',
+ } );
+ await expect( enableButton ).toBeVisible();
+
+ // Click the Enable button.
+ await enableButton.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 () => {
+ const optionsButton = paypalDiv.getByRole( 'button', {
+ name: 'Payment provider options',
+ } );
+ await expect( optionsButton ).toBeVisible();
+
+ await optionsButton.click();
+
+ const disableButton = page.getByRole( 'button', {
+ name: 'Disable',
+ } );
+ await expect( disableButton ).toBeVisible();
+
+ await disableButton.click();
+
+ // Confirm the Enable button is present again.
+ await expect(
+ paypalDiv.getByRole( 'link', { name: 'Enable' } )
+ ).toBeVisible();
+ } );
+ } );
+ }
+);