salix/e2e/paths/clients_path.spec.js

53 lines
1.7 KiB
JavaScript

import config from '../helpers/config.js';
import createNightmare from '../helpers/nightmare';
import selectors from '../helpers/selectors.js';
let components = selectors.components;
const nightmare = createNightmare();
describe('Clients path', () => {
fit('should log in', done => {
nightmare
.login()
.wait(200)
.url()
.then(url => {
expect(url).toBe(config.url + '#!/');
done();
});
});
it('should access to the clients index by clicking the clients button', done => {
nightmare
.click('body > vn-app > vn-vertical > vn-vertical > vn-home > vn-vertical > vn-module-container > a:nth-child(1)')
.wait(1000)
.url()
.then(url => {
expect(url).toBe(config.url + '#!/clients');
done();
});
});
it('should access to the create client by clicking the create-client button', done => {
nightmare
.click('body > vn-app > vn-vertical > vn-vertical > vn-client-index > div > a')
.wait(1000)
.url()
.then(url => {
expect(url).toBe(config.url + '#!/create');
done();
});
});
it('should receive an error when clicking the create button having all the form fields empty', done => {
nightmare
.click('body > vn-app > vn-vertical > vn-vertical > vn-client-create > form > div > vn-button-bar > vn-button > button')
.wait('body > vn-app > vn-vertical > vn-snackbar > div > div')
.getInnerText('body > vn-app > vn-vertical > vn-snackbar > div > div')
.then(result => {
expect(result).toBe('No hay cambios que guardar');
done();
});
});
});