@@ -616,11 +616,21 @@ export const deleteSavedCard = async (
616
616
page : Page ,
617
617
card : typeof config . cards . basic
618
618
) => {
619
+ // First, let's check if the card is visible on the page
620
+ const cardText = page . getByText ( card . label ) ;
621
+ const isCardVisible = await cardText . isVisible ( ) ;
622
+
623
+ if ( ! isCardVisible ) {
624
+ throw new Error (
625
+ `Card with label "${ card . label } " is not visible on the page`
626
+ ) ;
627
+ }
628
+
619
629
const row = page . getByRole ( 'row' , { name : card . label } ) . first ( ) ;
620
- await expect ( row ) . toBeVisible ( { timeout : 100 } ) ;
630
+ await expect ( row ) . toBeVisible ( { timeout : 5000 } ) ;
621
631
const button = row . getByRole ( 'link' , { name : 'Delete' } ) ;
622
- await expect ( button ) . toBeVisible ( { timeout : 100 } ) ;
623
- await expect ( button ) . toBeEnabled ( { timeout : 100 } ) ;
632
+ await expect ( button ) . toBeVisible ( { timeout : 5000 } ) ;
633
+ await expect ( button ) . toBeEnabled ( { timeout : 5000 } ) ;
624
634
await button . click ( ) ;
625
635
} ;
626
636
@@ -633,7 +643,7 @@ export const selectSavedCardOnCheckout = async (
633
643
`${ card . label } (expires ${ card . expires . month } /${ card . expires . year } )`
634
644
)
635
645
. first ( ) ;
636
- await expect ( option ) . toBeVisible ( { timeout : 100 } ) ;
646
+ await expect ( option ) . toBeVisible ( { timeout : 5000 } ) ;
637
647
await option . click ( ) ;
638
648
} ;
639
649
@@ -642,10 +652,10 @@ export const setDefaultPaymentMethod = async (
642
652
card : typeof config . cards . basic
643
653
) => {
644
654
const row = page . getByRole ( 'row' , { name : card . label } ) . first ( ) ;
645
- await expect ( row ) . toBeVisible ( { timeout : 100 } ) ;
655
+ await expect ( row ) . toBeVisible ( { timeout : 5000 } ) ;
646
656
const button = row . getByRole ( 'link' , { name : 'Make default' } ) ;
647
- await expect ( button ) . toBeVisible ( { timeout : 100 } ) ;
648
- await expect ( button ) . toBeEnabled ( { timeout : 100 } ) ;
657
+ await expect ( button ) . toBeVisible ( { timeout : 5000 } ) ;
658
+ await expect ( button ) . toBeEnabled ( { timeout : 5000 } ) ;
649
659
await button . click ( ) ;
650
660
} ;
651
661
0 commit comments