import createNightmare from '../nightmare'; const nightmare = createNightmare(); describe('Clients path', () => { it('should log in', done => { // nightmare user to go any further. nightmare .login('Nightmare', 'NightmarePassword') .wait('body > vn-app > vn-vertical > vn-topbar') .url() .then(url => { expect(url).toBe('http://localhost:5000/#!/'); 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('body > vn-app > vn-vertical > vn-vertical > vn-client-index > div > a > vn-float-button > button') .url() .then(url => { expect(url).toBe('http://localhost:5000/#!/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 > vn-float-button > button') .wait('body > vn-app > vn-vertical > vn-vertical > vn-client-create > form > div > vn-card > div > vn-vertical > vn-title > h3') .url() .then(url => { expect(url).toBe('http://localhost:5000/#!/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(); }); }); });