Skip to content

Commit 6ed9323

Browse files
authored
Merge pull request #4444 from woocommerce/dev/qa/new-autotests-pcp-6459-pcp-6513
[QA] New autotests for variable product, negative fees
2 parents 62d002b + 0f300e9 commit 6ed9323

55 files changed

Lines changed: 1726 additions & 769 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/e2e-tests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ on:
2121
- shard:settings
2222
- shard:transaction-usa
2323
- shard:transaction-mexico
24-
# - shard:transaction-googlepay - temporarily disabled due to instability in CI
2524
- shard:refund
2625
- shard:vaulting
2726
- shard:subscription
@@ -72,7 +71,6 @@ jobs:
7271
settings
7372
transaction-usa
7473
transaction-mexico
75-
# transaction-googlepay - temporarily disabled due to instability in CI
7674
refund
7775
vaulting
7876
subscription

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@
4848
"e2e:test:shard:transaction-mexico:smoke": "npx playwright test --project \"shard:transaction-mexico\" --grep \"@Smoke\"",
4949
"e2e:test:shard:transaction-mexico:critical": "npx playwright test --project \"shard:transaction-mexico\" --grep \"@Critical\"",
5050

51-
"e2e:test:shard:transaction-googlepay": "npx playwright test --project \"shard:transaction-googlepay\"",
52-
"e2e:test:shard:transaction-googlepay:smoke": "npx playwright test --project \"shard:transaction-googlepay\" --grep \"@Smoke\"",
53-
"e2e:test:shard:transaction-googlepay:critical": "npx playwright test --project \"shard:transaction-googlepay\" --grep \"@Critical\"",
54-
5551
"e2e:test:shard:refund": "npx playwright test --project \"shard:refund\"",
5652
"e2e:test:shard:refund:smoke": "npx playwright test --project \"shard:refund\" --grep \"@Smoke\"",
5753
"e2e:test:shard:refund:critical": "npx playwright test --project \"shard:refund\" --grep \"@Critical\"",

