mini refactor on e2e paths to show module on first describe

This commit is contained in:
Carlos Jimenez 2018-04-05 08:55:47 +02:00
parent e1495c652d
commit 694543a2da
25 changed files with 2537 additions and 2489 deletions

View File

@ -1,114 +1,116 @@
import selectors from '../../helpers/selectors'; import selectors from '../../helpers/selectors';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('create client path', () => { describe('Client', () => {
let nightmare = createNightmare(); describe('create path', () => {
let nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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');
}); });
});
it(`should search for the user Carol Danvers to confirm it isn't created yet`, () => { it('should access to the clients index by clicking the clients button', () => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .click(selectors.moduleAccessView.clientsSectionButton)
.type(selectors.clientsIndex.searchClientInput, 'Carol Danvers') .wait(selectors.clientsIndex.createClientButton)
.click(selectors.clientsIndex.searchButton) .parsedUrl()
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0) .then(url => {
.countSearchResults(selectors.clientsIndex.searchResult) expect(url.hash).toEqual('#!/clients');
.then(result => { });
expect(result).toEqual(0);
}); });
});
it('should access to the create client view by clicking the create-client floating button', () => { it(`should search for the user Carol Danvers to confirm it isn't created yet`, () => {
return nightmare return nightmare
.click(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.searchResult)
.wait(selectors.createClientView.createButton) .type(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
.parsedUrl() .click(selectors.clientsIndex.searchButton)
.then(url => { .waitForNumberOfElements(selectors.clientsIndex.searchResult, 0)
expect(url.hash).toEqual('#!/create'); .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', () => { it('should access to the create client view by clicking the create-client floating button', () => {
return nightmare return nightmare
.click(selectors.createClientView.createButton) .click(selectors.clientsIndex.createClientButton)
.waitForSnackbar() .wait(selectors.createClientView.createButton)
.then(result => { .parsedUrl()
expect(result).toEqual('Some fields are invalid'); .then(url => {
expect(url.hash).toEqual('#!/create');
});
}); });
});
it('should receive an error when clicking the create button having name and Business name fields empty', () => { it('should receive an error when clicking the create button having all the form fields empty', () => {
return nightmare return nightmare
.type(selectors.createClientView.taxNumber, '74451390E') .click(selectors.createClientView.createButton)
.type(selectors.createClientView.userName, 'CaptainMarvel') .waitForSnackbar()
.type(selectors.createClientView.email, 'CarolDanvers@verdnatura.es') .then(result => {
.waitToClick(selectors.createClientView.salesPersonInput) expect(result).toEqual('Some fields are invalid');
.waitToClick(selectors.createClientView.salesBruceBannerOption) });
.click(selectors.createClientView.createButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Some fields are invalid');
}); });
});
it(`should attempt to create a new user with all it's data but wrong email`, () => { it('should receive an error when clicking the create button having name and Business name fields empty', () => {
return nightmare return nightmare
.type(selectors.createClientView.name, 'Carol Danvers') .type(selectors.createClientView.taxNumber, '74451390E')
.type(selectors.createClientView.socialName, 'AVG tax') .type(selectors.createClientView.userName, 'CaptainMarvel')
.clearInput(selectors.createClientView.email) .type(selectors.createClientView.email, 'CarolDanvers@verdnatura.es')
.type(selectors.createClientView.email, 'incorrect email format') .waitToClick(selectors.createClientView.salesPersonInput)
.click(selectors.createClientView.createButton) .waitToClick(selectors.createClientView.salesBruceBannerOption)
.waitForSnackbar() .click(selectors.createClientView.createButton)
.then(result => { .waitForSnackbar()
expect(result).toContain('Some fields are invalid'); .then(result => {
expect(result).toContain('Some fields are invalid');
});
}); });
});
it(`should create a new user with all correct data`, () => { it(`should attempt to create a new user with all it's data but wrong email`, () => {
return nightmare return nightmare
.clearInput(selectors.createClientView.email) .type(selectors.createClientView.name, 'Carol Danvers')
.type(selectors.createClientView.email, 'caroldanvers@verdnatura.es') .type(selectors.createClientView.socialName, 'AVG tax')
.click(selectors.createClientView.createButton) .clearInput(selectors.createClientView.email)
.waitForSnackbar() .type(selectors.createClientView.email, 'incorrect email format')
.then(result => { .click(selectors.createClientView.createButton)
expect(result).toContain('Data saved!'); .waitForSnackbar()
.then(result => {
expect(result).toContain('Some fields are invalid');
});
}); });
});
it('should click on the Clients button of the top bar menu', () => { it(`should create a new user with all correct data`, () => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .clearInput(selectors.createClientView.email)
.wait(selectors.globalItems.applicationsMenuVisible) .type(selectors.createClientView.email, 'caroldanvers@verdnatura.es')
.waitToClick(selectors.globalItems.clientsButton) .click(selectors.createClientView.createButton)
.wait(selectors.clientsIndex.createClientButton) .waitForSnackbar()
.parsedUrl() .then(result => {
.then(url => { expect(result).toContain('Data saved!');
expect(url.hash).toEqual('#!/clients'); });
}); });
});
it(`should search for the user Carol Danvers to confirm it exists`, () => { it('should click on the Clients button of the top bar menu', () => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .waitToClick(selectors.globalItems.applicationsMenuButton)
.type(selectors.clientsIndex.searchClientInput, 'Carol Danvers') .wait(selectors.globalItems.applicationsMenuVisible)
.click(selectors.clientsIndex.searchButton) .waitToClick(selectors.globalItems.clientsButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .wait(selectors.clientsIndex.createClientButton)
.countSearchResults(selectors.clientsIndex.searchResult) .parsedUrl()
.then(result => { .then(url => {
expect(result).toEqual(1); 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);
});
}); });
}); });
}); });

View File

@ -1,130 +1,132 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('Edit basicData path', () => { describe('Client', () => {
const nightmare = createNightmare(); describe('Edit basicData path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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 Wayne', () => { it('should click on the Clients button of the top bar menu', () => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .waitToClick(selectors.globalItems.applicationsMenuButton)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Wayne') .wait(selectors.globalItems.applicationsMenuVisible)
.click(selectors.clientsIndex.searchButton) .waitToClick(selectors.globalItems.clientsButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .wait(selectors.clientsIndex.createClientButton)
.countSearchResults(selectors.clientsIndex.searchResult) .parsedUrl()
.then(result => { .then(url => {
expect(result).toEqual(1); expect(url.hash).toEqual('#!/clients');
});
}); });
});
it('should click on the search result to access to the clients basic data', () => { it('should search for the user Bruce Wayne', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Wayne') .wait(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientsIndex.searchResult) .type(selectors.clientsIndex.searchClientInput, 'Bruce Wayne')
.waitForURL('basic-data') .click(selectors.clientsIndex.searchButton)
.url() .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.then(url => { .countSearchResults(selectors.clientsIndex.searchResult)
expect(url).toContain('basic-data'); .then(result => {
expect(result).toEqual(1);
});
}); });
});
it('should edit the client basic data', () => { it('should click on the search result to access to the clients basic data', () => {
return nightmare return nightmare
.wait(selectors.clientBasicData.nameInput) .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Wayne')
.clearInput(selectors.clientBasicData.nameInput) .waitToClick(selectors.clientsIndex.searchResult)
.type(selectors.clientBasicData.nameInput, 'Ororo Munroe') .waitForURL('basic-data')
.clearInput(selectors.clientBasicData.contactInput) .url()
.type(selectors.clientBasicData.contactInput, 'Black Panther') .then(url => {
.clearInput(selectors.clientBasicData.phoneInput) expect(url).toContain('basic-data');
.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 name have been edited', () => { it('should edit the client basic data', () => {
return nightmare return nightmare
.click(selectors.clientFiscalData.fiscalDataButton) .wait(selectors.clientBasicData.nameInput)
.wait(selectors.clientFiscalData.addressInput) .clearInput(selectors.clientBasicData.nameInput)
.click(selectors.clientBasicData.basicDataButton) .type(selectors.clientBasicData.nameInput, 'Ororo Munroe')
.wait(selectors.clientBasicData.nameInput) .clearInput(selectors.clientBasicData.contactInput)
.getInputValue(selectors.clientBasicData.nameInput) .type(selectors.clientBasicData.contactInput, 'Black Panther')
.then(result => { .clearInput(selectors.clientBasicData.phoneInput)
expect(result).toEqual('Ororo Munroe'); .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', () => { it('should confirm the name have been edited', () => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.contactInput) .click(selectors.clientFiscalData.fiscalDataButton)
.then(result => { .wait(selectors.clientFiscalData.addressInput)
expect(result).toEqual('Black Panther'); .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', () => { it('should confirm the contact name have been edited', () => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.phoneInput) .getInputValue(selectors.clientBasicData.contactInput)
.then(result => { .then(result => {
expect(result).toEqual('123456789'); expect(result).toEqual('Black Panther');
});
}); });
});
it('should confirm the mobile phone number have been added', () => { it('should confirm the landline phone number have been added', () => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.mobileInput) .getInputValue(selectors.clientBasicData.phoneInput)
.then(result => { .then(result => {
expect(result).toEqual('987654321'); expect(result).toEqual('123456789');
});
}); });
});
it('should confirm the email have been edited', () => { it('should confirm the mobile phone number have been added', () => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.emailInput) .getInputValue(selectors.clientBasicData.mobileInput)
.then(result => { .then(result => {
expect(result).toEqual('Storm@verdnatura.es'); expect(result).toEqual('987654321');
});
}); });
});
it('should confirm the sales person have been selected', () => { it('should confirm the email have been edited', () => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.salesPersonInput) .getInputValue(selectors.clientBasicData.emailInput)
.then(result => { .then(result => {
expect(result).toEqual('accessory'); expect(result).toEqual('Storm@verdnatura.es');
});
}); });
});
it('should confirm the channel have been selected', () => { it('should confirm the sales person have been selected', () => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.channelInput) .getInputValue(selectors.clientBasicData.salesPersonInput)
.then(result => { .then(result => {
expect(result).toEqual('Metropolis newspaper'); 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');
});
}); });
}); });
}); });

View File

