@@ -4,7 +4,7 @@ import { prisma } from "@/db/prisma";
44import { hashPassword } from "@/lib/security" ;
55import type { CreateUserDTO } from "@/models/user.model" ;
66
7- import { baseUrl , cleanDatabase } from "./utils-tests-e2e" ;
7+ import { baseUrl , cleanDatabase , creditCards } from "./utils-tests-e2e" ;
88
99test . beforeEach ( async ( ) => {
1010 await cleanDatabase ( ) ;
@@ -76,9 +76,43 @@ test.describe("User", () => {
7676
7777 await page . getByRole ( "button" , { name : "Confirmar Orden" } ) . click ( ) ;
7878
79+ const checkoutFrame = page . locator ( 'iframe[name="checkout_frame"]' ) ;
80+ await expect ( checkoutFrame ) . toBeVisible ( { timeout : 10000 } ) ;
81+
82+ const validCard = creditCards . valid ;
83+
84+ await checkoutFrame
85+ . contentFrame ( )
86+ . getByRole ( "textbox" , { name : "#### #### #### ####" } )
87+ . fill ( validCard . number ) ;
88+
7989 await expect (
80- page . getByText ( "¡Muchas gracias por tu compra!" )
90+ checkoutFrame . contentFrame ( ) . getByRole ( "img" , { name : "Culqi icon" } )
8191 ) . toBeVisible ( ) ;
92+
93+ await checkoutFrame
94+ . contentFrame ( )
95+ . getByRole ( "textbox" , { name : "MM/AA" } )
96+ . fill ( validCard . exp ) ;
97+
98+ await checkoutFrame
99+ . contentFrame ( )
100+ . getByRole ( "textbox" , { name : "CVV" } )
101+ . fill ( validCard . cvv ) ;
102+
103+ await checkoutFrame
104+ . contentFrame ( )
105+ . getByRole ( "textbox" , { name :
"[email protected] " } ) 106+ . fill ( loginForm [ "Correo electrónico" ] ) ;
107+
108+ await checkoutFrame
109+ . contentFrame ( )
110+ . getByRole ( "button" , { name : "Pagar S/" } )
111+ . click ( ) ;
112+
113+ await expect ( page . getByText ( "¡Muchas gracias por tu compra!" ) ) . toBeVisible ( {
114+ timeout : 10000 ,
115+ } ) ;
82116 await expect ( page . getByTestId ( "orderId" ) ) . toBeVisible ( ) ;
83117 } ) ;
84118} ) ;
0 commit comments