File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ describe ( 'Create new user' , ( ) => {
2
+ it ( 'login as admin and create new user' , ( ) => {
3
+ // go to login page
4
+ cy . visit ( '/login' )
5
+ cy . get ( '#input-email' ) . type ( 'admin@admin.com' )
6
+ cy . get ( '#input-password' ) . type ( 'admin' )
7
+ cy . get ( 'button[type=submit]' ) . click ( )
8
+
9
+ // we should be redirected to /dashboard
10
+ cy . url ( )
11
+ . should ( 'include' , '/dashboard' )
12
+ . then ( ( ) => {
13
+ // click on users menu
14
+ cy . get ( '.pt-3 > .nav > :nth-child(6) > .nav-item > .nav-link' )
15
+ . should ( 'have.attr' , 'href' , '/dashboard/admin/users' )
16
+ . click ( )
17
+ . then ( ( ) => {
18
+ // click on create button
19
+ cy . get ( '.m-auto > .btn-primary' )
20
+ . should ( 'have.attr' , 'href' , '/dashboard/admin/users/create' )
21
+ . click ( )
22
+
23
+ // field all required fields
24
+ cy . get ( '#input-first-name' ) . type ( 'new-user' )
25
+ cy . get ( '#input-last-name' ) . type ( 'test' )
26
+ cy . get ( '#input-email' ) . type ( 'newuser@test.com' )
27
+ cy . get ( '#input-locale' ) . select ( 'FR' )
28
+ cy . get ( '#input-role' ) . select ( 'USER' )
29
+ cy . get ( 'form > .btn' )
30
+ . click ( ) // submit the form
31
+ . then ( ( ) => {
32
+ cy . url ( ) . should ( 'match' , / ( \/ d a s h b o a r d \/ a d m i n \/ u s e r s \/ ) / )
33
+ } )
34
+ } )
35
+ } )
36
+ } )
37
+ } )
You can’t perform that action at this time.
0 commit comments