@ -1,290 +1,292 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('Edit fiscalData path', () => { describe('Client', () => {
const nightmare = createNightmare(); describe('Edit fiscalData path', () => {
const nightmare = createNightmare();
beforeAll(() => { 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`, () => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitForLogin('developer');
.waitToClick(selectors.clientsIndex.searchResult) });
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/addresses/list') 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() .url()
.then(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 return nightmare
.waitToClick(selectors.clientAddresses.firstEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientAddresses.equalizationTaxCheckboxLabel) }, selectors.clientFiscalData.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)
.then(value => { .then(value => {
expect(value).toBeTruthy(); 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 return nightmare
.waitToClick(selectors.clientAddresses.addressesButton)
.waitToClick(selectors.clientAddresses.secondEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; 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 => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); });
}); });
});
it('should navigate back to fiscal data to confirm it have been edited', () => { it('should confirm Has to invoice checkbox is unchecked', () => {
return nightmare return nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .evaluate(selector => {
.wait(selectors.clientFiscalData.socialNameInput) return document.querySelector(selector).checked;
.getInputValue(selectors.clientFiscalData.socialNameInput) }, selectors.clientFiscalData.hasToInvoiceCheckboxLabel)
.then(result => { .then(value => {
expect(result).toEqual('SMASH!'); expect(value).toBeFalsy();
});
}); });
});
it('should confirm the fiscal id have been edited', () => { it('should confirm Invoice by mail checkbox is unchecked', () => {
return nightmare return nightmare
.getInputValue(selectors.clientFiscalData.fiscalIdInput) .evaluate(selector => {
.then(result => { return document.querySelector(selector).checked;
expect(result).toEqual('94980061C'); }, selectors.clientFiscalData.invoiceByMailCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
});
}); });
});
it('should confirm Equalization tax checkbox is checked', () => { it('should confirm Vies checkbox is checked', () => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.equalizationTaxCheckboxLabel) }, selectors.clientFiscalData.viesCheckboxInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); 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();
}); });
}); });
}); });

View File

@ -1,122 +1,124 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('Edit pay method path', () => { describe('Client', () => {
const nightmare = createNightmare(); describe('Edit pay method path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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', () => { it('should click on the Clients button of the top bar menu', () => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .waitToClick(selectors.globalItems.applicationsMenuButton)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') .wait(selectors.globalItems.applicationsMenuVisible)
.click(selectors.clientsIndex.searchButton) .waitToClick(selectors.globalItems.clientsButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .wait(selectors.clientsIndex.createClientButton)
.countSearchResults(selectors.clientsIndex.searchResult) .parsedUrl()
.then(result => { .then(url => {
expect(result).toEqual(1); expect(url.hash).toEqual('#!/clients');
});
}); });
});
it(`should click on the search result to access to the client's pay method`, () => { it('should search for the user Bruce Banner', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .wait(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientsIndex.searchResult) .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.waitToClick(selectors.clientPayMethod.payMethodButton) .click(selectors.clientsIndex.searchButton)
.waitForURL('billing-data') .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.url() .countSearchResults(selectors.clientsIndex.searchResult)
.then(url => { .then(result => {
expect(url).toContain('billing-data'); expect(result).toEqual(1);
});
}); });
});
it(`should attempt to edit the Pay method without an IBAN but fail`, () => { it(`should click on the search result to access to the client's pay method`, () => {
return nightmare return nightmare
.waitToClick(selectors.clientPayMethod.payMethodInput) .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientPayMethod.payMethodIBANOption) .waitToClick(selectors.clientsIndex.searchResult)
.clearInput(selectors.clientPayMethod.dueDayInput) .waitToClick(selectors.clientPayMethod.payMethodButton)
.type(selectors.clientPayMethod.dueDayInput, '60') .waitForURL('billing-data')
.waitToClick(selectors.clientPayMethod.receivedCoreVNHCheckbox) .url()
.waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox) .then(url => {
.waitToClick(selectors.clientPayMethod.receivedB2BVNLCheckbox) expect(url).toContain('billing-data');
.waitToClick(selectors.clientPayMethod.saveButton) });
.waitToClick(selectors.clientPayMethod.cancelNotificationButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Error');
}); });
});
it(`should add the IBAN`, () => { it(`should attempt to edit the Pay method without an IBAN but fail`, () => {
return nightmare return nightmare
.clearInput(selectors.clientPayMethod.IBANInput) .waitToClick(selectors.clientPayMethod.payMethodInput)
.type(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332') .waitToClick(selectors.clientPayMethod.payMethodIBANOption)
.waitToClick(selectors.clientPayMethod.saveButton) .clearInput(selectors.clientPayMethod.dueDayInput)
.waitToClick(selectors.clientPayMethod.cancelNotificationButton) .type(selectors.clientPayMethod.dueDayInput, '60')
.waitForSnackbar() .waitToClick(selectors.clientPayMethod.receivedCoreVNHCheckbox)
.then(result => { .waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox)
expect(result).toEqual('Data saved!'); .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`, () => { it(`should add the IBAN`, () => {
return nightmare return nightmare
.getInputValue(selectors.clientPayMethod.payMethodInput) .clearInput(selectors.clientPayMethod.IBANInput)
.then(result => { .type(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332')
expect(result).toEqual('PayMethod with IBAN'); .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', () => { it(`should confirm the IBAN pay method is sucessfully saved`, () => {
return nightmare return nightmare
.getInputValue(selectors.clientPayMethod.dueDayInput) .getInputValue(selectors.clientPayMethod.payMethodInput)
.then(result => { .then(result => {
expect(result).toEqual('60'); expect(result).toEqual('PayMethod with IBAN');
});
}); });
});
it('should confirm Received core VNH checkbox is unchecked', () => { it('should confirm the due day have been edited', () => {
return nightmare return nightmare
.evaluate(selector => { .getInputValue(selectors.clientPayMethod.dueDayInput)
return document.querySelector(selector).checked; .then(result => {
}, selectors.clientPayMethod.receivedCoreVNHCheckbox) expect(result).toEqual('60');
.then(value => { });
expect(value).toBeFalsy();
}); });
});
it('should confirm Received core VNL checkbox is unchecked', () => { it('should confirm Received core VNH checkbox is unchecked', () => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedCoreVNLCheckbox) }, selectors.clientPayMethod.receivedCoreVNHCheckbox)
.then(value => { .then(value => {
expect(value).toBeFalsy(); expect(value).toBeFalsy();
});
}); });
});
it('should confirm Received B2B VNL checkbox is unchecked', () => { it('should confirm Received core VNL checkbox is unchecked', () => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedB2BVNLCheckbox) }, selectors.clientPayMethod.receivedCoreVNLCheckbox)
.then(value => { .then(value => {
expect(value).toBeFalsy(); 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();
});
}); });
}); });
}); });

View File

@ -1,128 +1,130 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('Add address path', () => { describe('Client', () => {
const nightmare = createNightmare(); describe('Add address path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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', () => { it('should click on the Clients button of the top bar menu', () => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .waitToClick(selectors.globalItems.applicationsMenuButton)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') .wait(selectors.globalItems.applicationsMenuVisible)
.click(selectors.clientsIndex.searchButton) .waitToClick(selectors.globalItems.clientsButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .wait(selectors.clientsIndex.createClientButton)
.countSearchResults(selectors.clientsIndex.searchResult) .parsedUrl()
.then(result => { .then(url => {
expect(result).toEqual(1); expect(url.hash).toEqual('#!/clients');
});
}); });
});
it(`should click on the search result to access to the client addresses`, () => { it('should search for the user Bruce Banner', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .wait(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientsIndex.searchResult) .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.waitToClick(selectors.clientAddresses.addressesButton) .click(selectors.clientsIndex.searchButton)
.waitForURL('addresses/list') .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.url() .countSearchResults(selectors.clientsIndex.searchResult)
.then(url => { .then(result => {
expect(url).toContain('addresses/list'); expect(result).toEqual(1);
});
}); });
});
it(`should click on the add new address button to access to the new address form`, () => { it(`should click on the search result to access to the client addresses`, () => {
return nightmare return nightmare
.waitToClick(selectors.clientAddresses.createAddress) .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitForURL('addresses/create') .waitToClick(selectors.clientsIndex.searchResult)
.url() .waitToClick(selectors.clientAddresses.addressesButton)
.then(url => { .waitForURL('addresses/list')
expect(url).toContain('addresses/create'); .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', () => { it(`should click on the add new address button to access to the new address form`, () => {
return nightmare return nightmare
.waitToClick(selectors.clientAddresses.defaultCheckboxInput) .waitToClick(selectors.clientAddresses.createAddress)
.clearInput(selectors.clientAddresses.streetAddressInput) .waitForURL('addresses/create')
.type(selectors.clientAddresses.postcodeInput, '10022') .url()
.waitToClick(selectors.clientAddresses.provinceInput) .then(url => {
.waitToClick(selectors.clientAddresses.provinceSecondOption) expect(url).toContain('addresses/create');
.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 create a new address with all it's data`, () => { it('should receive an error after clicking save button as consignee, street and town fields are empty', () => {
return nightmare return nightmare
.type(selectors.clientAddresses.consigneeInput, 'Bruce Bunner') .waitToClick(selectors.clientAddresses.defaultCheckboxInput)
.type(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York') .clearInput(selectors.clientAddresses.streetAddressInput)
.type(selectors.clientAddresses.cityInput, 'New York') .type(selectors.clientAddresses.postcodeInput, '10022')
.click(selectors.clientAddresses.saveButton) .waitToClick(selectors.clientAddresses.provinceInput)
.waitForSnackbar() .waitToClick(selectors.clientAddresses.provinceSecondOption)
.then(result => { .waitToClick(selectors.clientAddresses.agencyInput)
expect(result).toContain('Data saved!'); .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`, () => { it(`should create a new address with all it's data`, () => {
return nightmare return nightmare
.waitToClick(selectors.clientAddresses.addressesButton) .type(selectors.clientAddresses.consigneeInput, 'Bruce Bunner')
.wait(selectors.clientAddresses.defaultAddress) .type(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York')
.getInnerText(selectors.clientAddresses.defaultAddress) .type(selectors.clientAddresses.cityInput, 'New York')
.then(result => { .click(selectors.clientAddresses.saveButton)
expect(result).toContain('320 Park Avenue New York'); .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`, () => { it(`should click on the addresses button confirm the new address exists and it's the default one`, () => {
return nightmare return nightmare
.waitToClick(selectors.clientAddresses.secondMakeDefaultStar) .waitToClick(selectors.clientAddresses.addressesButton)
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand') .wait(selectors.clientAddresses.defaultAddress)
.getInnerText(selectors.clientAddresses.defaultAddress) .getInnerText(selectors.clientAddresses.defaultAddress)
.then(result => { .then(result => {
expect(result).toContain('Somewhere in Thailand'); expect(result).toContain('320 Park Avenue New York');
});
}); });
});
it(`should click on the edit icon of the default address`, () => { it(`should click on the make default icon of the second address then confirm it is the default one now`, () => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand') .waitToClick(selectors.clientAddresses.secondMakeDefaultStar)
.waitToClick(selectors.clientAddresses.firstEditButton) .waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
.waitForURL('/edit') .getInnerText(selectors.clientAddresses.defaultAddress)
.url() .then(result => {
.then(result => { expect(result).toContain('Somewhere in Thailand');
expect(result).toContain('/edit'); });
}); });
});
it(`should click on the active checkbox and receive an error to save it becouse it is the default address`, () => { it(`should click on the edit icon of the default address`, () => {
return nightmare return nightmare
.waitToClick(selectors.clientAddresses.activeCheckbox) .waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
.waitToClick(selectors.clientAddresses.saveButton) .waitToClick(selectors.clientAddresses.firstEditButton)
.waitForSnackbar() .waitForURL('/edit')
.then(result => { .url()
expect(result).toContain('Error:'); .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:');
});
}); });
}); });
}); });

View File

@ -1,96 +1,98 @@
// import selectors from '../../helpers/selectors.js'; // import selectors from '../../helpers/selectors.js';
// import createNightmare from '../../helpers/helpers'; // import createNightmare from '../../helpers/helpers';
// describe('Add address notes path', () => { // describe('Client', () => {
// const nightmare = createNightmare(); // describe('Add address notes path', () => {
// const nightmare = createNightmare();
// beforeAll(() => { // beforeAll(() => {
// return nightmare // return nightmare
// .waitForLogin('developer'); // .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 Petter Parker', () => { // it('should click on the Clients button of the top bar menu', () => {
// return nightmare // return nightmare
// .wait(selectors.clientsIndex.searchResult) // .waitToClick(selectors.globalItems.applicationsMenuButton)
// .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') // .wait(selectors.globalItems.applicationsMenuVisible)
// .click(selectors.clientsIndex.searchButton) // .waitToClick(selectors.globalItems.clientsButton)
// .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) // .wait(selectors.clientsIndex.createClientButton)
// .countSearchResults(selectors.clientsIndex.searchResult) // .parsedUrl()
// .then(result => { // .then(url => {
// expect(result).toEqual(1); // expect(url.hash).toEqual('#!/clients');
// });
// }); // });
// });
// it(`should click on the search result to access to the client addresses`, () => { // it('should search for the user Petter Parker', () => {
// return nightmare // return nightmare
// .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') // .wait(selectors.clientsIndex.searchResult)
// .waitToClick(selectors.clientsIndex.searchResult) // .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
// .waitToClick(selectors.clientAddresses.addressesButton) // .click(selectors.clientsIndex.searchButton)
// .waitForURL('addresses/list') // .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
// .url() // .countSearchResults(selectors.clientsIndex.searchResult)
// .then(url => { // .then(result => {
// expect(url).toContain('addresses/list'); // expect(result).toEqual(1);
// });
// }); // });
// });
// it(`should click on the edit icon of the default address`, () => { // it(`should click on the search result to access to the client addresses`, () => {
// return nightmare // return nightmare
// .waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street') // .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
// .waitToClick(selectors.clientAddresses.firstEditButton) // .waitToClick(selectors.clientsIndex.searchResult)
// .waitForURL('/edit') // .waitToClick(selectors.clientAddresses.addressesButton)
// .url() // .waitForURL('addresses/list')
// .then(result => { // .url()
// expect(result).toContain('/edit'); // .then(url => {
// expect(url).toContain('addresses/list');
// });
// }); // });
// });
// it('should not save a description without observation type', () => { // it(`should click on the edit icon of the default address`, () => {
// return nightmare // return nightmare
// .waitToClick(selectors.clientAddresses.addObservationButton) // .waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street')
// .wait(selectors.clientAddresses.firstObservationDescriptionInput) // .waitToClick(selectors.clientAddresses.firstEditButton)
// .type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description') // .waitForURL('/edit')
// .waitToClick(selectors.clientAddresses.saveButton) // .url()
// .waitForSnackbar() // .then(result => {
// .then(result => { // expect(result).toContain('/edit');
// expect(result).toContain('Some fields are invalid'); // });
// }); // });
// });
// it('should not save an observation type without description', () => { // it('should not save a description without observation type', () => {
// return nightmare // return nightmare
// .clearInput(selectors.clientAddresses.firstObservationDescriptionInput) // .waitToClick(selectors.clientAddresses.addObservationButton)
// .waitToClick(selectors.clientAddresses.firstObservationTypeSelect) // .wait(selectors.clientAddresses.firstObservationDescriptionInput)
// .waitToClick(selectors.clientAddresses.firstObservationTypeSelectOptionOne) // .type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
// .waitToClick(selectors.clientAddresses.saveButton) // .waitToClick(selectors.clientAddresses.saveButton)
// .waitForSnackbar() // .waitForSnackbar()
// .then(result => { // .then(result => {
// expect(result).toContain('Some fields are invalid'); // expect(result).toContain('Some fields are invalid');
// });
// }); // });
// });
// it('should create two new observations', () => { // it('should not save an observation type without description', () => {
// return nightmare // return nightmare
// .type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description') // .clearInput(selectors.clientAddresses.firstObservationDescriptionInput)
// .waitToClick(selectors.clientAddresses.addObservationButton) // .waitToClick(selectors.clientAddresses.firstObservationTypeSelect)
// .waitToClick(selectors.clientAddresses.secondObservationTypeSelect) // .waitToClick(selectors.clientAddresses.firstObservationTypeSelectOptionOne)
// .waitToClick(selectors.clientAddresses.secondObservationTypeSelectOptionTwo) // .waitToClick(selectors.clientAddresses.saveButton)
// .type(selectors.clientAddresses.secondObservationDescriptionInput, 'second description') // .waitForSnackbar()
// .waitToClick(selectors.clientAddresses.saveButton) // .then(result => {
// .waitForSnackbar() // expect(result).toContain('Some fields are invalid');
// .then(result => { // });
// expect(result).toContain('pepinillos saved!'); // });
// 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!');
// });
// }); // });
// }); // });
// }); // });

View File

@ -1,78 +1,80 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('Edit web access path', () => { describe('Client', () => {
const nightmare = createNightmare(); describe('Edit web access path', () => {
const nightmare = createNightmare();
beforeAll(() => { 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();
return nightmare return nightmare
.getInputValue(selectors.clientWebAccess.userNameInput); .waitForLogin('developer');
}) });
.then(result => {
expect(result).toEqual('Hulk'); 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');
});
}); });
}); });
}); });

