1+ import { Page , Locator } from "@playwright/test" ;
2+
3+
4+ export class RegisterPage {
5+
6+ readonly page : Page ;
7+ readonly emailRegisterInput : Locator ;
8+ readonly nameRegisterInput : Locator ;
9+ readonly passwordRegisterInput : Locator ;
10+ readonly passwordConfirmationRegisterInput : Locator ;
11+ readonly accountWithOrWithoutBalanceToggle : Locator ;
12+ readonly registerButton : Locator ;
13+ readonly confirmationMessage : Locator ;
14+ readonly confirmationIcon : Locator ;
15+ readonly closeButton : Locator ;
16+
17+ constructor ( page : Page ) {
18+ this . page = page ;
19+ this . emailRegisterInput = page . locator ( 'form' ) . filter ( { hasText : 'Voltar ao loginE-mailÉ campo' } ) . getByPlaceholder ( 'Informe seu e-mail' ) ;
20+ this . nameRegisterInput = page . getByRole ( 'textbox' , { name : 'Informe seu Nome' } ) ;
21+ this . passwordRegisterInput = page . locator ( 'form' ) . filter ( { hasText : 'Voltar ao loginE-mailÉ campo' } ) . getByPlaceholder ( 'Informe sua senha' ) ;
22+ this . passwordConfirmationRegisterInput = page . getByRole ( 'textbox' , { name : 'Informe a confirmação da senha' } ) ;
23+ this . accountWithOrWithoutBalanceToggle = page . locator ( 'div' ) . filter ( { hasText : / ^ C r i a r c o n t a c o m s a l d o \? $ / } ) . locator ( 'span' ) ;
24+ this . registerButton = page . getByRole ( 'button' , { name : 'Cadastrar' } ) ;
25+ this . confirmationMessage = page . getByText ( 'A conta 329-0 foi criada com' ) ;
26+ this . confirmationIcon = page . locator ( 'div' ) . filter ( { hasText : / ^ A c o n t a 3 2 9 - 0 f o i c r i a d a c o m s u c e s s o F e c h a r $ / } ) . getByRole ( 'img' ) ;
27+ this . closeButton = page . getByText ( 'Fechar' ) ;
28+ }
29+
30+ async fillEmail ( email : string ) {
31+ await this . emailRegisterInput . fill ( email ) ;
32+ }
33+
34+ async fillName ( password : string ) {
35+ await this . nameRegisterInput . fill ( password ) ;
36+ }
37+
38+ async fillPassword ( password : string ) {
39+ await this . passwordRegisterInput . fill ( password ) ;
40+ }
41+
42+ async fillPasswordConfirmation ( password : string ) {
43+ await this . passwordConfirmationRegisterInput . fill ( password ) ;
44+ }
45+
46+ async clickBalanceToggle ( ) {
47+ await this . accountWithOrWithoutBalanceToggle . click ( ) ;
48+ }
49+
50+ async clickRegisterButton ( ) {
51+ await this . registerButton . click ( ) ;
52+ }
53+
54+ }
0 commit comments