1
+ import { test , expect } from '@playwright/test' ;
2
+ import { PAYMENT_METHODS } from '../fixtures/payment-methods' ;
3
+ import { CHECKOUT_TYPES } from '../fixtures/checkout-types' ;
4
+ import { PRODUCT_TYPES } from '../fixtures/product-types' ;
5
+ import { USER_TYPES } from '../fixtures/user-types' ;
6
+ import { CheckoutPage } from '../pages/checkout-page' ;
7
+ import { CartPage } from '../pages/cart-page' ;
8
+
9
+ test . describe ( 'Google Pay Payment Tests' , ( ) => {
10
+ const testCases = [
11
+ {
12
+ name : 'Classic' ,
13
+ checkoutType : CHECKOUT_TYPES . CLASSIC ,
14
+ selector : PAYMENT_METHODS . GOOGLE_PAY . selector . classic
15
+ } ,
16
+ {
17
+ name : 'Block' ,
18
+ checkoutType : CHECKOUT_TYPES . BLOCK ,
19
+ selector : PAYMENT_METHODS . GOOGLE_PAY . selector . block
20
+ }
21
+ ] ;
22
+
23
+ testCases . forEach ( ( { name, checkoutType, selector } ) => {
24
+ test ( `Google Pay Success - ${ name } Checkout` , async ( { page } ) => {
25
+ const checkoutPage = new CheckoutPage ( page , checkoutType ) ;
26
+ const cartHelper = new CartPage ( page ) ;
27
+
28
+ await cartHelper . addProductToCart ( PRODUCT_TYPES . SIMPLE ) ;
29
+ await checkoutPage . goToCheckout ( checkoutType ) ;
30
+ await checkoutPage . fillBillingDetails ( USER_TYPES . ES_USER ) ;
31
+
32
+ await page . click ( selector ) ;
33
+ await page . waitForTimeout ( 1000 ) ;
34
+
35
+ const iframe = page . locator ( 'iframe[name^="__zoid__monei_payment_request__"]' ) ;
36
+ await expect ( iframe ) . toBeVisible ( { timeout : 5000 } ) ;
37
+ console . log ( '✅ Google Pay button is visible' ) ;
38
+ } ) ;
39
+ } ) ;
40
+ } ) ;
0 commit comments