View File

@ -1,76 +1,78 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('Add notes path', () => { describe('Client', () => {
const nightmare = createNightmare(); describe('Add notes path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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', () => { it('should click on the Clients button of the top bar menu', () => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .waitToClick(selectors.globalItems.applicationsMenuButton)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') .wait(selectors.globalItems.applicationsMenuVisible)
.click(selectors.clientsIndex.searchButton) .waitToClick(selectors.globalItems.clientsButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .wait(selectors.clientsIndex.createClientButton)
.countSearchResults(selectors.clientsIndex.searchResult) .parsedUrl()
.then(result => { .then(url => {
expect(result).toEqual(1); expect(url.hash).toEqual('#!/clients');
});
}); });
});
it(`should click on the search result to access to the client's notes`, () => { it('should search for the user Bruce Banner', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .wait(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientsIndex.searchResult) .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.waitToClick(selectors.clientNotes.notesButton) .click(selectors.clientsIndex.searchButton)
.waitForURL('notes/list') .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.url() .countSearchResults(selectors.clientsIndex.searchResult)
.then(url => { .then(result => {
expect(url).toContain('notes/list'); expect(result).toEqual(1);
});
}); });
});
it(`should click on the add note button`, () => { it(`should click on the search result to access to the client's notes`, () => {
return nightmare return nightmare
.waitToClick(selectors.clientNotes.addNoteFloatButton) .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitForURL('/notes/create') .waitToClick(selectors.clientsIndex.searchResult)
.url() .waitToClick(selectors.clientNotes.notesButton)
.then(url => { .waitForURL('notes/list')
expect(url).toContain('/notes/create'); .url()
.then(url => {
expect(url).toContain('notes/list');
});
}); });
});
it(`should create a note`, () => { it(`should click on the add note button`, () => {
return nightmare return nightmare
.type(selectors.clientNotes.noteInput, 'Meeting with Black Widow 21st 9am') .waitToClick(selectors.clientNotes.addNoteFloatButton)
.click(selectors.clientNotes.saveButton) .waitForURL('/notes/create')
.waitForSnackbar() .url()
.then(result => { .then(url => {
expect(result).toEqual('Data saved!'); expect(url).toContain('/notes/create');
});
}); });
});
it('should confirm the note was created', () => { it(`should create a note`, () => {
return nightmare return nightmare
.wait(selectors.clientNotes.firstNoteText) .type(selectors.clientNotes.noteInput, 'Meeting with Black Widow 21st 9am')
.getInnerText(selectors.clientNotes.firstNoteText) .click(selectors.clientNotes.saveButton)
.then(value => { .waitForSnackbar()
expect(value).toEqual('Meeting with Black Widow 21st 9am'); .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');
});
}); });
}); });
}); });

View File

@ -1,78 +1,80 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('Add credit path', () => { describe('Client', () => {
const nightmare = createNightmare(); describe('Add credit path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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 Petter Parker', () => { it('should click on the Clients button of the top bar menu', () => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .waitToClick(selectors.globalItems.applicationsMenuButton)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker') .wait(selectors.globalItems.applicationsMenuVisible)
.click(selectors.clientsIndex.searchButton) .waitToClick(selectors.globalItems.clientsButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .wait(selectors.clientsIndex.createClientButton)
.countSearchResults(selectors.clientsIndex.searchResult) .parsedUrl()
.then(result => { .then(url => {
expect(result).toEqual(1); expect(url.hash).toEqual('#!/clients');
});
}); });
});
it(`should click on the search result to access to the client's credit`, () => { it('should search for the user Petter Parker', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .wait(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientsIndex.searchResult) .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.waitToClick(selectors.clientCredit.creditButton) .click(selectors.clientsIndex.searchButton)
.waitForURL('credit/list') .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.url() .countSearchResults(selectors.clientsIndex.searchResult)
.then(url => { .then(result => {
expect(url).toContain('credit/list'); expect(result).toEqual(1);
});
}); });
});
it(`should click on the add credit button`, () => { it(`should click on the search result to access to the client's credit`, () => {
return nightmare return nightmare
.waitToClick(selectors.clientCredit.addCreditFloatButton) .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitForURL('/credit/create') .waitToClick(selectors.clientsIndex.searchResult)
.url() .waitToClick(selectors.clientCredit.creditButton)
.then(url => { .waitForURL('credit/list')
expect(url).toContain('/credit/create'); .url()
.then(url => {
expect(url).toContain('credit/list');
});
}); });
});
it(`should edit the credit`, () => { it(`should click on the add credit button`, () => {
return nightmare return nightmare
.clearInput(selectors.clientCredit.creditInput) .waitToClick(selectors.clientCredit.addCreditFloatButton)
.type(selectors.clientCredit.creditInput, 999) .waitForURL('/credit/create')
.click(selectors.clientCredit.saveButton) .url()
.waitForSnackbar() .then(url => {
.then(result => { expect(url).toContain('/credit/create');
expect(result).toEqual('Data saved!'); });
}); });
});
it('should confirm the credit was updated', () => { it(`should edit the credit`, () => {
return nightmare return nightmare
.wait(selectors.clientCredit.firstCreditText) .clearInput(selectors.clientCredit.creditInput)
.getInnerText(selectors.clientCredit.firstCreditText) .type(selectors.clientCredit.creditInput, 999)
.then(value => { .click(selectors.clientCredit.saveButton)
expect(value).toContain(999); .waitForSnackbar()
expect(value).toContain('developer'); .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');
});
}); });
}); });
}); });

