Skip to content

Commit 7cfe50c

Browse files
committed
Test create user form
1 parent fff7f4d commit 7cfe50c

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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', /(\/dashboard\/admin\/users\/)/)
33+
})
34+
})
35+
})
36+
})
37+
})

0 commit comments

Comments
 (0)