Skip to content

Commit 10d5161

Browse files
committed
🔀 Merge branch 'dev/develop'
2 parents 77d5965 + a96febb commit 10d5161

12 files changed

Lines changed: 378 additions & 33 deletions

File tree

‎.github/workflows/e2e-tests.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@ on:
99
default: 'e2e:test:dev'
1010
type: choice
1111
options:
12+
- e2e:test:plugin-foundation
1213
- e2e:test:dev
1314
- e2e:test:smoke
1415
- e2e:test:critical
1516
- e2e:test:stress
1617
- e2e:test:all
18+
XRAY_TEST_EXEC_KEY:
19+
description: 'Xray Test Execution Key'
20+
required: false
21+
default: ''
22+
type: string
1723

1824
concurrency:
1925
group: ${{ github.workflow }}-${{ github.ref }}
@@ -47,6 +53,7 @@ jobs:
4753
ARTIFACT_INCLUDE_HIDDEN_FILES: true
4854
NODE_VERSION: 22
4955
PLAYWRIGHT_BROWSER_ARGS: 'chromium --with-deps'
56+
XRAY_TEST_EXEC_KEY: ${{ inputs.XRAY_TEST_EXEC_KEY }}
5057
PRE_SCRIPT: |
5158
# 1. Download and unzip the built plugin
5259
gh run download ${{ github.run_id }} -p "woocommerce-paypal-payments-*" -D resources/files

‎tests/qa/.env.example‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ WC_DEFAULT_CURRENCY=USD
2929
# Xray in Jira
3030
XRAY_CLIENT_ID=
3131
XRAY_CLIENT_SECRET=
32-
# TEST_EXEC_KEY=''
32+
# XRAY_TEST_EXEC_KEY=''
3333

3434
PAYPAL_PERSONAL_EMAIL_DE=
3535
PAYPAL_PERSONAL_PASS_DE=
@@ -40,6 +40,9 @@ PAYPAL_PERSONAL_PASS_US=
4040
PAYPAL_PERSONAL_EMAIL_US2=
4141
PAYPAL_PERSONAL_PASS_US2=
4242

43+
GOOGLE_PAY_EMAIL=
44+
GOOGLE_PAY_PASSWORD=
45+
4346
PAYPAL_PERSONAL_EMAIL_MX=
4447
PAYPAL_PERSONAL_PASS_MX=
4548

‎tests/qa/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ This will run the next scripts:
5959

