File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
packages/testing/src/playwright/unstable/page-objects Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @clerk/testing ' : patch
3
+ ---
4
+
5
+ Allow for ` waitForStripeElements ` helper to accept a ` state ` of ` visible ` or ` hidden ` .
Original file line number Diff line number Diff line change @@ -309,7 +309,9 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
309
309
} ) ;
310
310
await u . po . checkout . clickPayOrSubscribe ( ) ;
311
311
await expect ( u . po . page . locator ( '.cl-checkout-root' ) . getByText ( 'The card was declined.' ) . first ( ) ) . toBeVisible ( ) ;
312
- await u . po . checkout . waitForStipeElements ( ) ;
312
+ // It should unmount and remount the payment element
313
+ await u . po . checkout . waitForStripeElements ( { state : 'hidden' } ) ;
314
+ await u . po . checkout . waitForStripeElements ( { state : 'visible' } ) ;
313
315
await u . po . checkout . fillTestCard ( ) ;
314
316
await u . po . checkout . clickPayOrSubscribe ( ) ;
315
317
await expect ( u . po . page . locator ( '.cl-checkout-root' ) . getByText ( 'Payment was successful!' ) ) . toBeVisible ( ) ;
Original file line number Diff line number Diff line change @@ -28,11 +28,8 @@ export const createCheckoutPageObject = (testArgs: { page: EnhancedPage }) => {
28
28
await frame . getByLabel ( 'Country' ) . selectOption ( card . country ) ;
29
29
await frame . getByLabel ( 'ZIP code' ) . fill ( card . zip ) ;
30
30
} ,
31
- waitForStipeElements : async ( ) => {
32
- return page
33
- . frameLocator ( 'iframe[src*="elements-inner-payment"]' )
34
- . getByLabel ( 'Card number' )
35
- . waitFor ( { state : 'visible' } ) ;
31
+ waitForStripeElements : async ( { state = 'visible' } : { state ?: 'visible' | 'hidden' } = { } ) => {
32
+ return page . frameLocator ( 'iframe[src*="elements-inner-payment"]' ) . getByLabel ( 'Card number' ) . waitFor ( { state } ) ;
36
33
} ,
37
34
clickPayOrSubscribe : async ( ) => {
38
35
await self . root . getByRole ( 'button' , { name : / s u b s c r i b e | p a y \s \$ / i } ) . click ( ) ;
You can’t perform that action at this time.
0 commit comments