Skip to content

Commit 860ca3c

Browse files
authored
Merge pull request #4304 from woocommerce/dev/qa/fix-for-4.0.3
[QA] Auto test fixes for 4.0.3
2 parents 21364e3 + a0b0d06 commit 860ca3c

18 files changed

Lines changed: 55 additions & 115 deletions

tests/qa/resources/pcp-gateways.ts

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const payPal: Pcp.Gateway = {
1111
id: 'ppcp-gateway',
1212
description: '',
1313
title: 'PayPal',
14+
titleInModal: 'PayPal',
1415
titleInPcpSettings: 'PayPal',
1516
titleInWcSettings: 'PayPal',
1617
hasSettingsButton: true,
@@ -27,6 +28,7 @@ const venmo: Pcp.Gateway = {
2728
id: 'venmo',
2829
description: '',
2930
title: 'Venmo',
31+
titleInModal: 'Venmo',
3032
titleInPcpSettings: 'Venmo',
3133
titleInWcSettings: 'Venmo',
3234
hasSettingsButton: false,
@@ -41,6 +43,7 @@ const payLater: Pcp.Gateway = {
4143
id: 'pay-later',
4244
description: '',
4345
title: 'PayPal Pay Later',
46+
titleInModal: 'PayPal Pay Later',
4447
titleInPcpSettings: 'Pay Later',
4548
hasSettingsButton: false,
4649
enabled: false,
@@ -95,6 +98,7 @@ const applepay: Pcp.Gateway = {
9598
id: 'ppcp-applepay',
9699
description: '',
97100
title: 'Apple Pay',
101+
titleInModal: 'Apple Pay',
98102
titleInPcpSettings: 'Apple Pay',
99103
titleInWcSettings: 'Apple Pay (via PayPal)',
100104
hasSettingsButton: true,
@@ -110,6 +114,7 @@ const googlepay: Pcp.Gateway = {
110114
id: 'ppcp-googlepay',
111115
description: '',
112116
title: 'Google Pay',
117+
titleInModal: 'Google Pay',
113118
titleInPcpSettings: 'Google Pay',
114119
titleInWcSettings: ' (via PayPal)',
115120
hasSettingsButton: true,
@@ -126,6 +131,7 @@ const bancontact: Pcp.Gateway = {
126131
id: 'ppcp-bancontact',
127132
description: '',
128133
title: 'Bancontact',
134+
titleInModal: 'Bancontact',
129135
titleInPcpSettings: 'Bancontact',
130136
titleInWcSettings: 'Bancontact (via PayPal)',
131137
hasSettingsButton: true,
@@ -142,6 +148,7 @@ const blik: Pcp.Gateway = {
142148
id: 'ppcp-blik',
143149
description: '',
144150
title: 'Blik',
151+
titleInModal: 'Blik',
145152
titleInPcpSettings: 'Blik',
146153
titleInWcSettings: ' (via PayPal)',
147154
hasSettingsButton: true,
@@ -158,6 +165,7 @@ const eps: Pcp.Gateway = {
158165
id: 'ppcp-eps',
159166
description: '',
160167
title: 'EPS',
168+
titleInModal: 'EPS',
161169
titleInPcpSettings: 'EPS',
162170
titleInWcSettings: 'EPS (via PayPal)',
163171
hasSettingsButton: true,
@@ -174,6 +182,7 @@ const ideal: Pcp.Gateway = {
174182
id: 'ppcp-ideal',
175183
description: '',
176184
title: 'iDeal',
185+
titleInModal: 'iDeal',
177186
titleInPcpSettings: 'iDeal',
178187
titleInWcSettings: ' (via PayPal)',
179188
hasSettingsButton: true,
@@ -189,6 +198,7 @@ const mybank: Pcp.Gateway = {
189198
id: 'ppcp-mybank',
190199
description: '',
191200
title: 'MyBank',
201+
titleInModal: 'MyBank',
192202
titleInPcpSettings: 'MyBank',
193203
titleInWcSettings: ' (via PayPal)',
194204
hasSettingsButton: true,
@@ -204,6 +214,7 @@ const przelewy24: Pcp.Gateway = {
204214
id: 'ppcp-p24',
205215
description: '',
206216
title: 'Przelewy24',
217+
titleInModal: 'Przelewy24',
207218
titleInPcpSettings: 'Przelewy24',
208219
titleInWcSettings: ' (via PayPal)',
209220
hasSettingsButton: true,
@@ -220,6 +231,7 @@ const trustly: Pcp.Gateway = {
220231
id: 'ppcp-trustly',
221232
description: '',
222233
title: 'Trustly',
234+
titleInModal: 'Trustly',
223235
titleInPcpSettings: 'Trustly',
224236
titleInWcSettings: 'Trustly (via PayPal)',
225237
hasSettingsButton: true,
@@ -235,6 +247,7 @@ const multibanco: Pcp.Gateway = {
235247
id: 'ppcp-multibanco',
236248
description: '',
237249
title: 'Multibanco',
250+
titleInModal: 'Multibanco',
238251
titleInPcpSettings: 'Multibanco',
239252
titleInWcSettings: 'Multibanco (via PayPal)',
240253
hasSettingsButton: true,
@@ -250,6 +263,7 @@ const oxxo: Pcp.Gateway = {
250263
id: 'ppcp-oxxo-gateway',
251264
description: '',
252265
title: 'OXXO',
266+
titleInModal: 'OXXO',
253267
titleInPcpSettings: 'OXXO',
254268
titleInWcSettings: 'OXXO (via PayPal)',
255269
hasSettingsButton: true,
@@ -267,35 +281,23 @@ const payUponInvoice: Pcp.Gateway = {
267281
id: 'ppcp-pay-upon-invoice-gateway',
268282
description: '',
269283
title: 'Pay upon Invoice',
284+
titleInModal: 'Pay upon Invoice',
270285
titleInPcpSettings: 'Pay upon Invoice',
271286
titleInWcSettings: 'Pay upon Invoice',
272287
hasSettingsButton: true,
273288
// Disabled by default after a fresh connect; enabled only in country-specific test setups.
274289
enabled: false,
275290
};
276291

277-
const debitOrCreditCard: Pcp.Gateway = {
278-
shortcut: 'card',
279-
country: 'usa',
280-
currency: 'USD',
281-
282-
id: 'ppcp-gateway',
283-
description: '',
284-
title: 'Credit or debit cards (via PayPal)',
285-
titleInPcpSettings: 'Credit or debit cards',
286-
titleInWcSettings: 'Credit or debit cards (via PayPal)',
287-
hasSettingsButton: true,
288-
enabled: true,
289-
};
290-
291-
const standardCardButton: Pcp.Gateway = {
292+
const bcdc: Pcp.Gateway = {
292293
shortcut: 'card',
293294
country: 'usa',
294295
currency: 'USD',
295296

296297
id: 'ppcp-card-button-gateway',
297298
description: '',
298299
title: 'Debit & Credit Cards',
300+
titleInModal: 'Debit & Credit Cards',
299301
titleInPcpSettings: 'Debit & Credit Cards',
300302
titleInWcSettings: 'Debit & Credit Cards',
301303
hasSettingsButton: true,
@@ -323,6 +325,5 @@ export const gateways = {
323325
multibanco,
324326
oxxo,
325327
payUponInvoice,
326-
debitOrCreditCard,
327-
standardCardButton,
328+
bcdc,
328329
};

tests/qa/resources/pcp-payments.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,8 @@ const fastlaneRyan: Pcp.Payment = {
5555
card: cards.visaFastlane,
5656
};
5757

58-
const debitOrCreditCard: Pcp.Payment = {
59-
gateway: gateways.debitOrCreditCard,
60-
card: cards.visa,
61-
};
62-
63-
const standardCardButton: Pcp.Payment = {
64-
gateway: gateways.standardCardButton,
58+
const bcdc: Pcp.Payment = {
59+
gateway: gateways.bcdc,
6560
card: cards.visa,
6661
};
6762

@@ -85,8 +80,7 @@ export const payments = {
8580
acdc3ds,
8681
fastlaneGary,
8782
fastlaneRyan,
88-
debitOrCreditCard,
89-
standardCardButton,
83+
bcdc,
9084
payUponInvoice,
9185
googlePay,
9286
};

tests/qa/tests/05-transactions/transaction-googlepay.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ test.beforeAll( async ( { utils, pcpApi, wooCommerceApi } ) => {
3939
[ acdc.id ]: { id: acdc.id, enabled: true },
4040
[ googlepay.id ]: { id: googlepay.id, enabled: true },
4141
} );
42-
await wooCommerceApi.deleteAllOrders();
4342
} );
4443

4544
for ( const order of googlePayCheckout ) {

tests/qa/tests/05-transactions/transaction-usa-classic.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ test.beforeAll( async ( { utils, pcpApi, wooCommerceApi } ) => {
5858
[ acdc.id ]: { id: acdc.id, enabled: true },
5959
[ fastlane.id ]: { id: fastlane.id, enabled: false },
6060
} );
61-
await wooCommerceApi.deleteAllOrders();
6261
} );
6362

6463
for ( const testOrder of payPalClassicCheckout ) {

tests/qa/tests/05-transactions/transaction-usa.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ test.beforeAll( async ( { utils, pcpApi, wooCommerceApi } ) => {
5858
[ acdc.id ]: { id: acdc.id, enabled: true },
5959
[ fastlane.id ]: { id: fastlane.id, enabled: false },
6060
} );
61-
await wooCommerceApi.deleteAllOrders();
6261
} );
6362

6463
for ( const testOrder of payPalCheckout ) {

tests/qa/tests/06-refund/_test-scenarios/refund.scenario.ts

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const testRefund = ( testData: ShopRefund ) => {
2424
currency,
2525
isApiOrder,
2626
merchant,
27+
products,
2728
} = testData;
2829

2930
test(
@@ -32,12 +33,16 @@ export const testRefund = ( testData: ShopRefund ) => {
3233
async ( {
3334
wooCommerceUtils,
3435
utils,
36+
classicCheckout,
37+
payForOrder,
38+
orderReceived,
3539
wooCommerceOrderEdit,
3640
wooCommerceApi,
3741
payPalApi,
3842
} ) => {
3943
test.setTimeout( 2 * 60_000 );
4044
let order: WooCommerce.Order; // TODO: fix type in playwright-utils
45+
let orderId: number;
4146
const total = await countTotals( testData );
4247
const refundAvailable = total.order;
4348
const refundAmount = getAmountPercentage(
@@ -49,18 +54,31 @@ export const testRefund = ( testData: ShopRefund ) => {
4954
await test.step( 'Precondition: create WooCommerce order', async () => {
5055
if ( isApiOrder ) {
5156
order = await wooCommerceUtils.createApiOrder( testData );
52-
order = await utils.payForApiOrder(
53-
order.id,
54-
order.order_key,
55-
testData
56-
);
57+
await payForOrder.visit( order.id, order.order_key );
58+
await payForOrder.payPalUi.makePayment( { merchant, payment } );
5759
} else {
58-
order = await utils.completeOrderOnCheckout( testData );
60+
await utils.fillVisitorsCart( products );
61+
await classicCheckout.visit();
62+
await classicCheckout.completeCheckoutDetails( testData );
63+
await classicCheckout.payPalUi.makePayment( {merchant, payment } );
5964
}
60-
await expect(
61-
order.status,
62-
'Assert order status is processing'
63-
).toEqual( 'processing' );
65+
66+
await orderReceived.page.waitForLoadState();
67+
orderId = await orderReceived.getOrderNumber();
68+
// Assert order status is processing (sometimes takes time to update after payment)
69+
await expect
70+
.poll(
71+
async () => {
72+
order = await wooCommerceApi.getOrder( orderId );
73+
return order.status;
74+
},
75+
{
76+
message: 'Assert order status is processing',
77+
timeout: 30_000,
78+
intervals: [ 1_000, 2_000, 3_000 ],
79+
}
80+
)
81+
.toEqual( 'processing' );
6482
} );
6583

6684
// Test

tests/qa/tests/06-refund/refund-usa.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ test.beforeAll( async ( { utils, pcpApi, wooCommerceApi } ) => {
3333
[ payPal.id ]: { id: payPal.id, enabled: true },
3434
[ acdc.id ]: { id: acdc.id, enabled: true },
3535
} );
36-
await wooCommerceApi.deleteAllOrders();
3736
} );
3837

3938
for ( const testOrder of refundPayPalFromCheckout ) {

tests/qa/tests/07-vaulting/vaulting-checkout.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ test.beforeAll( async ( { utils, pcpApi, wooCommerceApi } ) => {
3737
savePaypalAndVenmo: true,
3838
saveCardDetails: true,
3939
} );
40-
await wooCommerceApi.deleteAllOrders();
4140
} );
4241

4342
for ( const testOrder of savePaymentMethodData ) {

tests/qa/tests/07-vaulting/vaulting-classic-cart.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ test.beforeAll( async ( { utils, pcpApi, wooCommerceApi } ) => {
3030
savePaypalAndVenmo: true,
3131
saveCardDetails: true,
3232
} );
33-
await wooCommerceApi.deleteAllOrders();
3433
} );
3534

3635
for ( const testOrder of savePaymentMethodData ) {

tests/qa/tests/07-vaulting/vaulting-classic-checkout.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ test.beforeAll( async ( { utils, pcpApi, wooCommerceApi } ) => {
3737
savePaypalAndVenmo: true,
3838
saveCardDetails: true,
3939
} );
40-
await wooCommerceApi.deleteAllOrders();
4140
} );
4241

4342
for ( const testOrder of savePaymentMethodData ) {

0 commit comments

Comments
 (0)