6060
2.1 Set general variables following [these steps](https://github.com/inpsyde/playwright-utils?tab=readme-ov-file#env-variables).
6161

62-
2.2 Set PayPal API keys and test credentials. See `.env.example`. The `.env` content with actual test users' credentials is [stored in 1Password](https://start.1password.com/open/i?a=UL7QZZ6P6JDVBI422AOVJXMEGU&v=uthlbcp4jkori6w6rhgxvsvfoe&i=klejf7rgcip76c7auhsnhvxcbi&h=inpsyde.1password.eu).
62+
2.2 Set PayPal API keys and test credentials. See `.env.example`. For Google Pay transaction tests, make sure to also set `GOOGLE_PAY_EMAIL` and `GOOGLE_PAY_PASSWORD`. The `.env` content with actual test users' credentials is [stored in 1Password](https://start.1password.com/open/i?a=UL7QZZ6P6JDVBI422AOVJXMEGU&v=uthlbcp4jkori6w6rhgxvsvfoe&i=klejf7rgcip76c7auhsnhvxcbi&h=inpsyde.1password.eu).
6363

6464
3. Configure `playwright.config.ts` of the project following [these steps](https://github.com/inpsyde/playwright-utils?tab=readme-ov-file#playwright-configuration).
6565

@@ -117,7 +117,7 @@ This will run the next scripts:
117117

118118
3. Set Test Execution ticket status `In progress`.
119119

120-
4. In `.env` file of the test project (`/tests/qa/`) add/update test execution ticket key (`TEST_EXEC_KEY='PCP-234'`).
120+
4. In `.env` file of the test project (`/tests/qa/`) add/update test execution ticket key (`XRAY_TEST_EXEC_KEY='PCP-234'`).
121121

122122
5. Download tested plugin `.zip` package (usually attached to release ticket) and add it to `/tests/qa/resources/files`. You may need to remove version number from the file name (expected name: `woocommerce-paypal-payments.zip`).
123123

‎tests/qa/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"lint:js:fix": "wp-scripts lint-js --resolve-plugins-relative-to ./ --fix **/*.{ts,tsx,mjs}",
3434
"e2e:setup:hosts": "echo '127.0.0.1 mywp.site' | sudo tee -a /etc/hosts",
3535
"e2e:setup:env": "npm run e2e:setup:hosts && npm install && npx wp-env start --update",
36+
"e2e:test:plugin-foundation": "npx playwright test --workers=1 --project \"plugin-foundation\"",
3637
"e2e:test:all": "npx playwright test --workers=1 --project \"all\"",
3738
"e2e:test:stress": "npx playwright test --project=\"stress\"",
3839
"e2e:test:critical": "npx playwright test --grep=\"@Critical\"",

‎tests/qa/playwright.config.ts‎

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,20 @@ export default defineConfig< BaseExtend >( {
3434
/* The base directory, relative to the config file, for snapshot files created with toMatchSnapshot */
3535
snapshotDir: './snapshots',
3636
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
37-
reporter: process.env.CI
38-
? [
39-
[ 'list' ],
40-
[ 'html', { outputFolder: 'playwright-report' } ],
41-
[
42-
'@inpsyde/playwright-utils/build/integration/jira/xray-reporter.js',
43-
{
44-
apiClient: {
45-
client_id: process.env.XRAY_CLIENT_ID,
46-
client_secret: process.env.XRAY_CLIENT_SECRET,
47-
},
48-
testExecutionKey: process.env.TEST_EXEC_KEY,
49-
},
50-
],
51-
]
52-
: [
53-
[ 'list' ],
54-
[ 'html', { outputFolder: 'playwright-report' } ],
55-
[
56-
'@inpsyde/playwright-utils/build/integration/jira/xray-reporter.js',
57-
{
58-
apiClient: {
59-
client_id: process.env.XRAY_CLIENT_ID,
60-
client_secret: process.env.XRAY_CLIENT_SECRET,
61-
},
62-
testExecutionKey: process.env.TEST_EXEC_KEY,
63-
},
64-
],
65-
],
37+
reporter: [
38+
[ 'list' ],
39+
[ 'html', { outputFolder: 'playwright-report' } ],
40+
[
41+
'@inpsyde/playwright-utils/build/integration/jira/xray-reporter.js',
42+
{
43+
apiClient: {
44+
client_id: process.env.XRAY_CLIENT_ID,
45+
client_secret: process.env.XRAY_CLIENT_SECRET,
46+
},
47+
testExecutionKey: process.env.XRAY_TEST_EXEC_KEY,
48+
},
49+
],
50+
],
6651
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
6752

6853
globalSetup: require.resolve( './global-setup' ),
@@ -136,10 +121,18 @@ export default defineConfig< BaseExtend >( {
136121
testMatch: /pcp\.setup\.ts/,
137122
fullyParallel: false,
138123
},
124+
{
125+
name: 'plugin-foundation',
126+
dependencies: [ 'setup-woocommerce' ],
127+
testMatch: /plugin-foundation\.spec\.ts/,
128+
},
139129
{
140130
name: 'all',
141131
dependencies: [ 'setup-woocommerce' ],
142-
testIgnore: /stress\.spec\.ts/,
132+
testIgnore: [
133+
/stress\.spec\.ts/,
134+
/plugin-foundation\.spec\.ts/,
135+
],
143136
},
144137
{
145138
name: 'stress',

‎tests/qa/resources/pcp-payments.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ const payUponInvoice: Pcp.Payment = {
7070
birthDate: '01.01.1991',
7171
};
7272

73+
const googlePay: Pcp.Payment = {
74+
gateway: gateways.googlepay,
75+
card: cards.visa,
76+
};
77+
7378
export const payments = {
7479
payPal,
7580
payPalVaulted,
@@ -83,4 +88,5 @@ export const payments = {
8388
debitOrCreditCard,
8489
standardCardButton,
8590
payUponInvoice,
91+
googlePay,
8692
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Internal dependencies
3+
*/
4+
import { payments, orders, customers, ShopOrder } from '../../../../resources';
5+
6+
const customer = customers.usa;
7+
8+
export const googlePayCheckout: ShopOrder[] = [
9+
{
10+
// https://inpsyde.atlassian.net/browse/PCP-26555
11+
title: 'PCP-26555 | Transaction - Checkout - Google Pay - Order by customer',
12+
...orders.default,
13+
payment: payments.googlePay,
14+
customer,
15+
},
16+
];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './googlepay-checkout.data';
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* Internal dependencies
3+
*/
4+
import { test } from '../../utils';
5+
import { merchants, storeConfigUsa, gateways, customers } from '../../resources';
6+
import { transactionsOnCheckout } from './_test-scenarios';
7+
import { googlePayCheckout } from './_test-data/googlepay';
8+
import { GooglePayPopup } from '../../utils/frontend/google-pay-popup';
9+
10+
const { acdc, googlepay } = gateways;
11+
12+
test.use( {
13+
// Strip Basic Auth from the visitor context — when present it breaks
14+
// Playwright's popup-event tracking for cross-origin window.open() calls.
15+
httpCredentials: undefined,
16+
screenshot: 'off',
17+
trace: 'off',
18+
video: 'off',
19+
launchOptions: {
20+
args: [
21+
'--disable-web-security',
22+
'--disable-blink-features=AutomationControlled',
23+
'--disable-features=UserAgentClientHint',
24+
],
25+
},
26+
} );
27+
28+
test.beforeEach( async ( { visitorPage } ) => {
29+
await GooglePayPopup.applyBrowserPatches( visitorPage.context() );
30+
} );
31+
32+
test.beforeAll( async ( { utils, pcpApi, wooCommerceApi } ) => {
33+
await utils.configureStore( { ...storeConfigUsa, customer: customers.usa } );
34+
await utils.installAndActivatePcp();
35+
await pcpApi.resetDb();
36+
await pcpApi.connectMerchant( merchants.usa.client_id, merchants.usa.client_secret );
37+
// Google Pay requires ACDC to be enabled alongside it.
38+
await pcpApi.updatePcpPaymentMethods( {
39+
[ acdc.id ]: { id: acdc.id, enabled: true },
40+
[ googlepay.id ]: { id: googlepay.id, enabled: true },
41+
} );
42+
await wooCommerceApi.deleteAllOrders();
43+
} );
44+
45+
for ( const order of googlePayCheckout ) {
46+
transactionsOnCheckout( order );
47+
}

0 commit comments

Comments
 (0)