@@ -13,7 +13,8 @@ test.describe.parallel('register', () => {
1313 poRegistration = new Registration ( page ) ;
1414 poUtils = new Utils ( page ) ;
1515 } ) ;
16- test ( 'Successfully Registration flow' , async ( { page } ) => {
16+
17+ test ( 'should complete the registration flow' , async ( { page } ) => {
1718 await test . step ( 'expect trigger a validation error if no data is provided on register' , async ( ) => {
1819 await page . goto ( '/home' ) ;
1920 await poRegistration . goToRegister . click ( ) ;
@@ -44,24 +45,27 @@ test.describe.parallel('register', () => {
4445 } ) ;
4546 } ) ;
4647
47- test . describe ( 'Registration without Account confirmation password set' , async ( ) => {
48+ test . describe ( 'should complete registration without account confirmation password set' , async ( ) => {
4849 test . beforeEach ( async ( { api } ) => {
4950 const result = await api . post ( '/settings/Accounts_RequirePasswordConfirmation' , { value : false } ) ;
5051
5152 await expect ( result . ok ( ) ) . toBeTruthy ( ) ;
5253 } ) ;
54+
5355 test . beforeEach ( async ( { page } ) => {
5456 await page . goto ( '/home' ) ;
5557 await poRegistration . goToRegister . click ( ) ;
5658 } ) ;
59+
5760 test . afterEach ( async ( { api } ) => {
5861 const result = await api . post ( '/settings/Accounts_RequirePasswordConfirmation' , {
5962 value : true ,
6063 } ) ;
64+
6165 await expect ( result . ok ( ) ) . toBeTruthy ( ) ;
6266 } ) ;
6367
64- test ( 'expect to register a user without password confirmation' , async ( ) => {
68+ test ( 'should register a user without password confirmation' , async ( ) => {
6569 await test . step ( 'expect to not have password confirmation field' , async ( ) => {
6670 await expect ( poRegistration . inputPasswordConfirm ) . toBeHidden ( ) ;
6771 } ) ;
@@ -78,12 +82,13 @@ test.describe.parallel('register', () => {
7882 } ) ;
7983 } ) ;
8084
81- test . describe ( 'Registration with manually confirmation enabled' , async ( ) => {
85+ test . describe ( 'should complete registration with manually confirmation enabled' , async ( ) => {
8286 test . beforeEach ( async ( { api } ) => {
8387 const result = await api . post ( '/settings/Accounts_ManuallyApproveNewUsers' , { value : true } ) ;
8488
8589 await expect ( result . ok ( ) ) . toBeTruthy ( ) ;
8690 } ) ;
91+
8792 test . beforeEach ( async ( { page } ) => {
8893 poRegistration = new Registration ( page ) ;
8994
@@ -98,7 +103,7 @@ test.describe.parallel('register', () => {
98103 await expect ( result . ok ( ) ) . toBeTruthy ( ) ;
99104 } ) ;
100105
101- test ( 'it should expect to have a textbox asking the reason for the registration' , async ( ) => {
106+ test ( 'should expect to have a textbox asking the reason for the registration' , async ( ) => {
102107 await test . step ( 'expect to have a textbox asking the reason for the registration' , async ( ) => {
103108 await expect ( poRegistration . inputReason ) . toBeVisible ( ) ;
104109 } ) ;
@@ -120,7 +125,7 @@ test.describe.parallel('register', () => {
120125 await api . post ( '/settings/Accounts_RegistrationForm' , { value : 'Public' } ) ;
121126 } ) ;
122127
123- test ( 'It should expect a message warning that registration is disabled' , async ( { page } ) => {
128+ test ( 'should expect a message warning that registration is disabled' , async ( { page } ) => {
124129 await page . goto ( '/home' ) ;
125130 await poRegistration . goToRegister . click ( ) ;
126131 await expect ( poRegistration . registrationDisabledCallout ) . toBeVisible ( ) ;
@@ -142,6 +147,7 @@ test.describe.parallel('register', () => {
142147 poRegistration = new Registration ( page ) ;
143148 poUtils = new Utils ( page ) ;
144149 } ) ;
150+
145151 test ( 'should not allow registration with an already registered email' , async ( { page } ) => {
146152 const email = faker . internet . email ( ) ;
147153 await request . post ( '/api/v1/users.register' ) . set ( 'Content-Type' , 'application/json' ) . send ( {
@@ -150,6 +156,7 @@ test.describe.parallel('register', () => {
150156 username : faker . internet . userName ( ) ,
151157 pass : 'any_password' ,
152158 } ) ;
159+
153160 await test . step ( 'Attempt registration with the same email' , async ( ) => {
154161 await page . goto ( '/home' ) ;
155162 await poRegistration . goToRegister . click ( ) ;
@@ -158,12 +165,9 @@ test.describe.parallel('register', () => {
158165 await poRegistration . username . fill ( faker . internet . userName ( ) ) ;
159166 await poRegistration . inputPassword . fill ( 'any_password' ) ;
160167 await poRegistration . inputPasswordConfirm . fill ( 'any_password' ) ;
161-
162168 await poRegistration . btnRegister . click ( ) ;
163169
164- const errorMessageLocator = page . locator ( 'span.rcx-field__error' ) . filter ( { hasText : 'Email already exists' } ) ;
165- await expect ( errorMessageLocator ) . toBeVisible ( ) ;
166- await expect ( errorMessageLocator ) . toHaveText ( 'Email already exists' ) ;
170+ await expect ( page . getByRole ( 'alert' ) . filter ( { hasText : 'Email already exists' } ) ) . toBeVisible ( ) ;
167171 } ) ;
168172 } ) ;
169173 } ) ;
@@ -182,7 +186,7 @@ test.describe.parallel('register', () => {
182186 await expect ( result . ok ( ) ) . toBeTruthy ( ) ;
183187 } ) ;
184188
185- test ( 'It should expect a message warning that registration is disabled' , async ( { page } ) => {
189+ test ( 'should expect a message warning that registration is disabled' , async ( { page } ) => {
186190 await page . goto ( '/home' ) ;
187191 await poRegistration . goToRegister . click ( ) ;
188192 await expect ( poRegistration . registrationDisabledCallout ) . toBeVisible ( ) ;
@@ -192,14 +196,15 @@ test.describe.parallel('register', () => {
192196 test . beforeEach ( async ( { page } ) => {
193197 await page . goto ( '/register/invalid_secret' ) ;
194198 } ) ;
195- test ( 'It should expect a invalid page informing that the secret password is invalid' , async ( { page } ) => {
199+
200+ test ( 'should expect a invalid page informing that the secret password is invalid' , async ( { page } ) => {
196201 await expect ( page . locator ( 'role=heading[level=2][name="The URL provided is invalid."]' ) ) . toBeVisible ( {
197202 timeout : 10000 ,
198203 } ) ;
199204 } ) ;
200205 } ) ;
201206
202- test ( 'It should register a user if the right secret password is provided' , async ( { page } ) => {
207+ test ( 'should register a user if the right secret password is provided' , async ( { page } ) => {
203208 await page . goto ( '/register/secret' ) ;
204209 await page . waitForSelector ( 'role=form' ) ;
205210 await poRegistration . inputName . fill ( faker . person . firstName ( ) ) ;
@@ -219,7 +224,7 @@ test.describe.parallel('register', () => {
219224 await expect ( result . ok ( ) ) . toBeTruthy ( ) ;
220225 } ) ;
221226
222- test ( 'It should show an invalid page informing that the url is not valid' , async ( { page } ) => {
227+ test ( 'should show an invalid page informing that the url is not valid' , async ( { page } ) => {
223228 await page . goto ( '/register/secret' ) ;
224229 await page . waitForSelector ( 'role=heading[level=2]' ) ;
225230 await expect ( page . locator ( 'role=heading[level=2][name="The URL provided is invalid."]' ) ) . toBeVisible ( ) ;
0 commit comments