View File

@ -1,90 +1,92 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('Add greuge path', () => { describe('Client', () => {
const nightmare = createNightmare(); describe('Add greuge path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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 Petter Parker', () => { it('should click on the Clients button of the top bar menu', () => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .waitToClick(selectors.globalItems.applicationsMenuButton)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker') .wait(selectors.globalItems.applicationsMenuVisible)
.click(selectors.clientsIndex.searchButton) .waitToClick(selectors.globalItems.clientsButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .wait(selectors.clientsIndex.createClientButton)
.countSearchResults(selectors.clientsIndex.searchResult) .parsedUrl()
.then(result => { .then(url => {
expect(result).toEqual(1); expect(url.hash).toEqual('#!/clients');
});
}); });
});
it(`should click on the search result to access to the client's greuge`, () => { it('should search for the user Petter Parker', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .wait(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientsIndex.searchResult) .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.waitToClick(selectors.clientGreuge.greugeButton) .click(selectors.clientsIndex.searchButton)
.waitForURL('greuge/list') .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.url() .countSearchResults(selectors.clientsIndex.searchResult)
.then(url => { .then(result => {
expect(url).toContain('greuge/list'); expect(result).toEqual(1);
});
}); });
});
it(`should click on the add greuge button`, () => { it(`should click on the search result to access to the client's greuge`, () => {
return nightmare return nightmare
.waitToClick(selectors.clientGreuge.addGreugeFloatButton) .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitForURL('greuge/create') .waitToClick(selectors.clientsIndex.searchResult)
.url() .waitToClick(selectors.clientGreuge.greugeButton)
.then(url => { .waitForURL('greuge/list')
expect(url).toContain('greuge/create'); .url()
.then(url => {
expect(url).toContain('greuge/list');
});
}); });
});
it(`should receive an error if all fields are empty but date and type on submit`, () => { it(`should click on the add greuge button`, () => {
return nightmare return nightmare
.waitToClick(selectors.clientGreuge.typeInput) .waitToClick(selectors.clientGreuge.addGreugeFloatButton)
.waitToClick(selectors.clientGreuge.typeSecondOption) .waitForURL('greuge/create')
.click(selectors.clientGreuge.saveButton) .url()
.waitForSnackbar() .then(url => {
.then(result => { expect(url).toContain('greuge/create');
expect(result).toContain('Some fields are invalid'); });
}); });
});
it(`should create a new greuge with all its data`, () => { it(`should receive an error if all fields are empty but date and type on submit`, () => {
return nightmare return nightmare
.type(selectors.clientGreuge.amountInput, 999) .waitToClick(selectors.clientGreuge.typeInput)
.type(selectors.clientGreuge.descriptionInput, 'new armor for Batman!') .waitToClick(selectors.clientGreuge.typeSecondOption)
.click(selectors.clientGreuge.saveButton) .click(selectors.clientGreuge.saveButton)
.waitForSnackbar() .waitForSnackbar()
.then(result => { .then(result => {
expect(result).toContain('Data saved!'); expect(result).toContain('Some fields are invalid');
});
}); });
});
it('should confirm the greuge was added to the list', () => { it(`should create a new greuge with all its data`, () => {
return nightmare return nightmare
.wait(selectors.clientGreuge.firstGreugeText) .type(selectors.clientGreuge.amountInput, 999)
.getInnerText(selectors.clientGreuge.firstGreugeText) .type(selectors.clientGreuge.descriptionInput, 'new armor for Batman!')
.then(value => { .click(selectors.clientGreuge.saveButton)
expect(value).toContain(999); .waitForSnackbar()
expect(value).toContain('new armor for Batman!'); .then(result => {
expect(value).toContain('Diff'); 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');
});
}); });
}); });
}); });

View File

@ -1,58 +1,60 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('mandate path', () => { describe('Client', () => {
const nightmare = createNightmare(); describe('mandate path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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 Petter Parker', () => { it('should click on the Clients button of the top bar menu', () => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .waitToClick(selectors.globalItems.applicationsMenuButton)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker') .wait(selectors.globalItems.applicationsMenuVisible)
.click(selectors.clientsIndex.searchButton) .waitToClick(selectors.globalItems.clientsButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .wait(selectors.clientsIndex.createClientButton)
.countSearchResults(selectors.clientsIndex.searchResult) .parsedUrl()
.then(result => { .then(url => {
expect(result).toEqual(1); expect(url.hash).toEqual('#!/clients');
});
}); });
});
it(`should click on the search result to access to the client's mandate`, () => { it('should search for the user Petter Parker', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter') .wait(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientsIndex.searchResult) .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.waitToClick(selectors.clientMandate.mandateButton) .click(selectors.clientsIndex.searchButton)
.waitForURL('mandate') .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.url() .countSearchResults(selectors.clientsIndex.searchResult)
.then(url => { .then(result => {
expect(url).toContain('mandate'); expect(result).toEqual(1);
});
}); });
});
it('should confirm the client has a mandate of the CORE type', () => { it(`should click on the search result to access to the client's mandate`, () => {
return nightmare return nightmare
.wait(selectors.clientMandate.firstMandateText) .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter')
.getInnerText(selectors.clientMandate.firstMandateText) .waitToClick(selectors.clientsIndex.searchResult)
.then(value => { .waitToClick(selectors.clientMandate.mandateButton)
expect(value).toContain('1'); .waitForURL('mandate')
expect(value).toContain('WAY'); .url()
expect(value).toContain('CORE'); .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');
});
}); });
}); });
}); });

View File

@ -1,471 +1,473 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('lock verified data path', () => { describe('Client', () => {
const nightmare = createNightmare(); describe('lock verified data path', () => {
const nightmare = createNightmare();
describe('as salesPerson', () => { describe('as salesPerson', () => {
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('salesPerson'); .waitForLogin('salesPerson');
}); });
it('should click on the Clients button of the top bar menu', () => { it('should click on the Clients button of the top bar menu', () => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton) .waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.createClientButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/clients'); 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', () => { describe('as administrative', () => {
return nightmare beforeAll(() => {
.wait(selectors.clientsIndex.searchResult) return nightmare
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker') .waitToClick(selectors.globalItems.logOutButton)
.click(selectors.clientsIndex.searchButton) .waitForLogin('administrative');
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) });
.countSearchResults(selectors.clientsIndex.searchResult)
.then(result => { it('should navigate to clients index', () => {
expect(result).toEqual(1); 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`, () => { describe('as salesPerson second run', () => {
return nightmare beforeAll(() => {
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') return nightmare
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.globalItems.logOutButton)
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitForLogin('salesPerson');
.waitForURL('fiscal-data') });
.parsedUrl()
.then(url => { it('should again click on the Clients button of the top bar menu', () => {
expect(url.hash).toContain('fiscal-data'); 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`, () => { describe('as salesAssistant', () => {
return nightmare beforeAll(() => {
.waitToClick(selectors.clientFiscalData.fiscalDataButton) return nightmare
.waitForURL('fiscal-data') .waitToClick(selectors.globalItems.logOutButton)
.parsedUrl() .waitForLogin('salesAssistant');
.then(url => { });
expect(url.hash).toContain('fiscal-data');
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', () => { describe('as salesPerson third run', () => {
return nightmare beforeAll(() => {
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput) return nightmare
.evaluate(selector => { .waitToClick(selectors.globalItems.logOutButton)
return document.querySelector(selector).className; .waitForLogin('salesPerson');
}, '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', () => { it('should again click on the Clients button of the top bar menu', () => {
return nightmare return nightmare
.wait(selectors.clientFiscalData.socialNameInput) .waitToClick(selectors.globalItems.applicationsMenuButton)
.clearInput(selectors.clientFiscalData.socialNameInput) .wait(selectors.globalItems.applicationsMenuVisible)
.type(selectors.clientFiscalData.socialNameInput, 'salesPerson was here') .waitToClick(selectors.globalItems.clientsButton)
.click(selectors.clientFiscalData.saveButton) .wait(selectors.clientsIndex.createClientButton)
.waitForSnackbar() .parsedUrl()
.then(result => { .then(url => {
expect(result).toEqual('Data saved!'); expect(url.hash).toEqual('#!/clients');
});
}); });
});
it('should confirm the social name have been edited', () => { it('should once again search for the user Petter Parker', () => {
return nightmare return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton) .wait(selectors.clientsIndex.searchResult)
.wait(selectors.clientBasicData.nameInput) .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .click(selectors.clientsIndex.searchButton)
.wait(selectors.clientFiscalData.socialNameInput) .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.getInputValue(selectors.clientFiscalData.socialNameInput) .countSearchResults(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual('salesPerson was here'); expect(result).toEqual(1);
});
}); });
});
});
describe('as administrative', () => { it(`should click on the search result to access to the client's fiscal data`, () => {
beforeAll(() => { return nightmare
return nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.globalItems.logOutButton) .waitToClick(selectors.clientsIndex.searchResult)
.waitForLogin('administrative'); .waitToClick(selectors.clientFiscalData.fiscalDataButton)
}); .waitForURL('fiscal-data')
.parsedUrl()
it('should navigate to clients index', () => { .then(url => {
return nightmare expect(url.hash).toContain('fiscal-data');
.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', () => { it(`should click on the fiscal data button to start editing`, () => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker') .waitForURL('fiscal-data')
.click(selectors.clientsIndex.searchButton) .parsedUrl()
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .then(url => {
.countSearchResults(selectors.clientsIndex.searchResult) expect(url.hash).toContain('fiscal-data');
.then(result => { });
expect(result).toEqual(1);
}); });
});
it(`should click on the search result to access to the Petter Parkers fiscal data`, () => { it('should confirm verified data button is enabled once again', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
.waitToClick(selectors.clientsIndex.searchResult) .evaluate(selector => {
.waitToClick(selectors.clientFiscalData.fiscalDataButton) return document.querySelector(selector).className;
.waitForURL('fiscal-data') }, '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')
.parsedUrl() .then(result => {
.then(url => { expect(result).toContain('is-disabled');
expect(url.hash).toContain('fiscal-data'); });
}); });
});
it(`should click on the fiscal data button`, () => { it('should confirm the form is enabled for salesPerson', () => {
return nightmare return nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .wait(selectors.clientFiscalData.socialNameInput)
.waitForURL('fiscal-data') .evaluate(selector => {
.parsedUrl() return document.querySelector(selector).className;
.then(url => { }, 'vn-textfield[field="$ctrl.client.socialName"] > div')
expect(url.hash).toContain('fiscal-data'); .then(result => {
}); expect(result).not.toContain('is-disabled');
}); });
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');
}); });
}); });
}); });

View File

@ -1,57 +1,59 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('invoice path', () => { describe('Client', () => {
const nightmare = createNightmare(); describe('invoice path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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 Petter Parker', () => { it('should click on the Clients button of the top bar menu', () => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .waitToClick(selectors.globalItems.applicationsMenuButton)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker') .wait(selectors.globalItems.applicationsMenuVisible)
.click(selectors.clientsIndex.searchButton) .waitToClick(selectors.globalItems.clientsButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .wait(selectors.clientsIndex.createClientButton)
.countSearchResults(selectors.clientsIndex.searchResult) .parsedUrl()
.then(result => { .then(url => {
expect(result).toEqual(1); expect(url.hash).toEqual('#!/clients');
});
}); });
});
it(`should click on the search result to access to the client invoices`, () => { it('should search for the user Petter Parker', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter') .wait(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientsIndex.searchResult) .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.waitToClick(selectors.clientInvoices.invoicesButton) .click(selectors.clientsIndex.searchButton)
.waitForURL('invoices') .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.parsedUrl() .countSearchResults(selectors.clientsIndex.searchResult)
.then(url => { .then(result => {
expect(url.hash).toContain('invoices'); expect(result).toEqual(1);
});
}); });
});
it('should confirm the client has an invoice', () => { it(`should click on the search result to access to the client invoices`, () => {
return nightmare return nightmare
.wait(selectors.clientInvoices.firstInvoiceText) .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter')
.getInnerText(selectors.clientInvoices.firstInvoiceText) .waitToClick(selectors.clientsIndex.searchResult)
.then(value => { .waitToClick(selectors.clientInvoices.invoicesButton)
expect(value).toContain('V1800001'); .waitForURL('invoices')
expect(value).toContain('350.50'); .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');
});
}); });
}); });
}); });

