diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index a99d6f833..a90d4f410 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -137,7 +137,7 @@ Nightmare.action('changeLanguageToEnglish', function(done) { this.click(selectors.globalItems.languageButton) .then(done); } - if (result != 'Cambiar idioma') { + if (result === 'Change language') { this.then(done); } }); diff --git a/e2e/paths/create_client_path.spec.js b/e2e/paths/create_client_path.spec.js index f67859183..887475d1b 100644 --- a/e2e/paths/create_client_path.spec.js +++ b/e2e/paths/create_client_path.spec.js @@ -33,20 +33,11 @@ describe('create client path', () => { it('should make sure the language is English', done => { nightmare - .wait(selectors.globalItems.languageButton) - .evaluate(selector => { - return document.querySelector(selector).title; - }, selectors.globalItems.languageButton) - .then(result => { - if (result === 'Cambiar idioma') { - nightmare.click(selectors.globalItems.languageButton) - .then(done); - } - if (result != 'Cambiar idioma') { - nightmare - .then(done); - } - }); + .changeLanguageToEnglish() + .then(() => { + done(); + }) + .catch(catchErrors(done)); }); it('should access to the clients index by clicking the clients button', done => { diff --git a/e2e/paths/edit_basic_data.spec.js b/e2e/paths/edit_basic_data.spec.js index c8099b03f..db1058ba8 100644 --- a/e2e/paths/edit_basic_data.spec.js +++ b/e2e/paths/edit_basic_data.spec.js @@ -33,20 +33,11 @@ describe('Edit basicData path', () => { it('should make sure the language is English', done => { nightmare - .wait(selectors.globalItems.languageButton) - .evaluate(selector => { - return document.querySelector(selector).title; - }, selectors.globalItems.languageButton) - .then(result => { - if (result === 'Cambiar idioma') { - nightmare.click(selectors.globalItems.languageButton) - .then(done); - } - if (result != 'Cambiar idioma') { - nightmare - .then(done); - } - }); + .changeLanguageToEnglish() + .then(() => { + done(); + }) + .catch(catchErrors(done)); }); it('should click on the Clients button of the top bar menu', done => { diff --git a/e2e/paths/edit_fiscal_data.spec.js b/e2e/paths/edit_fiscal_data.spec.js index 4b9dbbcf3..d88af12b0 100644 --- a/e2e/paths/edit_fiscal_data.spec.js +++ b/e2e/paths/edit_fiscal_data.spec.js @@ -33,20 +33,11 @@ describe('Edit fiscalData path', () => { it('should make sure the language is English', done => { nightmare - .wait(selectors.globalItems.languageButton) - .evaluate(selector => { - return document.querySelector(selector).title; - }, selectors.globalItems.languageButton) - .then(result => { - if (result === 'Cambiar idioma') { - nightmare.click(selectors.globalItems.languageButton) - .then(done); - } - if (result != 'Cambiar idioma') { - nightmare - .then(done); - } - }); + .changeLanguageToEnglish() + .then(() => { + done(); + }) + .catch(catchErrors(done)); }); it('should click on the Clients button of the top bar menu', done => {