Skip to content

Commit 119df78

Browse files
oaratovskyioaratovskyi
andauthored
Fix broken Alipay block checkout test (#10816)
Co-authored-by: oaratovskyi <[email protected]>
1 parent 9ba6c46 commit 119df78

File tree

2 files changed

+45
-38
lines changed

2 files changed

+45
-38
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: dev
3+
4+
Condition AliPay block tests under shouldRunWCBlocksTests

tests/e2e/specs/wcpay/shopper/alipay-checkout-purchase.spec.ts

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ import { test, expect, Page } from '@playwright/test';
77
* Internal dependencies
88
*/
99
import * as shopper from '../../../utils/shopper';
10-
import { getMerchant, getShopper } from '../../../utils/helpers';
10+
import { describeif, getMerchant, getShopper } from '../../../utils/helpers';
1111
import * as merchant from '../../../utils/merchant';
1212
import { config } from '../../../config/default';
1313
import { goToCheckoutWCB } from '../../../utils/shopper-navigation';
14+
import { shouldRunWCBlocksTests } from '../../../utils/constants';
1415

1516
test.describe( 'Alipay Checkout', () => {
1617
let merchantPage: Page;
@@ -63,45 +64,47 @@ test.describe( 'Alipay Checkout', () => {
6364
}
6465
);
6566

66-
test(
67+
describeif( shouldRunWCBlocksTests )(
6768
'checkout on block-based checkout page',
6869
{ tag: '@critical' },
69-
async () => {
70-
await shopper.setupProductCheckout(
71-
shopperPage,
72-
[ [ config.products.cap, 1 ] ],
73-
config.addresses.customer.billing
74-
);
75-
await goToCheckoutWCB( shopperPage );
76-
await shopper.fillBillingAddressWCB(
77-
shopperPage,
78-
config.addresses.customer.billing
79-
);
80-
81-
await shopperPage
82-
.getByRole( 'radio', {
83-
name: 'Alipay',
84-
} )
85-
.click();
86-
87-
await shopper.placeOrderWCB( shopperPage, false );
88-
89-
await expect(
90-
shopperPage.getByText( /Alipay test payment page/ )
91-
).toBeVisible();
92-
93-
await shopperPage.getByText( 'Authorize Test Payment' ).click();
94-
95-
await expect(
96-
shopperPage.getByRole( 'heading', {
97-
name: 'Order received',
98-
} )
99-
).toBeVisible();
100-
await expect(
101-
shopperPage.getByRole( 'img', {
102-
name: 'Alipay',
103-
} )
104-
).toBeVisible();
70+
() => {
71+
test( 'completes payment successfully', async () => {
72+
await shopper.setupProductCheckout(
73+
shopperPage,
74+
[ [ config.products.cap, 1 ] ],
75+
config.addresses.customer.billing
76+
);
77+
await goToCheckoutWCB( shopperPage );
78+
await shopper.fillBillingAddressWCB(
79+
shopperPage,
80+
config.addresses.customer.billing
81+
);
82+
83+
await shopperPage
84+
.getByRole( 'radio', {
85+
name: 'Alipay',
86+
} )
87+
.click();
88+
89+
await shopper.placeOrderWCB( shopperPage, false );
90+
91+
await expect(
92+
shopperPage.getByText( /Alipay test payment page/ )
93+
).toBeVisible();
94+
95+
await shopperPage.getByText( 'Authorize Test Payment' ).click();
96+
97+
await expect(
98+
shopperPage.getByRole( 'heading', {
99+
name: 'Order received',
100+
} )
101+
).toBeVisible();
102+
await expect(
103+
shopperPage.getByRole( 'img', {
104+
name: 'Alipay',
105+
} )
106+
).toBeVisible();
107+
} );
105108
}
106109
);
107110
} );

0 commit comments

Comments
 (0)