View File

@ -1,153 +1,155 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('Item summary path', () => { describe('Item', () => {
const nightmare = createNightmare(); describe('Summary path', () => {
const nightmare = createNightmare();
beforeAll(() => { 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();
return nightmare return nightmare
.waitToClick(selectors.itemsIndex.searchResultPreviewButton) .waitForLogin('developer');
.isVisible(selectors.itemSummary.basicData);
})
.then(result => {
expect(result).toBeTruthy();
}); });
});
it(`should check the item summary preview shows fields from basic data`, () => { it('should access to the items index by clicking the items button', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time') .click(selectors.moduleAccessView.itemsSectionButton)
.getInnerText(selectors.itemSummary.basicData) .wait(selectors.itemsIndex.createItemButton)
.then(result => { .parsedUrl()
expect(result).toContain('Name: Gem of Time'); .then(url => {
expect(url.hash).toEqual('#!/item/list');
});
}); });
});
it(`should check the item summary preview shows fields from tags`, () => { it('should search for the item Gem of Time', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow') .wait(selectors.itemsIndex.searchResult)
.getInnerText(selectors.itemSummary.tags) .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.then(result => { .click(selectors.itemsIndex.searchButton)
expect(result).toContain('Color: Yellow'); .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`, () => { it(`should click on the search result summary button to open the item summary popup`, () => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.getInnerText(selectors.itemSummary.niche) .isVisible(selectors.itemSummary.basicData)
.then(result => { .then(result => {
expect(result).toContain('Warehouse One: A1'); 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`, () => { it(`should check the item summary preview shows fields from basic data`, () => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix') .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time')
.getInnerText(selectors.itemSummary.botanical) .getInnerText(selectors.itemSummary.basicData)
.then(result => { .then(result => {
expect(result).toContain('Botanical: Hedera helix'); expect(result).toContain('Name: Gem of Time');
});
}); });
});
it(`should check the item summary preview shows fields from barcode`, () => { it(`should check the item summary preview shows fields from tags`, () => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemSummary.barcode, '1') .waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow')
.getInnerText(selectors.itemSummary.barcode) .getInnerText(selectors.itemSummary.tags)
.then(result => { .then(result => {
expect(result).toContain('1'); expect(result).toContain('Color: Yellow');
});
}); });
});
it(`should close the summary popup`, () => { it(`should check the item summary preview shows fields from niche`, () => {
return nightmare return nightmare
.waitToClick(selectors.itemsIndex.closeItemSummaryPreview) .waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1')
.isVisible(selectors.itemSummary.basicData) .getInnerText(selectors.itemSummary.niche)
.then(result => { .then(result => {
expect(result).toBeFalsy(); expect(result).toContain('Warehouse One: A1');
});
}); });
});
it(`should navigate to the one of the items detailed section`, () => { it(`should check the item summary preview shows fields from botanical`, () => {
return nightmare return nightmare
.waitToClick(selectors.itemsIndex.searchResult) .waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix')
.waitForURL('summary') .getInnerText(selectors.itemSummary.botanical)
.parsedUrl() .then(result => {
.then(url => { expect(result).toContain('Botanical: Hedera helix');
expect(url.hash).toContain('summary'); });
}); });
});
it(`should check the item summary shows fields from basic data section`, () => { it(`should check the item summary preview shows fields from barcode`, () => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time') .waitForTextInElement(selectors.itemSummary.barcode, '1')
.getInnerText(selectors.itemSummary.basicData) .getInnerText(selectors.itemSummary.barcode)
.then(result => { .then(result => {
expect(result).toContain('Name: Gem of Time'); expect(result).toContain('1');
});
}); });
});
it(`should check the item summary shows fields from tags section`, () => { it(`should close the summary popup`, () => {
return nightmare return nightmare
.getInnerText(selectors.itemSummary.tags) .waitToClick(selectors.itemsIndex.closeItemSummaryPreview)
.then(result => { .isVisible(selectors.itemSummary.basicData)
expect(result).toContain('Color: Yellow'); .then(result => {
expect(result).toBeFalsy();
});
}); });
});
it(`should check the item summary shows fields from niches section`, () => { it(`should navigate to the one of the items detailed section`, () => {
return nightmare return nightmare
.getInnerText(selectors.itemSummary.niche) .waitToClick(selectors.itemsIndex.searchResult)
.then(result => { .waitForURL('summary')
expect(result).toContain('Warehouse One: A1'); .parsedUrl()
.then(url => {
expect(url.hash).toContain('summary');
});
}); });
});
it(`should check the item summary shows fields from botanical section`, () => { it(`should check the item summary shows fields from basic data section`, () => {
return nightmare return nightmare
.getInnerText(selectors.itemSummary.botanical) .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time')
.then(result => { .getInnerText(selectors.itemSummary.basicData)
expect(result).toContain('Botanical: Hedera helix'); .then(result => {
expect(result).toContain('Name: Gem of Time');
});
}); });
});
it(`should check the item summary shows fields from barcodes section`, () => { it(`should check the item summary shows fields from tags section`, () => {
return nightmare return nightmare
.getInnerText(selectors.itemSummary.barcode) .getInnerText(selectors.itemSummary.tags)
.then(result => { .then(result => {
expect(result).toContain('1'); 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');
});
}); });
}); });
}); });

View File

