diff --git a/e2e/paths/clients_path.spec.js b/e2e/paths/clients_path.spec.js index 0e9903e93..e1ff13af4 100644 --- a/e2e/paths/clients_path.spec.js +++ b/e2e/paths/clients_path.spec.js @@ -42,7 +42,8 @@ describe('Clients path', () => { .then(url => { expect(url).toBe(config.url + '#!/create'); done(); - }); + }) + .catch(catchErrors(done)); }); it('should receive an error when clicking the create button having all the form fields empty', done => { @@ -53,7 +54,8 @@ describe('Clients path', () => { .then(result => { expect(result).toBe('No hay cambios que guardar'); done(); - }); + }) + .catch(catchErrors(done)); }); it('should receive an error when clicking the create button having all the form fields empty but name', done => { @@ -61,13 +63,14 @@ describe('Clients path', () => { .wait(3000) .type(selectors.createClientView.name, 'Bruce Wayne') .click(selectors.createClientView.createButton) - .wait(100) + .wait(200) .wait(selectors.globalItems.snackbar) .getInnerText(selectors.globalItems.snackbar) .then(result => { expect(result).toContain(`Error:`); done(); - }); + }) + .catch(catchErrors(done)); }); it('should receive an error when clicking the create button having all the form fields empty but Tax Number', done => { @@ -76,13 +79,14 @@ describe('Clients path', () => { .clearInput(selectors.createClientView.name) .type(selectors.createClientView.taxNumber, 'Wayne Industries Tax Number') .click(selectors.createClientView.createButton) - .wait(100) + .wait(200) .wait(selectors.globalItems.snackbar) .getInnerText(selectors.globalItems.snackbar) .then(result => { expect(result).toContain(`Error:`); done(); - }); + }) + .catch(catchErrors(done)); }); it('should receive an error when clicking the create button having all the form fields empty but Business Name', done => { @@ -91,13 +95,14 @@ describe('Clients path', () => { .clearInput(selectors.createClientView.taxNumber) .type(selectors.createClientView.businessName, 'Wayne Industries') .click(selectors.createClientView.createButton) - .wait(100) + .wait(200) .wait(selectors.globalItems.snackbar) .getInnerText(selectors.globalItems.snackbar) .then(result => { expect(result).toContain(`Error:`); done(); - }); + }) + .catch(catchErrors(done)); }); it('should receive an error when clicking the create button having all the form fields empty but User Name', done => { @@ -106,13 +111,14 @@ describe('Clients path', () => { .clearInput(selectors.createClientView.businessName) .type(selectors.createClientView.userName, 'Batman') .click(selectors.createClientView.createButton) - .wait(100) + .wait(200) .wait(selectors.globalItems.snackbar) .getInnerText(selectors.globalItems.snackbar) .then(result => { expect(result).toContain(`Error:`); done(); - }); + }) + .catch(catchErrors(done)); }); it('should receive an error when clicking the create button having all the form fields empty but email while email have incorrect format', done => { @@ -121,13 +127,14 @@ describe('Clients path', () => { .clearInput(selectors.createClientView.userName) .type(selectors.createClientView.email, 'I will save Gotham!') .click(selectors.createClientView.createButton) - .wait(100) + .wait(200) .wait(selectors.globalItems.snackbar) .getInnerText(selectors.globalItems.snackbar) .then(result => { expect(result).toBe(`Algunos campos no son vĂ¡lidos`); done(); - }); + }) + .catch(catchErrors(done)); }); it('should receive an error when clicking the create button having all the form fields empty but email', done => { @@ -136,12 +143,35 @@ describe('Clients path', () => { .clearInput(selectors.createClientView.email) .type(selectors.createClientView.email, 'IAmBatman@WayneIndustries.gotham') .click(selectors.createClientView.createButton) - .wait(100) + .wait(200) .wait(selectors.globalItems.snackbar) .getInnerText(selectors.globalItems.snackbar) .then(result => { expect(result).toContain(`Error:`); done(); - }); + }) + .catch(catchErrors(done)); }); + + // this test should remain commented until the fixtures are implemented to avoid chainned failures. + + // it('should receive an error when clicking the create button having all the form fields empty but email', done => { + // nightmare + // .wait(3000) + // .clearInput(selectors.createClientView.email) + // .type(selectors.createClientView.name, 'Bruce Wayne') + // .type(selectors.createClientView.taxNumber, 'Wayne Industries Tax Number') + // .type(selectors.createClientView.businessName, 'Wayne Industries') + // .type(selectors.createClientView.userName, 'Batman') + // .type(selectors.createClientView.email, 'IAmBatman@WayneIndustries.gotham') + // .click(selectors.createClientView.createButton) + // .wait(6000) + // .wait(selectors.globalItems.snackbar) + // .getInnerText(selectors.globalItems.snackbar) + // .then(result => { + // expect(result).toContain(`some validation message`); + // done(); + // }) + // .catch(catchErrors(done)); + // }); });