salix/e2e/paths/clients_path.spec.js

57 lines
1.8 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';
import {catchErrors} from '../../services/utils/jasmineHelpers';
2017-09-11 14:12:32 +00:00
const nightmare = createNightmare();
describe('Clients path', () => {
2017-09-17 13:09:10 +00:00
it('should log in', done => {
2017-09-11 14:12:32 +00:00
nightmare
.login()
.wait(3000)
.wait(selectors.globalItems.topBar)
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();
})
.catch(catchErrors(done));
2017-09-11 14:12:32 +00:00
});
it('should access to the clients index by clicking the clients button', done => {
nightmare
.click(selectors.moduleAccessView.clientsSectionButton)
.wait(3000)
.wait(selectors.clientsView.createClientButton)
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();
})
.catch(catchErrors(done));
2017-09-11 14:12:32 +00:00
});
it('should access to the create client view by clicking the create-client floating button', done => {
2017-09-11 14:12:32 +00:00
nightmare
.click(selectors.clientsView.createClientButton)
.wait(3000)
.wait(selectors.createClientView.createButton)
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(selectors.createClientView.createButton)
.wait(selectors.globalItems.snackbar)
.getInnerText(selectors.globalItems.snackbar)
2017-09-11 14:12:32 +00:00
.then(result => {
expect(result).toBe('No hay cambios que guardar');
done();
});
});
});