@ -1,118 +1,120 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('edit item basic data path', () => { describe('Item', () => {
const nightmare = createNightmare(); describe('Edit basic data path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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 Mind', () => { it('should access to the items index by clicking the items button', () => {
return nightmare return nightmare
.wait(selectors.itemsIndex.searchResult) .click(selectors.moduleAccessView.itemsSectionButton)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Mind') .wait(selectors.itemsIndex.createItemButton)
.click(selectors.itemsIndex.searchButton) .parsedUrl()
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) .then(url => {
.countSearchResults(selectors.itemsIndex.searchResult) expect(url.hash).toEqual('#!/item/list');
.then(result => { });
expect(result).toEqual(1);
}); });
});
it(`should click on the search result to access to the item basic data`, () => { it('should search for the item Gem of Mind', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind') .wait(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemsIndex.searchResult) .type(selectors.itemsIndex.searchItemInput, 'Gem of Mind')
.waitToClick(selectors.itemBasicData.basicDataButton) .click(selectors.itemsIndex.searchButton)
.waitForURL('data') .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.url() .countSearchResults(selectors.itemsIndex.searchResult)
.then(url => { .then(result => {
expect(url).toContain('data'); expect(result).toEqual(1);
});
}); });
});
it(`should edit the item basic data`, () => { it(`should click on the search result to access to the item basic data`, () => {
return nightmare return nightmare
.clearInput(selectors.itemBasicData.nameInput) .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind')
.type(selectors.itemBasicData.nameInput, 'Rose of Purity') .waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemBasicData.typeSelect) .waitToClick(selectors.itemBasicData.basicDataButton)
.waitToClick(selectors.itemBasicData.typeSelectOptionTwo) .waitForURL('data')
.waitToClick(selectors.itemBasicData.intrastatSelect) .url()
.waitToClick(selectors.itemBasicData.intrastatSelectOptionOne) .then(url => {
.clearInput(selectors.itemBasicData.relevancyInput) expect(url).toContain('data');
.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 name was edited`, () => { it(`should edit the item basic data`, () => {
return nightmare return nightmare
.click(selectors.itemNiches.nicheButton) .clearInput(selectors.itemBasicData.nameInput)
.wait(selectors.itemNiches.firstWarehouseDisabled) .type(selectors.itemBasicData.nameInput, 'Rose of Purity')
.waitToClick(selectors.itemBasicData.basicDataButton) .waitToClick(selectors.itemBasicData.typeSelect)
.waitForTextInInput(selectors.itemBasicData.nameInput, 'Rose of Purity') .waitToClick(selectors.itemBasicData.typeSelectOptionTwo)
.getInputValue(selectors.itemBasicData.nameInput) .waitToClick(selectors.itemBasicData.intrastatSelect)
.then(result => { .waitToClick(selectors.itemBasicData.intrastatSelectOptionOne)
expect(result).toEqual('Rose of Purity'); .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`, () => { it(`should confirm the item name was edited`, () => {
return nightmare return nightmare
.getInputValue(selectors.itemBasicData.typeSelect) .click(selectors.itemNiches.nicheButton)
.then(result => { .wait(selectors.itemNiches.firstWarehouseDisabled)
expect(result).toEqual('Crisantemo'); .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`, () => { it(`should confirm the item type was edited`, () => {
return nightmare return nightmare
.getInputValue(selectors.itemBasicData.intrastatSelect) .getInputValue(selectors.itemBasicData.typeSelect)
.then(result => { .then(result => {
expect(result).toEqual('Coral y materiales similares'); expect(result).toEqual('Crisantemo');
});
}); });
});
it(`should confirm the item relevancy was edited`, () => { it(`should confirm the item intrastad was edited`, () => {
return nightmare return nightmare
.getInputValue(selectors.itemBasicData.relevancyInput) .getInputValue(selectors.itemBasicData.intrastatSelect)
.then(result => { .then(result => {
expect(result).toEqual('1'); expect(result).toEqual('Coral y materiales similares');
});
}); });
});
it(`should confirm the item origin was edited`, () => { it(`should confirm the item relevancy was edited`, () => {
return nightmare return nightmare
.getInputValue(selectors.itemBasicData.originSelect) .getInputValue(selectors.itemBasicData.relevancyInput)
.then(result => { .then(result => {
expect(result).toEqual('Spain'); expect(result).toEqual('1');
});
}); });
});
it(`should confirm the item expence was edited`, () => { it(`should confirm the item origin was edited`, () => {
return nightmare return nightmare
.getInputValue(selectors.itemBasicData.expenceSelect) .getInputValue(selectors.itemBasicData.originSelect)
.then(result => { .then(result => {
expect(result).toEqual('Adquisición mercancia Extracomunitaria'); 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');
});
}); });
}); });
}); });

View File

@ -1,82 +1,84 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('add item tax path', () => { describe('Item', () => {
const nightmare = createNightmare(); describe('Edit tax path', () => {
const nightmare = createNightmare();
beforeAll(() => { 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');
return nightmare return nightmare
.getInputValue(selectors.itemTax.secondClassSelect); .waitForLogin('developer');
}) });
.then(result => {
expect(result).toEqual('Reduced VAT'); it('should access to the items index by clicking the items button', () => {
return nightmare return nightmare
.getInputValue(selectors.itemTax.thirdClassSelect); .click(selectors.moduleAccessView.itemsSectionButton)
}) .wait(selectors.itemsIndex.createItemButton)
.then(result => { .parsedUrl()
expect(result).toEqual('General VAT'); .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');
});
}); });
}); });
}); });

View File

@ -1,199 +1,201 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('create item tags path', () => { describe('Item', () => {
const nightmare = createNightmare(); describe('Create tags path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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', () => { it('should access to the items index by clicking the items button', () => {
return nightmare return nightmare
.wait(selectors.itemsIndex.searchResult) .click(selectors.moduleAccessView.itemsSectionButton)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time') .wait(selectors.itemsIndex.createItemButton)
.click(selectors.itemsIndex.searchButton) .parsedUrl()
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) .then(url => {
.countSearchResults(selectors.itemsIndex.searchResult) expect(url.hash).toEqual('#!/item/list');
.then(result => { });
expect(result).toEqual(1);
}); });
});
it(`should click on the search result to access to the item tags`, () => { it('should search for the item Gem of Time', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') .wait(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemsIndex.searchResult) .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.waitToClick(selectors.itemTags.tagsButton) .click(selectors.itemsIndex.searchButton)
.waitForURL('tags') .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.url() .countSearchResults(selectors.itemsIndex.searchResult)
.then(url => { .then(result => {
expect(url).toContain('tags'); expect(result).toEqual(1);
});
}); });
});
it(`should create a new tag and delete a former one`, () => { it(`should click on the search result to access to the item tags`, () => {
return nightmare return nightmare
.waitToClick(selectors.itemTags.firstRemoveTagButton) .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemTags.addItemTagButton) .waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemTags.fifthTagSelect) .waitToClick(selectors.itemTags.tagsButton)
.waitToClick(selectors.itemTags.fifthTagSelectOptionFive) .waitForURL('tags')
.type(selectors.itemTags.fifthValueInput, 'Thanos') .url()
.clearInput(selectors.itemTags.fifthRelevancyInput) .then(url => {
.type(selectors.itemTags.fifthRelevancyInput, '1') expect(url).toContain('tags');
.click(selectors.itemTags.submitItemTagsButton) });
.waitForSnackbar()
.then(result => {
expect(result).toContain('Data saved!');
}); });
});
it(`should confirm the first select is the expected one`, () => { it(`should create a new tag and delete a former one`, () => {
return nightmare return nightmare
.click(selectors.itemBasicData.basicDataButton) .waitToClick(selectors.itemTags.firstRemoveTagButton)
.wait(selectors.itemBasicData.nameInput) .waitToClick(selectors.itemTags.addItemTagButton)
.click(selectors.itemTags.tagsButton) .waitToClick(selectors.itemTags.fifthTagSelect)
.waitForTextInInput(selectors.itemTags.firstTagDisabled, 'Owner') .waitToClick(selectors.itemTags.fifthTagSelectOptionFive)
.getInputValue(selectors.itemTags.firstTagDisabled) .type(selectors.itemTags.fifthValueInput, 'Thanos')
.then(result => { .clearInput(selectors.itemTags.fifthRelevancyInput)
expect(result).toEqual('Owner'); .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`, () => { it(`should confirm the first select is the expected one`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemTags.firstValueInput, 'Thanos') .click(selectors.itemBasicData.basicDataButton)
.getInputValue(selectors.itemTags.firstValueInput) .wait(selectors.itemBasicData.nameInput)
.then(result => { .click(selectors.itemTags.tagsButton)
expect(result).toEqual('Thanos'); .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`, () => { it(`should confirm the first value is the expected one`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemTags.firstRelevancyInput, '1') .waitForTextInInput(selectors.itemTags.firstValueInput, 'Thanos')
.getInputValue(selectors.itemTags.firstRelevancyInput) .getInputValue(selectors.itemTags.firstValueInput)
.then(result => { .then(result => {
expect(result).toEqual('1'); expect(result).toEqual('Thanos');
});
}); });
});
it(`should confirm the second select is the expected one`, () => { it(`should confirm the first relevancy is the expected one`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemTags.secondTagDisabled, 'Location') .waitForTextInInput(selectors.itemTags.firstRelevancyInput, '1')
.getInputValue(selectors.itemTags.secondTagDisabled) .getInputValue(selectors.itemTags.firstRelevancyInput)
.then(result => { .then(result => {
expect(result).toEqual('Location'); expect(result).toEqual('1');
});
}); });
});
it(`should confirm the second value is the expected one`, () => { it(`should confirm the second select is the expected one`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemTags.secondValueInput, 'Gamoras hideout') .waitForTextInInput(selectors.itemTags.secondTagDisabled, 'Location')
.getInputValue(selectors.itemTags.secondValueInput) .getInputValue(selectors.itemTags.secondTagDisabled)
.then(result => { .then(result => {
expect(result).toEqual('Gamoras hideout'); expect(result).toEqual('Location');
});
}); });
});
it(`should confirm the second relevancy is the expected one`, () => { it(`should confirm the second value is the expected one`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemTags.secondRelevancyInput, '2') .waitForTextInInput(selectors.itemTags.secondValueInput, 'Gamoras hideout')
.getInputValue(selectors.itemTags.secondRelevancyInput) .getInputValue(selectors.itemTags.secondValueInput)
.then(result => { .then(result => {
expect(result).toEqual('2'); expect(result).toEqual('Gamoras hideout');
});
}); });
});
it(`should confirm the third select is the expected one`, () => { it(`should confirm the second relevancy is the expected one`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemTags.thirdTagDisabled, 'Shape') .waitForTextInInput(selectors.itemTags.secondRelevancyInput, '2')
.getInputValue(selectors.itemTags.thirdTagDisabled) .getInputValue(selectors.itemTags.secondRelevancyInput)
.then(result => { .then(result => {
expect(result).toEqual('Shape'); expect(result).toEqual('2');
});
}); });
});
it(`should confirm the third value is the expected one`, () => { it(`should confirm the third select is the expected one`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemTags.thirdValueInput, 'round') .waitForTextInInput(selectors.itemTags.thirdTagDisabled, 'Shape')
.getInputValue(selectors.itemTags.thirdValueInput) .getInputValue(selectors.itemTags.thirdTagDisabled)
.then(result => { .then(result => {
expect(result).toEqual('round'); expect(result).toEqual('Shape');
});
}); });
});
it(`should confirm the third relevancy is the expected one`, () => { it(`should confirm the third value is the expected one`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemTags.thirdRelevancyInput, '3') .waitForTextInInput(selectors.itemTags.thirdValueInput, 'round')
.getInputValue(selectors.itemTags.thirdRelevancyInput) .getInputValue(selectors.itemTags.thirdValueInput)
.then(result => { .then(result => {
expect(result).toEqual('3'); expect(result).toEqual('round');
});
}); });
});
it(`should confirm the fourth select is the expected one`, () => { it(`should confirm the third relevancy is the expected one`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemTags.fourthTagDisabled, 'Power') .waitForTextInInput(selectors.itemTags.thirdRelevancyInput, '3')
.getInputValue(selectors.itemTags.fourthTagDisabled) .getInputValue(selectors.itemTags.thirdRelevancyInput)
.then(result => { .then(result => {
expect(result).toEqual('Power'); expect(result).toEqual('3');
});
}); });
});
it(`should confirm the fourth value is the expected one`, () => { it(`should confirm the fourth select is the expected one`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemTags.fourthValueInput, 'Manipulates time') .waitForTextInInput(selectors.itemTags.fourthTagDisabled, 'Power')
.getInputValue(selectors.itemTags.fourthValueInput) .getInputValue(selectors.itemTags.fourthTagDisabled)
.then(result => { .then(result => {
expect(result).toEqual('Manipulates time'); expect(result).toEqual('Power');
});
}); });
});
it(`should confirm the fourth relevancy is the expected one`, () => { it(`should confirm the fourth value is the expected one`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemTags.fourthRelevancyInput, '4') .waitForTextInInput(selectors.itemTags.fourthValueInput, 'Manipulates time')
.getInputValue(selectors.itemTags.fourthRelevancyInput) .getInputValue(selectors.itemTags.fourthValueInput)
.then(result => { .then(result => {
expect(result).toEqual('4'); expect(result).toEqual('Manipulates time');
});
}); });
});
it(`should confirm the fifth select is the expected one`, () => { it(`should confirm the fourth relevancy is the expected one`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemTags.fifthTagDisabled, 'Color') .waitForTextInInput(selectors.itemTags.fourthRelevancyInput, '4')
.getInputValue(selectors.itemTags.fifthTagDisabled) .getInputValue(selectors.itemTags.fourthRelevancyInput)
.then(result => { .then(result => {
expect(result).toEqual('Color'); expect(result).toEqual('4');
});
}); });
});
it(`should confirm the fifth value is the expected one`, () => { it(`should confirm the fifth select is the expected one`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemTags.fifthValueInput, 'Yellow') .waitForTextInInput(selectors.itemTags.fifthTagDisabled, 'Color')
.getInputValue(selectors.itemTags.fifthValueInput) .getInputValue(selectors.itemTags.fifthTagDisabled)
.then(result => { .then(result => {
expect(result).toEqual('Yellow'); expect(result).toEqual('Color');
});
}); });
});
it(`should confirm the fifth relevancy is the expected one`, () => { it(`should confirm the fifth value is the expected one`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemTags.fifthRelevancyInput, '5') .waitForTextInInput(selectors.itemTags.fifthValueInput, 'Yellow')
.getInputValue(selectors.itemTags.fifthRelevancyInput) .getInputValue(selectors.itemTags.fifthValueInput)
.then(result => { .then(result => {
expect(result).toEqual('5'); 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');
});
}); });
}); });
}); });

View File

@ -1,102 +1,104 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('create item niche path', () => { describe('Item', () => {
const nightmare = createNightmare(); describe('Create niche path', () => {
const nightmare = createNightmare();
beforeAll(() => { 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');
return nightmare return nightmare
.getInputValue(selectors.itemNiches.firstCodeInput); .waitForLogin('developer');
})
.then(result => {
expect(result).toEqual('A1');
}); });
});
it(`should confirm the second niche is the expected one`, () => { it('should access to the items index by clicking the items button', () => {
return nightmare
.getInputValue(selectors.itemNiches.secondWarehouseDisabled)
.then(result => {
expect(result).toEqual('Warehouse Three');
return nightmare return nightmare
.getInputValue(selectors.itemNiches.secondCodeInput); .click(selectors.moduleAccessView.itemsSectionButton)
}) .wait(selectors.itemsIndex.createItemButton)
.then(result => { .parsedUrl()
expect(result).toEqual('A3'); .then(url => {
expect(url.hash).toEqual('#!/item/list');
});
}); });
});
it(`should confirm the third niche is the expected one`, () => { it('should search for the item Gem of Time', () => {
return nightmare
.getInputValue(selectors.itemNiches.thirdWarehouseDisabled)
.then(result => {
expect(result).toEqual('Warehouse Four');
return nightmare return nightmare
.getInputValue(selectors.itemNiches.thirdCodeInput); .wait(selectors.itemsIndex.searchResult)
}) .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.then(result => { .click(selectors.itemsIndex.searchButton)
expect(result).toEqual('A4'); .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');
});
}); });
}); });
}); });

View File

@ -1,132 +1,134 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('create item botanical path', () => { describe('Item', () => {
const nightmare = createNightmare(); describe('Create botanical path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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', () => { it('should access to the items index by clicking the items button', () => {
return nightmare return nightmare
.wait(selectors.itemsIndex.searchResult) .click(selectors.moduleAccessView.itemsSectionButton)
.type(selectors.itemsIndex.searchItemInput, 'Mjolnir') .wait(selectors.itemsIndex.createItemButton)
.click(selectors.itemsIndex.searchButton) .parsedUrl()
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) .then(url => {
.countSearchResults(selectors.itemsIndex.searchResult) expect(url.hash).toEqual('#!/item/list');
.then(result => { });
expect(result).toEqual(1);
}); });
});
it(`should click on the search result to access to the item botanical`, () => { it('should search for the item Gem of Time', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir') .wait(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemsIndex.searchResult) .type(selectors.itemsIndex.searchItemInput, 'Mjolnir')
.waitToClick(selectors.itemBotanical.botanicalButton) .click(selectors.itemsIndex.searchButton)
.waitForURL('botanical') .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.url() .countSearchResults(selectors.itemsIndex.searchResult)
.then(url => { .then(result => {
expect(url).toContain('botanical'); expect(result).toEqual(1);
});
}); });
});
it(`should create a new botanical for the item with id Mjolnir`, () => { it(`should click on the search result to access to the item botanical`, () => {
return nightmare return nightmare
.type(selectors.itemBotanical.botanicalInput, 'Cicuta maculata') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir')
.waitToClick(selectors.itemBotanical.genusSelect) .waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemBotanical.genusSelectOptionOne) .waitToClick(selectors.itemBotanical.botanicalButton)
.waitToClick(selectors.itemBotanical.speciesSelect) .waitForURL('botanical')
.waitToClick(selectors.itemBotanical.speciesSelectOptionOne) .url()
.waitToClick(selectors.itemBotanical.submitBotanicalButton) .then(url => {
.waitForSnackbar() expect(url).toContain('botanical');
.then(result => { });
expect(result).toContain('Data saved!');
}); });
});
it(`should confirm the botanical for item Mjolnir was created`, () => { it(`should create a new botanical for the item with id Mjolnir`, () => {
return nightmare return nightmare
.click(selectors.itemBasicData.basicDataButton) .type(selectors.itemBotanical.botanicalInput, 'Cicuta maculata')
.wait(selectors.itemBasicData.nameInput) .waitToClick(selectors.itemBotanical.genusSelect)
.click(selectors.itemBotanical.botanicalButton) .waitToClick(selectors.itemBotanical.genusSelectOptionOne)
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata') .waitToClick(selectors.itemBotanical.speciesSelect)
.getInputValue(selectors.itemBotanical.botanicalInput) .waitToClick(selectors.itemBotanical.speciesSelectOptionOne)
.then(result => { .waitToClick(selectors.itemBotanical.submitBotanicalButton)
expect(result).toEqual('Cicuta maculata'); .waitForSnackbar()
.then(result => {
expect(result).toContain('Data saved!');
});
}); });
});
it(`should confirm the Genus for item Mjolnir was created`, () => { it(`should confirm the botanical for item Mjolnir was created`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abelia') .click(selectors.itemBasicData.basicDataButton)
.getInputValue(selectors.itemBotanical.genusSelect) .wait(selectors.itemBasicData.nameInput)
.then(result => { .click(selectors.itemBotanical.botanicalButton)
expect(result).toEqual('Abelia'); .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`, () => { it(`should confirm the Genus for item Mjolnir was created`, () => {
return nightmare return nightmare
.getInputValue(selectors.itemBotanical.speciesSelect) .waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abelia')
.then(result => { .getInputValue(selectors.itemBotanical.genusSelect)
expect(result).toEqual('dealbata'); .then(result => {
expect(result).toEqual('Abelia');
});
}); });
});
it(`should edit botanical for the item Mjolnir`, () => { it(`should confirm the Species for item Mjolnir was created`, () => {
return nightmare return nightmare
.clearInput(selectors.itemBotanical.botanicalInput) .getInputValue(selectors.itemBotanical.speciesSelect)
.type(selectors.itemBotanical.botanicalInput, 'Herp Derp') .then(result => {
.waitToClick(selectors.itemBotanical.genusSelect) expect(result).toEqual('dealbata');
.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 botanical for item Mjolnir was edited`, () => { it(`should edit botanical for the item Mjolnir`, () => {
return nightmare return nightmare
.click(selectors.itemBasicData.basicDataButton) .clearInput(selectors.itemBotanical.botanicalInput)
.wait(selectors.itemBasicData.nameInput) .type(selectors.itemBotanical.botanicalInput, 'Herp Derp')
.click(selectors.itemBotanical.botanicalButton) .waitToClick(selectors.itemBotanical.genusSelect)
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp') .waitToClick(selectors.itemBotanical.genusSelectOptionTwo)
.getInputValue(selectors.itemBotanical.botanicalInput) .waitToClick(selectors.itemBotanical.speciesSelect)
.then(result => { .waitToClick(selectors.itemBotanical.speciesSelectOptionTwo)
expect(result).toEqual('Herp Derp'); .waitToClick(selectors.itemBotanical.submitBotanicalButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Data saved!');
});
}); });
});
it(`should confirm the Genus for item Mjolnir was edited`, () => { it(`should confirm the botanical for item Mjolnir was edited`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abies') .click(selectors.itemBasicData.basicDataButton)
.getInputValue(selectors.itemBotanical.genusSelect) .wait(selectors.itemBasicData.nameInput)
.then(result => { .click(selectors.itemBotanical.botanicalButton)
expect(result).toEqual('Abies'); .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`, () => { it(`should confirm the Genus for item Mjolnir was edited`, () => {
return nightmare return nightmare
.getInputValue(selectors.itemBotanical.speciesSelect) .waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abies')
.then(result => { .getInputValue(selectors.itemBotanical.genusSelect)
expect(result).toEqual('decurrens'); .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');
});
}); });
}); });
}); });

View File

@ -1,70 +1,72 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('create item barcodes path', () => { describe('Item', () => {
const nightmare = createNightmare(); describe('Create barcodes path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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', () => { it('should access to the items index by clicking the items button', () => {
return nightmare return nightmare
.wait(selectors.itemsIndex.searchResult) .click(selectors.moduleAccessView.itemsSectionButton)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time') .wait(selectors.itemsIndex.createItemButton)
.click(selectors.itemsIndex.searchButton) .parsedUrl()
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) .then(url => {
.countSearchResults(selectors.itemsIndex.searchResult) expect(url.hash).toEqual('#!/item/list');
.then(result => { });
expect(result).toEqual(1);
}); });
});
it(`should click on the search result to access to the item barcodes`, () => { it('should search for the item Gem of Time', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') .wait(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemsIndex.searchResult) .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.waitToClick(selectors.itemBarcodes.barcodeButton) .click(selectors.itemsIndex.searchButton)
.waitForURL('barcode') .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.url() .countSearchResults(selectors.itemsIndex.searchResult)
.then(url => { .then(result => {
expect(url).toContain('barcode'); expect(result).toEqual(1);
});
}); });
});
it(`should click create a new code and delete a former one`, () => { it(`should click on the search result to access to the item barcodes`, () => {
return nightmare return nightmare
.waitToClick(selectors.itemBarcodes.firstCodeRemoveButton) .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemBarcodes.addBarcodeButton) .waitToClick(selectors.itemsIndex.searchResult)
.wait(selectors.itemBarcodes.thirdCodeInput) .waitToClick(selectors.itemBarcodes.barcodeButton)
.type(selectors.itemBarcodes.thirdCodeInput, '5') .waitForURL('barcode')
.waitToClick(selectors.itemBarcodes.submitBarcodesButton) .url()
.waitForSnackbar() .then(url => {
.then(result => { expect(url).toContain('barcode');
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`, () => { it(`should click create a new code and delete a former one`, () => {
return nightmare return nightmare
.click(selectors.itemBasicData.basicDataButton) .waitToClick(selectors.itemBarcodes.firstCodeRemoveButton)
.wait(selectors.itemBasicData.nameInput) .waitToClick(selectors.itemBarcodes.addBarcodeButton)
.click(selectors.itemBarcodes.barcodeButton) .wait(selectors.itemBarcodes.thirdCodeInput)
.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5') .type(selectors.itemBarcodes.thirdCodeInput, '5')
.getInputValue(selectors.itemBarcodes.thirdCodeInput) .waitToClick(selectors.itemBarcodes.submitBarcodesButton)
.then(result => { .waitForSnackbar()
expect(result).toEqual('5'); .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');
});
}); });
}); });
}); });

View File

@ -2,14 +2,14 @@ import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('Item', () => { describe('Item', () => {
const nightmare = createNightmare(); describe('Create path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .waitForLogin('developer');
}); });
describe('create path', () => {
it('should access to the items index by clicking the items button', () => { it('should access to the items index by clicking the items button', () => {
return nightmare return nightmare
.click(selectors.moduleAccessView.itemsSectionButton) .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', () => { it('should return to the items index by clicking the return to items button', () => {
return nightmare return nightmare
.click(selectors.itemBasicData.goToItemIndexButton) .click(selectors.itemBasicData.goToItemIndexButton)

View File

@ -1,77 +1,79 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('create ticket notes path', () => { describe('Ticket', () => {
const nightmare = createNightmare(); describe('Create notes path', () => {
const nightmare = createNightmare();
beforeAll(() => { 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');
return nightmare return nightmare
.getInputValue(selectors.ticketNotes.firstDescriptionInput); .waitForLogin('developer');
}) });
.then(result => {
expect(result).toEqual('description'); 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');
});
}); });
}); });
}); });

View File

@ -1,59 +1,61 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('delete ticket expeditions path', () => { describe('Ticket', () => {
const nightmare = createNightmare(); describe('Delete expeditions path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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', () => { it('should access to the tickets index by clicking the tickets button', () => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchTicketInput) .click(selectors.moduleAccessView.ticketsSectionButton)
.type(selectors.ticketsIndex.searchTicketInput, '1') .wait(selectors.ticketsIndex.createTicketButton)
.click(selectors.ticketsIndex.searchButton) .parsedUrl()
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .then(url => {
.countSearchResults(selectors.ticketsIndex.searchResult) expect(url.hash).toEqual('#!/ticket/list');
.then(result => { });
expect(result).toEqual(1);
}); });
});
it(`should click on the search result to access to the ticket expeditions`, () => { it('should search for the ticket with id 1', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1') .wait(selectors.ticketsIndex.searchTicketInput)
.waitToClick(selectors.ticketsIndex.searchResult) .type(selectors.ticketsIndex.searchTicketInput, '1')
.waitToClick(selectors.ticketExpedition.expeditionButton) .click(selectors.ticketsIndex.searchButton)
.waitForURL('expedition') .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.url() .countSearchResults(selectors.ticketsIndex.searchResult)
.then(url => { .then(result => {
expect(url).toContain('expedition'); expect(result).toEqual(1);
});
}); });
});
it(`should delete a former expedition and confirm the remaining expedition is the expected one`, () => { it(`should click on the search result to access to the ticket expeditions`, () => {
return nightmare return nightmare
.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton) .waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
.click(selectors.ticketPackages.packagesButton) .waitToClick(selectors.ticketsIndex.searchResult)
.wait(selectors.ticketPackages.firstPackageSelect) .waitToClick(selectors.ticketExpedition.expeditionButton)
.click(selectors.ticketExpedition.expeditionButton) .waitForURL('expedition')
.wait(selectors.ticketExpedition.secondExpeditionText) .url()
.getInnerText(selectors.ticketExpedition.secondExpeditionText) .then(url => {
.then(value => { expect(url).toContain('expedition');
expect(value).toContain('Iron Patriot'); });
expect(value).toContain('root'); });
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');
});
}); });
}); });
}); });

View File

@ -1,73 +1,75 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('list sale path', () => { describe('Ticket', () => {
const nightmare = createNightmare(); describe('List sale path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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');
}); });
});
it('should search for the ticket 1', () => { it('should click on the Tickets button of the top bar menu', () => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .waitToClick(selectors.globalItems.applicationsMenuButton)
.type(selectors.ticketsIndex.searchTicketInput, 1) .wait(selectors.globalItems.applicationsMenuVisible)
.click(selectors.ticketsIndex.searchButton) .waitToClick(selectors.globalItems.ticketsButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .wait(selectors.ticketsIndex.createTicketButton)
.countSearchResults(selectors.ticketsIndex.searchResult) .parsedUrl()
.then(result => { .then(url => {
expect(result).toEqual(1); expect(url.hash).toEqual('#!/ticket/list');
});
}); });
});
it(`should click on the search result to access to the ticket's sale`, () => { it('should search for the ticket 1', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Batman') .wait(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketsIndex.searchResult) .type(selectors.ticketsIndex.searchTicketInput, 1)
.waitToClick(selectors.ticketSales.saleButton) .click(selectors.ticketsIndex.searchButton)
.waitForURL('sale') .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.url() .countSearchResults(selectors.ticketsIndex.searchResult)
.then(url => { .then(result => {
expect(url).toContain('sale'); expect(result).toEqual(1);
});
}); });
});
it('should confirm the fist ticket sale is the expected one', () => { it(`should click on the search result to access to the ticket's sale`, () => {
return nightmare return nightmare
.wait(selectors.ticketSales.firstSaleText) .waitForTextInElement(selectors.ticketsIndex.searchResult, 'Batman')
.getInnerText(selectors.ticketSales.firstSaleText) .waitToClick(selectors.ticketsIndex.searchResult)
.then(value => { .waitToClick(selectors.ticketSales.saleButton)
expect(value).toContain('Color Yellow'); .waitForURL('sale')
expect(value).toContain('2'); .url()
expect(value).toContain('€1.50'); .then(url => {
expect(value).toContain('0 %'); expect(url).toContain('sale');
expect(value).toContain('€3.00'); });
}); });
});
it('should confirm the second ticket sale is the expected one', () => { it('should confirm the fist ticket sale is the expected one', () => {
return nightmare return nightmare
.wait(selectors.ticketSales.secondSaleText) .wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.secondSaleText) .getInnerText(selectors.ticketSales.firstSaleText)
.then(value => { .then(value => {
expect(value).toContain('Color Yellow'); expect(value).toContain('Color Yellow');
expect(value).toContain('5'); expect(value).toContain('2');
expect(value).toContain('€1.50'); expect(value).toContain('€1.50');
expect(value).toContain('0 %'); expect(value).toContain('0 %');
expect(value).toContain('€7.50'); 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');
});
}); });
}); });
}); });

View File

@ -1,126 +1,128 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('create ticket packages path', () => { describe('Ticket', () => {
const nightmare = createNightmare(); describe('Create packages path', () => {
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('developer'); .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');
}); });
});
it('should search for the ticket 1', () => { it('should click on the Tickets button of the top bar menu', () => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .waitToClick(selectors.globalItems.applicationsMenuButton)
.type(selectors.ticketsIndex.searchTicketInput, 1) .wait(selectors.globalItems.applicationsMenuVisible)
.click(selectors.ticketsIndex.searchButton) .waitToClick(selectors.globalItems.ticketsButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .wait(selectors.ticketsIndex.createTicketButton)
.countSearchResults(selectors.ticketsIndex.searchResult) .parsedUrl()
.then(result => { .then(url => {
expect(result).toEqual(1); expect(url.hash).toEqual('#!/ticket/list');
});
}); });
});
it(`should click on the search result to access to the ticket packages`, () => { it('should search for the ticket 1', () => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Batman') .wait(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketsIndex.searchResult) .type(selectors.ticketsIndex.searchTicketInput, 1)
.waitToClick(selectors.ticketPackages.packagesButton) .click(selectors.ticketsIndex.searchButton)
.waitForURL('package/index') .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.url() .countSearchResults(selectors.ticketsIndex.searchResult)
.then(url => { .then(result => {
expect(url).toContain('package/index'); expect(result).toEqual(1);
});
}); });
});
it(`should delete the first package and receive and error to save a new one with blank quantity`, () => { it(`should click on the search result to access to the ticket packages`, () => {
return nightmare return nightmare
.waitToClick(selectors.ticketPackages.firstRemovePackageButton) .waitForTextInElement(selectors.ticketsIndex.searchResult, 'Batman')
.waitToClick(selectors.ticketPackages.addPackageButton) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketPackages.firstPackageSelect) .waitToClick(selectors.ticketPackages.packagesButton)
.waitToClick(selectors.ticketPackages.firstPackageSelectOptionThree) .waitForURL('package/index')
.click(selectors.ticketPackages.savePackagesButton) .url()
.waitForSnackbar() .then(url => {
.then(result => { expect(url).toContain('package/index');
expect(result).toContain('Some fields are invalid'); });
}); });
});
it(`should attempt create a new package but receive an error if quantity is a string`, () => { it(`should delete the first package and receive and error to save a new one with blank quantity`, () => {
return nightmare return nightmare
.type(selectors.ticketPackages.firstQuantityInput, 'ninety 9') .waitToClick(selectors.ticketPackages.firstRemovePackageButton)
.click(selectors.ticketPackages.savePackagesButton) .waitToClick(selectors.ticketPackages.addPackageButton)
.waitForSnackbar() .waitToClick(selectors.ticketPackages.firstPackageSelect)
.then(result => { .waitToClick(selectors.ticketPackages.firstPackageSelectOptionThree)
expect(result).toContain('Some fields are invalid'); .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`, () => { it(`should attempt create a new package but receive an error if quantity is a string`, () => {
return nightmare return nightmare
.clearInput(selectors.ticketPackages.firstQuantityInput) .type(selectors.ticketPackages.firstQuantityInput, 'ninety 9')
.type(selectors.ticketPackages.firstQuantityInput, '0') .click(selectors.ticketPackages.savePackagesButton)
.click(selectors.ticketPackages.savePackagesButton) .waitForSnackbar()
.waitForSnackbar() .then(result => {
.then(result => { expect(result).toContain('Some fields are invalid');
expect(result).toContain('Some fields are invalid'); });
}); });
});
it(`should attempt create a new package but receive an error if package is blank`, () => { it(`should attempt create a new package but receive an error if quantity is 0`, () => {
return nightmare return nightmare
.clearInput(selectors.ticketPackages.firstQuantityInput) .clearInput(selectors.ticketPackages.firstQuantityInput)
.type(selectors.ticketPackages.firstQuantityInput, '99') .type(selectors.ticketPackages.firstQuantityInput, '0')
.click(selectors.ticketPackages.clearPackageSelectButton) .click(selectors.ticketPackages.savePackagesButton)
.click(selectors.ticketPackages.savePackagesButton) .waitForSnackbar()
.waitForSnackbar() .then(result => {
.then(result => { expect(result).toContain('Some fields are invalid');
expect(result).toContain('Package cannot be blank'); });
}); });
});
it(`should create a new package with correct data`, () => { it(`should attempt create a new package but receive an error if package is blank`, () => {
return nightmare return nightmare
.waitToClick(selectors.ticketPackages.firstPackageSelect) .clearInput(selectors.ticketPackages.firstQuantityInput)
.waitToClick(selectors.ticketPackages.firstPackageSelectOptionThree) .type(selectors.ticketPackages.firstQuantityInput, '99')
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Iron Patriot') .click(selectors.ticketPackages.clearPackageSelectButton)
.click(selectors.ticketPackages.savePackagesButton) .click(selectors.ticketPackages.savePackagesButton)
.waitForSnackbar() .waitForSnackbar()
.then(result => { .then(result => {
expect(result).toContain('Data saved!'); expect(result).toContain('Package cannot be blank');
});
}); });
});
it(`should confirm the first select is the expected one`, () => { it(`should create a new package with correct data`, () => {
return nightmare return nightmare
.click(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketPackages.firstPackageSelect)
.wait(selectors.ticketSales.firstPackageSelect) .waitToClick(selectors.ticketPackages.firstPackageSelectOptionThree)
.click(selectors.ticketPackages.packagesButton) .waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Iron Patriot')
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Iron Patriot') .click(selectors.ticketPackages.savePackagesButton)
.getInputValue(selectors.ticketPackages.firstPackageSelect) .waitForSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Iron Patriot'); expect(result).toContain('Data saved!');
});
}); });
});
it(`should confirm the first quantity is the expected one`, () => { it(`should confirm the first select is the expected one`, () => {
return nightmare return nightmare
.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99') .click(selectors.ticketSales.saleButton)
.getInputValue(selectors.ticketPackages.firstQuantityInput) .wait(selectors.ticketSales.firstPackageSelect)
.then(result => { .click(selectors.ticketPackages.packagesButton)
expect(result).toEqual('99'); .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');
});
}); });
}); });
}); });