statping/dev/test/cypress/integration/users.js

52 lines
1.9 KiB
JavaScript
Raw Normal View History

context('User Testing', () => {
beforeEach(function () {
cy.visit('http://localhost:8080/dashboard')
cy.get('input[name="username"]').type('admin')
cy.get('input[name="password"]').type('admin')
cy.get('form').submit()
})
it('should view users', () => {
cy.visit('http://localhost:8080/users')
cy.get('tr').should('have.length', 2)
cy.title().should('eq', 'Statup | Users')
})
it('should create a new user', () => {
cy.visit('http://localhost:8080/users')
cy.get('input[name="username"]').type('hunterlong')
cy.get('input[name="email"]').type('info@yayaya.com')
cy.get('input[name="password"]').type('admin')
cy.get('input[name="password_confirm"]').type('admin')
cy.get('form').submit()
cy.get('tr').should('have.length', 3)
})
2018-08-19 00:37:00 +00:00
it('should create a edit user', () => {
cy.visit('http://localhost:8080/user/2')
cy.get('input[name="password"]').type('password567')
cy.get('input[name="password_confirm"]').type('password567')
cy.get('form').submit()
cy.get('tr').should('have.length', 3)
})
// it('should logout and login with new password', () => {
// cy.visit('http://localhost:8080/logout')
// cy.title().should('eq', 'Statup | Users')
// cy.get('#user_2 > .btn-group > .btn-danger').click()
// cy.get('tr').should('have.length', 2)
// cy.visit('http://localhost:8080/login')
// cy.get('input[name="username"]').type('hunterlong')
// cy.get('input[name="password"]').type('password567')
// cy.get('form').submit()
// cy.title().should('eq', 'Project Updated Status')
// })
it('should delete a user', () => {
cy.visit('http://localhost:8080/users')
cy.get('#user_2 > .btn-group > .btn-danger').click()
cy.get('tr').should('have.length', 2)
})
});