1
- import { expect , test } from '@playwright/test' ;
1
+ import { expect , test } from '@playwright/test' ;
2
2
import dotenv from 'dotenv' ;
3
3
4
4
dotenv . config ( ) ;
5
5
6
- const HOST = process . env . KINDE_ISSUER_URL || ""
7
- const LOGIN_REDIRECT_URL = process . env . KINDE_POST_LOGIN_REDIRECT_URL || ""
8
- const LOGOUT_REDIRECT_URL = process . env . KINDE_POST_LOGOUT_REDIRECT_URL || ""
9
- const USER_EMAIL = process . env . KINDE_USER_EMAIL_TEST || ""
10
- const USER_PASSWORD = process . env . KINDE_USER_PASSWORD_TEST || ""
6
+ const HOST = process . env . KINDE_ISSUER_URL || '' ;
7
+ const LOGIN_REDIRECT_URL = process . env . KINDE_POST_LOGIN_REDIRECT_URL || '' ;
8
+ const LOGOUT_REDIRECT_URL = process . env . KINDE_POST_LOGOUT_REDIRECT_URL || '' ;
9
+ const USER_EMAIL = process . env . KINDE_USER_EMAIL_TEST || '' ;
10
+ const USER_PASSWORD = process . env . KINDE_USER_PASSWORD_TEST || '' ;
11
11
12
- test ( 'Authentication Login' , async ( { page } ) => {
12
+ test ( 'Authentication Login' , async ( { page} ) => {
13
13
await page . goto ( 'api/auth/login' ) ;
14
14
15
- await page . waitForURL ( new RegExp ( `${ HOST } /auth/cx/_:nav&m:login` ) )
15
+ await page . waitForURL ( new RegExp ( `${ HOST } /auth/cx/_:nav&m:login` ) ) ;
16
16
17
17
await page . getByLabel ( 'Email' ) . fill ( USER_EMAIL ) ;
18
18
await page . getByText ( 'Log in' ) . click ( ) ;
19
19
await page . waitForTimeout ( 3000 ) ;
20
20
await page . locator ( '#input_field_p_password_password' ) . fill ( USER_PASSWORD ) ;
21
- await page . locator ( '[type="submit"]' , {
22
- hasText : 'Continue'
23
- } ) . click ( ) ;
24
-
21
+ await page
22
+ . locator ( '[type="submit"]' , {
23
+ hasText : 'Continue'
24
+ } )
25
+ . click ( ) ;
26
+
25
27
await expect ( async ( ) => {
26
28
expect ( page . url ( ) ) . toContain ( LOGIN_REDIRECT_URL ) ;
27
29
} ) . toPass ( ) ;
28
30
} ) ;
29
31
30
- test ( 'Should redirect to registration page' , async ( { page } ) => {
32
+ test ( 'Should redirect to registration page' , async ( { page} ) => {
31
33
await page . goto ( 'api/auth/register' ) ;
32
34
33
- await page . waitForURL ( new RegExp ( `${ HOST } /auth/cx/_:nav&m:register` ) )
35
+ await page . waitForURL ( new RegExp ( `${ HOST } /auth/cx/_:nav&m:register` ) ) ;
34
36
35
- await expect ( page . locator ( '[name=p_first_name]' ) ) . toBeVisible ( )
37
+ await expect ( page . locator ( '[name=p_first_name]' ) ) . toBeVisible ( ) ;
36
38
37
- await expect ( page . locator ( '[name=p_last_name]' ) ) . toBeVisible ( )
39
+ await expect ( page . locator ( '[name=p_last_name]' ) ) . toBeVisible ( ) ;
38
40
39
- await expect ( page . locator ( '[name=p_email]' ) ) . toBeVisible ( )
41
+ await expect ( page . locator ( '[name=p_email]' ) ) . toBeVisible ( ) ;
40
42
} ) ;
41
43
42
- test ( 'Should redirect to create org page' , async ( { page } ) => {
44
+ test ( 'Should redirect to create org page' , async ( { page} ) => {
43
45
await page . goto ( 'api/auth/create_org' ) ;
44
46
45
- await expect ( page . locator ( '[name=p_first_name]' ) ) . toBeVisible ( )
47
+ await expect ( page . locator ( '[name=p_first_name]' ) ) . toBeVisible ( ) ;
46
48
47
- await expect ( page . locator ( '[name=p_last_name]' ) ) . toBeVisible ( )
49
+ await expect ( page . locator ( '[name=p_last_name]' ) ) . toBeVisible ( ) ;
48
50
49
- await expect ( page . locator ( '[name=p_email]' ) ) . toBeVisible ( )
51
+ await expect ( page . locator ( '[name=p_email]' ) ) . toBeVisible ( ) ;
50
52
} ) ;
51
53
52
- test ( 'Should redirect to logout page' , async ( { page } ) => {
54
+ test ( 'Should redirect to logout page' , async ( { page} ) => {
53
55
await page . goto ( 'api/auth/logout' ) ;
54
56
55
57
await expect ( async ( ) => {
56
58
expect ( page . url ( ) ) . toContain ( LOGOUT_REDIRECT_URL ) ;
57
59
} ) . toPass ( ) ;
58
- } ) ;
60
+ } ) ;
0 commit comments