diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 89f8e1acc..a99d6f833 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -127,6 +127,22 @@ Nightmare.action('waitForTextInElement', function(selector, name, done) { .then(done); }); +Nightmare.action('changeLanguageToEnglish', function(done) { + this.wait(selectors.globalItems.languageButton) + .evaluate(selector => { + return document.querySelector(selector).title; + }, selectors.globalItems.languageButton) + .then(result => { + if (result === 'Cambiar idioma') { + this.click(selectors.globalItems.languageButton) + .then(done); + } + if (result != 'Cambiar idioma') { + this.then(done); + } + }); +}); + Nightmare.action('waitForSnackbarReset', function(done) { this.wait(() => { return document.querySelector('vn-snackbar').innerText === ''; diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 9a35b41f0..b0b56ce69 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -10,6 +10,7 @@ export default { globalItems: { topBar: `${components.vnTopbar}`, logOutButton: `${components.vnIcon}[icon="exit_to_app"]`, + languageButton: `${components.vnIcon}[icon="language"]`, snackbarIsActive: '.mdl-snackbar--active > .mdl-snackbar__text', applicationsMenuButton: `${components.vnIcon}[icon="apps"]`, applicationsMenuVisible: `${components.vnMainMenu} .is-visible > div`, diff --git a/e2e/paths/create_client_path.spec.js b/e2e/paths/create_client_path.spec.js index ed3ffb5ec..f67859183 100644 --- a/e2e/paths/create_client_path.spec.js +++ b/e2e/paths/create_client_path.spec.js @@ -31,6 +31,24 @@ describe('create client path', () => { .catch(catchErrors(done)); }); + 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); + } + }); + }); + it('should access to the clients index by clicking the clients button', done => { nightmare .click(selectors.moduleAccessView.clientsSectionButton) @@ -75,7 +93,7 @@ describe('create client path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('No hay cambios que guardar'); + expect(result).toEqual('No changes to save'); done(); }) .catch(catchErrors(done)); @@ -149,7 +167,7 @@ describe('create client path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`Algunos campos no son válidos`); + expect(result).toEqual('Some fields are invalid'); done(); }) .catch(catchErrors(done)); @@ -184,7 +202,7 @@ describe('create client path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toContain(`¡Datos guardados!`); + expect(result).toContain('Data saved!'); done(); }) .catch(catchErrors(done)); diff --git a/e2e/paths/edit_basic_data.spec.js b/e2e/paths/edit_basic_data.spec.js index 0ba2e4193..c8099b03f 100644 --- a/e2e/paths/edit_basic_data.spec.js +++ b/e2e/paths/edit_basic_data.spec.js @@ -31,6 +31,24 @@ describe('Edit basicData path', () => { .catch(catchErrors(done)); }); + 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); + } + }); + }); + it('should click on the Clients button of the top bar menu', done => { nightmare .waitToClick(selectors.globalItems.applicationsMenuButton) @@ -81,7 +99,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -111,7 +129,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -141,7 +159,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -171,7 +189,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -201,7 +219,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -231,7 +249,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -261,7 +279,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); diff --git a/e2e/paths/edit_fiscal_data.spec.js b/e2e/paths/edit_fiscal_data.spec.js index 58b9f3418..4b9dbbcf3 100644 --- a/e2e/paths/edit_fiscal_data.spec.js +++ b/e2e/paths/edit_fiscal_data.spec.js @@ -31,6 +31,24 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); + 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); + } + }); + }); + it('should click on the Clients button of the top bar menu', done => { nightmare .waitToClick(selectors.globalItems.applicationsMenuButton) @@ -82,7 +100,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -112,7 +130,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -140,7 +158,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -153,7 +171,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -185,7 +203,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -215,7 +233,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -245,7 +263,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -275,7 +293,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -305,7 +323,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -333,7 +351,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -363,7 +381,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -393,7 +411,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -423,7 +441,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -453,7 +471,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -483,7 +501,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done));