salix/e2e/paths/clients_path.spec.js

59 lines
1.8 KiB
JavaScript

import config from '../helpers/config.js';
import createNightmare from '../helpers/nightmare';
import selectors from '../helpers/selectors.js';
import {catchErrors} from '../../services/utils/jasmineHelpers';
const nightmare = createNightmare();
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
describe('Clients path', () => {
it('should log in', done => {
nightmare
.login()
.wait(3000)
.wait(selectors.globalItems.topBar)
.url()
.then(url => {
expect(url).toBe(config.url + '#!/');
done();
})
.catch(catchErrors(done));
});
it('should access to the clients index by clicking the clients button', done => {
nightmare
.click(selectors.moduleAccessView.clientsSectionButton)
.wait(3000)
.wait(selectors.clientsView.createClientButton)
.url()
.then(url => {
expect(url).toBe(config.url + '#!/clients');
done();
})
.catch(catchErrors(done));
});
it('should access to the create client view by clicking the create-client floating button', done => {
nightmare
.click(selectors.clientsView.createClientButton)
.wait(3000)
.wait(selectors.createClientView.createButton)
.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(selectors.createClientView.createButton)
.wait(selectors.globalItems.snackbar)
.getInnerText(selectors.globalItems.snackbar)
.then(result => {
expect(result).toBe('No hay cambios que guardar');
done();
});
});
});