playwright.config.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -167,20 +167,6 @@ export default defineConfig< BaseExtend >( {
167167
grep: /setup:transaction:mexico;/,
168168
fullyParallel: false,
169169
},
170-
{
171-
name: 'setup-transaction-googlepay',
172-
dependencies: [ 'setup-pcp-usa' ],
173-
testMatch: /03-pcp\.setup\.ts/,
174-
grep: /setup:transaction:googlepay;/,
175-
fullyParallel: false,
176-
},
177-
{
178-
name: 'setup-refund',
179-
dependencies: [ 'setup-pcp-usa' ],
180-
testMatch: /03-pcp\.setup\.ts/,
181-
grep: /setup:refund;/,
182-
fullyParallel: false,
183-
},
184170
{
185171
name: 'setup-vaulting',
186172
dependencies: [ 'setup-pcp-usa' ],
@@ -226,19 +212,14 @@ export default defineConfig< BaseExtend >( {
226212
dependencies: [ 'setup-transaction-usa' ],
227213
testMatch: /05-transactions\/transaction-usa.*\.spec\.ts/,
228214
},
229-
{
230-
name: 'shard:transaction-googlepay',
231-
dependencies: [ 'setup-transaction-googlepay' ],
232-
testMatch: /05-transactions\/transaction-googlepay\.spec\.ts/,
233-
},
234215
{
235216
name: 'shard:transaction-mexico',
236217
dependencies: [ 'setup-transaction-mexico' ],
237218
testMatch: /05-transactions\/transaction-mexico.*\.spec\.ts/,
238219
},
239220
{
240221
name: 'shard:refund',
241-
dependencies: [ 'setup-refund' ],
222+
dependencies: [ 'setup-transaction-usa' ],
242223
testMatch: /06-refund\/.*\.spec\.ts/,
243224
},
244225
{

tests/qa/resources/e2e-plugins.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,9 @@ export const subscriptionsPlugin = {
3535
slug: 'woocommerce-subscriptions',
3636
zipFilePath: `${ filePath }/woocommerce-subscriptions.zip`,
3737
};
38+
39+
export const negative12FeePlugin = {
40+
name: 'Negative 12 Fee',
41+
slug: 'negative-12-fee',
42+
zipFilePath: `${ filePath }/negative-12-fee.zip`,
43+
};
683 Bytes
Binary file not shown.

tests/qa/resources/orders.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ const country = process.env.WC_DEFAULT_COUNTRY || 'usa';
1111
const currency = process.env.WC_DEFAULT_CURRENCY || 'USD';
1212
const merchant = merchants[ country ];
1313

14+
orders.negative12Fee = {
15+
...orders.default,
16+
fees: [ {
17+
name: 'negative12Fee',
18+
total: '-12.00',
19+
type: 'fixed',
20+
} ],
21+
};
22+
1423
for ( const order in orders ) {
1524
orders[ order ].merchant = merchant;
1625
orders[ order ].currency = currency;

tests/qa/resources/pcp-products.ts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,78 @@
33
*/
44
import { products as baseProducts } from '@inpsyde/playwright-utils/build';
55

6+
const variationNotSelected100: WooCommerce.CreateProduct = {
7+
name: 'Variable T-Shirt',
8+
slug: 'variable-t-shirt',
9+
type: 'variable',
10+
regular_price: '100.00',
11+
description:
12+
'A comfortable t-shirt available in multiple colors and sizes.',
13+
short_description: 'Variable t-shirt with color and size options.',
14+
attributes: [
15+
{
16+
name: 'Color',
17+
variation: true,
18+
options: [ 'Gray', 'Red' ],
19+
},
20+
{
21+
name: 'Size',
22+
variation: true,
23+
options: [ 'M', 'L' ],
24+
},
25+
],
26+
default_attributes: [],
27+
variations: [
28+
{
29+
attributes: [
30+
{ name: 'Color', option: 'Gray' },
31+
{ name: 'Size', option: 'M' },
32+
],
33+
regular_price: '100.00',
34+
stock_status: 'instock',
35+
manage_stock: false,
36+
},
37+
{
38+
attributes: [
39+
{ name: 'Color', option: 'Gray' },
40+
{ name: 'Size', option: 'L' },
41+
],
42+
regular_price: '100.00',
43+
stock_status: 'instock',
44+
manage_stock: false,
45+
},
46+
{
47+
attributes: [
48+
{ name: 'Color', option: 'Red' },
49+
{ name: 'Size', option: 'M' },
50+
],
51+
regular_price: '100.00',
52+
stock_status: 'instock',
53+
manage_stock: false,
54+
},
55+
{
56+
attributes: [
57+
{ name: 'Color', option: 'Red' },
58+
{ name: 'Size', option: 'L' },
59+
],
60+
regular_price: '100.00',
61+
stock_status: 'instock',
62+
manage_stock: false,
63+
},
64+
],
65+
images: [
66+
{
67+
src: 'https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vneck-tee-2.jpg',
68+
},
69+
{
70+
src: 'https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/tshirt-2.jpg',
71+
},
72+
{
73+
src: 'https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/t-shirt-with-logo-1.jpg',
74+
},
75+
],
76+
};
77+
678
const subscriptionPayPal: WooCommerce.CreateProduct = {
779
name: 'PayPal Subscription Test Product',
880
slug: 'paypal-subscription-test-product',
@@ -73,6 +145,7 @@ export const products: {
73145
[ key: string ]: WooCommerce.CreateProduct;
74146
} = {
75147
...baseProducts,
148+
variationNotSelected100,
76149
subscriptionPayPal,
77150
subscriptionPayPalFreeTrial,
78151
simpleWithStock,

tests/qa/resources/types.ts

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export type ShopConfig = {
99
};
1010
customer?: WooCommerce.CreateCustomer; // Registered customer to be created
1111
products?: WooCommerce.CreateProduct[]; // Products to be created if not existing
12+
isPayNowEnabled?: boolean; // Is Pay Now Experience option enabled in PCP Settings > Payment Methods
1213
};
1314

1415
export type PayPalAccount = {
@@ -144,6 +145,65 @@ export namespace Pcp {
144145
softDescriptor?: string;
145146
subtotalAdjustment?: string;
146147
};
148+
149+
export namespace Styling {
150+
// Top-level styling keys (camelCase) — addresses each location's config
151+
export type LocationPageKey =
152+
| 'cart'
153+
| 'classicCheckout'
154+
| 'expressCheckout'
155+
| 'miniCart'
156+
| 'product';
157+
158+
// Value echoed in the `location` field of a styling block (snake_case)
159+
export type LocationPageSlug =
160+
| 'cart'
161+
| 'classic_checkout'
162+
| 'express_checkout'
163+
| 'mini_cart'
164+
| 'product';
165+
166+
// API value of Admin.Styling.ButtonLayout
167+
export type ButtonLayout = 'vertical' | 'horizontal';
168+
169+
// API value of Admin.Styling.ButtonShape
170+
export type ButtonShape = 'rect' | 'pill';
171+
172+
// API value of Admin.Styling.ButtonLabel
173+
// 'paypal' = PayPal, 'checkout' = Checkout, 'buynow' = PayPal Buy Now, 'pay' = Pay with PayPal
174+
export type ButtonLabel = 'paypal' | 'checkout' | 'buynow' | 'pay';
175+
176+
// API value of Admin.Styling.ButtonColor
177+
export type ButtonColor =
178+
| 'gold'
179+
| 'blue'
180+
| 'silver'
181+
| 'black'
182+
| 'white';
183+
184+
// Per-location styling block (mirrors Admin.Styling.Config)
185+
export type LocationPageConfig = {
186+
enabled?: boolean;
187+
methods?: Extract <
188+
GatewayId,
189+
| 'ppcp-gateway'
190+
| 'pay-later'
191+
| 'venmo'
192+
| 'ppcp-googlepay'
193+
| 'ppcp-applepay'
194+
>[];
195+
label?: ButtonLabel;
196+
shape?: ButtonShape;
197+
color?: ButtonColor;
198+
location?: LocationPageSlug;
199+
layout?: ButtonLayout;
200+
tagline?: boolean;
201+
};
202+
203+
export type Settings = Partial <
204+
Record < LocationPageKey, LocationPageConfig >
205+
>;
206+
}
147207
}
148208

149209
export namespace Admin {
@@ -184,7 +244,7 @@ export namespace Pcp {
184244
};
185245

186246
export namespace Styling {
187-
export type Location =
247+
export type LocationPage =
188248
| 'Cart'
189249
| 'Classic Checkout'
190250
| 'Express Checkout'
@@ -216,8 +276,8 @@ export namespace Pcp {
216276
| 'Black'
217277
| 'White';
218278

219-
export type Config = {
220-
location?: Location;
279+
export type LocationPageConfig = {
280+
location?: LocationPage;
221281
enablePaymentMethodsInLocation?: boolean;
222282
paymentMethods?: PaymentMethods;
223283
buttonLayout?: ButtonLayout;
@@ -294,8 +354,17 @@ export namespace Pcp {
294354
merchant?: Merchant;
295355
paymentMethods?: Gateway[];
296356
settings?: Settings;
297-
styling?: Styling.Config;
357+
styling?: Styling.LocationPageConfig;
298358
payLaterMessaging?: Plm.Config;
299359
};
300360
}
301361
}
362+
363+
export type PayPalPaymentDetails = {
364+
transactionId?: string;
365+
currency?: string;
366+
amount?: string;
367+
grossAmount?: string;
368+
payPalFee?: string;
369+
netAmount?: string;
370+
};

tests/qa/tests/03-plugin-settings/pay-later-messaging-ui.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ test.beforeAll( async ( { utils, pcpApi } ) => {
1414
);
1515
} );
1616

17-
test( 'PCP-0000 | Settings - Pay Later Messaging - Default UI', async ( {
17+
// https://inpsyde.atlassian.net/browse/PCP-4336
18+
test( 'PCP-4336 | Settings - Pay Later Messaging - Default UI', async ( {
1819
utils,
1920
payPalUi,
2021
pcpPayLaterMessaging,
@@ -107,7 +108,8 @@ test( 'PCP-0000 | Settings - Pay Later Messaging - Default UI', async ( {
107108
).not.toBeVisible();
108109
} );
109110

110-
test( 'PCP-0000 | Settings - Pay Later Messaging - Disabled on all pages', async ( {
111+
// https://inpsyde.atlassian.net/browse/PCP-4337
112+
test( 'PCP-4337 | Settings - Pay Later Messaging - Disabled on all pages', async ( {
111113
utils,
112114
payPalUi,
113115
pcpPayLaterMessaging,

tests/qa/tests/03-plugin-settings/styling-ui.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ test.beforeAll( async ( { utils, pcpApi } ) => {
2222
);
2323
} );
2424

25-
test( 'PCP-0000 | Settings - Styling - Default UI', async ( {
25+
// https://inpsyde.atlassian.net/browse/PCP-4747
26+
test( 'PCP-4747 | Settings - US- Styling - Default UI', async ( {
2627
utils,
2728
pcpStyling,
2829
product,

0 commit comments

Comments
 (0)