@@ -139,20 +139,30 @@ export const placeOrder = async ( page: Page ) => {
139
139
}
140
140
} ;
141
141
142
- export const placeOrderWCB = async ( page : Page ) => {
143
- const placeOrderButton = page . getByRole ( 'button' , {
144
- name : 'Place Order' ,
145
- } ) ;
142
+ export const placeOrderWCB = async (
143
+ page : Page ,
144
+ confirmOrderReceived = true
145
+ ) => {
146
+ const placeOrderButton = page . locator (
147
+ '.wc-block-components-checkout-place-order-button'
148
+ ) ;
146
149
147
150
await placeOrderButton . focus ( ) ;
148
151
await waitForUiRefresh ( page ) ;
149
152
150
153
await placeOrderButton . click ( ) ;
151
154
152
- await page . waitForURL ( / \/ o r d e r - r e c e i v e d \/ / ) ;
153
- await expect (
154
- page . getByRole ( 'heading' , { name : 'Order received' } )
155
- ) . toBeVisible ( ) ;
155
+ await expect ( placeOrderButton ) . toBeDisabled ( ) ;
156
+ await expect ( placeOrderButton ) . toHaveClass (
157
+ / w c - b l o c k - c o m p o n e n t s - b u t t o n - - l o a d i n g /
158
+ ) ;
159
+
160
+ if ( confirmOrderReceived ) {
161
+ await page . waitForURL ( / \/ o r d e r - r e c e i v e d \/ / ) ;
162
+ await expect (
163
+ page . getByRole ( 'heading' , { name : 'Order received' } )
164
+ ) . toBeVisible ( ) ;
165
+ }
156
166
} ;
157
167
158
168
const ensureSavedCardNotSelected = async ( page : Page ) => {
@@ -248,7 +258,7 @@ export const confirmCardAuthentication = async (
248
258
authorize = true
249
259
) => {
250
260
// Wait for the Stripe modal to appear.
251
- await page . waitForTimeout ( 3000 ) ;
261
+ await page . waitForTimeout ( 5000 ) ;
252
262
253
263
// Stripe card input also uses __privateStripeFrame as a prefix, so need to make sure we wait for an iframe that
254
264
// appears at the top of the DOM.
0 commit comments