#1077 e2e específico para login
This commit is contained in:
parent
f21b88840c
commit
c3679b5642
|
@ -0,0 +1,61 @@
|
|||
import createNightmare from '../../helpers/nightmare';
|
||||
import config from '../../helpers/config.js';
|
||||
|
||||
|
||||
describe('Login path', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
it('should receive an error when the username is incorrect', async() => {
|
||||
const username = 'nobody';
|
||||
const password = 'nightmare';
|
||||
|
||||
const result = await nightmare
|
||||
.goto(`${config.url}/#!/login`)
|
||||
.wait(`vn-login input[name=user]`)
|
||||
.write(`vn-login input[name=user]`, username)
|
||||
.write(`vn-login input[name=password]`, password)
|
||||
.click(`vn-login input[type=submit]`)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should receive an error when the username is blank', async() => {
|
||||
const password = 'nightmare';
|
||||
|
||||
const result = await nightmare
|
||||
.clearInput(`vn-login input[name=user]`)
|
||||
.write(`vn-login input[name=password]`, password)
|
||||
.click(`vn-login input[type=submit]`)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should receive an error when the password is incorrect', async() => {
|
||||
const username = 'employee';
|
||||
const password = 'badpassword';
|
||||
|
||||
const result = await nightmare
|
||||
.write(`vn-login input[name=user]`, username)
|
||||
.write(`vn-login input[name=password]`, password)
|
||||
.click(`vn-login input[type=submit]`)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should log in', async() => {
|
||||
const username = 'employee';
|
||||
const password = 'nightmare';
|
||||
|
||||
const url = await nightmare
|
||||
.write(`vn-login input[name=user]`, username)
|
||||
.write(`vn-login input[name=password]`, password)
|
||||
.click(`vn-login input[type=submit]`)
|
||||
.wait('#logout')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/');
|
||||
});
|
||||
});
|
|
@ -67,5 +67,6 @@
|
|||
"You can't create a ticket for a inactive client": "No puedes crear un ticket para un cliente inactivo",
|
||||
"Tag value cannot be blank": "El valor del tag no puede quedar en blanco",
|
||||
"ORDER_EMPTY": "Cesta vacía",
|
||||
"You don't have enough privileges to do that": "No tienes permisos para cambiar esto"
|
||||
"You don't have enough privileges to do that": "No tienes permisos para cambiar esto",
|
||||
"You can't create a ticket for a client that has a debt": "No puedes crear un ticket para un client con deuda"
|
||||
}
|
Loading…
Reference in New Issue