@@ -22,6 +22,15 @@ export class CheckoutPage {
22
22
paymentMethodButton = ( ) => this . page . locator ( this . paymentMethodSelector ) ;
23
23
placeOrderButton = ( ) => this . page . getByRole ( 'button' , { name : 'Place Order' } ) ;
24
24
25
+ private widgetInitPaymentframe = ( ) => this . page . locator ( '#tl-checkout-widget' ) . contentFrame ( ) ;
26
+ private widgetBankingModal = ( ) => this . page . locator ( '#tl-hpp-next' ) . contentFrame ( ) ;
27
+ widgetPayButton = ( ) => this . widgetInitPaymentframe ( ) . getByTestId ( 'checkout-button-loaded' ) ;
28
+ widgetSelectBankModal = ( ) => this . widgetInitPaymentframe ( ) . getByText ( 'Select your bank' ) ;
29
+ widgetMockBank = ( ) => this . widgetBankingModal ( ) . getByTestId ( 'provider-list-item-mock-payments-gb-redirect' ) ;
30
+ widgetContinueButton = ( ) => this . widgetBankingModal ( ) . getByTestId ( 'go-to-bank-button' ) ;
31
+ widgetContinueOnDesktopButton = ( ) => this . widgetBankingModal ( ) . getByText ( 'on this device' ) ;
32
+ widgetPaymentBeingProcessedText = ( ) => this . widgetBankingModal ( ) . getByText ( 'confirming your payment' , { exact : false } )
33
+
25
34
// Methods
26
35
27
36
async fillShippingDetailsAndSubmit ( email : string , isMobile : boolean = false ) {
@@ -73,4 +82,29 @@ export class CheckoutPage {
73
82
await this . placeOrderButton ( ) . isEnabled ( ) ;
74
83
await this . placeOrderButton ( ) . click ( ) ;
75
84
}
85
+
86
+ async clickWidgetPayButton ( ) {
87
+ await expect ( this . widgetPayButton ( ) ) . toBeVisible ( { timeout : 5000 } ) ;
88
+ await this . widgetPayButton ( ) . click ( ) ;
89
+ }
90
+
91
+ async selectWidgetMockBankAndContinueOnDesktop ( ) {
92
+ await this . selectWidgetMockBankAndContinue ( ) ;
93
+ await this . widgetContinueOnDesktopButton ( ) . click ( ) ;
94
+ }
95
+
96
+ async selectMockBankAndContinueOnMobile ( ) {
97
+ await this . selectWidgetMockBankAndContinue ( ) ;
98
+ }
99
+
100
+ private async selectWidgetMockBankAndContinue ( ) {
101
+ await expect ( this . widgetMockBank ( ) ) . toBeVisible ( { timeout : 15000 } )
102
+ await this . widgetMockBank ( ) . click ( ) ;
103
+ await expect ( this . widgetContinueButton ( ) ) . toBeVisible ( { timeout : 10000 } )
104
+ await this . widgetContinueButton ( ) . click ( ) ;
105
+ }
106
+
107
+ async expectPaymentProcessingText ( ) {
108
+ await expect ( this . widgetPaymentBeingProcessedText ( ) ) . toBeVisible ( { timeout : 5000 } ) ;
109
+ }
76
110
}
0 commit comments