salix/e2e/paths/clients_path.spec.js

53 lines
1.7 KiB
JavaScript
Raw Normal View History

2017-09-15 10:24:37 +00:00
import config from '../helpers/config.js';
import createNightmare from '../helpers/nightmare';
import selectors from '../helpers/selectors.js';
let components = selectors.components;
2017-09-11 14:12:32 +00:00
const nightmare = createNightmare();
describe('Clients path', () => {
2017-09-15 10:24:37 +00:00
fit('should log in', done => {
2017-09-11 14:12:32 +00:00
nightmare
2017-09-15 10:24:37 +00:00
.login('nightmare', 'NightmarePassword')
.wait(1000)
2017-09-11 14:12:32 +00:00
.url()
.then(url => {
2017-09-15 10:24:37 +00:00
expect(url).toBe(config.url + '#!/');
2017-09-11 14:12:32 +00:00
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)')
2017-09-15 10:24:37 +00:00
.wait(1000)
2017-09-11 14:12:32 +00:00
.url()
.then(url => {
2017-09-15 10:24:37 +00:00
expect(url).toBe(config.url + '#!/clients');
2017-09-11 14:12:32 +00:00
done();
});
});
it('should access to the create client by clicking the create-client button', done => {
nightmare
2017-09-15 10:24:37 +00:00
.click('body > vn-app > vn-vertical > vn-vertical > vn-client-index > div > a')
.wait(1000)
2017-09-11 14:12:32 +00:00
.url()
.then(url => {
2017-09-15 10:24:37 +00:00
expect(url).toBe(config.url + '#!/create');
2017-09-11 14:12:32 +00:00
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();
});
});
});