diff --git a/e2e/paths/client-module/01_create_client.spec.js b/e2e/paths/client-module/01_create_client.spec.js index 87a06c413..e2f31c004 100644 --- a/e2e/paths/client-module/01_create_client.spec.js +++ b/e2e/paths/client-module/01_create_client.spec.js @@ -1,114 +1,116 @@ import selectors from '../../helpers/selectors'; import createNightmare from '../../helpers/helpers'; -describe('create client path', () => { - let nightmare = createNightmare(); +describe('Client', () => { + describe('create path', () => { + let nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should access to the clients index by clicking the clients button', () => { - return nightmare - .click(selectors.moduleAccessView.clientsSectionButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it(`should search for the user Carol Danvers to confirm it isn't created yet`, () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Carol Danvers') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 0) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(0); + it('should access to the clients index by clicking the clients button', () => { + return nightmare + .click(selectors.moduleAccessView.clientsSectionButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); }); - }); - it('should access to the create client view by clicking the create-client floating button', () => { - return nightmare - .click(selectors.clientsIndex.createClientButton) - .wait(selectors.createClientView.createButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/create'); + it(`should search for the user Carol Danvers to confirm it isn't created yet`, () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Carol Danvers') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 0) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(0); + }); }); - }); - it('should receive an error when clicking the create button having all the form fields empty', () => { - return nightmare - .click(selectors.createClientView.createButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Some fields are invalid'); + it('should access to the create client view by clicking the create-client floating button', () => { + return nightmare + .click(selectors.clientsIndex.createClientButton) + .wait(selectors.createClientView.createButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/create'); + }); }); - }); - it('should receive an error when clicking the create button having name and Business name fields empty', () => { - return nightmare - .type(selectors.createClientView.taxNumber, '74451390E') - .type(selectors.createClientView.userName, 'CaptainMarvel') - .type(selectors.createClientView.email, 'CarolDanvers@verdnatura.es') - .waitToClick(selectors.createClientView.salesPersonInput) - .waitToClick(selectors.createClientView.salesBruceBannerOption) - .click(selectors.createClientView.createButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Some fields are invalid'); + it('should receive an error when clicking the create button having all the form fields empty', () => { + return nightmare + .click(selectors.createClientView.createButton) + .waitForSnackbar() + .then(result => { + expect(result).toEqual('Some fields are invalid'); + }); }); - }); - it(`should attempt to create a new user with all it's data but wrong email`, () => { - return nightmare - .type(selectors.createClientView.name, 'Carol Danvers') - .type(selectors.createClientView.socialName, 'AVG tax') - .clearInput(selectors.createClientView.email) - .type(selectors.createClientView.email, 'incorrect email format') - .click(selectors.createClientView.createButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Some fields are invalid'); + it('should receive an error when clicking the create button having name and Business name fields empty', () => { + return nightmare + .type(selectors.createClientView.taxNumber, '74451390E') + .type(selectors.createClientView.userName, 'CaptainMarvel') + .type(selectors.createClientView.email, 'CarolDanvers@verdnatura.es') + .waitToClick(selectors.createClientView.salesPersonInput) + .waitToClick(selectors.createClientView.salesBruceBannerOption) + .click(selectors.createClientView.createButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Some fields are invalid'); + }); }); - }); - it(`should create a new user with all correct data`, () => { - return nightmare - .clearInput(selectors.createClientView.email) - .type(selectors.createClientView.email, 'caroldanvers@verdnatura.es') - .click(selectors.createClientView.createButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Data saved!'); + it(`should attempt to create a new user with all it's data but wrong email`, () => { + return nightmare + .type(selectors.createClientView.name, 'Carol Danvers') + .type(selectors.createClientView.socialName, 'AVG tax') + .clearInput(selectors.createClientView.email) + .type(selectors.createClientView.email, 'incorrect email format') + .click(selectors.createClientView.createButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Some fields are invalid'); + }); }); - }); - it('should click on the Clients button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); + it(`should create a new user with all correct data`, () => { + return nightmare + .clearInput(selectors.createClientView.email) + .type(selectors.createClientView.email, 'caroldanvers@verdnatura.es') + .click(selectors.createClientView.createButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Data saved!'); + }); }); - }); - it(`should search for the user Carol Danvers to confirm it exists`, () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Carol Danvers') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should click on the Clients button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); + }); + + it(`should search for the user Carol Danvers to confirm it exists`, () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Carol Danvers') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); }); }); diff --git a/e2e/paths/client-module/02_edit_basic_data.spec.js b/e2e/paths/client-module/02_edit_basic_data.spec.js index 671f64fd0..7a6ef4f22 100644 --- a/e2e/paths/client-module/02_edit_basic_data.spec.js +++ b/e2e/paths/client-module/02_edit_basic_data.spec.js @@ -1,130 +1,132 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('Edit basicData path', () => { - const nightmare = createNightmare(); +describe('Client', () => { + describe('Edit basicData path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should click on the Clients button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it('should search for the user Bruce Wayne', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Bruce Wayne') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should click on the Clients button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); }); - }); - it('should click on the search result to access to the clients basic data', () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Wayne') - .waitToClick(selectors.clientsIndex.searchResult) - .waitForURL('basic-data') - .url() - .then(url => { - expect(url).toContain('basic-data'); + it('should search for the user Bruce Wayne', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Bruce Wayne') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it('should edit the client basic data', () => { - return nightmare - .wait(selectors.clientBasicData.nameInput) - .clearInput(selectors.clientBasicData.nameInput) - .type(selectors.clientBasicData.nameInput, 'Ororo Munroe') - .clearInput(selectors.clientBasicData.contactInput) - .type(selectors.clientBasicData.contactInput, 'Black Panther') - .clearInput(selectors.clientBasicData.phoneInput) - .type(selectors.clientBasicData.phoneInput, '123456789') - .clearInput(selectors.clientBasicData.mobileInput) - .type(selectors.clientBasicData.mobileInput, '987654321') - .clearInput(selectors.clientBasicData.emailInput) - .type(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es') - .waitToClick(selectors.clientBasicData.salesPersonInput) - .waitToClick(selectors.clientBasicData.salesPersonOptionOne) - .waitToClick(selectors.clientBasicData.channelInput) - .waitToClick(selectors.clientBasicData.channelMetropolisOption) - .click(selectors.clientBasicData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); + it('should click on the search result to access to the clients basic data', () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Wayne') + .waitToClick(selectors.clientsIndex.searchResult) + .waitForURL('basic-data') + .url() + .then(url => { + expect(url).toContain('basic-data'); + }); }); - }); - it('should confirm the name have been edited', () => { - return nightmare - .click(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.addressInput) - .click(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .getInputValue(selectors.clientBasicData.nameInput) - .then(result => { - expect(result).toEqual('Ororo Munroe'); + it('should edit the client basic data', () => { + return nightmare + .wait(selectors.clientBasicData.nameInput) + .clearInput(selectors.clientBasicData.nameInput) + .type(selectors.clientBasicData.nameInput, 'Ororo Munroe') + .clearInput(selectors.clientBasicData.contactInput) + .type(selectors.clientBasicData.contactInput, 'Black Panther') + .clearInput(selectors.clientBasicData.phoneInput) + .type(selectors.clientBasicData.phoneInput, '123456789') + .clearInput(selectors.clientBasicData.mobileInput) + .type(selectors.clientBasicData.mobileInput, '987654321') + .clearInput(selectors.clientBasicData.emailInput) + .type(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es') + .waitToClick(selectors.clientBasicData.salesPersonInput) + .waitToClick(selectors.clientBasicData.salesPersonOptionOne) + .waitToClick(selectors.clientBasicData.channelInput) + .waitToClick(selectors.clientBasicData.channelMetropolisOption) + .click(selectors.clientBasicData.saveButton) + .waitForSnackbar() + .then(result => { + expect(result).toEqual('Data saved!'); + }); }); - }); - it('should confirm the contact name have been edited', () => { - return nightmare - .getInputValue(selectors.clientBasicData.contactInput) - .then(result => { - expect(result).toEqual('Black Panther'); + it('should confirm the name have been edited', () => { + return nightmare + .click(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.addressInput) + .click(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .getInputValue(selectors.clientBasicData.nameInput) + .then(result => { + expect(result).toEqual('Ororo Munroe'); + }); }); - }); - it('should confirm the landline phone number have been added', () => { - return nightmare - .getInputValue(selectors.clientBasicData.phoneInput) - .then(result => { - expect(result).toEqual('123456789'); + it('should confirm the contact name have been edited', () => { + return nightmare + .getInputValue(selectors.clientBasicData.contactInput) + .then(result => { + expect(result).toEqual('Black Panther'); + }); }); - }); - it('should confirm the mobile phone number have been added', () => { - return nightmare - .getInputValue(selectors.clientBasicData.mobileInput) - .then(result => { - expect(result).toEqual('987654321'); + it('should confirm the landline phone number have been added', () => { + return nightmare + .getInputValue(selectors.clientBasicData.phoneInput) + .then(result => { + expect(result).toEqual('123456789'); + }); }); - }); - it('should confirm the email have been edited', () => { - return nightmare - .getInputValue(selectors.clientBasicData.emailInput) - .then(result => { - expect(result).toEqual('Storm@verdnatura.es'); + it('should confirm the mobile phone number have been added', () => { + return nightmare + .getInputValue(selectors.clientBasicData.mobileInput) + .then(result => { + expect(result).toEqual('987654321'); + }); }); - }); - it('should confirm the sales person have been selected', () => { - return nightmare - .getInputValue(selectors.clientBasicData.salesPersonInput) - .then(result => { - expect(result).toEqual('accessory'); + it('should confirm the email have been edited', () => { + return nightmare + .getInputValue(selectors.clientBasicData.emailInput) + .then(result => { + expect(result).toEqual('Storm@verdnatura.es'); + }); }); - }); - it('should confirm the channel have been selected', () => { - return nightmare - .getInputValue(selectors.clientBasicData.channelInput) - .then(result => { - expect(result).toEqual('Metropolis newspaper'); + it('should confirm the sales person have been selected', () => { + return nightmare + .getInputValue(selectors.clientBasicData.salesPersonInput) + .then(result => { + expect(result).toEqual('accessory'); + }); + }); + + it('should confirm the channel have been selected', () => { + return nightmare + .getInputValue(selectors.clientBasicData.channelInput) + .then(result => { + expect(result).toEqual('Metropolis newspaper'); + }); }); }); }); diff --git a/e2e/paths/client-module/03_edit_fiscal_data.spec.js b/e2e/paths/client-module/03_edit_fiscal_data.spec.js index 5564bc51d..00ad34468 100644 --- a/e2e/paths/client-module/03_edit_fiscal_data.spec.js +++ b/e2e/paths/client-module/03_edit_fiscal_data.spec.js @@ -1,290 +1,292 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('Edit fiscalData path', () => { - const nightmare = createNightmare(); +describe('Client', () => { + describe('Edit fiscalData path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should click on the Clients button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); - }); - }); - - it('should search for the user Bruce Banner', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); - }); - }); - - describe('Confirm all addresses have EQtax false for future propagation test', () => { - it(`should click on the search result to access to the client's addresses`, () => { + beforeAll(() => { return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientAddresses.addressesButton) - .waitForURL('/addresses/list') + .waitForLogin('developer'); + }); + + it('should click on the Clients button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); + }); + + it('should search for the user Bruce Banner', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); + }); + + describe('Confirm all addresses have EQtax false for future propagation test', () => { + it(`should click on the search result to access to the client's addresses`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientAddresses.addressesButton) + .waitForURL('/addresses/list') + .url() + .then(url => { + expect(url).toContain('/addresses/list'); + }); + }); + + it(`should click on the 1st edit icon to check EQtax is checked`, () => { + return nightmare + .waitToClick(selectors.clientAddresses.firstEditButton) + .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientAddresses.equalizationTaxCheckboxLabel) + .then(value => { + expect(value).toBeFalsy(); + }); + }); + + it(`should go back to addresses then select the second one and confirm the EQtax is checked`, () => { + return nightmare + .waitToClick(selectors.clientAddresses.addressesButton) + .waitToClick(selectors.clientAddresses.secondEditButton) + .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientAddresses.equalizationTaxCheckboxLabel) + .then(value => { + expect(value).toBeFalsy(); + }); + }); + }); + + it(`should click on the fiscal data button to start editing`, () => { + return nightmare + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .waitForURL('fiscal-data') .url() .then(url => { - expect(url).toContain('/addresses/list'); + expect(url).toContain('fiscal-data'); }); }); - it(`should click on the 1st edit icon to check EQtax is checked`, () => { + it('should edit the clients fiscal data', () => { + return nightmare + .wait(selectors.clientFiscalData.socialNameInput) + .clearInput(selectors.clientFiscalData.socialNameInput) + .type(selectors.clientFiscalData.socialNameInput, 'SMASH!') + .clearInput(selectors.clientFiscalData.fiscalIdInput) + .type(selectors.clientFiscalData.fiscalIdInput, '94980061C') + .waitToClick(selectors.clientFiscalData.equalizationTaxCheckboxLabel) + .clearInput(selectors.clientFiscalData.addressInput) + .type(selectors.clientFiscalData.addressInput, 'Somewhere edited') + .clearInput(selectors.clientFiscalData.cityInput) + .type(selectors.clientFiscalData.cityInput, 'N/A') + .clearInput(selectors.clientFiscalData.postcodeInput) + .type(selectors.clientFiscalData.postcodeInput, '12345') + .waitToClick(selectors.clientFiscalData.provinceInput) + .waitToClick(selectors.clientFiscalData.provinceFifthOption) + .waitToClick(selectors.clientFiscalData.activeCheckboxLabel) + .waitToClick(selectors.clientFiscalData.frozenCheckboxLabel) + .waitToClick(selectors.clientFiscalData.invoiceByAddressCheckboxInput) + .waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput) + .waitToClick(selectors.clientFiscalData.hasToInvoiceCheckboxLabel) + .waitToClick(selectors.clientFiscalData.invoiceByMailCheckboxLabel) + .waitToClick(selectors.clientFiscalData.viesCheckboxInput) + .click(selectors.clientFiscalData.saveButton) + .waitForSnackbar() + .then(result => { + expect(result).toEqual('Data saved!'); + }); + }); + + it('should propagate the Equalization tax', () => { + return nightmare + .waitToClick(selectors.clientFiscalData.acceptPropagationButton) + .waitForSnackbar() + .then(result => { + expect(result).toEqual('Equivalent tax spreaded'); + }); + }); + + describe('confirm all addresses have now EQtax checked', () => { + it(`should click on the addresses button to access to the client's addresses`, () => { + return nightmare + .waitToClick(selectors.clientAddresses.addressesButton) + .waitForURL('/addresses/list') + .url() + .then(url => { + expect(url).toContain('/addresses/list'); + }); + }); + + it(`should click on the 1st edit icon to confirm EQtax is checked`, () => { + return nightmare + .waitToClick(selectors.clientAddresses.firstEditButton) + .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientAddresses.equalizationTaxCheckboxLabel) + .then(value => { + expect(value).toBeTruthy(); + }); + }); + + it(`should go back to addresses then select the second one and confirm the EQtax is checked`, () => { + return nightmare + .waitToClick(selectors.clientAddresses.addressesButton) + .waitToClick(selectors.clientAddresses.secondEditButton) + .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientAddresses.equalizationTaxCheckboxLabel) + .then(value => { + expect(value).toBeTruthy(); + }); + }); + }); + + it('should navigate back to fiscal data to confirm it have been edited', () => { + return nightmare + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.socialNameInput) + .getInputValue(selectors.clientFiscalData.socialNameInput) + .then(result => { + expect(result).toEqual('SMASH!'); + }); + }); + + it('should confirm the fiscal id have been edited', () => { + return nightmare + .getInputValue(selectors.clientFiscalData.fiscalIdInput) + .then(result => { + expect(result).toEqual('94980061C'); + }); + }); + + it('should confirm Equalization tax checkbox is checked', () => { return nightmare - .waitToClick(selectors.clientAddresses.firstEditButton) - .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.clientAddresses.equalizationTaxCheckboxLabel) - .then(value => { - expect(value).toBeFalsy(); - }); - }); - - it(`should go back to addresses then select the second one and confirm the EQtax is checked`, () => { - return nightmare - .waitToClick(selectors.clientAddresses.addressesButton) - .waitToClick(selectors.clientAddresses.secondEditButton) - .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientAddresses.equalizationTaxCheckboxLabel) - .then(value => { - expect(value).toBeFalsy(); - }); - }); - }); - - it(`should click on the fiscal data button to start editing`, () => { - return nightmare - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitForURL('fiscal-data') - .url() - .then(url => { - expect(url).toContain('fiscal-data'); - }); - }); - - it('should edit the clients fiscal data', () => { - return nightmare - .wait(selectors.clientFiscalData.socialNameInput) - .clearInput(selectors.clientFiscalData.socialNameInput) - .type(selectors.clientFiscalData.socialNameInput, 'SMASH!') - .clearInput(selectors.clientFiscalData.fiscalIdInput) - .type(selectors.clientFiscalData.fiscalIdInput, '94980061C') - .waitToClick(selectors.clientFiscalData.equalizationTaxCheckboxLabel) - .clearInput(selectors.clientFiscalData.addressInput) - .type(selectors.clientFiscalData.addressInput, 'Somewhere edited') - .clearInput(selectors.clientFiscalData.cityInput) - .type(selectors.clientFiscalData.cityInput, 'N/A') - .clearInput(selectors.clientFiscalData.postcodeInput) - .type(selectors.clientFiscalData.postcodeInput, '12345') - .waitToClick(selectors.clientFiscalData.provinceInput) - .waitToClick(selectors.clientFiscalData.provinceFifthOption) - .waitToClick(selectors.clientFiscalData.activeCheckboxLabel) - .waitToClick(selectors.clientFiscalData.frozenCheckboxLabel) - .waitToClick(selectors.clientFiscalData.invoiceByAddressCheckboxInput) - .waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput) - .waitToClick(selectors.clientFiscalData.hasToInvoiceCheckboxLabel) - .waitToClick(selectors.clientFiscalData.invoiceByMailCheckboxLabel) - .waitToClick(selectors.clientFiscalData.viesCheckboxInput) - .click(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - - it('should propagate the Equalization tax', () => { - return nightmare - .waitToClick(selectors.clientFiscalData.acceptPropagationButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Equivalent tax spreaded'); - }); - }); - - describe('confirm all addresses have now EQtax checked', () => { - it(`should click on the addresses button to access to the client's addresses`, () => { - return nightmare - .waitToClick(selectors.clientAddresses.addressesButton) - .waitForURL('/addresses/list') - .url() - .then(url => { - expect(url).toContain('/addresses/list'); - }); - }); - - it(`should click on the 1st edit icon to confirm EQtax is checked`, () => { - return nightmare - .waitToClick(selectors.clientAddresses.firstEditButton) - .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientAddresses.equalizationTaxCheckboxLabel) + }, selectors.clientFiscalData.equalizationTaxCheckboxLabel) .then(value => { expect(value).toBeTruthy(); }); }); - it(`should go back to addresses then select the second one and confirm the EQtax is checked`, () => { + it('should confirm the address have been edited', () => { + return nightmare + .getInputValue(selectors.clientFiscalData.addressInput) + .then(result => { + expect(result).toEqual('Somewhere edited'); + }); + }); + + it('should confirm the city have been edited', () => { + return nightmare + .getInputValue(selectors.clientFiscalData.cityInput) + .then(result => { + expect(result).toEqual('N/A'); + }); + }); + + it('should confirm the postcode have been edited', () => { + return nightmare + .getInputValue(selectors.clientFiscalData.postcodeInput) + .then(result => { + expect(result).toEqual('12345'); + }); + }); + + it(`should confirm the province have been selected`, () => { + return nightmare + .getInputValue(selectors.clientFiscalData.provinceInput) + .then(result => { + expect(result).toEqual('Province two'); + }); + }); + + it('should confirm active checkbox is unchecked', () => { return nightmare - .waitToClick(selectors.clientAddresses.addressesButton) - .waitToClick(selectors.clientAddresses.secondEditButton) - .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.clientAddresses.equalizationTaxCheckboxLabel) + }, selectors.clientFiscalData.activeCheckboxLabel) + .then(value => { + expect(value).toBeFalsy(); + }); + }); + + it('should confirm frozen checkbox is unchecked', () => { + return nightmare + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientFiscalData.frozenCheckboxLabel) + .then(value => { + expect(value).toBeFalsy(); + }); + }); + + it('should confirm invoice by address checkbox is unchecked', () => { + return nightmare + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientFiscalData.invoiceByAddressCheckboxInput) + .then(value => { + expect(value).toBeFalsy(); + }); + }); + + it('should confirm Verified data checkbox is checked', () => { + return nightmare + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientFiscalData.verifiedDataCheckboxInput) .then(value => { expect(value).toBeTruthy(); }); }); - }); - it('should navigate back to fiscal data to confirm it have been edited', () => { - return nightmare - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.socialNameInput) - .getInputValue(selectors.clientFiscalData.socialNameInput) - .then(result => { - expect(result).toEqual('SMASH!'); + it('should confirm Has to invoice checkbox is unchecked', () => { + return nightmare + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientFiscalData.hasToInvoiceCheckboxLabel) + .then(value => { + expect(value).toBeFalsy(); + }); }); - }); - it('should confirm the fiscal id have been edited', () => { - return nightmare - .getInputValue(selectors.clientFiscalData.fiscalIdInput) - .then(result => { - expect(result).toEqual('94980061C'); + it('should confirm Invoice by mail checkbox is unchecked', () => { + return nightmare + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientFiscalData.invoiceByMailCheckboxLabel) + .then(value => { + expect(value).toBeFalsy(); + }); }); - }); - it('should confirm Equalization tax checkbox is checked', () => { - return nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.equalizationTaxCheckboxLabel) - .then(value => { - expect(value).toBeTruthy(); - }); - }); - - it('should confirm the address have been edited', () => { - return nightmare - .getInputValue(selectors.clientFiscalData.addressInput) - .then(result => { - expect(result).toEqual('Somewhere edited'); - }); - }); - - it('should confirm the city have been edited', () => { - return nightmare - .getInputValue(selectors.clientFiscalData.cityInput) - .then(result => { - expect(result).toEqual('N/A'); - }); - }); - - it('should confirm the postcode have been edited', () => { - return nightmare - .getInputValue(selectors.clientFiscalData.postcodeInput) - .then(result => { - expect(result).toEqual('12345'); - }); - }); - - it(`should confirm the province have been selected`, () => { - return nightmare - .getInputValue(selectors.clientFiscalData.provinceInput) - .then(result => { - expect(result).toEqual('Province two'); - }); - }); - - it('should confirm active checkbox is unchecked', () => { - return nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.activeCheckboxLabel) - .then(value => { - expect(value).toBeFalsy(); - }); - }); - - it('should confirm frozen checkbox is unchecked', () => { - return nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.frozenCheckboxLabel) - .then(value => { - expect(value).toBeFalsy(); - }); - }); - - it('should confirm invoice by address checkbox is unchecked', () => { - return nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.invoiceByAddressCheckboxInput) - .then(value => { - expect(value).toBeFalsy(); - }); - }); - - it('should confirm Verified data checkbox is checked', () => { - return nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.verifiedDataCheckboxInput) - .then(value => { - expect(value).toBeTruthy(); - }); - }); - - it('should confirm Has to invoice checkbox is unchecked', () => { - return nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.hasToInvoiceCheckboxLabel) - .then(value => { - expect(value).toBeFalsy(); - }); - }); - - it('should confirm Invoice by mail checkbox is unchecked', () => { - return nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.invoiceByMailCheckboxLabel) - .then(value => { - expect(value).toBeFalsy(); - }); - }); - - it('should confirm Vies checkbox is checked', () => { - return nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.viesCheckboxInput) - .then(value => { - expect(value).toBeTruthy(); + it('should confirm Vies checkbox is checked', () => { + return nightmare + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientFiscalData.viesCheckboxInput) + .then(value => { + expect(value).toBeTruthy(); + }); }); }); }); diff --git a/e2e/paths/client-module/04_edit_pay_method.spec.js b/e2e/paths/client-module/04_edit_pay_method.spec.js index 108a5494e..90e766b58 100644 --- a/e2e/paths/client-module/04_edit_pay_method.spec.js +++ b/e2e/paths/client-module/04_edit_pay_method.spec.js @@ -1,122 +1,124 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('Edit pay method path', () => { - const nightmare = createNightmare(); +describe('Client', () => { + describe('Edit pay method path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should click on the Clients button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it('should search for the user Bruce Banner', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should click on the Clients button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); }); - }); - it(`should click on the search result to access to the client's pay method`, () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientPayMethod.payMethodButton) - .waitForURL('billing-data') - .url() - .then(url => { - expect(url).toContain('billing-data'); + it('should search for the user Bruce Banner', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it(`should attempt to edit the Pay method without an IBAN but fail`, () => { - return nightmare - .waitToClick(selectors.clientPayMethod.payMethodInput) - .waitToClick(selectors.clientPayMethod.payMethodIBANOption) - .clearInput(selectors.clientPayMethod.dueDayInput) - .type(selectors.clientPayMethod.dueDayInput, '60') - .waitToClick(selectors.clientPayMethod.receivedCoreVNHCheckbox) - .waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox) - .waitToClick(selectors.clientPayMethod.receivedB2BVNLCheckbox) - .waitToClick(selectors.clientPayMethod.saveButton) - .waitToClick(selectors.clientPayMethod.cancelNotificationButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Error'); + it(`should click on the search result to access to the client's pay method`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientPayMethod.payMethodButton) + .waitForURL('billing-data') + .url() + .then(url => { + expect(url).toContain('billing-data'); + }); }); - }); - it(`should add the IBAN`, () => { - return nightmare - .clearInput(selectors.clientPayMethod.IBANInput) - .type(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332') - .waitToClick(selectors.clientPayMethod.saveButton) - .waitToClick(selectors.clientPayMethod.cancelNotificationButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); + it(`should attempt to edit the Pay method without an IBAN but fail`, () => { + return nightmare + .waitToClick(selectors.clientPayMethod.payMethodInput) + .waitToClick(selectors.clientPayMethod.payMethodIBANOption) + .clearInput(selectors.clientPayMethod.dueDayInput) + .type(selectors.clientPayMethod.dueDayInput, '60') + .waitToClick(selectors.clientPayMethod.receivedCoreVNHCheckbox) + .waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox) + .waitToClick(selectors.clientPayMethod.receivedB2BVNLCheckbox) + .waitToClick(selectors.clientPayMethod.saveButton) + .waitToClick(selectors.clientPayMethod.cancelNotificationButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Error'); + }); }); - }); - it(`should confirm the IBAN pay method is sucessfully saved`, () => { - return nightmare - .getInputValue(selectors.clientPayMethod.payMethodInput) - .then(result => { - expect(result).toEqual('PayMethod with IBAN'); + it(`should add the IBAN`, () => { + return nightmare + .clearInput(selectors.clientPayMethod.IBANInput) + .type(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332') + .waitToClick(selectors.clientPayMethod.saveButton) + .waitToClick(selectors.clientPayMethod.cancelNotificationButton) + .waitForSnackbar() + .then(result => { + expect(result).toEqual('Data saved!'); + }); }); - }); - it('should confirm the due day have been edited', () => { - return nightmare - .getInputValue(selectors.clientPayMethod.dueDayInput) - .then(result => { - expect(result).toEqual('60'); + it(`should confirm the IBAN pay method is sucessfully saved`, () => { + return nightmare + .getInputValue(selectors.clientPayMethod.payMethodInput) + .then(result => { + expect(result).toEqual('PayMethod with IBAN'); + }); }); - }); - it('should confirm Received core VNH checkbox is unchecked', () => { - return nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientPayMethod.receivedCoreVNHCheckbox) - .then(value => { - expect(value).toBeFalsy(); + it('should confirm the due day have been edited', () => { + return nightmare + .getInputValue(selectors.clientPayMethod.dueDayInput) + .then(result => { + expect(result).toEqual('60'); + }); }); - }); - it('should confirm Received core VNL checkbox is unchecked', () => { - return nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientPayMethod.receivedCoreVNLCheckbox) - .then(value => { - expect(value).toBeFalsy(); + it('should confirm Received core VNH checkbox is unchecked', () => { + return nightmare + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientPayMethod.receivedCoreVNHCheckbox) + .then(value => { + expect(value).toBeFalsy(); + }); }); - }); - it('should confirm Received B2B VNL checkbox is unchecked', () => { - return nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientPayMethod.receivedB2BVNLCheckbox) - .then(value => { - expect(value).toBeFalsy(); + it('should confirm Received core VNL checkbox is unchecked', () => { + return nightmare + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientPayMethod.receivedCoreVNLCheckbox) + .then(value => { + expect(value).toBeFalsy(); + }); + }); + + it('should confirm Received B2B VNL checkbox is unchecked', () => { + return nightmare + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientPayMethod.receivedB2BVNLCheckbox) + .then(value => { + expect(value).toBeFalsy(); + }); }); }); }); diff --git a/e2e/paths/client-module/05_add_address.spec.js b/e2e/paths/client-module/05_add_address.spec.js index e765aea72..ae149d3de 100644 --- a/e2e/paths/client-module/05_add_address.spec.js +++ b/e2e/paths/client-module/05_add_address.spec.js @@ -1,128 +1,130 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('Add address path', () => { - const nightmare = createNightmare(); +describe('Client', () => { + describe('Add address path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should click on the Clients button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it('should search for the user Bruce Banner', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should click on the Clients button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); }); - }); - it(`should click on the search result to access to the client addresses`, () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientAddresses.addressesButton) - .waitForURL('addresses/list') - .url() - .then(url => { - expect(url).toContain('addresses/list'); + it('should search for the user Bruce Banner', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it(`should click on the add new address button to access to the new address form`, () => { - return nightmare - .waitToClick(selectors.clientAddresses.createAddress) - .waitForURL('addresses/create') - .url() - .then(url => { - expect(url).toContain('addresses/create'); + it(`should click on the search result to access to the client addresses`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientAddresses.addressesButton) + .waitForURL('addresses/list') + .url() + .then(url => { + expect(url).toContain('addresses/list'); + }); }); - }); - it('should receive an error after clicking save button as consignee, street and town fields are empty', () => { - return nightmare - .waitToClick(selectors.clientAddresses.defaultCheckboxInput) - .clearInput(selectors.clientAddresses.streetAddressInput) - .type(selectors.clientAddresses.postcodeInput, '10022') - .waitToClick(selectors.clientAddresses.provinceInput) - .waitToClick(selectors.clientAddresses.provinceSecondOption) - .waitToClick(selectors.clientAddresses.agencyInput) - .waitToClick(selectors.clientAddresses.agenctySecondOption) - .type(selectors.clientAddresses.phoneInput, '999887744') - .type(selectors.clientAddresses.mobileInput, '999887744') - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Some fields are invalid'); + it(`should click on the add new address button to access to the new address form`, () => { + return nightmare + .waitToClick(selectors.clientAddresses.createAddress) + .waitForURL('addresses/create') + .url() + .then(url => { + expect(url).toContain('addresses/create'); + }); }); - }); - it(`should create a new address with all it's data`, () => { - return nightmare - .type(selectors.clientAddresses.consigneeInput, 'Bruce Bunner') - .type(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York') - .type(selectors.clientAddresses.cityInput, 'New York') - .click(selectors.clientAddresses.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Data saved!'); + it('should receive an error after clicking save button as consignee, street and town fields are empty', () => { + return nightmare + .waitToClick(selectors.clientAddresses.defaultCheckboxInput) + .clearInput(selectors.clientAddresses.streetAddressInput) + .type(selectors.clientAddresses.postcodeInput, '10022') + .waitToClick(selectors.clientAddresses.provinceInput) + .waitToClick(selectors.clientAddresses.provinceSecondOption) + .waitToClick(selectors.clientAddresses.agencyInput) + .waitToClick(selectors.clientAddresses.agenctySecondOption) + .type(selectors.clientAddresses.phoneInput, '999887744') + .type(selectors.clientAddresses.mobileInput, '999887744') + .waitToClick(selectors.clientFiscalData.saveButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Some fields are invalid'); + }); }); - }); - it(`should click on the addresses button confirm the new address exists and it's the default one`, () => { - return nightmare - .waitToClick(selectors.clientAddresses.addressesButton) - .wait(selectors.clientAddresses.defaultAddress) - .getInnerText(selectors.clientAddresses.defaultAddress) - .then(result => { - expect(result).toContain('320 Park Avenue New York'); + it(`should create a new address with all it's data`, () => { + return nightmare + .type(selectors.clientAddresses.consigneeInput, 'Bruce Bunner') + .type(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York') + .type(selectors.clientAddresses.cityInput, 'New York') + .click(selectors.clientAddresses.saveButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Data saved!'); + }); }); - }); - it(`should click on the make default icon of the second address then confirm it is the default one now`, () => { - return nightmare - .waitToClick(selectors.clientAddresses.secondMakeDefaultStar) - .waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand') - .getInnerText(selectors.clientAddresses.defaultAddress) - .then(result => { - expect(result).toContain('Somewhere in Thailand'); + it(`should click on the addresses button confirm the new address exists and it's the default one`, () => { + return nightmare + .waitToClick(selectors.clientAddresses.addressesButton) + .wait(selectors.clientAddresses.defaultAddress) + .getInnerText(selectors.clientAddresses.defaultAddress) + .then(result => { + expect(result).toContain('320 Park Avenue New York'); + }); }); - }); - it(`should click on the edit icon of the default address`, () => { - return nightmare - .waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand') - .waitToClick(selectors.clientAddresses.firstEditButton) - .waitForURL('/edit') - .url() - .then(result => { - expect(result).toContain('/edit'); + it(`should click on the make default icon of the second address then confirm it is the default one now`, () => { + return nightmare + .waitToClick(selectors.clientAddresses.secondMakeDefaultStar) + .waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand') + .getInnerText(selectors.clientAddresses.defaultAddress) + .then(result => { + expect(result).toContain('Somewhere in Thailand'); + }); }); - }); - it(`should click on the active checkbox and receive an error to save it becouse it is the default address`, () => { - return nightmare - .waitToClick(selectors.clientAddresses.activeCheckbox) - .waitToClick(selectors.clientAddresses.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Error:'); + it(`should click on the edit icon of the default address`, () => { + return nightmare + .waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand') + .waitToClick(selectors.clientAddresses.firstEditButton) + .waitForURL('/edit') + .url() + .then(result => { + expect(result).toContain('/edit'); + }); + }); + + it(`should click on the active checkbox and receive an error to save it becouse it is the default address`, () => { + return nightmare + .waitToClick(selectors.clientAddresses.activeCheckbox) + .waitToClick(selectors.clientAddresses.saveButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Error:'); + }); }); }); }); diff --git a/e2e/paths/client-module/06_add_address_notes.spec.js b/e2e/paths/client-module/06_add_address_notes.spec.js index 0c2008bd0..6a1c0a6c6 100644 --- a/e2e/paths/client-module/06_add_address_notes.spec.js +++ b/e2e/paths/client-module/06_add_address_notes.spec.js @@ -1,96 +1,98 @@ // import selectors from '../../helpers/selectors.js'; // import createNightmare from '../../helpers/helpers'; -// describe('Add address notes path', () => { -// const nightmare = createNightmare(); +// describe('Client', () => { +// describe('Add address notes path', () => { +// const nightmare = createNightmare(); -// beforeAll(() => { -// return nightmare -// .waitForLogin('developer'); -// }); - -// it('should click on the Clients button of the top bar menu', () => { -// return nightmare -// .waitToClick(selectors.globalItems.applicationsMenuButton) -// .wait(selectors.globalItems.applicationsMenuVisible) -// .waitToClick(selectors.globalItems.clientsButton) -// .wait(selectors.clientsIndex.createClientButton) -// .parsedUrl() -// .then(url => { -// expect(url.hash).toEqual('#!/clients'); +// beforeAll(() => { +// return nightmare +// .waitForLogin('developer'); // }); -// }); -// it('should search for the user Petter Parker', () => { -// return nightmare -// .wait(selectors.clientsIndex.searchResult) -// .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') -// .click(selectors.clientsIndex.searchButton) -// .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) -// .countSearchResults(selectors.clientsIndex.searchResult) -// .then(result => { -// expect(result).toEqual(1); +// it('should click on the Clients button of the top bar menu', () => { +// return nightmare +// .waitToClick(selectors.globalItems.applicationsMenuButton) +// .wait(selectors.globalItems.applicationsMenuVisible) +// .waitToClick(selectors.globalItems.clientsButton) +// .wait(selectors.clientsIndex.createClientButton) +// .parsedUrl() +// .then(url => { +// expect(url.hash).toEqual('#!/clients'); +// }); // }); -// }); -// it(`should click on the search result to access to the client addresses`, () => { -// return nightmare -// .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') -// .waitToClick(selectors.clientsIndex.searchResult) -// .waitToClick(selectors.clientAddresses.addressesButton) -// .waitForURL('addresses/list') -// .url() -// .then(url => { -// expect(url).toContain('addresses/list'); +// it('should search for the user Petter Parker', () => { +// return nightmare +// .wait(selectors.clientsIndex.searchResult) +// .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') +// .click(selectors.clientsIndex.searchButton) +// .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) +// .countSearchResults(selectors.clientsIndex.searchResult) +// .then(result => { +// expect(result).toEqual(1); +// }); // }); -// }); -// it(`should click on the edit icon of the default address`, () => { -// return nightmare -// .waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street') -// .waitToClick(selectors.clientAddresses.firstEditButton) -// .waitForURL('/edit') -// .url() -// .then(result => { -// expect(result).toContain('/edit'); +// it(`should click on the search result to access to the client addresses`, () => { +// return nightmare +// .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') +// .waitToClick(selectors.clientsIndex.searchResult) +// .waitToClick(selectors.clientAddresses.addressesButton) +// .waitForURL('addresses/list') +// .url() +// .then(url => { +// expect(url).toContain('addresses/list'); +// }); // }); -// }); -// it('should not save a description without observation type', () => { -// return nightmare -// .waitToClick(selectors.clientAddresses.addObservationButton) -// .wait(selectors.clientAddresses.firstObservationDescriptionInput) -// .type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description') -// .waitToClick(selectors.clientAddresses.saveButton) -// .waitForSnackbar() -// .then(result => { -// expect(result).toContain('Some fields are invalid'); +// it(`should click on the edit icon of the default address`, () => { +// return nightmare +// .waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street') +// .waitToClick(selectors.clientAddresses.firstEditButton) +// .waitForURL('/edit') +// .url() +// .then(result => { +// expect(result).toContain('/edit'); +// }); // }); -// }); -// it('should not save an observation type without description', () => { -// return nightmare -// .clearInput(selectors.clientAddresses.firstObservationDescriptionInput) -// .waitToClick(selectors.clientAddresses.firstObservationTypeSelect) -// .waitToClick(selectors.clientAddresses.firstObservationTypeSelectOptionOne) -// .waitToClick(selectors.clientAddresses.saveButton) -// .waitForSnackbar() -// .then(result => { -// expect(result).toContain('Some fields are invalid'); +// it('should not save a description without observation type', () => { +// return nightmare +// .waitToClick(selectors.clientAddresses.addObservationButton) +// .wait(selectors.clientAddresses.firstObservationDescriptionInput) +// .type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description') +// .waitToClick(selectors.clientAddresses.saveButton) +// .waitForSnackbar() +// .then(result => { +// expect(result).toContain('Some fields are invalid'); +// }); // }); -// }); -// it('should create two new observations', () => { -// return nightmare -// .type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description') -// .waitToClick(selectors.clientAddresses.addObservationButton) -// .waitToClick(selectors.clientAddresses.secondObservationTypeSelect) -// .waitToClick(selectors.clientAddresses.secondObservationTypeSelectOptionTwo) -// .type(selectors.clientAddresses.secondObservationDescriptionInput, 'second description') -// .waitToClick(selectors.clientAddresses.saveButton) -// .waitForSnackbar() -// .then(result => { -// expect(result).toContain('pepinillos saved!'); +// it('should not save an observation type without description', () => { +// return nightmare +// .clearInput(selectors.clientAddresses.firstObservationDescriptionInput) +// .waitToClick(selectors.clientAddresses.firstObservationTypeSelect) +// .waitToClick(selectors.clientAddresses.firstObservationTypeSelectOptionOne) +// .waitToClick(selectors.clientAddresses.saveButton) +// .waitForSnackbar() +// .then(result => { +// expect(result).toContain('Some fields are invalid'); +// }); +// }); + +// it('should create two new observations', () => { +// return nightmare +// .type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description') +// .waitToClick(selectors.clientAddresses.addObservationButton) +// .waitToClick(selectors.clientAddresses.secondObservationTypeSelect) +// .waitToClick(selectors.clientAddresses.secondObservationTypeSelectOptionTwo) +// .type(selectors.clientAddresses.secondObservationDescriptionInput, 'second description') +// .waitToClick(selectors.clientAddresses.saveButton) +// .waitForSnackbar() +// .then(result => { +// expect(result).toContain('pepinillos saved!'); +// }); // }); // }); // }); diff --git a/e2e/paths/client-module/07_edit_web_access.spec.js b/e2e/paths/client-module/07_edit_web_access.spec.js index bb0c29304..32a2dac1e 100644 --- a/e2e/paths/client-module/07_edit_web_access.spec.js +++ b/e2e/paths/client-module/07_edit_web_access.spec.js @@ -1,78 +1,80 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('Edit web access path', () => { - const nightmare = createNightmare(); +describe('Client', () => { + describe('Edit web access path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should click on the Clients button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); - }); - }); - - it('should search for the user Bruce Banner', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); - }); - }); - - it(`should click on the search result to access to the client's web access`, () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientWebAccess.webAccessButton) - .waitForURL('web-access') - .url() - .then(url => { - expect(url).toContain('web-access'); - }); - }); - - it(`should uncheck the Enable web access checkbox and update the name`, () => { - return nightmare - .waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox) - .clearInput(selectors.clientWebAccess.userNameInput) - .type(selectors.clientWebAccess.userNameInput, 'Hulk') - .waitToClick(selectors.clientWebAccess.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain(`Data saved!`); - }); - }); - - it('should confirm web access is unchecked and name updated', () => { - return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientWebAccess.webAccessButton) - .wait(selectors.clientWebAccess.enableWebAccessCheckbox) - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientWebAccess.enableWebAccessCheckbox) - .then(value => { - expect(value).toBeFalsy(); + beforeAll(() => { return nightmare - .getInputValue(selectors.clientWebAccess.userNameInput); - }) - .then(result => { - expect(result).toEqual('Hulk'); + .waitForLogin('developer'); + }); + + it('should click on the Clients button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); + }); + + it('should search for the user Bruce Banner', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); + }); + + it(`should click on the search result to access to the client's web access`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientWebAccess.webAccessButton) + .waitForURL('web-access') + .url() + .then(url => { + expect(url).toContain('web-access'); + }); + }); + + it(`should uncheck the Enable web access checkbox and update the name`, () => { + return nightmare + .waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox) + .clearInput(selectors.clientWebAccess.userNameInput) + .type(selectors.clientWebAccess.userNameInput, 'Hulk') + .waitToClick(selectors.clientWebAccess.saveButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain(`Data saved!`); + }); + }); + + it('should confirm web access is unchecked and name updated', () => { + return nightmare + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientWebAccess.webAccessButton) + .wait(selectors.clientWebAccess.enableWebAccessCheckbox) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientWebAccess.enableWebAccessCheckbox) + .then(value => { + expect(value).toBeFalsy(); + return nightmare + .getInputValue(selectors.clientWebAccess.userNameInput); + }) + .then(result => { + expect(result).toEqual('Hulk'); + }); }); }); }); diff --git a/e2e/paths/client-module/08_add_notes.spec.js b/e2e/paths/client-module/08_add_notes.spec.js index 5193ee7d4..5265accf2 100644 --- a/e2e/paths/client-module/08_add_notes.spec.js +++ b/e2e/paths/client-module/08_add_notes.spec.js @@ -1,76 +1,78 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('Add notes path', () => { - const nightmare = createNightmare(); +describe('Client', () => { + describe('Add notes path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should click on the Clients button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it('should search for the user Bruce Banner', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should click on the Clients button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); }); - }); - it(`should click on the search result to access to the client's notes`, () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientNotes.notesButton) - .waitForURL('notes/list') - .url() - .then(url => { - expect(url).toContain('notes/list'); + it('should search for the user Bruce Banner', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it(`should click on the add note button`, () => { - return nightmare - .waitToClick(selectors.clientNotes.addNoteFloatButton) - .waitForURL('/notes/create') - .url() - .then(url => { - expect(url).toContain('/notes/create'); + it(`should click on the search result to access to the client's notes`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientNotes.notesButton) + .waitForURL('notes/list') + .url() + .then(url => { + expect(url).toContain('notes/list'); + }); }); - }); - it(`should create a note`, () => { - return nightmare - .type(selectors.clientNotes.noteInput, 'Meeting with Black Widow 21st 9am') - .click(selectors.clientNotes.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); + it(`should click on the add note button`, () => { + return nightmare + .waitToClick(selectors.clientNotes.addNoteFloatButton) + .waitForURL('/notes/create') + .url() + .then(url => { + expect(url).toContain('/notes/create'); + }); }); - }); - it('should confirm the note was created', () => { - return nightmare - .wait(selectors.clientNotes.firstNoteText) - .getInnerText(selectors.clientNotes.firstNoteText) - .then(value => { - expect(value).toEqual('Meeting with Black Widow 21st 9am'); + it(`should create a note`, () => { + return nightmare + .type(selectors.clientNotes.noteInput, 'Meeting with Black Widow 21st 9am') + .click(selectors.clientNotes.saveButton) + .waitForSnackbar() + .then(result => { + expect(result).toEqual('Data saved!'); + }); + }); + + it('should confirm the note was created', () => { + return nightmare + .wait(selectors.clientNotes.firstNoteText) + .getInnerText(selectors.clientNotes.firstNoteText) + .then(value => { + expect(value).toEqual('Meeting with Black Widow 21st 9am'); + }); }); }); }); diff --git a/e2e/paths/client-module/09_add_credit.spec.js b/e2e/paths/client-module/09_add_credit.spec.js index c5ad8088d..8b5083d32 100644 --- a/e2e/paths/client-module/09_add_credit.spec.js +++ b/e2e/paths/client-module/09_add_credit.spec.js @@ -1,78 +1,80 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('Add credit path', () => { - const nightmare = createNightmare(); +describe('Client', () => { + describe('Add credit path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should click on the Clients button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it('should search for the user Petter Parker', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should click on the Clients button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); }); - }); - it(`should click on the search result to access to the client's credit`, () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientCredit.creditButton) - .waitForURL('credit/list') - .url() - .then(url => { - expect(url).toContain('credit/list'); + it('should search for the user Petter Parker', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it(`should click on the add credit button`, () => { - return nightmare - .waitToClick(selectors.clientCredit.addCreditFloatButton) - .waitForURL('/credit/create') - .url() - .then(url => { - expect(url).toContain('/credit/create'); + it(`should click on the search result to access to the client's credit`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientCredit.creditButton) + .waitForURL('credit/list') + .url() + .then(url => { + expect(url).toContain('credit/list'); + }); }); - }); - it(`should edit the credit`, () => { - return nightmare - .clearInput(selectors.clientCredit.creditInput) - .type(selectors.clientCredit.creditInput, 999) - .click(selectors.clientCredit.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); + it(`should click on the add credit button`, () => { + return nightmare + .waitToClick(selectors.clientCredit.addCreditFloatButton) + .waitForURL('/credit/create') + .url() + .then(url => { + expect(url).toContain('/credit/create'); + }); }); - }); - it('should confirm the credit was updated', () => { - return nightmare - .wait(selectors.clientCredit.firstCreditText) - .getInnerText(selectors.clientCredit.firstCreditText) - .then(value => { - expect(value).toContain(999); - expect(value).toContain('developer'); + it(`should edit the credit`, () => { + return nightmare + .clearInput(selectors.clientCredit.creditInput) + .type(selectors.clientCredit.creditInput, 999) + .click(selectors.clientCredit.saveButton) + .waitForSnackbar() + .then(result => { + expect(result).toEqual('Data saved!'); + }); + }); + + it('should confirm the credit was updated', () => { + return nightmare + .wait(selectors.clientCredit.firstCreditText) + .getInnerText(selectors.clientCredit.firstCreditText) + .then(value => { + expect(value).toContain(999); + expect(value).toContain('developer'); + }); }); }); }); diff --git a/e2e/paths/client-module/10_add_greuge.spec.js b/e2e/paths/client-module/10_add_greuge.spec.js index 9f8f93771..a9cc6c94b 100644 --- a/e2e/paths/client-module/10_add_greuge.spec.js +++ b/e2e/paths/client-module/10_add_greuge.spec.js @@ -1,90 +1,92 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('Add greuge path', () => { - const nightmare = createNightmare(); +describe('Client', () => { + describe('Add greuge path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should click on the Clients button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it('should search for the user Petter Parker', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should click on the Clients button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); }); - }); - it(`should click on the search result to access to the client's greuge`, () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientGreuge.greugeButton) - .waitForURL('greuge/list') - .url() - .then(url => { - expect(url).toContain('greuge/list'); + it('should search for the user Petter Parker', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it(`should click on the add greuge button`, () => { - return nightmare - .waitToClick(selectors.clientGreuge.addGreugeFloatButton) - .waitForURL('greuge/create') - .url() - .then(url => { - expect(url).toContain('greuge/create'); + it(`should click on the search result to access to the client's greuge`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientGreuge.greugeButton) + .waitForURL('greuge/list') + .url() + .then(url => { + expect(url).toContain('greuge/list'); + }); }); - }); - it(`should receive an error if all fields are empty but date and type on submit`, () => { - return nightmare - .waitToClick(selectors.clientGreuge.typeInput) - .waitToClick(selectors.clientGreuge.typeSecondOption) - .click(selectors.clientGreuge.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Some fields are invalid'); + it(`should click on the add greuge button`, () => { + return nightmare + .waitToClick(selectors.clientGreuge.addGreugeFloatButton) + .waitForURL('greuge/create') + .url() + .then(url => { + expect(url).toContain('greuge/create'); + }); }); - }); - it(`should create a new greuge with all its data`, () => { - return nightmare - .type(selectors.clientGreuge.amountInput, 999) - .type(selectors.clientGreuge.descriptionInput, 'new armor for Batman!') - .click(selectors.clientGreuge.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Data saved!'); + it(`should receive an error if all fields are empty but date and type on submit`, () => { + return nightmare + .waitToClick(selectors.clientGreuge.typeInput) + .waitToClick(selectors.clientGreuge.typeSecondOption) + .click(selectors.clientGreuge.saveButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Some fields are invalid'); + }); }); - }); - it('should confirm the greuge was added to the list', () => { - return nightmare - .wait(selectors.clientGreuge.firstGreugeText) - .getInnerText(selectors.clientGreuge.firstGreugeText) - .then(value => { - expect(value).toContain(999); - expect(value).toContain('new armor for Batman!'); - expect(value).toContain('Diff'); + it(`should create a new greuge with all its data`, () => { + return nightmare + .type(selectors.clientGreuge.amountInput, 999) + .type(selectors.clientGreuge.descriptionInput, 'new armor for Batman!') + .click(selectors.clientGreuge.saveButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Data saved!'); + }); + }); + + it('should confirm the greuge was added to the list', () => { + return nightmare + .wait(selectors.clientGreuge.firstGreugeText) + .getInnerText(selectors.clientGreuge.firstGreugeText) + .then(value => { + expect(value).toContain(999); + expect(value).toContain('new armor for Batman!'); + expect(value).toContain('Diff'); + }); }); }); }); diff --git a/e2e/paths/client-module/11_mandate.spec.js b/e2e/paths/client-module/11_mandate.spec.js index 9728afa02..0959d95ba 100644 --- a/e2e/paths/client-module/11_mandate.spec.js +++ b/e2e/paths/client-module/11_mandate.spec.js @@ -1,58 +1,60 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('mandate path', () => { - const nightmare = createNightmare(); +describe('Client', () => { + describe('mandate path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should click on the Clients button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it('should search for the user Petter Parker', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should click on the Clients button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); }); - }); - it(`should click on the search result to access to the client's mandate`, () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientMandate.mandateButton) - .waitForURL('mandate') - .url() - .then(url => { - expect(url).toContain('mandate'); + it('should search for the user Petter Parker', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it('should confirm the client has a mandate of the CORE type', () => { - return nightmare - .wait(selectors.clientMandate.firstMandateText) - .getInnerText(selectors.clientMandate.firstMandateText) - .then(value => { - expect(value).toContain('1'); - expect(value).toContain('WAY'); - expect(value).toContain('CORE'); + it(`should click on the search result to access to the client's mandate`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientMandate.mandateButton) + .waitForURL('mandate') + .url() + .then(url => { + expect(url).toContain('mandate'); + }); + }); + + it('should confirm the client has a mandate of the CORE type', () => { + return nightmare + .wait(selectors.clientMandate.firstMandateText) + .getInnerText(selectors.clientMandate.firstMandateText) + .then(value => { + expect(value).toContain('1'); + expect(value).toContain('WAY'); + expect(value).toContain('CORE'); + }); }); }); }); diff --git a/e2e/paths/client-module/12_lock_of_verified_data.spec.js b/e2e/paths/client-module/12_lock_of_verified_data.spec.js index 775e588b1..602cb492e 100644 --- a/e2e/paths/client-module/12_lock_of_verified_data.spec.js +++ b/e2e/paths/client-module/12_lock_of_verified_data.spec.js @@ -1,471 +1,473 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('lock verified data path', () => { - const nightmare = createNightmare(); +describe('Client', () => { + describe('lock verified data path', () => { + const nightmare = createNightmare(); - describe('as salesPerson', () => { - beforeAll(() => { - return nightmare - .waitForLogin('salesPerson'); - }); + describe('as salesPerson', () => { + beforeAll(() => { + return nightmare + .waitForLogin('salesPerson'); + }); - it('should click on the Clients button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); + it('should click on the Clients button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); + }); + + it('should search for the user Petter Parker', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); + }); + + it(`should click on the search result to access to the client's fiscal data`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .waitForURL('fiscal-data') + .parsedUrl() + .then(url => { + expect(url.hash).toContain('fiscal-data'); + }); + }); + + it(`should click on the fiscal data button to start editing`, () => { + return nightmare + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .waitForURL('fiscal-data') + .parsedUrl() + .then(url => { + expect(url.hash).toContain('fiscal-data'); + }); + }); + + it('should confirm verified data button is disabled for salesPerson', () => { + return nightmare + .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) + .evaluate(selector => { + return document.querySelector(selector).className; + }, 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-horizontal:nth-child(5) > vn-check:nth-child(4) > label') + .then(result => { + expect(result).toContain('is-disabled'); + }); + }); + + it('should edit the social name', () => { + return nightmare + .wait(selectors.clientFiscalData.socialNameInput) + .clearInput(selectors.clientFiscalData.socialNameInput) + .type(selectors.clientFiscalData.socialNameInput, 'salesPerson was here') + .click(selectors.clientFiscalData.saveButton) + .waitForSnackbar() + .then(result => { + expect(result).toEqual('Data saved!'); + }); + }); + + it('should confirm the social name have been edited', () => { + return nightmare + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.socialNameInput) + .getInputValue(selectors.clientFiscalData.socialNameInput) + .then(result => { + expect(result).toEqual('salesPerson was here'); + }); }); }); - it('should search for the user Petter Parker', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + describe('as administrative', () => { + beforeAll(() => { + return nightmare + .waitToClick(selectors.globalItems.logOutButton) + .waitForLogin('administrative'); + }); + + it('should navigate to clients index', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); + }); + + it('should search again for the user Petter Parker', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); + }); + + it(`should click on the search result to access to the Petter Parkers fiscal data`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .waitForURL('fiscal-data') + .parsedUrl() + .then(url => { + expect(url.hash).toContain('fiscal-data'); + }); + }); + + it(`should click on the fiscal data button`, () => { + return nightmare + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .waitForURL('fiscal-data') + .parsedUrl() + .then(url => { + expect(url.hash).toContain('fiscal-data'); + }); + }); + + it('should confirm verified data button is enabled for administrative', () => { + return nightmare + .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) + .evaluate(selector => { + return document.querySelector(selector).className; + }, 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-horizontal:nth-child(5) > vn-check:nth-child(3) > label') + .then(result => { + expect(result).not.toContain('is-disabled'); + }); + }); + + it('should check the Verified data checkbox', () => { + return nightmare + .waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput) + .waitToClick(selectors.clientFiscalData.saveButton) + .waitForSnackbar() + .then(result => { + expect(result).toEqual('Data saved!'); + }); + }); + + it('should confirm Verified data checkbox is checked', () => { + return nightmare + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientFiscalData.verifiedDataCheckboxInput) + .then(value => { + expect(value).toBeTruthy(); + }); + }); + + it('should again edit the social name', () => { + return nightmare + .wait(selectors.clientFiscalData.socialNameInput) + .clearInput(selectors.clientFiscalData.socialNameInput) + .type(selectors.clientFiscalData.socialNameInput, 'administrative was here') + .click(selectors.clientFiscalData.saveButton) + .waitForSnackbar() + .then(result => { + expect(result).toEqual('Data saved!'); + }); + }); + + it('should confirm the social name have been edited once and for all', () => { + return nightmare + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.socialNameInput) + .getInputValue(selectors.clientFiscalData.socialNameInput) + .then(result => { + expect(result).toEqual('administrative was here'); + }); }); }); - it(`should click on the search result to access to the client's fiscal data`, () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitForURL('fiscal-data') - .parsedUrl() - .then(url => { - expect(url.hash).toContain('fiscal-data'); + describe('as salesPerson second run', () => { + beforeAll(() => { + return nightmare + .waitToClick(selectors.globalItems.logOutButton) + .waitForLogin('salesPerson'); + }); + + it('should again click on the Clients button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); + }); + + it('should again search for the user Petter Parker', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); + }); + + it(`should click on the search result to access to the client's fiscal data`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .waitForURL('fiscal-data') + .parsedUrl() + .then(url => { + expect(url.hash).toContain('fiscal-data'); + }); + }); + + it(`should click on the fiscal data button to start editing`, () => { + return nightmare + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .waitForURL('fiscal-data') + .parsedUrl() + .then(url => { + expect(url.hash).toContain('fiscal-data'); + }); + }); + + it('should confirm verified data button is disabled once again for salesPerson', () => { + return nightmare + .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) + .evaluate(selector => { + return document.querySelector(selector).className; + }, 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-horizontal:nth-child(5) > vn-check:nth-child(3) > label') + .then(result => { + expect(result).toContain('is-disabled'); + }); + }); + + it('should confirm the form have been disabled for salesPerson', () => { + return nightmare + .wait(selectors.clientFiscalData.socialNameInput) + .evaluate(selector => { + return document.querySelector(selector).className; + }, 'vn-textfield[field="$ctrl.client.socialName"] > div') + .then(result => { + expect(result).toContain('is-disabled'); + }); }); }); - it(`should click on the fiscal data button to start editing`, () => { - return nightmare - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitForURL('fiscal-data') - .parsedUrl() - .then(url => { - expect(url.hash).toContain('fiscal-data'); + describe('as salesAssistant', () => { + beforeAll(() => { + return nightmare + .waitToClick(selectors.globalItems.logOutButton) + .waitForLogin('salesAssistant'); + }); + + it('should navigate to clients index', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); + }); + + it('should search again for the user Petter Parker', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); + }); + + it(`should click on the search result to access to the Petter Parkers fiscal data`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .waitForURL('fiscal-data') + .parsedUrl() + .then(url => { + expect(url.hash).toContain('fiscal-data'); + }); + }); + + it(`should click on the fiscal data button`, () => { + return nightmare + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .waitForURL('fiscal-data') + .parsedUrl() + .then(url => { + expect(url.hash).toContain('fiscal-data'); + }); + }); + + it('should confirm verified data button is enabled for salesAssistant', () => { + return nightmare + .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) + .evaluate(selector => { + return document.querySelector(selector).className; + }, 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-horizontal:nth-child(5) > vn-check:nth-child(3) > label') + .then(result => { + expect(result).not.toContain('is-disabled'); + }); + }); + + it('should uncheck the Verified data checkbox', () => { + return nightmare + .waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput) + .waitToClick(selectors.clientFiscalData.saveButton) + .waitForSnackbar() + .then(result => { + expect(result).toEqual('Data saved!'); + }); + }); + + it('should confirm Verified data checkbox is unchecked', () => { + return nightmare + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientFiscalData.verifiedDataCheckboxInput) + .then(value => { + expect(value).toBeFalsy(); + }); + }); + + it('should again edit the social name', () => { + return nightmare + .wait(selectors.clientFiscalData.socialNameInput) + .clearInput(selectors.clientFiscalData.socialNameInput) + .type(selectors.clientFiscalData.socialNameInput, 'salesAssistant was here') + .click(selectors.clientFiscalData.saveButton) + .waitForSnackbar() + .then(result => { + expect(result).toEqual('Data saved!'); + }); + }); + + it('should confirm the social name have been edited once and for all', () => { + return nightmare + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.socialNameInput) + .getInputValue(selectors.clientFiscalData.socialNameInput) + .then(result => { + expect(result).toEqual('salesAssistant was here'); + }); }); }); - it('should confirm verified data button is disabled for salesPerson', () => { - return nightmare - .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) - .evaluate(selector => { - return document.querySelector(selector).className; - }, 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-horizontal:nth-child(5) > vn-check:nth-child(4) > label') - .then(result => { - expect(result).toContain('is-disabled'); + describe('as salesPerson third run', () => { + beforeAll(() => { + return nightmare + .waitToClick(selectors.globalItems.logOutButton) + .waitForLogin('salesPerson'); }); - }); - it('should edit the social name', () => { - return nightmare - .wait(selectors.clientFiscalData.socialNameInput) - .clearInput(selectors.clientFiscalData.socialNameInput) - .type(selectors.clientFiscalData.socialNameInput, 'salesPerson was here') - .click(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); + it('should again click on the Clients button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); }); - }); - it('should confirm the social name have been edited', () => { - return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.socialNameInput) - .getInputValue(selectors.clientFiscalData.socialNameInput) - .then(result => { - expect(result).toEqual('salesPerson was here'); + it('should once again search for the user Petter Parker', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - }); - describe('as administrative', () => { - beforeAll(() => { - return nightmare - .waitToClick(selectors.globalItems.logOutButton) - .waitForLogin('administrative'); - }); - - it('should navigate to clients index', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); + it(`should click on the search result to access to the client's fiscal data`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .waitForURL('fiscal-data') + .parsedUrl() + .then(url => { + expect(url.hash).toContain('fiscal-data'); + }); }); - }); - it('should search again for the user Petter Parker', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it(`should click on the fiscal data button to start editing`, () => { + return nightmare + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .waitForURL('fiscal-data') + .parsedUrl() + .then(url => { + expect(url.hash).toContain('fiscal-data'); + }); }); - }); - it(`should click on the search result to access to the Petter Parkers fiscal data`, () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitForURL('fiscal-data') - .parsedUrl() - .then(url => { - expect(url.hash).toContain('fiscal-data'); + it('should confirm verified data button is enabled once again', () => { + return nightmare + .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) + .evaluate(selector => { + return document.querySelector(selector).className; + }, 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-horizontal:nth-child(5) > vn-check:nth-child(4) > label') + .then(result => { + expect(result).toContain('is-disabled'); + }); }); - }); - it(`should click on the fiscal data button`, () => { - return nightmare - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitForURL('fiscal-data') - .parsedUrl() - .then(url => { - expect(url.hash).toContain('fiscal-data'); - }); - }); - - it('should confirm verified data button is enabled for administrative', () => { - return nightmare - .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) - .evaluate(selector => { - return document.querySelector(selector).className; - }, 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-horizontal:nth-child(5) > vn-check:nth-child(3) > label') - .then(result => { - expect(result).not.toContain('is-disabled'); - }); - }); - - it('should check the Verified data checkbox', () => { - return nightmare - .waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput) - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - - it('should confirm Verified data checkbox is checked', () => { - return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.verifiedDataCheckboxInput) - .then(value => { - expect(value).toBeTruthy(); - }); - }); - - it('should again edit the social name', () => { - return nightmare - .wait(selectors.clientFiscalData.socialNameInput) - .clearInput(selectors.clientFiscalData.socialNameInput) - .type(selectors.clientFiscalData.socialNameInput, 'administrative was here') - .click(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - - it('should confirm the social name have been edited once and for all', () => { - return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.socialNameInput) - .getInputValue(selectors.clientFiscalData.socialNameInput) - .then(result => { - expect(result).toEqual('administrative was here'); - }); - }); - }); - - describe('as salesPerson second run', () => { - beforeAll(() => { - return nightmare - .waitToClick(selectors.globalItems.logOutButton) - .waitForLogin('salesPerson'); - }); - - it('should again click on the Clients button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); - }); - }); - - it('should again search for the user Petter Parker', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); - }); - }); - - it(`should click on the search result to access to the client's fiscal data`, () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitForURL('fiscal-data') - .parsedUrl() - .then(url => { - expect(url.hash).toContain('fiscal-data'); - }); - }); - - it(`should click on the fiscal data button to start editing`, () => { - return nightmare - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitForURL('fiscal-data') - .parsedUrl() - .then(url => { - expect(url.hash).toContain('fiscal-data'); - }); - }); - - it('should confirm verified data button is disabled once again for salesPerson', () => { - return nightmare - .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) - .evaluate(selector => { - return document.querySelector(selector).className; - }, 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-horizontal:nth-child(5) > vn-check:nth-child(3) > label') - .then(result => { - expect(result).toContain('is-disabled'); - }); - }); - - it('should confirm the form have been disabled for salesPerson', () => { - return nightmare - .wait(selectors.clientFiscalData.socialNameInput) - .evaluate(selector => { - return document.querySelector(selector).className; - }, 'vn-textfield[field="$ctrl.client.socialName"] > div') - .then(result => { - expect(result).toContain('is-disabled'); - }); - }); - }); - - describe('as salesAssistant', () => { - beforeAll(() => { - return nightmare - .waitToClick(selectors.globalItems.logOutButton) - .waitForLogin('salesAssistant'); - }); - - it('should navigate to clients index', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); - }); - }); - - it('should search again for the user Petter Parker', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); - }); - }); - - it(`should click on the search result to access to the Petter Parkers fiscal data`, () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitForURL('fiscal-data') - .parsedUrl() - .then(url => { - expect(url.hash).toContain('fiscal-data'); - }); - }); - - it(`should click on the fiscal data button`, () => { - return nightmare - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitForURL('fiscal-data') - .parsedUrl() - .then(url => { - expect(url.hash).toContain('fiscal-data'); - }); - }); - - it('should confirm verified data button is enabled for salesAssistant', () => { - return nightmare - .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) - .evaluate(selector => { - return document.querySelector(selector).className; - }, 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-horizontal:nth-child(5) > vn-check:nth-child(3) > label') - .then(result => { - expect(result).not.toContain('is-disabled'); - }); - }); - - it('should uncheck the Verified data checkbox', () => { - return nightmare - .waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput) - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - - it('should confirm Verified data checkbox is unchecked', () => { - return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.verifiedDataCheckboxInput) - .then(value => { - expect(value).toBeFalsy(); - }); - }); - - it('should again edit the social name', () => { - return nightmare - .wait(selectors.clientFiscalData.socialNameInput) - .clearInput(selectors.clientFiscalData.socialNameInput) - .type(selectors.clientFiscalData.socialNameInput, 'salesAssistant was here') - .click(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - - it('should confirm the social name have been edited once and for all', () => { - return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.socialNameInput) - .getInputValue(selectors.clientFiscalData.socialNameInput) - .then(result => { - expect(result).toEqual('salesAssistant was here'); - }); - }); - }); - - describe('as salesPerson third run', () => { - beforeAll(() => { - return nightmare - .waitToClick(selectors.globalItems.logOutButton) - .waitForLogin('salesPerson'); - }); - - it('should again click on the Clients button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); - }); - }); - - it('should once again search for the user Petter Parker', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); - }); - }); - - it(`should click on the search result to access to the client's fiscal data`, () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitForURL('fiscal-data') - .parsedUrl() - .then(url => { - expect(url.hash).toContain('fiscal-data'); - }); - }); - - it(`should click on the fiscal data button to start editing`, () => { - return nightmare - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitForURL('fiscal-data') - .parsedUrl() - .then(url => { - expect(url.hash).toContain('fiscal-data'); - }); - }); - - it('should confirm verified data button is enabled once again', () => { - return nightmare - .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) - .evaluate(selector => { - return document.querySelector(selector).className; - }, 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-horizontal:nth-child(5) > vn-check:nth-child(4) > label') - .then(result => { - expect(result).toContain('is-disabled'); - }); - }); - - it('should confirm the form is enabled for salesPerson', () => { - return nightmare - .wait(selectors.clientFiscalData.socialNameInput) - .evaluate(selector => { - return document.querySelector(selector).className; - }, 'vn-textfield[field="$ctrl.client.socialName"] > div') - .then(result => { - expect(result).not.toContain('is-disabled'); + it('should confirm the form is enabled for salesPerson', () => { + return nightmare + .wait(selectors.clientFiscalData.socialNameInput) + .evaluate(selector => { + return document.querySelector(selector).className; + }, 'vn-textfield[field="$ctrl.client.socialName"] > div') + .then(result => { + expect(result).not.toContain('is-disabled'); + }); }); }); }); diff --git a/e2e/paths/client-module/13_invoices.spec.js b/e2e/paths/client-module/13_invoices.spec.js index 1bc5bec99..ab386140b 100644 --- a/e2e/paths/client-module/13_invoices.spec.js +++ b/e2e/paths/client-module/13_invoices.spec.js @@ -1,57 +1,59 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('invoice path', () => { - const nightmare = createNightmare(); +describe('Client', () => { + describe('invoice path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should click on the Clients button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.clientsButton) - .wait(selectors.clientsIndex.createClientButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/clients'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it('should search for the user Petter Parker', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should click on the Clients button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); }); - }); - it(`should click on the search result to access to the client invoices`, () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientInvoices.invoicesButton) - .waitForURL('invoices') - .parsedUrl() - .then(url => { - expect(url.hash).toContain('invoices'); + it('should search for the user Petter Parker', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it('should confirm the client has an invoice', () => { - return nightmare - .wait(selectors.clientInvoices.firstInvoiceText) - .getInnerText(selectors.clientInvoices.firstInvoiceText) - .then(value => { - expect(value).toContain('V1800001'); - expect(value).toContain('350.50'); + it(`should click on the search result to access to the client invoices`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientInvoices.invoicesButton) + .waitForURL('invoices') + .parsedUrl() + .then(url => { + expect(url.hash).toContain('invoices'); + }); + }); + + it('should confirm the client has an invoice', () => { + return nightmare + .wait(selectors.clientInvoices.firstInvoiceText) + .getInnerText(selectors.clientInvoices.firstInvoiceText) + .then(value => { + expect(value).toContain('V1800001'); + expect(value).toContain('350.50'); + }); }); }); }); diff --git a/e2e/paths/item-module/01_item_summary.spec.js b/e2e/paths/item-module/01_item_summary.spec.js index db25c163b..caee7f0fb 100644 --- a/e2e/paths/item-module/01_item_summary.spec.js +++ b/e2e/paths/item-module/01_item_summary.spec.js @@ -1,153 +1,155 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('Item summary path', () => { - const nightmare = createNightmare(); +describe('Item', () => { + describe('Summary path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should access to the items index by clicking the items button', () => { - return nightmare - .click(selectors.moduleAccessView.itemsSectionButton) - .wait(selectors.itemsIndex.createItemButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/item/list'); - }); - }); - - it('should search for the item Gem of Time', () => { - return nightmare - .wait(selectors.itemsIndex.searchResult) - .type(selectors.itemsIndex.searchItemInput, 'Gem of Time') - .click(selectors.itemsIndex.searchButton) - .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) - .countSearchResults(selectors.itemsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); - }); - }); - - it(`should click on the search result summary button to open the item summary popup`, () => { - return nightmare - .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') - .isVisible(selectors.itemSummary.basicData) - .then(result => { - expect(result).toBeFalsy(); + beforeAll(() => { return nightmare - .waitToClick(selectors.itemsIndex.searchResultPreviewButton) - .isVisible(selectors.itemSummary.basicData); - }) - .then(result => { - expect(result).toBeTruthy(); + .waitForLogin('developer'); }); - }); - it(`should check the item summary preview shows fields from basic data`, () => { - return nightmare - .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time') - .getInnerText(selectors.itemSummary.basicData) - .then(result => { - expect(result).toContain('Name: Gem of Time'); + it('should access to the items index by clicking the items button', () => { + return nightmare + .click(selectors.moduleAccessView.itemsSectionButton) + .wait(selectors.itemsIndex.createItemButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/item/list'); + }); }); - }); - it(`should check the item summary preview shows fields from tags`, () => { - return nightmare - .waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow') - .getInnerText(selectors.itemSummary.tags) - .then(result => { - expect(result).toContain('Color: Yellow'); + it('should search for the item Gem of Time', () => { + return nightmare + .wait(selectors.itemsIndex.searchResult) + .type(selectors.itemsIndex.searchItemInput, 'Gem of Time') + .click(selectors.itemsIndex.searchButton) + .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) + .countSearchResults(selectors.itemsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it(`should check the item summary preview shows fields from niche`, () => { - return nightmare - .waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1') - .getInnerText(selectors.itemSummary.niche) - .then(result => { - expect(result).toContain('Warehouse One: A1'); + it(`should click on the search result summary button to open the item summary popup`, () => { + return nightmare + .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') + .isVisible(selectors.itemSummary.basicData) + .then(result => { + expect(result).toBeFalsy(); + return nightmare + .waitToClick(selectors.itemsIndex.searchResultPreviewButton) + .isVisible(selectors.itemSummary.basicData); + }) + .then(result => { + expect(result).toBeTruthy(); + }); }); - }); - it(`should check the item summary preview shows fields from botanical`, () => { - return nightmare - .waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix') - .getInnerText(selectors.itemSummary.botanical) - .then(result => { - expect(result).toContain('Botanical: Hedera helix'); + it(`should check the item summary preview shows fields from basic data`, () => { + return nightmare + .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time') + .getInnerText(selectors.itemSummary.basicData) + .then(result => { + expect(result).toContain('Name: Gem of Time'); + }); }); - }); - it(`should check the item summary preview shows fields from barcode`, () => { - return nightmare - .waitForTextInElement(selectors.itemSummary.barcode, '1') - .getInnerText(selectors.itemSummary.barcode) - .then(result => { - expect(result).toContain('1'); + it(`should check the item summary preview shows fields from tags`, () => { + return nightmare + .waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow') + .getInnerText(selectors.itemSummary.tags) + .then(result => { + expect(result).toContain('Color: Yellow'); + }); }); - }); - it(`should close the summary popup`, () => { - return nightmare - .waitToClick(selectors.itemsIndex.closeItemSummaryPreview) - .isVisible(selectors.itemSummary.basicData) - .then(result => { - expect(result).toBeFalsy(); + it(`should check the item summary preview shows fields from niche`, () => { + return nightmare + .waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1') + .getInnerText(selectors.itemSummary.niche) + .then(result => { + expect(result).toContain('Warehouse One: A1'); + }); }); - }); - it(`should navigate to the one of the items detailed section`, () => { - return nightmare - .waitToClick(selectors.itemsIndex.searchResult) - .waitForURL('summary') - .parsedUrl() - .then(url => { - expect(url.hash).toContain('summary'); + it(`should check the item summary preview shows fields from botanical`, () => { + return nightmare + .waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix') + .getInnerText(selectors.itemSummary.botanical) + .then(result => { + expect(result).toContain('Botanical: Hedera helix'); + }); }); - }); - it(`should check the item summary shows fields from basic data section`, () => { - return nightmare - .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time') - .getInnerText(selectors.itemSummary.basicData) - .then(result => { - expect(result).toContain('Name: Gem of Time'); + it(`should check the item summary preview shows fields from barcode`, () => { + return nightmare + .waitForTextInElement(selectors.itemSummary.barcode, '1') + .getInnerText(selectors.itemSummary.barcode) + .then(result => { + expect(result).toContain('1'); + }); }); - }); - it(`should check the item summary shows fields from tags section`, () => { - return nightmare - .getInnerText(selectors.itemSummary.tags) - .then(result => { - expect(result).toContain('Color: Yellow'); + it(`should close the summary popup`, () => { + return nightmare + .waitToClick(selectors.itemsIndex.closeItemSummaryPreview) + .isVisible(selectors.itemSummary.basicData) + .then(result => { + expect(result).toBeFalsy(); + }); }); - }); - it(`should check the item summary shows fields from niches section`, () => { - return nightmare - .getInnerText(selectors.itemSummary.niche) - .then(result => { - expect(result).toContain('Warehouse One: A1'); + it(`should navigate to the one of the items detailed section`, () => { + return nightmare + .waitToClick(selectors.itemsIndex.searchResult) + .waitForURL('summary') + .parsedUrl() + .then(url => { + expect(url.hash).toContain('summary'); + }); }); - }); - it(`should check the item summary shows fields from botanical section`, () => { - return nightmare - .getInnerText(selectors.itemSummary.botanical) - .then(result => { - expect(result).toContain('Botanical: Hedera helix'); + it(`should check the item summary shows fields from basic data section`, () => { + return nightmare + .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time') + .getInnerText(selectors.itemSummary.basicData) + .then(result => { + expect(result).toContain('Name: Gem of Time'); + }); }); - }); - it(`should check the item summary shows fields from barcodes section`, () => { - return nightmare - .getInnerText(selectors.itemSummary.barcode) - .then(result => { - expect(result).toContain('1'); + it(`should check the item summary shows fields from tags section`, () => { + return nightmare + .getInnerText(selectors.itemSummary.tags) + .then(result => { + expect(result).toContain('Color: Yellow'); + }); + }); + + it(`should check the item summary shows fields from niches section`, () => { + return nightmare + .getInnerText(selectors.itemSummary.niche) + .then(result => { + expect(result).toContain('Warehouse One: A1'); + }); + }); + + it(`should check the item summary shows fields from botanical section`, () => { + return nightmare + .getInnerText(selectors.itemSummary.botanical) + .then(result => { + expect(result).toContain('Botanical: Hedera helix'); + }); + }); + + it(`should check the item summary shows fields from barcodes section`, () => { + return nightmare + .getInnerText(selectors.itemSummary.barcode) + .then(result => { + expect(result).toContain('1'); + }); }); }); }); diff --git a/e2e/paths/item-module/02_edit_item_basic_data.spec.js b/e2e/paths/item-module/02_edit_item_basic_data.spec.js index 6deee3bff..d6a5fac5c 100644 --- a/e2e/paths/item-module/02_edit_item_basic_data.spec.js +++ b/e2e/paths/item-module/02_edit_item_basic_data.spec.js @@ -1,118 +1,120 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('edit item basic data path', () => { - const nightmare = createNightmare(); +describe('Item', () => { + describe('Edit basic data path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should access to the items index by clicking the items button', () => { - return nightmare - .click(selectors.moduleAccessView.itemsSectionButton) - .wait(selectors.itemsIndex.createItemButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/item/list'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it('should search for the item Gem of Mind', () => { - return nightmare - .wait(selectors.itemsIndex.searchResult) - .type(selectors.itemsIndex.searchItemInput, 'Gem of Mind') - .click(selectors.itemsIndex.searchButton) - .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) - .countSearchResults(selectors.itemsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should access to the items index by clicking the items button', () => { + return nightmare + .click(selectors.moduleAccessView.itemsSectionButton) + .wait(selectors.itemsIndex.createItemButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/item/list'); + }); }); - }); - it(`should click on the search result to access to the item basic data`, () => { - return nightmare - .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind') - .waitToClick(selectors.itemsIndex.searchResult) - .waitToClick(selectors.itemBasicData.basicDataButton) - .waitForURL('data') - .url() - .then(url => { - expect(url).toContain('data'); + it('should search for the item Gem of Mind', () => { + return nightmare + .wait(selectors.itemsIndex.searchResult) + .type(selectors.itemsIndex.searchItemInput, 'Gem of Mind') + .click(selectors.itemsIndex.searchButton) + .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) + .countSearchResults(selectors.itemsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it(`should edit the item basic data`, () => { - return nightmare - .clearInput(selectors.itemBasicData.nameInput) - .type(selectors.itemBasicData.nameInput, 'Rose of Purity') - .waitToClick(selectors.itemBasicData.typeSelect) - .waitToClick(selectors.itemBasicData.typeSelectOptionTwo) - .waitToClick(selectors.itemBasicData.intrastatSelect) - .waitToClick(selectors.itemBasicData.intrastatSelectOptionOne) - .clearInput(selectors.itemBasicData.relevancyInput) - .type(selectors.itemBasicData.relevancyInput, '1') - .waitToClick(selectors.itemBasicData.originSelect) - .waitToClick(selectors.itemBasicData.originSelectOptionTwo) - .waitToClick(selectors.itemBasicData.expenceSelect) - .waitToClick(selectors.itemBasicData.expenceSelectOptionTwo) - .click(selectors.itemBasicData.submitBasicDataButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Data saved!'); + it(`should click on the search result to access to the item basic data`, () => { + return nightmare + .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind') + .waitToClick(selectors.itemsIndex.searchResult) + .waitToClick(selectors.itemBasicData.basicDataButton) + .waitForURL('data') + .url() + .then(url => { + expect(url).toContain('data'); + }); }); - }); - it(`should confirm the item name was edited`, () => { - return nightmare - .click(selectors.itemNiches.nicheButton) - .wait(selectors.itemNiches.firstWarehouseDisabled) - .waitToClick(selectors.itemBasicData.basicDataButton) - .waitForTextInInput(selectors.itemBasicData.nameInput, 'Rose of Purity') - .getInputValue(selectors.itemBasicData.nameInput) - .then(result => { - expect(result).toEqual('Rose of Purity'); + it(`should edit the item basic data`, () => { + return nightmare + .clearInput(selectors.itemBasicData.nameInput) + .type(selectors.itemBasicData.nameInput, 'Rose of Purity') + .waitToClick(selectors.itemBasicData.typeSelect) + .waitToClick(selectors.itemBasicData.typeSelectOptionTwo) + .waitToClick(selectors.itemBasicData.intrastatSelect) + .waitToClick(selectors.itemBasicData.intrastatSelectOptionOne) + .clearInput(selectors.itemBasicData.relevancyInput) + .type(selectors.itemBasicData.relevancyInput, '1') + .waitToClick(selectors.itemBasicData.originSelect) + .waitToClick(selectors.itemBasicData.originSelectOptionTwo) + .waitToClick(selectors.itemBasicData.expenceSelect) + .waitToClick(selectors.itemBasicData.expenceSelectOptionTwo) + .click(selectors.itemBasicData.submitBasicDataButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Data saved!'); + }); }); - }); - it(`should confirm the item type was edited`, () => { - return nightmare - .getInputValue(selectors.itemBasicData.typeSelect) - .then(result => { - expect(result).toEqual('Crisantemo'); + it(`should confirm the item name was edited`, () => { + return nightmare + .click(selectors.itemNiches.nicheButton) + .wait(selectors.itemNiches.firstWarehouseDisabled) + .waitToClick(selectors.itemBasicData.basicDataButton) + .waitForTextInInput(selectors.itemBasicData.nameInput, 'Rose of Purity') + .getInputValue(selectors.itemBasicData.nameInput) + .then(result => { + expect(result).toEqual('Rose of Purity'); + }); }); - }); - it(`should confirm the item intrastad was edited`, () => { - return nightmare - .getInputValue(selectors.itemBasicData.intrastatSelect) - .then(result => { - expect(result).toEqual('Coral y materiales similares'); + it(`should confirm the item type was edited`, () => { + return nightmare + .getInputValue(selectors.itemBasicData.typeSelect) + .then(result => { + expect(result).toEqual('Crisantemo'); + }); }); - }); - it(`should confirm the item relevancy was edited`, () => { - return nightmare - .getInputValue(selectors.itemBasicData.relevancyInput) - .then(result => { - expect(result).toEqual('1'); + it(`should confirm the item intrastad was edited`, () => { + return nightmare + .getInputValue(selectors.itemBasicData.intrastatSelect) + .then(result => { + expect(result).toEqual('Coral y materiales similares'); + }); }); - }); - it(`should confirm the item origin was edited`, () => { - return nightmare - .getInputValue(selectors.itemBasicData.originSelect) - .then(result => { - expect(result).toEqual('Spain'); + it(`should confirm the item relevancy was edited`, () => { + return nightmare + .getInputValue(selectors.itemBasicData.relevancyInput) + .then(result => { + expect(result).toEqual('1'); + }); }); - }); - it(`should confirm the item expence was edited`, () => { - return nightmare - .getInputValue(selectors.itemBasicData.expenceSelect) - .then(result => { - expect(result).toEqual('Adquisición mercancia Extracomunitaria'); + it(`should confirm the item origin was edited`, () => { + return nightmare + .getInputValue(selectors.itemBasicData.originSelect) + .then(result => { + expect(result).toEqual('Spain'); + }); + }); + + it(`should confirm the item expence was edited`, () => { + return nightmare + .getInputValue(selectors.itemBasicData.expenceSelect) + .then(result => { + expect(result).toEqual('Adquisición mercancia Extracomunitaria'); + }); }); }); }); diff --git a/e2e/paths/item-module/03_edit_item_tax.spec.js b/e2e/paths/item-module/03_edit_item_tax.spec.js index 4347d1752..0e8713706 100644 --- a/e2e/paths/item-module/03_edit_item_tax.spec.js +++ b/e2e/paths/item-module/03_edit_item_tax.spec.js @@ -1,82 +1,84 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('add item tax path', () => { - const nightmare = createNightmare(); +describe('Item', () => { + describe('Edit tax path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should access to the items index by clicking the items button', () => { - return nightmare - .click(selectors.moduleAccessView.itemsSectionButton) - .wait(selectors.itemsIndex.createItemButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/item/list'); - }); - }); - - it('should search for the item Gem of Time', () => { - return nightmare - .wait(selectors.itemsIndex.searchResult) - .type(selectors.itemsIndex.searchItemInput, 'Gem of Time') - .click(selectors.itemsIndex.searchButton) - .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) - .countSearchResults(selectors.itemsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); - }); - }); - - it(`should click on the search result to access to the item tax`, () => { - return nightmare - .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') - .waitToClick(selectors.itemsIndex.searchResult) - .waitToClick(selectors.itemTax.taxButton) - .waitForURL('tax') - .url() - .then(url => { - expect(url).toContain('tax'); - }); - }); - - it(`should add the item tax to all countries`, () => { - return nightmare - .waitToClick(selectors.itemTax.firstClassSelect) - .waitToClick(selectors.itemTax.firstClassSelectOptionTwo) - .waitToClick(selectors.itemTax.secondClassSelect) - .waitToClick(selectors.itemTax.secondClassSelectOptionOne) - .waitToClick(selectors.itemTax.thirdClassSelect) - .waitToClick(selectors.itemTax.thirdClassSelectOptionTwo) - .click(selectors.itemTax.submitTaxButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Data saved!'); - }); - }); - - it(`should confirm the item tax class was edited`, () => { - return nightmare - .click(selectors.itemTags.tagsButton) - .wait(selectors.itemTags.firstTagDisabled) - .waitToClick(selectors.itemTax.taxButton) - .waitForTextInInput(selectors.itemTax.firstClassSelect, 'general') - .getInputValue(selectors.itemTax.firstClassSelect) - .then(result => { - expect(result).toEqual('General VAT'); + beforeAll(() => { return nightmare - .getInputValue(selectors.itemTax.secondClassSelect); - }) - .then(result => { - expect(result).toEqual('Reduced VAT'); + .waitForLogin('developer'); + }); + + it('should access to the items index by clicking the items button', () => { return nightmare - .getInputValue(selectors.itemTax.thirdClassSelect); - }) - .then(result => { - expect(result).toEqual('General VAT'); + .click(selectors.moduleAccessView.itemsSectionButton) + .wait(selectors.itemsIndex.createItemButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/item/list'); + }); + }); + + it('should search for the item Gem of Time', () => { + return nightmare + .wait(selectors.itemsIndex.searchResult) + .type(selectors.itemsIndex.searchItemInput, 'Gem of Time') + .click(selectors.itemsIndex.searchButton) + .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) + .countSearchResults(selectors.itemsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); + }); + + it(`should click on the search result to access to the item tax`, () => { + return nightmare + .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') + .waitToClick(selectors.itemsIndex.searchResult) + .waitToClick(selectors.itemTax.taxButton) + .waitForURL('tax') + .url() + .then(url => { + expect(url).toContain('tax'); + }); + }); + + it(`should add the item tax to all countries`, () => { + return nightmare + .waitToClick(selectors.itemTax.firstClassSelect) + .waitToClick(selectors.itemTax.firstClassSelectOptionTwo) + .waitToClick(selectors.itemTax.secondClassSelect) + .waitToClick(selectors.itemTax.secondClassSelectOptionOne) + .waitToClick(selectors.itemTax.thirdClassSelect) + .waitToClick(selectors.itemTax.thirdClassSelectOptionTwo) + .click(selectors.itemTax.submitTaxButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Data saved!'); + }); + }); + + it(`should confirm the item tax class was edited`, () => { + return nightmare + .click(selectors.itemTags.tagsButton) + .wait(selectors.itemTags.firstTagDisabled) + .waitToClick(selectors.itemTax.taxButton) + .waitForTextInInput(selectors.itemTax.firstClassSelect, 'general') + .getInputValue(selectors.itemTax.firstClassSelect) + .then(result => { + expect(result).toEqual('General VAT'); + return nightmare + .getInputValue(selectors.itemTax.secondClassSelect); + }) + .then(result => { + expect(result).toEqual('Reduced VAT'); + return nightmare + .getInputValue(selectors.itemTax.thirdClassSelect); + }) + .then(result => { + expect(result).toEqual('General VAT'); + }); }); }); }); diff --git a/e2e/paths/item-module/04_create_item_tags.spec.js b/e2e/paths/item-module/04_create_item_tags.spec.js index ca2dfe2f7..2354df3fe 100644 --- a/e2e/paths/item-module/04_create_item_tags.spec.js +++ b/e2e/paths/item-module/04_create_item_tags.spec.js @@ -1,199 +1,201 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('create item tags path', () => { - const nightmare = createNightmare(); +describe('Item', () => { + describe('Create tags path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should access to the items index by clicking the items button', () => { - return nightmare - .click(selectors.moduleAccessView.itemsSectionButton) - .wait(selectors.itemsIndex.createItemButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/item/list'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it('should search for the item Gem of Time', () => { - return nightmare - .wait(selectors.itemsIndex.searchResult) - .type(selectors.itemsIndex.searchItemInput, 'Gem of Time') - .click(selectors.itemsIndex.searchButton) - .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) - .countSearchResults(selectors.itemsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should access to the items index by clicking the items button', () => { + return nightmare + .click(selectors.moduleAccessView.itemsSectionButton) + .wait(selectors.itemsIndex.createItemButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/item/list'); + }); }); - }); - it(`should click on the search result to access to the item tags`, () => { - return nightmare - .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') - .waitToClick(selectors.itemsIndex.searchResult) - .waitToClick(selectors.itemTags.tagsButton) - .waitForURL('tags') - .url() - .then(url => { - expect(url).toContain('tags'); + it('should search for the item Gem of Time', () => { + return nightmare + .wait(selectors.itemsIndex.searchResult) + .type(selectors.itemsIndex.searchItemInput, 'Gem of Time') + .click(selectors.itemsIndex.searchButton) + .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) + .countSearchResults(selectors.itemsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it(`should create a new tag and delete a former one`, () => { - return nightmare - .waitToClick(selectors.itemTags.firstRemoveTagButton) - .waitToClick(selectors.itemTags.addItemTagButton) - .waitToClick(selectors.itemTags.fifthTagSelect) - .waitToClick(selectors.itemTags.fifthTagSelectOptionFive) - .type(selectors.itemTags.fifthValueInput, 'Thanos') - .clearInput(selectors.itemTags.fifthRelevancyInput) - .type(selectors.itemTags.fifthRelevancyInput, '1') - .click(selectors.itemTags.submitItemTagsButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Data saved!'); + it(`should click on the search result to access to the item tags`, () => { + return nightmare + .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') + .waitToClick(selectors.itemsIndex.searchResult) + .waitToClick(selectors.itemTags.tagsButton) + .waitForURL('tags') + .url() + .then(url => { + expect(url).toContain('tags'); + }); }); - }); - it(`should confirm the first select is the expected one`, () => { - return nightmare - .click(selectors.itemBasicData.basicDataButton) - .wait(selectors.itemBasicData.nameInput) - .click(selectors.itemTags.tagsButton) - .waitForTextInInput(selectors.itemTags.firstTagDisabled, 'Owner') - .getInputValue(selectors.itemTags.firstTagDisabled) - .then(result => { - expect(result).toEqual('Owner'); + it(`should create a new tag and delete a former one`, () => { + return nightmare + .waitToClick(selectors.itemTags.firstRemoveTagButton) + .waitToClick(selectors.itemTags.addItemTagButton) + .waitToClick(selectors.itemTags.fifthTagSelect) + .waitToClick(selectors.itemTags.fifthTagSelectOptionFive) + .type(selectors.itemTags.fifthValueInput, 'Thanos') + .clearInput(selectors.itemTags.fifthRelevancyInput) + .type(selectors.itemTags.fifthRelevancyInput, '1') + .click(selectors.itemTags.submitItemTagsButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Data saved!'); + }); }); - }); - it(`should confirm the first value is the expected one`, () => { - return nightmare - .waitForTextInInput(selectors.itemTags.firstValueInput, 'Thanos') - .getInputValue(selectors.itemTags.firstValueInput) - .then(result => { - expect(result).toEqual('Thanos'); + it(`should confirm the first select is the expected one`, () => { + return nightmare + .click(selectors.itemBasicData.basicDataButton) + .wait(selectors.itemBasicData.nameInput) + .click(selectors.itemTags.tagsButton) + .waitForTextInInput(selectors.itemTags.firstTagDisabled, 'Owner') + .getInputValue(selectors.itemTags.firstTagDisabled) + .then(result => { + expect(result).toEqual('Owner'); + }); }); - }); - it(`should confirm the first relevancy is the expected one`, () => { - return nightmare - .waitForTextInInput(selectors.itemTags.firstRelevancyInput, '1') - .getInputValue(selectors.itemTags.firstRelevancyInput) - .then(result => { - expect(result).toEqual('1'); + it(`should confirm the first value is the expected one`, () => { + return nightmare + .waitForTextInInput(selectors.itemTags.firstValueInput, 'Thanos') + .getInputValue(selectors.itemTags.firstValueInput) + .then(result => { + expect(result).toEqual('Thanos'); + }); }); - }); - it(`should confirm the second select is the expected one`, () => { - return nightmare - .waitForTextInInput(selectors.itemTags.secondTagDisabled, 'Location') - .getInputValue(selectors.itemTags.secondTagDisabled) - .then(result => { - expect(result).toEqual('Location'); + it(`should confirm the first relevancy is the expected one`, () => { + return nightmare + .waitForTextInInput(selectors.itemTags.firstRelevancyInput, '1') + .getInputValue(selectors.itemTags.firstRelevancyInput) + .then(result => { + expect(result).toEqual('1'); + }); }); - }); - it(`should confirm the second value is the expected one`, () => { - return nightmare - .waitForTextInInput(selectors.itemTags.secondValueInput, 'Gamoras hideout') - .getInputValue(selectors.itemTags.secondValueInput) - .then(result => { - expect(result).toEqual('Gamoras hideout'); + it(`should confirm the second select is the expected one`, () => { + return nightmare + .waitForTextInInput(selectors.itemTags.secondTagDisabled, 'Location') + .getInputValue(selectors.itemTags.secondTagDisabled) + .then(result => { + expect(result).toEqual('Location'); + }); }); - }); - it(`should confirm the second relevancy is the expected one`, () => { - return nightmare - .waitForTextInInput(selectors.itemTags.secondRelevancyInput, '2') - .getInputValue(selectors.itemTags.secondRelevancyInput) - .then(result => { - expect(result).toEqual('2'); + it(`should confirm the second value is the expected one`, () => { + return nightmare + .waitForTextInInput(selectors.itemTags.secondValueInput, 'Gamoras hideout') + .getInputValue(selectors.itemTags.secondValueInput) + .then(result => { + expect(result).toEqual('Gamoras hideout'); + }); }); - }); - it(`should confirm the third select is the expected one`, () => { - return nightmare - .waitForTextInInput(selectors.itemTags.thirdTagDisabled, 'Shape') - .getInputValue(selectors.itemTags.thirdTagDisabled) - .then(result => { - expect(result).toEqual('Shape'); + it(`should confirm the second relevancy is the expected one`, () => { + return nightmare + .waitForTextInInput(selectors.itemTags.secondRelevancyInput, '2') + .getInputValue(selectors.itemTags.secondRelevancyInput) + .then(result => { + expect(result).toEqual('2'); + }); }); - }); - it(`should confirm the third value is the expected one`, () => { - return nightmare - .waitForTextInInput(selectors.itemTags.thirdValueInput, 'round') - .getInputValue(selectors.itemTags.thirdValueInput) - .then(result => { - expect(result).toEqual('round'); + it(`should confirm the third select is the expected one`, () => { + return nightmare + .waitForTextInInput(selectors.itemTags.thirdTagDisabled, 'Shape') + .getInputValue(selectors.itemTags.thirdTagDisabled) + .then(result => { + expect(result).toEqual('Shape'); + }); }); - }); - it(`should confirm the third relevancy is the expected one`, () => { - return nightmare - .waitForTextInInput(selectors.itemTags.thirdRelevancyInput, '3') - .getInputValue(selectors.itemTags.thirdRelevancyInput) - .then(result => { - expect(result).toEqual('3'); + it(`should confirm the third value is the expected one`, () => { + return nightmare + .waitForTextInInput(selectors.itemTags.thirdValueInput, 'round') + .getInputValue(selectors.itemTags.thirdValueInput) + .then(result => { + expect(result).toEqual('round'); + }); }); - }); - it(`should confirm the fourth select is the expected one`, () => { - return nightmare - .waitForTextInInput(selectors.itemTags.fourthTagDisabled, 'Power') - .getInputValue(selectors.itemTags.fourthTagDisabled) - .then(result => { - expect(result).toEqual('Power'); + it(`should confirm the third relevancy is the expected one`, () => { + return nightmare + .waitForTextInInput(selectors.itemTags.thirdRelevancyInput, '3') + .getInputValue(selectors.itemTags.thirdRelevancyInput) + .then(result => { + expect(result).toEqual('3'); + }); }); - }); - it(`should confirm the fourth value is the expected one`, () => { - return nightmare - .waitForTextInInput(selectors.itemTags.fourthValueInput, 'Manipulates time') - .getInputValue(selectors.itemTags.fourthValueInput) - .then(result => { - expect(result).toEqual('Manipulates time'); + it(`should confirm the fourth select is the expected one`, () => { + return nightmare + .waitForTextInInput(selectors.itemTags.fourthTagDisabled, 'Power') + .getInputValue(selectors.itemTags.fourthTagDisabled) + .then(result => { + expect(result).toEqual('Power'); + }); }); - }); - it(`should confirm the fourth relevancy is the expected one`, () => { - return nightmare - .waitForTextInInput(selectors.itemTags.fourthRelevancyInput, '4') - .getInputValue(selectors.itemTags.fourthRelevancyInput) - .then(result => { - expect(result).toEqual('4'); + it(`should confirm the fourth value is the expected one`, () => { + return nightmare + .waitForTextInInput(selectors.itemTags.fourthValueInput, 'Manipulates time') + .getInputValue(selectors.itemTags.fourthValueInput) + .then(result => { + expect(result).toEqual('Manipulates time'); + }); }); - }); - it(`should confirm the fifth select is the expected one`, () => { - return nightmare - .waitForTextInInput(selectors.itemTags.fifthTagDisabled, 'Color') - .getInputValue(selectors.itemTags.fifthTagDisabled) - .then(result => { - expect(result).toEqual('Color'); + it(`should confirm the fourth relevancy is the expected one`, () => { + return nightmare + .waitForTextInInput(selectors.itemTags.fourthRelevancyInput, '4') + .getInputValue(selectors.itemTags.fourthRelevancyInput) + .then(result => { + expect(result).toEqual('4'); + }); }); - }); - it(`should confirm the fifth value is the expected one`, () => { - return nightmare - .waitForTextInInput(selectors.itemTags.fifthValueInput, 'Yellow') - .getInputValue(selectors.itemTags.fifthValueInput) - .then(result => { - expect(result).toEqual('Yellow'); + it(`should confirm the fifth select is the expected one`, () => { + return nightmare + .waitForTextInInput(selectors.itemTags.fifthTagDisabled, 'Color') + .getInputValue(selectors.itemTags.fifthTagDisabled) + .then(result => { + expect(result).toEqual('Color'); + }); }); - }); - it(`should confirm the fifth relevancy is the expected one`, () => { - return nightmare - .waitForTextInInput(selectors.itemTags.fifthRelevancyInput, '5') - .getInputValue(selectors.itemTags.fifthRelevancyInput) - .then(result => { - expect(result).toEqual('5'); + it(`should confirm the fifth value is the expected one`, () => { + return nightmare + .waitForTextInInput(selectors.itemTags.fifthValueInput, 'Yellow') + .getInputValue(selectors.itemTags.fifthValueInput) + .then(result => { + expect(result).toEqual('Yellow'); + }); + }); + + it(`should confirm the fifth relevancy is the expected one`, () => { + return nightmare + .waitForTextInInput(selectors.itemTags.fifthRelevancyInput, '5') + .getInputValue(selectors.itemTags.fifthRelevancyInput) + .then(result => { + expect(result).toEqual('5'); + }); }); }); }); diff --git a/e2e/paths/item-module/05_create_item_niche.spec.js b/e2e/paths/item-module/05_create_item_niche.spec.js index cdadc7e0f..5468ceeb1 100644 --- a/e2e/paths/item-module/05_create_item_niche.spec.js +++ b/e2e/paths/item-module/05_create_item_niche.spec.js @@ -1,102 +1,104 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('create item niche path', () => { - const nightmare = createNightmare(); +describe('Item', () => { + describe('Create niche path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should access to the items index by clicking the items button', () => { - return nightmare - .click(selectors.moduleAccessView.itemsSectionButton) - .wait(selectors.itemsIndex.createItemButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/item/list'); - }); - }); - - it('should search for the item Gem of Time', () => { - return nightmare - .wait(selectors.itemsIndex.searchResult) - .type(selectors.itemsIndex.searchItemInput, 'Gem of Time') - .click(selectors.itemsIndex.searchButton) - .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) - .countSearchResults(selectors.itemsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); - }); - }); - - it(`should click on the search result to access to the item niches`, () => { - return nightmare - .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') - .waitToClick(selectors.itemsIndex.searchResult) - .waitToClick(selectors.itemNiches.nicheButton) - .waitForURL('niche') - .url() - .then(url => { - expect(url).toContain('niche'); - }); - }); - - it(`should click create a new niche and delete a former one`, () => { - return nightmare - .waitToClick(selectors.itemNiches.addNicheButton) - .waitToClick(selectors.itemNiches.secondNicheRemoveButton) - .waitToClick(selectors.itemNiches.thirdWarehouseSelect) - .waitToClick(selectors.itemNiches.thirdWarehouseSelectFourthOption) - .type(selectors.itemNiches.thirdCodeInput, 'A4') - .click(selectors.itemNiches.submitNichesButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Data saved!'); - }); - }); - - it(`should confirm the first niche is the expected one`, () => { - return nightmare - .click(selectors.itemBasicData.basicDataButton) - .wait(selectors.itemBasicData.nameInput) - .click(selectors.itemNiches.nicheButton) - .waitForTextInInput(selectors.itemNiches.firstWarehouseDisabled, 'Warehouse One') - .getInputValue(selectors.itemNiches.firstWarehouseDisabled) - .then(result => { - expect(result).toEqual('Warehouse One'); + beforeAll(() => { return nightmare - .getInputValue(selectors.itemNiches.firstCodeInput); - }) - .then(result => { - expect(result).toEqual('A1'); + .waitForLogin('developer'); }); - }); - it(`should confirm the second niche is the expected one`, () => { - return nightmare - .getInputValue(selectors.itemNiches.secondWarehouseDisabled) - .then(result => { - expect(result).toEqual('Warehouse Three'); + it('should access to the items index by clicking the items button', () => { return nightmare - .getInputValue(selectors.itemNiches.secondCodeInput); - }) - .then(result => { - expect(result).toEqual('A3'); + .click(selectors.moduleAccessView.itemsSectionButton) + .wait(selectors.itemsIndex.createItemButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/item/list'); + }); }); - }); - it(`should confirm the third niche is the expected one`, () => { - return nightmare - .getInputValue(selectors.itemNiches.thirdWarehouseDisabled) - .then(result => { - expect(result).toEqual('Warehouse Four'); + it('should search for the item Gem of Time', () => { return nightmare - .getInputValue(selectors.itemNiches.thirdCodeInput); - }) - .then(result => { - expect(result).toEqual('A4'); + .wait(selectors.itemsIndex.searchResult) + .type(selectors.itemsIndex.searchItemInput, 'Gem of Time') + .click(selectors.itemsIndex.searchButton) + .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) + .countSearchResults(selectors.itemsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); + }); + + it(`should click on the search result to access to the item niches`, () => { + return nightmare + .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') + .waitToClick(selectors.itemsIndex.searchResult) + .waitToClick(selectors.itemNiches.nicheButton) + .waitForURL('niche') + .url() + .then(url => { + expect(url).toContain('niche'); + }); + }); + + it(`should click create a new niche and delete a former one`, () => { + return nightmare + .waitToClick(selectors.itemNiches.addNicheButton) + .waitToClick(selectors.itemNiches.secondNicheRemoveButton) + .waitToClick(selectors.itemNiches.thirdWarehouseSelect) + .waitToClick(selectors.itemNiches.thirdWarehouseSelectFourthOption) + .type(selectors.itemNiches.thirdCodeInput, 'A4') + .click(selectors.itemNiches.submitNichesButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Data saved!'); + }); + }); + + it(`should confirm the first niche is the expected one`, () => { + return nightmare + .click(selectors.itemBasicData.basicDataButton) + .wait(selectors.itemBasicData.nameInput) + .click(selectors.itemNiches.nicheButton) + .waitForTextInInput(selectors.itemNiches.firstWarehouseDisabled, 'Warehouse One') + .getInputValue(selectors.itemNiches.firstWarehouseDisabled) + .then(result => { + expect(result).toEqual('Warehouse One'); + return nightmare + .getInputValue(selectors.itemNiches.firstCodeInput); + }) + .then(result => { + expect(result).toEqual('A1'); + }); + }); + + it(`should confirm the second niche is the expected one`, () => { + return nightmare + .getInputValue(selectors.itemNiches.secondWarehouseDisabled) + .then(result => { + expect(result).toEqual('Warehouse Three'); + return nightmare + .getInputValue(selectors.itemNiches.secondCodeInput); + }) + .then(result => { + expect(result).toEqual('A3'); + }); + }); + + it(`should confirm the third niche is the expected one`, () => { + return nightmare + .getInputValue(selectors.itemNiches.thirdWarehouseDisabled) + .then(result => { + expect(result).toEqual('Warehouse Four'); + return nightmare + .getInputValue(selectors.itemNiches.thirdCodeInput); + }) + .then(result => { + expect(result).toEqual('A4'); + }); }); }); }); diff --git a/e2e/paths/item-module/06_create_item_botanical.spec.js b/e2e/paths/item-module/06_create_item_botanical.spec.js index 18462c2a6..00eea71e2 100644 --- a/e2e/paths/item-module/06_create_item_botanical.spec.js +++ b/e2e/paths/item-module/06_create_item_botanical.spec.js @@ -1,132 +1,134 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('create item botanical path', () => { - const nightmare = createNightmare(); +describe('Item', () => { + describe('Create botanical path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should access to the items index by clicking the items button', () => { - return nightmare - .click(selectors.moduleAccessView.itemsSectionButton) - .wait(selectors.itemsIndex.createItemButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/item/list'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it('should search for the item Gem of Time', () => { - return nightmare - .wait(selectors.itemsIndex.searchResult) - .type(selectors.itemsIndex.searchItemInput, 'Mjolnir') - .click(selectors.itemsIndex.searchButton) - .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) - .countSearchResults(selectors.itemsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should access to the items index by clicking the items button', () => { + return nightmare + .click(selectors.moduleAccessView.itemsSectionButton) + .wait(selectors.itemsIndex.createItemButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/item/list'); + }); }); - }); - it(`should click on the search result to access to the item botanical`, () => { - return nightmare - .waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir') - .waitToClick(selectors.itemsIndex.searchResult) - .waitToClick(selectors.itemBotanical.botanicalButton) - .waitForURL('botanical') - .url() - .then(url => { - expect(url).toContain('botanical'); + it('should search for the item Gem of Time', () => { + return nightmare + .wait(selectors.itemsIndex.searchResult) + .type(selectors.itemsIndex.searchItemInput, 'Mjolnir') + .click(selectors.itemsIndex.searchButton) + .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) + .countSearchResults(selectors.itemsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it(`should create a new botanical for the item with id Mjolnir`, () => { - return nightmare - .type(selectors.itemBotanical.botanicalInput, 'Cicuta maculata') - .waitToClick(selectors.itemBotanical.genusSelect) - .waitToClick(selectors.itemBotanical.genusSelectOptionOne) - .waitToClick(selectors.itemBotanical.speciesSelect) - .waitToClick(selectors.itemBotanical.speciesSelectOptionOne) - .waitToClick(selectors.itemBotanical.submitBotanicalButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Data saved!'); + it(`should click on the search result to access to the item botanical`, () => { + return nightmare + .waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir') + .waitToClick(selectors.itemsIndex.searchResult) + .waitToClick(selectors.itemBotanical.botanicalButton) + .waitForURL('botanical') + .url() + .then(url => { + expect(url).toContain('botanical'); + }); }); - }); - it(`should confirm the botanical for item Mjolnir was created`, () => { - return nightmare - .click(selectors.itemBasicData.basicDataButton) - .wait(selectors.itemBasicData.nameInput) - .click(selectors.itemBotanical.botanicalButton) - .waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata') - .getInputValue(selectors.itemBotanical.botanicalInput) - .then(result => { - expect(result).toEqual('Cicuta maculata'); + it(`should create a new botanical for the item with id Mjolnir`, () => { + return nightmare + .type(selectors.itemBotanical.botanicalInput, 'Cicuta maculata') + .waitToClick(selectors.itemBotanical.genusSelect) + .waitToClick(selectors.itemBotanical.genusSelectOptionOne) + .waitToClick(selectors.itemBotanical.speciesSelect) + .waitToClick(selectors.itemBotanical.speciesSelectOptionOne) + .waitToClick(selectors.itemBotanical.submitBotanicalButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Data saved!'); + }); }); - }); - it(`should confirm the Genus for item Mjolnir was created`, () => { - return nightmare - .waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abelia') - .getInputValue(selectors.itemBotanical.genusSelect) - .then(result => { - expect(result).toEqual('Abelia'); + it(`should confirm the botanical for item Mjolnir was created`, () => { + return nightmare + .click(selectors.itemBasicData.basicDataButton) + .wait(selectors.itemBasicData.nameInput) + .click(selectors.itemBotanical.botanicalButton) + .waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata') + .getInputValue(selectors.itemBotanical.botanicalInput) + .then(result => { + expect(result).toEqual('Cicuta maculata'); + }); }); - }); - it(`should confirm the Species for item Mjolnir was created`, () => { - return nightmare - .getInputValue(selectors.itemBotanical.speciesSelect) - .then(result => { - expect(result).toEqual('dealbata'); + it(`should confirm the Genus for item Mjolnir was created`, () => { + return nightmare + .waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abelia') + .getInputValue(selectors.itemBotanical.genusSelect) + .then(result => { + expect(result).toEqual('Abelia'); + }); }); - }); - it(`should edit botanical for the item Mjolnir`, () => { - return nightmare - .clearInput(selectors.itemBotanical.botanicalInput) - .type(selectors.itemBotanical.botanicalInput, 'Herp Derp') - .waitToClick(selectors.itemBotanical.genusSelect) - .waitToClick(selectors.itemBotanical.genusSelectOptionTwo) - .waitToClick(selectors.itemBotanical.speciesSelect) - .waitToClick(selectors.itemBotanical.speciesSelectOptionTwo) - .waitToClick(selectors.itemBotanical.submitBotanicalButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Data saved!'); + it(`should confirm the Species for item Mjolnir was created`, () => { + return nightmare + .getInputValue(selectors.itemBotanical.speciesSelect) + .then(result => { + expect(result).toEqual('dealbata'); + }); }); - }); - it(`should confirm the botanical for item Mjolnir was edited`, () => { - return nightmare - .click(selectors.itemBasicData.basicDataButton) - .wait(selectors.itemBasicData.nameInput) - .click(selectors.itemBotanical.botanicalButton) - .waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp') - .getInputValue(selectors.itemBotanical.botanicalInput) - .then(result => { - expect(result).toEqual('Herp Derp'); + it(`should edit botanical for the item Mjolnir`, () => { + return nightmare + .clearInput(selectors.itemBotanical.botanicalInput) + .type(selectors.itemBotanical.botanicalInput, 'Herp Derp') + .waitToClick(selectors.itemBotanical.genusSelect) + .waitToClick(selectors.itemBotanical.genusSelectOptionTwo) + .waitToClick(selectors.itemBotanical.speciesSelect) + .waitToClick(selectors.itemBotanical.speciesSelectOptionTwo) + .waitToClick(selectors.itemBotanical.submitBotanicalButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Data saved!'); + }); }); - }); - it(`should confirm the Genus for item Mjolnir was edited`, () => { - return nightmare - .waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abies') - .getInputValue(selectors.itemBotanical.genusSelect) - .then(result => { - expect(result).toEqual('Abies'); + it(`should confirm the botanical for item Mjolnir was edited`, () => { + return nightmare + .click(selectors.itemBasicData.basicDataButton) + .wait(selectors.itemBasicData.nameInput) + .click(selectors.itemBotanical.botanicalButton) + .waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp') + .getInputValue(selectors.itemBotanical.botanicalInput) + .then(result => { + expect(result).toEqual('Herp Derp'); + }); }); - }); - it(`should confirm the Species for item Mjolnir was edited`, () => { - return nightmare - .getInputValue(selectors.itemBotanical.speciesSelect) - .then(result => { - expect(result).toEqual('decurrens'); + it(`should confirm the Genus for item Mjolnir was edited`, () => { + return nightmare + .waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abies') + .getInputValue(selectors.itemBotanical.genusSelect) + .then(result => { + expect(result).toEqual('Abies'); + }); + }); + + it(`should confirm the Species for item Mjolnir was edited`, () => { + return nightmare + .getInputValue(selectors.itemBotanical.speciesSelect) + .then(result => { + expect(result).toEqual('decurrens'); + }); }); }); }); diff --git a/e2e/paths/item-module/07_create_item_barcode.spec.js b/e2e/paths/item-module/07_create_item_barcode.spec.js index f2900988a..b1f1d9364 100644 --- a/e2e/paths/item-module/07_create_item_barcode.spec.js +++ b/e2e/paths/item-module/07_create_item_barcode.spec.js @@ -1,70 +1,72 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('create item barcodes path', () => { - const nightmare = createNightmare(); +describe('Item', () => { + describe('Create barcodes path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should access to the items index by clicking the items button', () => { - return nightmare - .click(selectors.moduleAccessView.itemsSectionButton) - .wait(selectors.itemsIndex.createItemButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/item/list'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it('should search for the item Gem of Time', () => { - return nightmare - .wait(selectors.itemsIndex.searchResult) - .type(selectors.itemsIndex.searchItemInput, 'Gem of Time') - .click(selectors.itemsIndex.searchButton) - .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) - .countSearchResults(selectors.itemsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should access to the items index by clicking the items button', () => { + return nightmare + .click(selectors.moduleAccessView.itemsSectionButton) + .wait(selectors.itemsIndex.createItemButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/item/list'); + }); }); - }); - it(`should click on the search result to access to the item barcodes`, () => { - return nightmare - .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') - .waitToClick(selectors.itemsIndex.searchResult) - .waitToClick(selectors.itemBarcodes.barcodeButton) - .waitForURL('barcode') - .url() - .then(url => { - expect(url).toContain('barcode'); + it('should search for the item Gem of Time', () => { + return nightmare + .wait(selectors.itemsIndex.searchResult) + .type(selectors.itemsIndex.searchItemInput, 'Gem of Time') + .click(selectors.itemsIndex.searchButton) + .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) + .countSearchResults(selectors.itemsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it(`should click create a new code and delete a former one`, () => { - return nightmare - .waitToClick(selectors.itemBarcodes.firstCodeRemoveButton) - .waitToClick(selectors.itemBarcodes.addBarcodeButton) - .wait(selectors.itemBarcodes.thirdCodeInput) - .type(selectors.itemBarcodes.thirdCodeInput, '5') - .waitToClick(selectors.itemBarcodes.submitBarcodesButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Data saved!'); + it(`should click on the search result to access to the item barcodes`, () => { + return nightmare + .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') + .waitToClick(selectors.itemsIndex.searchResult) + .waitToClick(selectors.itemBarcodes.barcodeButton) + .waitForURL('barcode') + .url() + .then(url => { + expect(url).toContain('barcode'); + }); }); - }); - it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, () => { - return nightmare - .click(selectors.itemBasicData.basicDataButton) - .wait(selectors.itemBasicData.nameInput) - .click(selectors.itemBarcodes.barcodeButton) - .waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5') - .getInputValue(selectors.itemBarcodes.thirdCodeInput) - .then(result => { - expect(result).toEqual('5'); + it(`should click create a new code and delete a former one`, () => { + return nightmare + .waitToClick(selectors.itemBarcodes.firstCodeRemoveButton) + .waitToClick(selectors.itemBarcodes.addBarcodeButton) + .wait(selectors.itemBarcodes.thirdCodeInput) + .type(selectors.itemBarcodes.thirdCodeInput, '5') + .waitToClick(selectors.itemBarcodes.submitBarcodesButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Data saved!'); + }); + }); + + it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, () => { + return nightmare + .click(selectors.itemBasicData.basicDataButton) + .wait(selectors.itemBasicData.nameInput) + .click(selectors.itemBarcodes.barcodeButton) + .waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5') + .getInputValue(selectors.itemBarcodes.thirdCodeInput) + .then(result => { + expect(result).toEqual('5'); + }); }); }); }); diff --git a/e2e/paths/item-module/08_item_create_and_clone.spec.js b/e2e/paths/item-module/08_item_create_and_clone.spec.js index 788d07ecf..af05afcb7 100644 --- a/e2e/paths/item-module/08_item_create_and_clone.spec.js +++ b/e2e/paths/item-module/08_item_create_and_clone.spec.js @@ -2,14 +2,14 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; describe('Item', () => { - const nightmare = createNightmare(); + describe('Create path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); + }); - describe('create path', () => { it('should access to the items index by clicking the items button', () => { return nightmare .click(selectors.moduleAccessView.itemsSectionButton) @@ -83,7 +83,7 @@ describe('Item', () => { }); }); - describe('clone path', () => { + describe('Clone path', () => { it('should return to the items index by clicking the return to items button', () => { return nightmare .click(selectors.itemBasicData.goToItemIndexButton) diff --git a/e2e/paths/ticket-module/01_create_ticket_observations.spec.js b/e2e/paths/ticket-module/01_create_ticket_observations.spec.js index 237f3e9a5..3f6599bca 100644 --- a/e2e/paths/ticket-module/01_create_ticket_observations.spec.js +++ b/e2e/paths/ticket-module/01_create_ticket_observations.spec.js @@ -1,77 +1,79 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('create ticket notes path', () => { - const nightmare = createNightmare(); +describe('Ticket', () => { + describe('Create notes path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should access to the tickets index by clicking the tickets button', () => { - return nightmare - .click(selectors.moduleAccessView.ticketsSectionButton) - .wait(selectors.ticketsIndex.createTicketButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/ticket/list'); - }); - }); - - it('should search for the ticket with id 1', () => { - return nightmare - .wait(selectors.ticketsIndex.searchTicketInput) - .type(selectors.ticketsIndex.searchTicketInput, '1') - .click(selectors.ticketsIndex.searchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countSearchResults(selectors.ticketsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); - }); - }); - - it(`should click on the search result to access to the ticket notes`, () => { - return nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, '1') - .waitToClick(selectors.ticketsIndex.searchResult) - .waitToClick(selectors.ticketNotes.notesButton) - .waitForURL('observation') - .url() - .then(url => { - expect(url).toContain('observation'); - }); - }); - - it(`should click create a new note and delete a former one`, () => { - return nightmare - .waitToClick(selectors.ticketNotes.firstNoteRemoveButton) - .waitToClick(selectors.ticketNotes.addNoteButton) - .waitToClick(selectors.ticketNotes.firstNoteSelect) - .waitForTextInElement(selectors.ticketNotes.firstNoteSelectSecondOption, 'observation two') - .waitToClick(selectors.ticketNotes.firstNoteSelectSecondOption) - .type(selectors.ticketNotes.firstDescriptionInput, 'description') - .click(selectors.ticketNotes.submitNotesButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Data saved!'); - }); - }); - - it(`should confirm the note is the expected one`, () => { - return nightmare - .click(selectors.ticketPackages.packagesButton) - .wait(selectors.ticketPackages.firstPackageSelect) - .click(selectors.ticketNotes.notesButton) - .waitForTextInInput(selectors.ticketNotes.firstNoteDisabled, 'observation two') - .getInputValue(selectors.ticketNotes.firstNoteDisabled) - .then(result => { - expect(result).toEqual('observation two'); + beforeAll(() => { return nightmare - .getInputValue(selectors.ticketNotes.firstDescriptionInput); - }) - .then(result => { - expect(result).toEqual('description'); + .waitForLogin('developer'); + }); + + it('should access to the tickets index by clicking the tickets button', () => { + return nightmare + .click(selectors.moduleAccessView.ticketsSectionButton) + .wait(selectors.ticketsIndex.createTicketButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/ticket/list'); + }); + }); + + it('should search for the ticket with id 1', () => { + return nightmare + .wait(selectors.ticketsIndex.searchTicketInput) + .type(selectors.ticketsIndex.searchTicketInput, '1') + .click(selectors.ticketsIndex.searchButton) + .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) + .countSearchResults(selectors.ticketsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); + }); + + it(`should click on the search result to access to the ticket notes`, () => { + return nightmare + .waitForTextInElement(selectors.ticketsIndex.searchResult, '1') + .waitToClick(selectors.ticketsIndex.searchResult) + .waitToClick(selectors.ticketNotes.notesButton) + .waitForURL('observation') + .url() + .then(url => { + expect(url).toContain('observation'); + }); + }); + + it(`should click create a new note and delete a former one`, () => { + return nightmare + .waitToClick(selectors.ticketNotes.firstNoteRemoveButton) + .waitToClick(selectors.ticketNotes.addNoteButton) + .waitToClick(selectors.ticketNotes.firstNoteSelect) + .waitForTextInElement(selectors.ticketNotes.firstNoteSelectSecondOption, 'observation two') + .waitToClick(selectors.ticketNotes.firstNoteSelectSecondOption) + .type(selectors.ticketNotes.firstDescriptionInput, 'description') + .click(selectors.ticketNotes.submitNotesButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Data saved!'); + }); + }); + + it(`should confirm the note is the expected one`, () => { + return nightmare + .click(selectors.ticketPackages.packagesButton) + .wait(selectors.ticketPackages.firstPackageSelect) + .click(selectors.ticketNotes.notesButton) + .waitForTextInInput(selectors.ticketNotes.firstNoteDisabled, 'observation two') + .getInputValue(selectors.ticketNotes.firstNoteDisabled) + .then(result => { + expect(result).toEqual('observation two'); + return nightmare + .getInputValue(selectors.ticketNotes.firstDescriptionInput); + }) + .then(result => { + expect(result).toEqual('description'); + }); }); }); }); diff --git a/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js b/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js index 21e8be652..f5cf14114 100644 --- a/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js +++ b/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js @@ -1,59 +1,61 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('delete ticket expeditions path', () => { - const nightmare = createNightmare(); +describe('Ticket', () => { + describe('Delete expeditions path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should access to the tickets index by clicking the tickets button', () => { - return nightmare - .click(selectors.moduleAccessView.ticketsSectionButton) - .wait(selectors.ticketsIndex.createTicketButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/ticket/list'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it('should search for the ticket with id 1', () => { - return nightmare - .wait(selectors.ticketsIndex.searchTicketInput) - .type(selectors.ticketsIndex.searchTicketInput, '1') - .click(selectors.ticketsIndex.searchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countSearchResults(selectors.ticketsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should access to the tickets index by clicking the tickets button', () => { + return nightmare + .click(selectors.moduleAccessView.ticketsSectionButton) + .wait(selectors.ticketsIndex.createTicketButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/ticket/list'); + }); }); - }); - it(`should click on the search result to access to the ticket expeditions`, () => { - return nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, '1') - .waitToClick(selectors.ticketsIndex.searchResult) - .waitToClick(selectors.ticketExpedition.expeditionButton) - .waitForURL('expedition') - .url() - .then(url => { - expect(url).toContain('expedition'); + it('should search for the ticket with id 1', () => { + return nightmare + .wait(selectors.ticketsIndex.searchTicketInput) + .type(selectors.ticketsIndex.searchTicketInput, '1') + .click(selectors.ticketsIndex.searchButton) + .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) + .countSearchResults(selectors.ticketsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it(`should delete a former expedition and confirm the remaining expedition is the expected one`, () => { - return nightmare - .waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton) - .click(selectors.ticketPackages.packagesButton) - .wait(selectors.ticketPackages.firstPackageSelect) - .click(selectors.ticketExpedition.expeditionButton) - .wait(selectors.ticketExpedition.secondExpeditionText) - .getInnerText(selectors.ticketExpedition.secondExpeditionText) - .then(value => { - expect(value).toContain('Iron Patriot'); - expect(value).toContain('root'); + it(`should click on the search result to access to the ticket expeditions`, () => { + return nightmare + .waitForTextInElement(selectors.ticketsIndex.searchResult, '1') + .waitToClick(selectors.ticketsIndex.searchResult) + .waitToClick(selectors.ticketExpedition.expeditionButton) + .waitForURL('expedition') + .url() + .then(url => { + expect(url).toContain('expedition'); + }); + }); + + it(`should delete a former expedition and confirm the remaining expedition is the expected one`, () => { + return nightmare + .waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton) + .click(selectors.ticketPackages.packagesButton) + .wait(selectors.ticketPackages.firstPackageSelect) + .click(selectors.ticketExpedition.expeditionButton) + .wait(selectors.ticketExpedition.secondExpeditionText) + .getInnerText(selectors.ticketExpedition.secondExpeditionText) + .then(value => { + expect(value).toContain('Iron Patriot'); + expect(value).toContain('root'); + }); }); }); }); diff --git a/e2e/paths/ticket-module/03_list_sale.spec.js b/e2e/paths/ticket-module/03_list_sale.spec.js index a7dca061d..aa151a783 100644 --- a/e2e/paths/ticket-module/03_list_sale.spec.js +++ b/e2e/paths/ticket-module/03_list_sale.spec.js @@ -1,73 +1,75 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('list sale path', () => { - const nightmare = createNightmare(); +describe('Ticket', () => { + describe('List sale path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should click on the Tickets button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.ticketsButton) - .wait(selectors.ticketsIndex.createTicketButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/ticket/list'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it('should search for the ticket 1', () => { - return nightmare - .wait(selectors.ticketsIndex.searchResult) - .type(selectors.ticketsIndex.searchTicketInput, 1) - .click(selectors.ticketsIndex.searchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countSearchResults(selectors.ticketsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should click on the Tickets button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.ticketsButton) + .wait(selectors.ticketsIndex.createTicketButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/ticket/list'); + }); }); - }); - it(`should click on the search result to access to the ticket's sale`, () => { - return nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, 'Batman') - .waitToClick(selectors.ticketsIndex.searchResult) - .waitToClick(selectors.ticketSales.saleButton) - .waitForURL('sale') - .url() - .then(url => { - expect(url).toContain('sale'); + it('should search for the ticket 1', () => { + return nightmare + .wait(selectors.ticketsIndex.searchResult) + .type(selectors.ticketsIndex.searchTicketInput, 1) + .click(selectors.ticketsIndex.searchButton) + .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) + .countSearchResults(selectors.ticketsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it('should confirm the fist ticket sale is the expected one', () => { - return nightmare - .wait(selectors.ticketSales.firstSaleText) - .getInnerText(selectors.ticketSales.firstSaleText) - .then(value => { - expect(value).toContain('Color Yellow'); - expect(value).toContain('2'); - expect(value).toContain('€1.50'); - expect(value).toContain('0 %'); - expect(value).toContain('€3.00'); + it(`should click on the search result to access to the ticket's sale`, () => { + return nightmare + .waitForTextInElement(selectors.ticketsIndex.searchResult, 'Batman') + .waitToClick(selectors.ticketsIndex.searchResult) + .waitToClick(selectors.ticketSales.saleButton) + .waitForURL('sale') + .url() + .then(url => { + expect(url).toContain('sale'); + }); }); - }); - it('should confirm the second ticket sale is the expected one', () => { - return nightmare - .wait(selectors.ticketSales.secondSaleText) - .getInnerText(selectors.ticketSales.secondSaleText) - .then(value => { - expect(value).toContain('Color Yellow'); - expect(value).toContain('5'); - expect(value).toContain('€1.50'); - expect(value).toContain('0 %'); - expect(value).toContain('€7.50'); + it('should confirm the fist ticket sale is the expected one', () => { + return nightmare + .wait(selectors.ticketSales.firstSaleText) + .getInnerText(selectors.ticketSales.firstSaleText) + .then(value => { + expect(value).toContain('Color Yellow'); + expect(value).toContain('2'); + expect(value).toContain('€1.50'); + expect(value).toContain('0 %'); + expect(value).toContain('€3.00'); + }); + }); + + it('should confirm the second ticket sale is the expected one', () => { + return nightmare + .wait(selectors.ticketSales.secondSaleText) + .getInnerText(selectors.ticketSales.secondSaleText) + .then(value => { + expect(value).toContain('Color Yellow'); + expect(value).toContain('5'); + expect(value).toContain('€1.50'); + expect(value).toContain('0 %'); + expect(value).toContain('€7.50'); + }); }); }); }); diff --git a/e2e/paths/ticket-module/04_create_ticket_packages.spec.js b/e2e/paths/ticket-module/04_create_ticket_packages.spec.js index a7aabd411..47b2fcea5 100644 --- a/e2e/paths/ticket-module/04_create_ticket_packages.spec.js +++ b/e2e/paths/ticket-module/04_create_ticket_packages.spec.js @@ -1,126 +1,128 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('create ticket packages path', () => { - const nightmare = createNightmare(); +describe('Ticket', () => { + describe('Create packages path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); - - it('should click on the Tickets button of the top bar menu', () => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.ticketsButton) - .wait(selectors.ticketsIndex.createTicketButton) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/ticket/list'); + beforeAll(() => { + return nightmare + .waitForLogin('developer'); }); - }); - it('should search for the ticket 1', () => { - return nightmare - .wait(selectors.ticketsIndex.searchResult) - .type(selectors.ticketsIndex.searchTicketInput, 1) - .click(selectors.ticketsIndex.searchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countSearchResults(selectors.ticketsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); + it('should click on the Tickets button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.ticketsButton) + .wait(selectors.ticketsIndex.createTicketButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/ticket/list'); + }); }); - }); - it(`should click on the search result to access to the ticket packages`, () => { - return nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, 'Batman') - .waitToClick(selectors.ticketsIndex.searchResult) - .waitToClick(selectors.ticketPackages.packagesButton) - .waitForURL('package/index') - .url() - .then(url => { - expect(url).toContain('package/index'); + it('should search for the ticket 1', () => { + return nightmare + .wait(selectors.ticketsIndex.searchResult) + .type(selectors.ticketsIndex.searchTicketInput, 1) + .click(selectors.ticketsIndex.searchButton) + .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) + .countSearchResults(selectors.ticketsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); }); - }); - it(`should delete the first package and receive and error to save a new one with blank quantity`, () => { - return nightmare - .waitToClick(selectors.ticketPackages.firstRemovePackageButton) - .waitToClick(selectors.ticketPackages.addPackageButton) - .waitToClick(selectors.ticketPackages.firstPackageSelect) - .waitToClick(selectors.ticketPackages.firstPackageSelectOptionThree) - .click(selectors.ticketPackages.savePackagesButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Some fields are invalid'); + it(`should click on the search result to access to the ticket packages`, () => { + return nightmare + .waitForTextInElement(selectors.ticketsIndex.searchResult, 'Batman') + .waitToClick(selectors.ticketsIndex.searchResult) + .waitToClick(selectors.ticketPackages.packagesButton) + .waitForURL('package/index') + .url() + .then(url => { + expect(url).toContain('package/index'); + }); }); - }); - it(`should attempt create a new package but receive an error if quantity is a string`, () => { - return nightmare - .type(selectors.ticketPackages.firstQuantityInput, 'ninety 9') - .click(selectors.ticketPackages.savePackagesButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Some fields are invalid'); + it(`should delete the first package and receive and error to save a new one with blank quantity`, () => { + return nightmare + .waitToClick(selectors.ticketPackages.firstRemovePackageButton) + .waitToClick(selectors.ticketPackages.addPackageButton) + .waitToClick(selectors.ticketPackages.firstPackageSelect) + .waitToClick(selectors.ticketPackages.firstPackageSelectOptionThree) + .click(selectors.ticketPackages.savePackagesButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Some fields are invalid'); + }); }); - }); - it(`should attempt create a new package but receive an error if quantity is 0`, () => { - return nightmare - .clearInput(selectors.ticketPackages.firstQuantityInput) - .type(selectors.ticketPackages.firstQuantityInput, '0') - .click(selectors.ticketPackages.savePackagesButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Some fields are invalid'); + it(`should attempt create a new package but receive an error if quantity is a string`, () => { + return nightmare + .type(selectors.ticketPackages.firstQuantityInput, 'ninety 9') + .click(selectors.ticketPackages.savePackagesButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Some fields are invalid'); + }); }); - }); - it(`should attempt create a new package but receive an error if package is blank`, () => { - return nightmare - .clearInput(selectors.ticketPackages.firstQuantityInput) - .type(selectors.ticketPackages.firstQuantityInput, '99') - .click(selectors.ticketPackages.clearPackageSelectButton) - .click(selectors.ticketPackages.savePackagesButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Package cannot be blank'); + it(`should attempt create a new package but receive an error if quantity is 0`, () => { + return nightmare + .clearInput(selectors.ticketPackages.firstQuantityInput) + .type(selectors.ticketPackages.firstQuantityInput, '0') + .click(selectors.ticketPackages.savePackagesButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Some fields are invalid'); + }); }); - }); - it(`should create a new package with correct data`, () => { - return nightmare - .waitToClick(selectors.ticketPackages.firstPackageSelect) - .waitToClick(selectors.ticketPackages.firstPackageSelectOptionThree) - .waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Iron Patriot') - .click(selectors.ticketPackages.savePackagesButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Data saved!'); + it(`should attempt create a new package but receive an error if package is blank`, () => { + return nightmare + .clearInput(selectors.ticketPackages.firstQuantityInput) + .type(selectors.ticketPackages.firstQuantityInput, '99') + .click(selectors.ticketPackages.clearPackageSelectButton) + .click(selectors.ticketPackages.savePackagesButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Package cannot be blank'); + }); }); - }); - it(`should confirm the first select is the expected one`, () => { - return nightmare - .click(selectors.ticketSales.saleButton) - .wait(selectors.ticketSales.firstPackageSelect) - .click(selectors.ticketPackages.packagesButton) - .waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Iron Patriot') - .getInputValue(selectors.ticketPackages.firstPackageSelect) - .then(result => { - expect(result).toEqual('Iron Patriot'); + it(`should create a new package with correct data`, () => { + return nightmare + .waitToClick(selectors.ticketPackages.firstPackageSelect) + .waitToClick(selectors.ticketPackages.firstPackageSelectOptionThree) + .waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Iron Patriot') + .click(selectors.ticketPackages.savePackagesButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Data saved!'); + }); }); - }); - it(`should confirm the first quantity is the expected one`, () => { - return nightmare - .waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99') - .getInputValue(selectors.ticketPackages.firstQuantityInput) - .then(result => { - expect(result).toEqual('99'); + it(`should confirm the first select is the expected one`, () => { + return nightmare + .click(selectors.ticketSales.saleButton) + .wait(selectors.ticketSales.firstPackageSelect) + .click(selectors.ticketPackages.packagesButton) + .waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Iron Patriot') + .getInputValue(selectors.ticketPackages.firstPackageSelect) + .then(result => { + expect(result).toEqual('Iron Patriot'); + }); + }); + + it(`should confirm the first quantity is the expected one`, () => { + return nightmare + .waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99') + .getInputValue(selectors.ticketPackages.firstQuantityInput) + .then(result => { + expect(result).toEqual('99'); + }); }); }); });