Merge branch 'dev' of https://git.verdnatura.es/salix into dev

This commit is contained in:
Juan 2018-10-22 17:54:12 +02:00
commit 9f7be6364c
29 changed files with 1095 additions and 786 deletions

View File

@ -311,7 +311,7 @@ export default {
}, },
ticketSales: { ticketSales: {
saleLine: `vn-table div > vn-tbody > vn-tr`, saleLine: `vn-table div > vn-tbody > vn-tr`,
saleDescriptorPopover: `vn-item-descriptor-popover vn-item-descriptor`, saleDescriptorPopover: 'vn-ticket-sale vn-item-descriptor-popover > vn-popover',
saleDescriptorPopoverSummaryButton: 'vn-item-descriptor-popover a[href="#!/item/1/summary"]', saleDescriptorPopoverSummaryButton: 'vn-item-descriptor-popover a[href="#!/item/1/summary"]',
saleButton: `vn-menu-item a[ui-sref="ticket.card.sale"]`, saleButton: `vn-menu-item a[ui-sref="ticket.card.sale"]`,
descriptorItemDiaryButton: `vn-item-descriptor > vn-card > div > vn-horizontal.quicklinks.ng-scope > vn-horizontal > a > vn-icon > i`, descriptorItemDiaryButton: `vn-item-descriptor > vn-card > div > vn-horizontal.quicklinks.ng-scope > vn-horizontal > a > vn-icon > i`,
@ -351,11 +351,11 @@ export default {
stateMenuOptions: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(1)', stateMenuOptions: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(1)',
moreMenuButton: 'vn-ticket-sale vn-tool-bar > vn-icon-menu[label="More"] button', moreMenuButton: 'vn-ticket-sale vn-tool-bar > vn-icon-menu[label="More"] button',
moreMenuDeleteOption: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(2)', moreMenuDeleteOption: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(2)',
moreMenuReseveOption: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(3)', moreMenuReseveOption: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(4)',
moreMenuUnmarkResevedOption: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(4)', moreMenuUnmarkResevedOption: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(5)',
moreMenuUpdateDiscount: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(5)', moreMenuUpdateDiscount: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(5)',
moreMenuUpdateDiscountInput: 'vn-ticket-sale vn-dialog.shown vn-ticket-sale-edit-discount input', moreMenuUpdateDiscountInput: 'vn-ticket-sale vn-dialog.shown vn-ticket-sale-edit-discount input',
moreMenuCreateClaim: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(6)' moreMenuCreateClaim: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(1)'
}, },
ticketTracking: { ticketTracking: {
trackingButton: `vn-left-menu a[ui-sref="ticket.card.tracking.index"]`, trackingButton: `vn-left-menu a[ui-sref="ticket.card.tracking.index"]`,

View File

@ -9,7 +9,7 @@ describe('Claim edit basic data path', () => {
.waitForLogin('salesAssistant'); .waitForLogin('salesAssistant');
}); });
it('should click on the Claims button of the top bar menu', () => { it('should click on the Claims button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -18,10 +18,11 @@ describe('Claim edit basic data path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/claim/index'); expect(url.hash).toEqual('#!/claim/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the claim with id 1', () => { it('should search for the claim with id 1', done => {
return nightmare return nightmare
.wait(selectors.claimsIndex.searchResult) .wait(selectors.claimsIndex.searchResult)
.type(selectors.claimsIndex.searchClaimInput, '1') .type(selectors.claimsIndex.searchClaimInput, '1')
@ -30,10 +31,11 @@ describe('Claim edit basic data path', () => {
.countElement(selectors.claimsIndex.searchResult) .countElement(selectors.claimsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the claim Basic Data`, () => { it(`should click on the search result to access to the claim Basic Data`, done => {
return nightmare return nightmare
.waitToClick(selectors.claimsIndex.searchResult) .waitToClick(selectors.claimsIndex.searchResult)
.waitToClick(selectors.claimBasicData.basicDataButton) .waitToClick(selectors.claimBasicData.basicDataButton)
@ -41,10 +43,11 @@ describe('Claim edit basic data path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('basic-data'); expect(url).toContain('basic-data');
}); done();
}).catch(done.fail);
}); });
it(`should edit claim state, is paid with mana and observation fields`, () => { it(`should edit claim state, is paid with mana and observation fields`, done => {
return nightmare return nightmare
.waitToClick(selectors.claimBasicData.claimStateSelect) .waitToClick(selectors.claimBasicData.claimStateSelect)
.waitToClick(selectors.claimBasicData.claimStateSelectThirdOption) .waitToClick(selectors.claimBasicData.claimStateSelectThirdOption)
@ -55,10 +58,11 @@ describe('Claim edit basic data path', () => {
.waitForSnackbar() .waitForSnackbar()
.then(result => { .then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Data saved!'])); expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
}); done();
}).catch(done.fail);
}); });
it('should confirm the claim state was edited', () => { it('should confirm the claim state was edited', done => {
return nightmare return nightmare
.click(selectors.claimDetails.detailsButton) .click(selectors.claimDetails.detailsButton)
.wait(selectors.claimDetails.addItemButton) .wait(selectors.claimDetails.addItemButton)
@ -67,28 +71,31 @@ describe('Claim edit basic data path', () => {
.getInputValue(selectors.claimBasicData.claimStateSelect) .getInputValue(selectors.claimBasicData.claimStateSelect)
.then(result => { .then(result => {
expect(result).toEqual('Gestionado'); expect(result).toEqual('Gestionado');
}); done();
}).catch(done.fail);
}); });
it('should confirm the Is paid with mana checkbox is checked', () => { it('should confirm the Is paid with mana checkbox is checked', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.claimBasicData.isPaidWithManaCheckbox) }, selectors.claimBasicData.isPaidWithManaCheckbox)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should confirm the claim observation was edited', () => { it('should confirm the claim observation was edited', done => {
return nightmare return nightmare
.getInputValue(selectors.claimBasicData.observationInput) .getInputValue(selectors.claimBasicData.observationInput)
.then(result => { .then(result => {
expect(result).toEqual('edited observation'); expect(result).toEqual('edited observation');
}); done();
}).catch(done.fail);
}); });
it(`should edit the claim to leave it untainted`, () => { it(`should edit the claim to leave it untainted`, done => {
return nightmare return nightmare
.waitToClick(selectors.claimBasicData.claimStateSelect) .waitToClick(selectors.claimBasicData.claimStateSelect)
.waitToClick(selectors.claimBasicData.claimStateSelectFourthOption) .waitToClick(selectors.claimBasicData.claimStateSelectFourthOption)
@ -99,6 +106,7 @@ describe('Claim edit basic data path', () => {
.waitForSnackbar() .waitForSnackbar()
.then(result => { .then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Data saved!'])); expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
}); done();
}).catch(done.fail);
}); });
}); });

View File

@ -10,17 +10,18 @@ describe('Client', () => {
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should access to the clients index by clicking the clients button', () => { it('should access to the clients index by clicking the clients button', done => {
return nightmare return nightmare
.click(selectors.moduleAccessView.clientsSectionButton) .click(selectors.moduleAccessView.clientsSectionButton)
.wait(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.createClientButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it(`should search for the user Carol Danvers to confirm it isn't created yet`, () => { it(`should search for the user Carol Danvers to confirm it isn't created yet`, done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Carol Danvers') .type(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
@ -29,49 +30,54 @@ describe('Client', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(0); expect(result).toEqual(0);
}); done();
}).catch(done.fail);
}); });
it('should access to the create client view by clicking the create-client floating button', () => { it('should access to the create client view by clicking the create-client floating button', done => {
return nightmare return nightmare
.click(selectors.clientsIndex.createClientButton) .click(selectors.clientsIndex.createClientButton)
.wait(selectors.createClientView.createButton) .wait(selectors.createClientView.createButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/create'); expect(url.hash).toEqual('#!/client/create');
}); done();
}).catch(done.fail);
}); });
it('should return to the client index by clicking the cancel button', () => { it('should return to the client index by clicking the cancel button', done => {
return nightmare return nightmare
.click(selectors.createClientView.cancelButton) .click(selectors.createClientView.cancelButton)
.wait(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.createClientButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should now access to the create client view by clicking the create-client floating button', () => { it('should now access to the create client view by clicking the create-client floating button', done => {
return nightmare return nightmare
.click(selectors.clientsIndex.createClientButton) .click(selectors.clientsIndex.createClientButton)
.wait(selectors.createClientView.createButton) .wait(selectors.createClientView.createButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/create'); expect(url.hash).toEqual('#!/client/create');
}); done();
}).catch(done.fail);
}); });
it('should receive an error when clicking the create button having all the form fields empty', () => { it('should receive an error when clicking the create button having all the form fields empty', done => {
return nightmare return nightmare
.click(selectors.createClientView.createButton) .click(selectors.createClientView.createButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Some fields are invalid'); expect(result).toEqual('Some fields are invalid');
}); done();
}).catch(done.fail);
}); });
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 name and Business name fields empty', done => {
return nightmare return nightmare
.type(selectors.createClientView.taxNumber, '74451390E') .type(selectors.createClientView.taxNumber, '74451390E')
.type(selectors.createClientView.userName, 'CaptainMarvel') .type(selectors.createClientView.userName, 'CaptainMarvel')
@ -82,10 +88,11 @@ describe('Client', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Some fields are invalid'); expect(result).toEqual('Some fields are invalid');
}); done();
}).catch(done.fail);
}); });
it(`should attempt to create a new user with all it's data but wrong email`, () => { it(`should attempt to create a new user with all it's data but wrong email`, done => {
return nightmare return nightmare
.type(selectors.createClientView.name, 'Carol Danvers') .type(selectors.createClientView.name, 'Carol Danvers')
.type(selectors.createClientView.socialName, 'AVG tax') .type(selectors.createClientView.socialName, 'AVG tax')
@ -95,10 +102,11 @@ describe('Client', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Some fields are invalid'); expect(result).toEqual('Some fields are invalid');
}); done();
}).catch(done.fail);
}); });
it(`should create a new user with all correct data`, () => { it(`should create a new user with all correct data`, done => {
return nightmare return nightmare
.clearInput(selectors.createClientView.email) .clearInput(selectors.createClientView.email)
.type(selectors.createClientView.email, 'caroldanvers@verdnatura.es') .type(selectors.createClientView.email, 'caroldanvers@verdnatura.es')
@ -106,10 +114,11 @@ describe('Client', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should click on the Clients button of the top bar menu', () => { it('should click on the Clients button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -118,10 +127,11 @@ describe('Client', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it(`should search for the user Carol Danvers to confirm it exists`, () => { it(`should search for the user Carol Danvers to confirm it exists`, done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Carol Danvers') .type(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
@ -130,7 +140,8 @@ describe('Client', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -9,7 +9,7 @@ describe('Client Edit basicData path', () => {
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should click on the Clients button of the top bar menu', () => { it('should click on the Clients button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -18,10 +18,11 @@ describe('Client Edit basicData path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the user Bruce Wayne', () => { it('should search for the user Bruce Wayne', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Wayne') .type(selectors.clientsIndex.searchClientInput, 'Bruce Wayne')
@ -30,10 +31,11 @@ describe('Client Edit basicData path', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it('should click on the search result to access to the client summary', () => { it('should click on the search result to access to the client summary', done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Wayne') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Wayne')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
@ -41,10 +43,11 @@ describe('Client Edit basicData path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('summary'); expect(url).toContain('summary');
}); done();
}).catch(done.fail);
}); });
it('should not be able to change the salesPerson', () => { it('should not be able to change the salesPerson', done => {
return nightmare return nightmare
.click(selectors.clientBasicData.basicDataButton) .click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput) .wait(selectors.clientBasicData.nameInput)
@ -53,10 +56,11 @@ describe('Client Edit basicData path', () => {
}, selectors.clientBasicData.salesPersonInput) }, selectors.clientBasicData.salesPersonInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should edit the client basic data but leave salesPerson untainted', () => { it('should edit the client basic data but leave salesPerson untainted', done => {
return nightmare return nightmare
.clearInput(selectors.clientBasicData.nameInput) .clearInput(selectors.clientBasicData.nameInput)
.type(selectors.clientBasicData.nameInput, 'Ptonomy Wallace') .type(selectors.clientBasicData.nameInput, 'Ptonomy Wallace')
@ -74,10 +78,11 @@ describe('Client Edit basicData path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should confirm the name have been edited', () => { it('should confirm the name have been edited', done => {
return nightmare return nightmare
.click(selectors.clientFiscalData.fiscalDataButton) .click(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.addressInput) .wait(selectors.clientFiscalData.addressInput)
@ -86,47 +91,53 @@ describe('Client Edit basicData path', () => {
.getInputValue(selectors.clientBasicData.nameInput) .getInputValue(selectors.clientBasicData.nameInput)
.then(result => { .then(result => {
expect(result).toEqual('Ptonomy Wallace'); expect(result).toEqual('Ptonomy Wallace');
}); done();
}).catch(done.fail);
}); });
it('should confirm the contact name have been edited', () => { it('should confirm the contact name have been edited', done => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.contactInput) .getInputValue(selectors.clientBasicData.contactInput)
.then(result => { .then(result => {
expect(result).toEqual('David Haller'); expect(result).toEqual('David Haller');
}); done();
}).catch(done.fail);
}); });
it('should confirm the landline phone number have been added', () => { it('should confirm the landline phone number have been added', done => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.phoneInput) .getInputValue(selectors.clientBasicData.phoneInput)
.then(result => { .then(result => {
expect(result).toEqual('987654321'); expect(result).toEqual('987654321');
}); done();
}).catch(done.fail);
}); });
it('should confirm the mobile phone number have been added', () => { it('should confirm the mobile phone number have been added', done => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.mobileInput) .getInputValue(selectors.clientBasicData.mobileInput)
.then(result => { .then(result => {
expect(result).toEqual('123456789'); expect(result).toEqual('123456789');
}); done();
}).catch(done.fail);
}); });
it('should confirm the email have been edited', () => { it('should confirm the email have been edited', done => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.emailInput) .getInputValue(selectors.clientBasicData.emailInput)
.then(result => { .then(result => {
expect(result).toEqual('PWallace@verdnatura.es'); expect(result).toEqual('PWallace@verdnatura.es');
}); done();
}).catch(done.fail);
}); });
it('should confirm the channel have been selected', () => { it('should confirm the channel have been selected', done => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.channelInput) .getInputValue(selectors.clientBasicData.channelInput)
.then(result => { .then(result => {
expect(result).toEqual('Rumors on the streets'); expect(result).toEqual('Rumors on the streets');
}); done();
}).catch(done.fail);
}); });
}); });
@ -137,7 +148,7 @@ describe('Client Edit basicData path', () => {
.waitForLogin('salesAssistant'); .waitForLogin('salesAssistant');
}); });
it('should now click on the Clients button of the top bar menu', () => { it('should now click on the Clients button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -146,10 +157,11 @@ describe('Client Edit basicData path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should now search for the user Ptonomy Wallace', () => { it('should now search for the user Ptonomy Wallace', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Ptonomy Wallace') .type(selectors.clientsIndex.searchClientInput, 'Ptonomy Wallace')
@ -158,10 +170,11 @@ describe('Client Edit basicData path', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it('should now click on the search result to access to the client summary', () => { it('should now click on the search result to access to the client summary', done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Ptonomy Wallace') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Ptonomy Wallace')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
@ -169,10 +182,11 @@ describe('Client Edit basicData path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('summary'); expect(url).toContain('summary');
}); done();
}).catch(done.fail);
}); });
it('should be able to change the salesPerson', () => { it('should be able to change the salesPerson', done => {
return nightmare return nightmare
.click(selectors.clientBasicData.basicDataButton) .click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput) .wait(selectors.clientBasicData.nameInput)
@ -181,10 +195,11 @@ describe('Client Edit basicData path', () => {
}, selectors.clientBasicData.salesPersonInput) }, selectors.clientBasicData.salesPersonInput)
.then(value => { .then(value => {
expect(value).toBeFalsy(); expect(value).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it('should edit the client basic data including salesPerson', () => { it('should edit the client basic data including salesPerson', done => {
return nightmare return nightmare
.clearInput(selectors.clientBasicData.nameInput) .clearInput(selectors.clientBasicData.nameInput)
.type(selectors.clientBasicData.nameInput, 'Ororo Munroe') .type(selectors.clientBasicData.nameInput, 'Ororo Munroe')
@ -204,10 +219,11 @@ describe('Client Edit basicData path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should now confirm the name have been edited', () => { it('should now confirm the name have been edited', done => {
return nightmare return nightmare
.click(selectors.clientFiscalData.fiscalDataButton) .click(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.addressInput) .wait(selectors.clientFiscalData.addressInput)
@ -216,55 +232,62 @@ describe('Client Edit basicData path', () => {
.getInputValue(selectors.clientBasicData.nameInput) .getInputValue(selectors.clientBasicData.nameInput)
.then(result => { .then(result => {
expect(result).toEqual('Ororo Munroe'); expect(result).toEqual('Ororo Munroe');
}); done();
}).catch(done.fail);
}); });
it('should now confirm the contact name have been edited', () => { it('should now confirm the contact name have been edited', done => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.contactInput) .getInputValue(selectors.clientBasicData.contactInput)
.then(result => { .then(result => {
expect(result).toEqual('Black Panther'); expect(result).toEqual('Black Panther');
}); done();
}).catch(done.fail);
}); });
it('should now confirm the landline phone number have been added', () => { it('should now confirm the landline phone number have been added', done => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.phoneInput) .getInputValue(selectors.clientBasicData.phoneInput)
.then(result => { .then(result => {
expect(result).toEqual('123456789'); expect(result).toEqual('123456789');
}); done();
}).catch(done.fail);
}); });
it('should now confirm the mobile phone number have been added', () => { it('should now confirm the mobile phone number have been added', done => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.mobileInput) .getInputValue(selectors.clientBasicData.mobileInput)
.then(result => { .then(result => {
expect(result).toEqual('987654321'); expect(result).toEqual('987654321');
}); done();
}).catch(done.fail);
}); });
it('should now confirm the email have been edited', () => { it('should now confirm the email have been edited', done => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.emailInput) .getInputValue(selectors.clientBasicData.emailInput)
.then(result => { .then(result => {
expect(result).toEqual('Storm@verdnatura.es'); expect(result).toEqual('Storm@verdnatura.es');
}); done();
}).catch(done.fail);
}); });
it('should confirm the sales person have been selected', () => { it('should confirm the sales person have been selected', done => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.salesPersonInput) .getInputValue(selectors.clientBasicData.salesPersonInput)
.then(result => { .then(result => {
expect(result).toEqual('accessory'); expect(result).toEqual('accessory');
}); done();
}).catch(done.fail);
}); });
it('should now confirm the channel have been selected', () => { it('should now confirm the channel have been selected', done => {
return nightmare return nightmare
.getInputValue(selectors.clientBasicData.channelInput) .getInputValue(selectors.clientBasicData.channelInput)
.then(result => { .then(result => {
expect(result).toEqual('Metropolis newspaper'); expect(result).toEqual('Metropolis newspaper');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -9,7 +9,7 @@ describe('Client Edit fiscalData path', () => {
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should click on the Clients button of the top bar menu', () => { it('should click on the Clients button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -18,10 +18,11 @@ describe('Client Edit fiscalData path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the user Bruce Banner', () => { it('should search for the user Bruce Banner', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
@ -30,7 +31,8 @@ describe('Client Edit fiscalData path', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
// Confirms all addresses have EQtax false for future propagation test step 1 // Confirms all addresses have EQtax false for future propagation test step 1
@ -83,7 +85,7 @@ describe('Client Edit fiscalData path', () => {
}); });
}); });
it('should not be able to edit the social name', () => { it('should not be able to edit the social name', done => {
return nightmare return nightmare
.wait(selectors.clientFiscalData.socialNameInput) .wait(selectors.clientFiscalData.socialNameInput)
.evaluate(selector => { .evaluate(selector => {
@ -91,157 +93,173 @@ describe('Client Edit fiscalData path', () => {
}, selectors.clientFiscalData.socialNameInput) }, selectors.clientFiscalData.socialNameInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should not be able to edit the fiscal id', () => { it('should not be able to edit the fiscal id', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.fiscalIdInput) }, selectors.clientFiscalData.fiscalIdInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should not be able to edit the address', () => { it('should not be able to edit the address', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.addressInput) }, selectors.clientFiscalData.addressInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should not be able to edit the postcode', () => { it('should not be able to edit the postcode', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.postcodeInput) }, selectors.clientFiscalData.postcodeInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should not be able to edit the city', () => { it('should not be able to edit the city', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.cityInput) }, selectors.clientFiscalData.cityInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should not be able to edit the country', () => { it('should not be able to edit the country', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.countryInput) }, selectors.clientFiscalData.countryInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should not be able to edit the province', () => { it('should not be able to edit the province', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.provinceInput) }, selectors.clientFiscalData.provinceInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should not be able to edit the active checkbox', () => { it('should not be able to edit the active checkbox', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.activeCheckboxInput) }, selectors.clientFiscalData.activeCheckboxInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should not be able to edit the frozen checkbox', () => { it('should not be able to edit the frozen checkbox', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.frozenCheckboxInput) }, selectors.clientFiscalData.frozenCheckboxInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should not be able to edit the has to invoice checkbox', () => { it('should not be able to edit the has to invoice checkbox', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.hasToInvoiceCheckboxInput) }, selectors.clientFiscalData.hasToInvoiceCheckboxInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should not be able to edit the vies checkbox', () => { it('should not be able to edit the vies checkbox', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.viesCheckboxInput) }, selectors.clientFiscalData.viesCheckboxInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should not be able to edit the invoice by mail checkbox', () => { it('should not be able to edit the invoice by mail checkbox', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.invoiceByMailCheckboxInput) }, selectors.clientFiscalData.invoiceByMailCheckboxInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should not be able to edit the invoice by address', () => { it('should not be able to edit the invoice by address', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.invoiceByAddressCheckboxInput) }, selectors.clientFiscalData.invoiceByAddressCheckboxInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should not be able to edit the equalization tax checkbox', () => { it('should not be able to edit the equalization tax checkbox', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.equalizationTaxCheckboxLabel) }, selectors.clientFiscalData.equalizationTaxCheckboxLabel)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should not be able to edit the verified data checkbox', () => { it('should not be able to edit the verified data checkbox', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.verifiedDataCheckboxInput) }, selectors.clientFiscalData.verifiedDataCheckboxInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should not be able to use the submit button', () => { it('should not be able to use the submit button', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.saveButton) }, selectors.clientFiscalData.saveButton)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
}); });
@ -251,7 +269,7 @@ describe('Client Edit fiscalData path', () => {
.waitForLogin('administrative'); .waitForLogin('administrative');
}); });
it('should now click on the Clients button of the top bar menu', () => { it('should now click on the Clients button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -260,10 +278,11 @@ describe('Client Edit fiscalData path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should now search for the user Bruce Banner', () => { it('should now search for the user Bruce Banner', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
@ -272,7 +291,8 @@ describe('Client Edit fiscalData path', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should access to the client fiscal data`, () => { it(`should access to the client fiscal data`, () => {
@ -287,7 +307,7 @@ describe('Client Edit fiscalData path', () => {
}); });
}); });
it('should edit the clients fiscal data', () => { it('should edit the clients fiscal data', done => {
return nightmare return nightmare
.wait(selectors.clientFiscalData.socialNameInput) .wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput) .clearInput(selectors.clientFiscalData.socialNameInput)
@ -317,16 +337,18 @@ describe('Client Edit fiscalData path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should propagate the Equalization tax', () => { it('should propagate the Equalization tax', done => {
return nightmare return nightmare
.waitToClick(selectors.clientFiscalData.acceptPropagationButton) .waitToClick(selectors.clientFiscalData.acceptPropagationButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Equivalent tax spreaded'); expect(result).toEqual('Equivalent tax spreaded');
}); done();
}).catch(done.fail);
}); });
// confirm all addresses have now EQtax checked step 1 // confirm all addresses have now EQtax checked step 1
@ -367,46 +389,51 @@ describe('Client Edit fiscalData path', () => {
}); });
}); });
it('should navigate back to fiscal data to confirm its name have been edited', () => { it('should navigate back to fiscal data to confirm its name have been edited', done => {
return nightmare return nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.socialNameInput) .wait(selectors.clientFiscalData.socialNameInput)
.getInputValue(selectors.clientFiscalData.socialNameInput) .getInputValue(selectors.clientFiscalData.socialNameInput)
.then(result => { .then(result => {
expect(result).toEqual('SMASH!'); expect(result).toEqual('SMASH!');
}); done();
}).catch(done.fail);
}); });
it('should confirm the fiscal id have been edited', () => { it('should confirm the fiscal id have been edited', done => {
return nightmare return nightmare
.getInputValue(selectors.clientFiscalData.fiscalIdInput) .getInputValue(selectors.clientFiscalData.fiscalIdInput)
.then(result => { .then(result => {
expect(result).toEqual('94980061C'); expect(result).toEqual('94980061C');
}); done();
}).catch(done.fail);
}); });
it('should confirm the address have been edited', () => { it('should confirm the address have been edited', done => {
return nightmare return nightmare
.getInputValue(selectors.clientFiscalData.addressInput) .getInputValue(selectors.clientFiscalData.addressInput)
.then(result => { .then(result => {
expect(result).toEqual('Somewhere edited'); expect(result).toEqual('Somewhere edited');
}); done();
}).catch(done.fail);
}); });
it('should confirm the postcode have been edited', () => { it('should confirm the postcode have been edited', done => {
return nightmare return nightmare
.getInputValue(selectors.clientFiscalData.postcodeInput) .getInputValue(selectors.clientFiscalData.postcodeInput)
.then(result => { .then(result => {
expect(result).toEqual('12345'); expect(result).toEqual('12345');
}); done();
}).catch(done.fail);
}); });
it('should confirm the city have been edited', () => { it('should confirm the city have been edited', done => {
return nightmare return nightmare
.getInputValue(selectors.clientFiscalData.cityInput) .getInputValue(selectors.clientFiscalData.cityInput)
.then(result => { .then(result => {
expect(result).toEqual('N/A'); expect(result).toEqual('N/A');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the country have been selected`, () => { it(`should confirm the country have been selected`, () => {
@ -425,84 +452,92 @@ describe('Client Edit fiscalData path', () => {
}); });
}); });
it('should confirm active checkbox is unchecked', () => { it('should confirm active checkbox is unchecked', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.activeCheckboxLabel) }, selectors.clientFiscalData.activeCheckboxLabel)
.then(value => { .then(value => {
expect(value).toBeFalsy(); expect(value).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it('should confirm frozen checkbox is unchecked', () => { it('should confirm frozen checkbox is unchecked', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.frozenCheckboxLabel) }, selectors.clientFiscalData.frozenCheckboxLabel)
.then(value => { .then(value => {
expect(value).toBeFalsy(); expect(value).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it('should confirm Has to invoice checkbox is unchecked', () => { it('should confirm Has to invoice checkbox is unchecked', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.hasToInvoiceCheckboxLabel) }, selectors.clientFiscalData.hasToInvoiceCheckboxLabel)
.then(value => { .then(value => {
expect(value).toBeFalsy(); expect(value).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it('should confirm Vies checkbox is checked', () => { it('should confirm Vies checkbox is checked', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.viesCheckboxInput) }, selectors.clientFiscalData.viesCheckboxInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should confirm Invoice by mail checkbox is unchecked', () => { it('should confirm Invoice by mail checkbox is unchecked', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.invoiceByMailCheckboxLabel) }, selectors.clientFiscalData.invoiceByMailCheckboxLabel)
.then(value => { .then(value => {
expect(value).toBeFalsy(); expect(value).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it('should confirm invoice by address checkbox is unchecked', () => { it('should confirm invoice by address checkbox is unchecked', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.invoiceByAddressCheckboxInput) }, selectors.clientFiscalData.invoiceByAddressCheckboxInput)
.then(value => { .then(value => {
expect(value).toBeFalsy(); expect(value).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it('should confirm Equalization tax checkbox is checked', () => { it('should confirm Equalization tax checkbox is checked', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.equalizationTaxCheckboxLabel) }, selectors.clientFiscalData.equalizationTaxCheckboxLabel)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should confirm Verified data checkbox is checked', () => { it('should confirm Verified data checkbox is checked', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.verifiedDataCheckboxInput) }, selectors.clientFiscalData.verifiedDataCheckboxInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 1 // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 1
@ -529,7 +564,7 @@ describe('Client Edit fiscalData path', () => {
}); });
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 3 // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 3
it('should navigate back to fiscal data to confirm invoice by address is now checked', () => { it('should navigate back to fiscal data to confirm invoice by address is now checked', done => {
return nightmare return nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.invoiceByAddressCheckboxInput) .wait(selectors.clientFiscalData.invoiceByAddressCheckboxInput)
@ -538,7 +573,8 @@ describe('Client Edit fiscalData path', () => {
}, selectors.clientFiscalData.invoiceByAddressCheckboxInput) }, selectors.clientFiscalData.invoiceByAddressCheckboxInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,7 +10,7 @@ xdescribe('Client', () => {
.waitForLogin('administrative'); .waitForLogin('administrative');
}); });
it('should click on the Clients button of the top bar menu', () => { it('should click on the Clients button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -19,10 +19,11 @@ xdescribe('Client', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the user Bruce Banner', () => { it('should search for the user Bruce Banner', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
@ -31,10 +32,11 @@ xdescribe('Client', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the client's pay method`, () => { it(`should click on the search result to access to the client's pay method`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
@ -43,10 +45,11 @@ xdescribe('Client', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('billing-data'); expect(url).toContain('billing-data');
}); done();
}).catch(done.fail);
}); });
it(`should attempt to edit the Pay method without an IBAN but fail`, () => { it(`should attempt to edit the Pay method without an IBAN but fail`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientPayMethod.payMethodInput) .waitToClick(selectors.clientPayMethod.payMethodInput)
.waitToClick(selectors.clientPayMethod.payMethodIBANOption) .waitToClick(selectors.clientPayMethod.payMethodIBANOption)
@ -61,10 +64,11 @@ xdescribe('Client', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('That payment method requires an IBAN'); expect(result).toEqual('That payment method requires an IBAN');
}); done();
}).catch(done.fail);
}); });
it(`should add the IBAN`, () => { it(`should add the IBAN`, done => {
return nightmare return nightmare
.clearInput(selectors.clientPayMethod.IBANInput) .clearInput(selectors.clientPayMethod.IBANInput)
.type(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332') .type(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332')
@ -73,53 +77,59 @@ xdescribe('Client', () => {
.waitForSnackbar() .waitForSnackbar()
.then(result => { .then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Data saved!', 'Notification sent!'])); expect(result).toEqual(jasmine.arrayContaining(['Data saved!', 'Notification sent!']));
}); done();
}).catch(done.fail);
}); });
it(`should confirm the IBAN pay method is sucessfully saved`, () => { it(`should confirm the IBAN pay method is sucessfully saved`, done => {
return nightmare return nightmare
.getInputValue(selectors.clientPayMethod.payMethodInput) .getInputValue(selectors.clientPayMethod.payMethodInput)
.then(result => { .then(result => {
expect(result).toEqual('PayMethod with IBAN'); expect(result).toEqual('PayMethod with IBAN');
}); done();
}).catch(done.fail);
}); });
it('should confirm the due day have been edited', () => { it('should confirm the due day have been edited', done => {
return nightmare return nightmare
.getInputValue(selectors.clientPayMethod.dueDayInput) .getInputValue(selectors.clientPayMethod.dueDayInput)
.then(result => { .then(result => {
expect(result).toEqual('60'); expect(result).toEqual('60');
}); done();
}).catch(done.fail);
}); });
it('should confirm Received LCR checkbox is checked', () => { it('should confirm Received LCR checkbox is checked', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedCoreLCRCheckbox) }, selectors.clientPayMethod.receivedCoreLCRCheckbox)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should confirm Received core VNL checkbox is unchecked', () => { it('should confirm Received core VNL checkbox is unchecked', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedCoreVNLCheckbox) }, selectors.clientPayMethod.receivedCoreVNLCheckbox)
.then(value => { .then(value => {
expect(value).toBeFalsy(); expect(value).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it('should confirm Received B2B VNL checkbox is unchecked', () => { it('should confirm Received B2B VNL checkbox is unchecked', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedB2BVNLCheckbox) }, selectors.clientPayMethod.receivedB2BVNLCheckbox)
.then(value => { .then(value => {
expect(value).toBeFalsy(); expect(value).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,7 +10,7 @@ describe('Client', () => {
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should click on the Clients button of the top bar menu', () => { it('should click on the Clients button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -19,10 +19,11 @@ describe('Client', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the user Bruce Banner', () => { it('should search for the user Bruce Banner', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
@ -31,10 +32,11 @@ describe('Client', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the client addresses`, () => { it(`should click on the search result to access to the client addresses`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
@ -43,40 +45,44 @@ describe('Client', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('address/index'); expect(url).toContain('address/index');
}); done();
}).catch(done.fail);
}); });
it(`should click on the add new address button to access to the new address form`, () => { it(`should click on the add new address button to access to the new address form`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientAddresses.createAddress) .waitToClick(selectors.clientAddresses.createAddress)
.waitForURL('address/create') .waitForURL('address/create')
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('address/create'); expect(url).toContain('address/create');
}); done();
}).catch(done.fail);
}); });
it(`should return to the addreses section by clicking the cancel button`, () => { it(`should return to the addreses section by clicking the cancel button`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientAddresses.cancelButton) .waitToClick(selectors.clientAddresses.cancelButton)
.waitForURL('address/index') .waitForURL('address/index')
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('address/index'); expect(url).toContain('address/index');
}); done();
}).catch(done.fail);
}); });
it(`should now click on the add new address button to access to the new address form`, () => { it(`should now click on the add new address button to access to the new address form`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientAddresses.createAddress) .waitToClick(selectors.clientAddresses.createAddress)
.waitForURL('address/create') .waitForURL('address/create')
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('address/create'); expect(url).toContain('address/create');
}); done();
}).catch(done.fail);
}); });
it('should receive an error after clicking save button as consignee, street and town fields are empty', () => { it('should receive an error after clicking save button as consignee, street and town fields are empty', done => {
return nightmare return nightmare
.waitToClick(selectors.clientAddresses.defaultCheckboxInput) .waitToClick(selectors.clientAddresses.defaultCheckboxInput)
.clearInput(selectors.clientAddresses.streetAddressInput) .clearInput(selectors.clientAddresses.streetAddressInput)
@ -91,10 +97,11 @@ describe('Client', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Some fields are invalid'); expect(result).toEqual('Some fields are invalid');
}); done();
}).catch(done.fail);
}); });
it(`should create a new address with all it's data`, () => { it(`should create a new address with all it's data`, done => {
return nightmare return nightmare
.type(selectors.clientAddresses.consigneeInput, 'Bruce Bunner') .type(selectors.clientAddresses.consigneeInput, 'Bruce Bunner')
.type(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York') .type(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York')
@ -103,30 +110,33 @@ describe('Client', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it(`should click on the addresses button confirm the new address exists and it's the default one`, () => { it(`should click on the addresses button confirm the new address exists and it's the default one`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientAddresses.addressesButton) .waitToClick(selectors.clientAddresses.addressesButton)
.wait(selectors.clientAddresses.defaultAddress) .wait(selectors.clientAddresses.defaultAddress)
.getInnerText(selectors.clientAddresses.defaultAddress) .getInnerText(selectors.clientAddresses.defaultAddress)
.then(result => { .then(result => {
expect(result).toContain('320 Park Avenue New York'); expect(result).toContain('320 Park Avenue New York');
}); done();
}).catch(done.fail);
}); });
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 make default icon of the second address then confirm it is the default one now`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientAddresses.secondMakeDefaultStar) .waitToClick(selectors.clientAddresses.secondMakeDefaultStar)
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand') .waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
.getInnerText(selectors.clientAddresses.defaultAddress) .getInnerText(selectors.clientAddresses.defaultAddress)
.then(result => { .then(result => {
expect(result).toContain('Somewhere in Thailand'); expect(result).toContain('Somewhere in Thailand');
}); done();
}).catch(done.fail);
}); });
it(`should click on the edit icon of the default address`, () => { it(`should click on the edit icon of the default address`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand') .waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
.waitToClick(selectors.clientAddresses.firstEditButton) .waitToClick(selectors.clientAddresses.firstEditButton)
@ -134,17 +144,19 @@ describe('Client', () => {
.url() .url()
.then(result => { .then(result => {
expect(result).toContain('/edit'); expect(result).toContain('/edit');
}); done();
}).catch(done.fail);
}); });
it(`should click on the active checkbox and receive an error to save it because it is the default address`, () => { it(`should click on the active checkbox and receive an error to save it because it is the default address`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientAddresses.activeCheckbox) .waitToClick(selectors.clientAddresses.activeCheckbox)
.waitToClick(selectors.clientAddresses.saveButton) .waitToClick(selectors.clientAddresses.saveButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('The default consignee can not be unchecked'); expect(result).toEqual('The default consignee can not be unchecked');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -9,7 +9,7 @@ describe('Client add address notes path', () => {
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should click on the Clients button of the top bar menu', () => { it('should click on the Clients button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -18,10 +18,11 @@ describe('Client add address notes path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the user Petter Parker', () => { it('should search for the user Petter Parker', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker') .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
@ -30,10 +31,11 @@ describe('Client add address notes path', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the client addresses`, () => { it(`should click on the search result to access to the client addresses`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
@ -42,10 +44,11 @@ describe('Client add address notes path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('address/index'); expect(url).toContain('address/index');
}); done();
}).catch(done.fail);
}); });
it(`should click on the edit icon of the default address`, () => { it(`should click on the edit icon of the default address`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street') .waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street')
.waitToClick(selectors.clientAddresses.firstEditButton) .waitToClick(selectors.clientAddresses.firstEditButton)
@ -53,10 +56,11 @@ describe('Client add address notes path', () => {
.url() .url()
.then(result => { .then(result => {
expect(result).toContain('/edit'); expect(result).toContain('/edit');
}); done();
}).catch(done.fail);
}); });
it('should not save a description without observation type', () => { it('should not save a description without observation type', done => {
return nightmare return nightmare
.waitToClick(selectors.clientAddresses.addObservationButton) .waitToClick(selectors.clientAddresses.addObservationButton)
.wait(selectors.clientAddresses.firstObservationDescriptionInput) .wait(selectors.clientAddresses.firstObservationDescriptionInput)
@ -65,10 +69,11 @@ describe('Client add address notes path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Observation type cannot be blank'); expect(result).toEqual('Observation type cannot be blank');
}); done();
}).catch(done.fail);
}); });
it('should not save an observation type without description', () => { it('should not save an observation type without description', done => {
return nightmare return nightmare
.clearInput(selectors.clientAddresses.firstObservationDescriptionInput) .clearInput(selectors.clientAddresses.firstObservationDescriptionInput)
.waitToClick(selectors.clientAddresses.firstObservationTypeSelect) .waitToClick(selectors.clientAddresses.firstObservationTypeSelect)
@ -77,10 +82,11 @@ describe('Client add address notes path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Some fields are invalid'); expect(result).toEqual('Some fields are invalid');
}); done();
}).catch(done.fail);
}); });
it('should create two new observations', () => { it('should create two new observations', done => {
return nightmare return nightmare
.type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description') .type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
.waitToClick(selectors.clientAddresses.addObservationButton) .waitToClick(selectors.clientAddresses.addObservationButton)
@ -91,6 +97,7 @@ describe('Client add address notes path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
}); });

View File

@ -10,7 +10,7 @@ describe('Client', () => {
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should click on the Clients button of the top bar menu', () => { it('should click on the Clients button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -19,10 +19,11 @@ describe('Client', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the user Bruce Banner', () => { it('should search for the user Bruce Banner', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
@ -31,10 +32,11 @@ describe('Client', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the client's web access`, () => { it(`should click on the search result to access to the client's web access`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
@ -43,10 +45,11 @@ describe('Client', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('web-access'); expect(url).toContain('web-access');
}); done();
}).catch(done.fail);
}); });
it(`should uncheck the Enable web access checkbox and update the name`, () => { it(`should uncheck the Enable web access checkbox and update the name`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox) .waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox)
.clearInput(selectors.clientWebAccess.userNameInput) .clearInput(selectors.clientWebAccess.userNameInput)
@ -55,10 +58,11 @@ describe('Client', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should confirm web access is now unchecked', () => { it('should confirm web access is now unchecked', done => {
return nightmare return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton) .waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput) .wait(selectors.clientBasicData.nameInput)
@ -69,15 +73,17 @@ describe('Client', () => {
}, selectors.clientWebAccess.enableWebAccessCheckbox) }, selectors.clientWebAccess.enableWebAccessCheckbox)
.then(value => { .then(value => {
expect(value).toBeFalsy(); expect(value).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it('should confirm web access name have been updated', () => { it('should confirm web access name have been updated', done => {
return nightmare return nightmare
.getInputValue(selectors.clientWebAccess.userNameInput) .getInputValue(selectors.clientWebAccess.userNameInput)
.then(result => { .then(result => {
expect(result).toEqual('Hulk'); expect(result).toEqual('Hulk');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,7 +10,7 @@ describe('Client', () => {
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should click on the Clients button of the top bar menu', () => { it('should click on the Clients button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -19,10 +19,11 @@ describe('Client', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the user Bruce Banner', () => { it('should search for the user Bruce Banner', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
@ -31,10 +32,11 @@ describe('Client', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the client's notes`, () => { it(`should click on the search result to access to the client's notes`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
@ -43,36 +45,40 @@ describe('Client', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('note/index'); expect(url).toContain('note/index');
}); done();
}).catch(done.fail);
}); });
it(`should click on the add note button`, () => { it(`should click on the add note button`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientNotes.addNoteFloatButton) .waitToClick(selectors.clientNotes.addNoteFloatButton)
.waitForURL('/note/create') .waitForURL('/note/create')
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/note/create'); expect(url).toContain('/note/create');
}); done();
}).catch(done.fail);
}); });
it(`should create a note`, () => { it(`should create a note`, done => {
return nightmare return nightmare
.type(selectors.clientNotes.noteInput, 'Meeting with Black Widow 21st 9am') .type(selectors.clientNotes.noteInput, 'Meeting with Black Widow 21st 9am')
.click(selectors.clientNotes.saveButton) .click(selectors.clientNotes.saveButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should confirm the note was created', () => { it('should confirm the note was created', done => {
return nightmare return nightmare
.wait(selectors.clientNotes.firstNoteText) .wait(selectors.clientNotes.firstNoteText)
.getInnerText(selectors.clientNotes.firstNoteText) .getInnerText(selectors.clientNotes.firstNoteText)
.then(value => { .then(value => {
expect(value).toEqual('Meeting with Black Widow 21st 9am'); expect(value).toEqual('Meeting with Black Widow 21st 9am');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,7 +10,7 @@ describe('Client', () => {
.waitForLogin('salesAssistant'); .waitForLogin('salesAssistant');
}); });
it('should click on the Clients button of the top bar menu', () => { it('should click on the Clients button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -19,10 +19,11 @@ describe('Client', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the user Ororo Munroe', () => { it('should search for the user Ororo Munroe', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Ororo Munroe') .type(selectors.clientsIndex.searchClientInput, 'Ororo Munroe')
@ -31,10 +32,11 @@ describe('Client', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the client's credit`, () => { it(`should click on the search result to access to the client's credit`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Ororo Munroe') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Ororo Munroe')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
@ -43,20 +45,22 @@ describe('Client', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('credit/index'); expect(url).toContain('credit/index');
}); done();
}).catch(done.fail);
}); });
it(`should click on the add credit button`, () => { it(`should click on the add credit button`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientCredit.addCreditFloatButton) .waitToClick(selectors.clientCredit.addCreditFloatButton)
.waitForURL('/credit/create') .waitForURL('/credit/create')
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/credit/create'); expect(url).toContain('/credit/create');
}); done();
}).catch(done.fail);
}); });
it(`should edit the credit`, () => { it(`should edit the credit`, done => {
return nightmare return nightmare
.clearInput(selectors.clientCredit.creditInput) .clearInput(selectors.clientCredit.creditInput)
.type(selectors.clientCredit.creditInput, 999) .type(selectors.clientCredit.creditInput, 999)
@ -64,17 +68,19 @@ describe('Client', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should confirm the credit was updated', () => { it('should confirm the credit was updated', done => {
return nightmare return nightmare
.wait(selectors.clientCredit.firstCreditText) .wait(selectors.clientCredit.firstCreditText)
.getInnerText(selectors.clientCredit.firstCreditText) .getInnerText(selectors.clientCredit.firstCreditText)
.then(value => { .then(value => {
expect(value).toContain(999); expect(value).toContain(999);
expect(value).toContain('salesAssistant'); expect(value).toContain('salesAssistant');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,7 +10,7 @@ describe('Client', () => {
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should click on the Clients button of the top bar menu', () => { it('should click on the Clients button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -19,10 +19,11 @@ describe('Client', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the user Petter Parker', () => { it('should search for the user Petter Parker', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker') .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
@ -31,10 +32,11 @@ describe('Client', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the client's greuge`, () => { it(`should click on the search result to access to the client's greuge`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
@ -43,20 +45,22 @@ describe('Client', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('greuge/index'); expect(url).toContain('greuge/index');
}); done();
}).catch(done.fail);
}); });
it(`should click on the add greuge button`, () => { it(`should click on the add greuge button`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientGreuge.addGreugeFloatButton) .waitToClick(selectors.clientGreuge.addGreugeFloatButton)
.waitForURL('greuge/create') .waitForURL('greuge/create')
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('greuge/create'); expect(url).toContain('greuge/create');
}); done();
}).catch(done.fail);
}); });
it(`should receive an error if all fields are empty but date and type on submit`, () => { it(`should receive an error if all fields are empty but date and type on submit`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientGreuge.typeInput) .waitToClick(selectors.clientGreuge.typeInput)
.waitToClick(selectors.clientGreuge.typeSecondOption) .waitToClick(selectors.clientGreuge.typeSecondOption)
@ -64,10 +68,11 @@ describe('Client', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Some fields are invalid'); expect(result).toEqual('Some fields are invalid');
}); done();
}).catch(done.fail);
}); });
it(`should create a new greuge with all its data`, () => { it(`should create a new greuge with all its data`, done => {
return nightmare return nightmare
.type(selectors.clientGreuge.amountInput, 999) .type(selectors.clientGreuge.amountInput, 999)
.waitForTextInInput(selectors.clientGreuge.amountInput, '999') .waitForTextInInput(selectors.clientGreuge.amountInput, '999')
@ -76,10 +81,11 @@ describe('Client', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should confirm the greuge was added to the list', () => { it('should confirm the greuge was added to the list', done => {
return nightmare return nightmare
.wait(selectors.clientGreuge.firstGreugeText) .wait(selectors.clientGreuge.firstGreugeText)
.getInnerText(selectors.clientGreuge.firstGreugeText) .getInnerText(selectors.clientGreuge.firstGreugeText)
@ -87,7 +93,8 @@ describe('Client', () => {
expect(value).toContain(999); expect(value).toContain(999);
expect(value).toContain('new armor for Batman!'); expect(value).toContain('new armor for Batman!');
expect(value).toContain('Diff'); expect(value).toContain('Diff');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,7 +10,7 @@ describe('Client', () => {
.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', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -19,10 +19,11 @@ describe('Client', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the user Petter Parker', () => { it('should search for the user Petter Parker', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker') .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
@ -31,10 +32,11 @@ describe('Client', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the client's mandate`, () => { it(`should click on the search result to access to the client's mandate`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
@ -43,10 +45,11 @@ describe('Client', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('mandate'); expect(url).toContain('mandate');
}); done();
}).catch(done.fail);
}); });
it('should confirm the client has a mandate of the CORE type', () => { it('should confirm the client has a mandate of the CORE type', done => {
return nightmare return nightmare
.wait(selectors.clientMandate.firstMandateText) .wait(selectors.clientMandate.firstMandateText)
.getInnerText(selectors.clientMandate.firstMandateText) .getInnerText(selectors.clientMandate.firstMandateText)
@ -54,7 +57,8 @@ describe('Client', () => {
expect(value).toContain('1'); expect(value).toContain('1');
expect(value).toContain('VNL'); expect(value).toContain('VNL');
expect(value).toContain('CORE'); expect(value).toContain('CORE');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,7 +10,7 @@ describe('Client lock verified data path', () => {
.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', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -19,10 +19,11 @@ describe('Client lock verified data path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the user Petter Parker', () => { it('should search for the user Petter Parker', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker') .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
@ -31,10 +32,11 @@ describe('Client lock verified data path', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the client's fiscal data`, () => { it(`should click on the search result to access to the client's fiscal data`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
@ -43,20 +45,22 @@ describe('Client lock verified data path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toContain('fiscal-data'); expect(url.hash).toContain('fiscal-data');
}); done();
}).catch(done.fail);
}); });
it(`should click on the fiscal data button to start editing`, () => { it(`should click on the fiscal data button to start editing`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data') .waitForURL('fiscal-data')
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toContain('fiscal-data'); expect(url.hash).toContain('fiscal-data');
}); done();
}).catch(done.fail);
}); });
it('should confirm verified data button is disabled for salesPerson', () => { it('should confirm verified data button is disabled for salesPerson', done => {
return nightmare return nightmare
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput) .wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
.evaluate(selector => { .evaluate(selector => {
@ -64,10 +68,11 @@ describe('Client lock verified data path', () => {
}, selectors.clientFiscalData.verifiedDataCheckbox) }, selectors.clientFiscalData.verifiedDataCheckbox)
.then(result => { .then(result => {
expect(result).toBeTruthy(); expect(result).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should edit the social name', () => { it('should edit the social name', done => {
return nightmare return nightmare
.wait(selectors.clientFiscalData.socialNameInput) .wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput) .clearInput(selectors.clientFiscalData.socialNameInput)
@ -76,10 +81,11 @@ describe('Client lock verified data path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should confirm the social name have been edited', () => { it('should confirm the social name have been edited', done => {
return nightmare return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton) .waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput) .wait(selectors.clientBasicData.nameInput)
@ -88,7 +94,8 @@ describe('Client lock verified data path', () => {
.getInputValue(selectors.clientFiscalData.socialNameInput) .getInputValue(selectors.clientFiscalData.socialNameInput)
.then(result => { .then(result => {
expect(result).toEqual('salesPerson was here'); expect(result).toEqual('salesPerson was here');
}); done();
}).catch(done.fail);
}); });
}); });
@ -99,7 +106,7 @@ describe('Client lock verified data path', () => {
.waitForLogin('administrative'); .waitForLogin('administrative');
}); });
it('should navigate to clients index', () => { it('should navigate to clients index', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -108,10 +115,11 @@ describe('Client lock verified data path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should search again for the user Petter Parker', () => { it('should search again for the user Petter Parker', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker') .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
@ -120,10 +128,11 @@ describe('Client lock verified data path', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the Petter Parkers fiscal data`, () => { it(`should click on the search result to access to the Petter Parkers fiscal data`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
@ -132,20 +141,22 @@ describe('Client lock verified data path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toContain('fiscal-data'); expect(url.hash).toContain('fiscal-data');
}); done();
}).catch(done.fail);
}); });
it(`should click on the fiscal data button`, () => { it(`should click on the fiscal data button`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data') .waitForURL('fiscal-data')
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toContain('fiscal-data'); expect(url.hash).toContain('fiscal-data');
}); done();
}).catch(done.fail);
}); });
it('should confirm verified data button is enabled for administrative', () => { it('should confirm verified data button is enabled for administrative', done => {
return nightmare return nightmare
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput) .wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
.evaluate(selector => { .evaluate(selector => {
@ -153,20 +164,22 @@ describe('Client lock verified data path', () => {
}, selectors.clientFiscalData.verifiedDataCheckbox) }, selectors.clientFiscalData.verifiedDataCheckbox)
.then(result => { .then(result => {
expect(result).not.toBeTruthy(); expect(result).not.toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should check the Verified data checkbox', () => { it('should check the Verified data checkbox', done => {
return nightmare return nightmare
.waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput) .waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput)
.waitToClick(selectors.clientFiscalData.saveButton) .waitToClick(selectors.clientFiscalData.saveButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should confirm Verified data checkbox is checked', () => { it('should confirm Verified data checkbox is checked', done => {
return nightmare return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton) .waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput) .wait(selectors.clientBasicData.nameInput)
@ -177,10 +190,11 @@ describe('Client lock verified data path', () => {
}, selectors.clientFiscalData.verifiedDataCheckboxInput) }, selectors.clientFiscalData.verifiedDataCheckboxInput)
.then(value => { .then(value => {
expect(value).toBeTruthy(); expect(value).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should again edit the social name', () => { it('should again edit the social name', done => {
return nightmare return nightmare
.wait(selectors.clientFiscalData.socialNameInput) .wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput) .clearInput(selectors.clientFiscalData.socialNameInput)
@ -189,10 +203,11 @@ describe('Client lock verified data path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should again confirm the social name have been edited', () => { it('should again confirm the social name have been edited', done => {
return nightmare return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton) .waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput) .wait(selectors.clientBasicData.nameInput)
@ -201,7 +216,8 @@ describe('Client lock verified data path', () => {
.getInputValue(selectors.clientFiscalData.socialNameInput) .getInputValue(selectors.clientFiscalData.socialNameInput)
.then(result => { .then(result => {
expect(result).toEqual('administrative was here'); expect(result).toEqual('administrative was here');
}); done();
}).catch(done.fail);
}); });
}); });
@ -212,7 +228,7 @@ describe('Client lock verified data path', () => {
.waitForLogin('salesPerson'); .waitForLogin('salesPerson');
}); });
it('should again click on the Clients button of the top bar menu', () => { it('should again click on the Clients button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -221,10 +237,11 @@ describe('Client lock verified data path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should again search for the user Petter Parker', () => { it('should again search for the user Petter Parker', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker') .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
@ -233,10 +250,11 @@ describe('Client lock verified data path', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the client's fiscal data`, () => { it(`should click on the search result to access to the client's fiscal data`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
@ -245,20 +263,22 @@ describe('Client lock verified data path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toContain('fiscal-data'); expect(url.hash).toContain('fiscal-data');
}); done();
}).catch(done.fail);
}); });
it(`should click on the fiscal data button to start editing`, () => { it(`should click on the fiscal data button to start editing`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data') .waitForURL('fiscal-data')
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toContain('fiscal-data'); expect(url.hash).toContain('fiscal-data');
}); done();
}).catch(done.fail);
}); });
it('should confirm verified data button is disabled once again for salesPerson', () => { it('should confirm verified data button is disabled once again for salesPerson', done => {
return nightmare return nightmare
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput) .wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
.evaluate(selector => { .evaluate(selector => {
@ -266,10 +286,11 @@ describe('Client lock verified data path', () => {
}, selectors.clientFiscalData.verifiedDataCheckbox) }, selectors.clientFiscalData.verifiedDataCheckbox)
.then(result => { .then(result => {
expect(result).toBe(true); expect(result).toBe(true);
}); done();
}).catch(done.fail);
}); });
it('should confirm the form have been disabled for salesPerson', () => { it('should confirm the form have been disabled for salesPerson', done => {
return nightmare return nightmare
.wait(selectors.clientFiscalData.socialNameInput) .wait(selectors.clientFiscalData.socialNameInput)
.evaluate(selector => { .evaluate(selector => {
@ -277,7 +298,8 @@ describe('Client lock verified data path', () => {
}, 'vn-textfield[field="$ctrl.client.socialName"] input') }, 'vn-textfield[field="$ctrl.client.socialName"] input')
.then(result => { .then(result => {
expect(result).toEqual(true); expect(result).toEqual(true);
}); done();
}).catch(done.fail);
}); });
}); });
@ -288,7 +310,7 @@ describe('Client lock verified data path', () => {
.waitForLogin('salesAssistant'); .waitForLogin('salesAssistant');
}); });
it('should now navigate to clients index', () => { it('should now navigate to clients index', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -297,10 +319,11 @@ describe('Client lock verified data path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should now search again for the user Petter Parker', () => { it('should now search again for the user Petter Parker', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker') .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
@ -309,10 +332,11 @@ describe('Client lock verified data path', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the Petter Parkers fiscal data`, () => { it(`should click on the search result to access to the Petter Parkers fiscal data`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
@ -321,20 +345,22 @@ describe('Client lock verified data path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toContain('fiscal-data'); expect(url.hash).toContain('fiscal-data');
}); done();
}).catch(done.fail);
}); });
it(`should click on the fiscal data button`, () => { it(`should click on the fiscal data button`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data') .waitForURL('fiscal-data')
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toContain('fiscal-data'); expect(url.hash).toContain('fiscal-data');
}); done();
}).catch(done.fail);
}); });
it('should confirm verified data button is enabled for salesAssistant', () => { it('should confirm verified data button is enabled for salesAssistant', done => {
return nightmare return nightmare
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput) .wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
.evaluate(selector => { .evaluate(selector => {
@ -342,20 +368,22 @@ describe('Client lock verified data path', () => {
}, selectors.clientFiscalData.verifiedDataCheckbox) }, selectors.clientFiscalData.verifiedDataCheckbox)
.then(result => { .then(result => {
expect(result).not.toBe(true); expect(result).not.toBe(true);
}); done();
}).catch(done.fail);
}); });
it('should uncheck the Verified data checkbox', () => { it('should uncheck the Verified data checkbox', done => {
return nightmare return nightmare
.waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput) .waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput)
.waitToClick(selectors.clientFiscalData.saveButton) .waitToClick(selectors.clientFiscalData.saveButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should confirm Verified data checkbox is unchecked', () => { it('should confirm Verified data checkbox is unchecked', done => {
return nightmare return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton) .waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput) .wait(selectors.clientBasicData.nameInput)
@ -366,10 +394,11 @@ describe('Client lock verified data path', () => {
}, selectors.clientFiscalData.verifiedDataCheckboxInput) }, selectors.clientFiscalData.verifiedDataCheckboxInput)
.then(value => { .then(value => {
expect(value).toBeFalsy(); expect(value).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it('should now edit the social name', () => { it('should now edit the social name', done => {
return nightmare return nightmare
.wait(selectors.clientFiscalData.socialNameInput) .wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput) .clearInput(selectors.clientFiscalData.socialNameInput)
@ -378,10 +407,11 @@ describe('Client lock verified data path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should now confirm the social name have been edited once and for all', () => { it('should now confirm the social name have been edited once and for all', done => {
return nightmare return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton) .waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput) .wait(selectors.clientBasicData.nameInput)
@ -390,7 +420,8 @@ describe('Client lock verified data path', () => {
.getInputValue(selectors.clientFiscalData.socialNameInput) .getInputValue(selectors.clientFiscalData.socialNameInput)
.then(result => { .then(result => {
expect(result).toEqual('salesAssistant was here'); expect(result).toEqual('salesAssistant was here');
}); done();
}).catch(done.fail);
}); });
}); });
@ -401,7 +432,7 @@ describe('Client lock verified data path', () => {
.waitForLogin('salesPerson'); .waitForLogin('salesPerson');
}); });
it('should now click on the Clients button of the top bar menu', () => { it('should now click on the Clients button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -410,10 +441,11 @@ describe('Client lock verified data path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
}); done();
}).catch(done.fail);
}); });
it('should once again search for the user Petter Parker', () => { it('should once again search for the user Petter Parker', done => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker') .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
@ -422,10 +454,11 @@ describe('Client lock verified data path', () => {
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the client's fiscal data`, () => { it(`should click on the search result to access to the client's fiscal data`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
@ -434,20 +467,22 @@ describe('Client lock verified data path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toContain('fiscal-data'); expect(url.hash).toContain('fiscal-data');
}); done();
}).catch(done.fail);
}); });
it(`should click on the fiscal data button to start editing`, () => { it(`should click on the fiscal data button to start editing`, done => {
return nightmare return nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data') .waitForURL('fiscal-data')
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toContain('fiscal-data'); expect(url.hash).toContain('fiscal-data');
}); done();
}).catch(done.fail);
}); });
it('should confirm verified data button is enabled once again', () => { it('should confirm verified data button is enabled once again', done => {
return nightmare return nightmare
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput) .wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
.evaluate(selector => { .evaluate(selector => {
@ -455,10 +490,11 @@ describe('Client lock verified data path', () => {
}, selectors.clientFiscalData.verifiedDataCheckbox) }, selectors.clientFiscalData.verifiedDataCheckbox)
.then(result => { .then(result => {
expect(result).toBe(true); expect(result).toBe(true);
}); done();
}).catch(done.fail);
}); });
it('should confirm the form is enabled for salesPerson', () => { it('should confirm the form is enabled for salesPerson', done => {
return nightmare return nightmare
.wait(selectors.clientFiscalData.socialNameInput) .wait(selectors.clientFiscalData.socialNameInput)
.evaluate(selector => { .evaluate(selector => {
@ -466,7 +502,8 @@ describe('Client lock verified data path', () => {
}, 'vn-textfield[field="$ctrl.client.socialName"] > div') }, 'vn-textfield[field="$ctrl.client.socialName"] > div')
.then(result => { .then(result => {
expect(result).not.toBe(true); expect(result).not.toBe(true);
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,17 +10,18 @@ describe('Item', () => {
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should access to the items index by clicking the items button', () => { it('should access to the items index by clicking the items button', done => {
return nightmare return nightmare
.click(selectors.moduleAccessView.itemsSectionButton) .click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton) .wait(selectors.itemsIndex.createItemButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/item/index'); expect(url.hash).toEqual('#!/item/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the item Gem of Time', () => { it('should search for the item Gem of Time', done => {
return nightmare return nightmare
.wait(selectors.itemsIndex.searchResult) .wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time') .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
@ -29,10 +30,11 @@ describe('Item', () => {
.countElement(selectors.itemsIndex.searchResult) .countElement(selectors.itemsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result summary button to open the item summary popup`, () => { it(`should click on the search result summary button to open the item summary popup`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.isVisible(selectors.itemSummary.basicData) .isVisible(selectors.itemSummary.basicData)
@ -44,112 +46,125 @@ describe('Item', () => {
}) })
.then(result => { .then(result => {
expect(result).toBeTruthy(); expect(result).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it(`should check the item summary preview shows fields from basic data`, () => { it(`should check the item summary preview shows fields from basic data`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time') .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time')
.getInnerText(selectors.itemSummary.basicData) .getInnerText(selectors.itemSummary.basicData)
.then(result => { .then(result => {
expect(result).toContain('Name: Gem of Time'); expect(result).toContain('Name: Gem of Time');
}); done();
}).catch(done.fail);
}); });
it(`should check the item summary preview shows fields from tags`, () => { it(`should check the item summary preview shows fields from tags`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow') .waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow')
.getInnerText(selectors.itemSummary.tags) .getInnerText(selectors.itemSummary.tags)
.then(result => { .then(result => {
expect(result).toContain('Color: Yellow'); expect(result).toContain('Color: Yellow');
}); done();
}).catch(done.fail);
}); });
it(`should check the item summary preview shows fields from niche`, () => { it(`should check the item summary preview shows fields from niche`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1') .waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1')
.getInnerText(selectors.itemSummary.niche) .getInnerText(selectors.itemSummary.niche)
.then(result => { .then(result => {
expect(result).toContain('Warehouse One: A1'); expect(result).toContain('Warehouse One: A1');
}); done();
}).catch(done.fail);
}); });
it(`should check the item summary preview shows fields from botanical`, () => { it(`should check the item summary preview shows fields from botanical`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix') .waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix')
.getInnerText(selectors.itemSummary.botanical) .getInnerText(selectors.itemSummary.botanical)
.then(result => { .then(result => {
expect(result).toContain('Botanical: Hedera helix'); expect(result).toContain('Botanical: Hedera helix');
}); done();
}).catch(done.fail);
}); });
it(`should check the item summary preview shows fields from barcode`, () => { it(`should check the item summary preview shows fields from barcode`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemSummary.barcode, '1') .waitForTextInElement(selectors.itemSummary.barcode, '1')
.getInnerText(selectors.itemSummary.barcode) .getInnerText(selectors.itemSummary.barcode)
.then(result => { .then(result => {
expect(result).toContain('1'); expect(result).toContain('1');
}); done();
}).catch(done.fail);
}); });
it(`should close the summary popup`, () => { it(`should close the summary popup`, done => {
return nightmare return nightmare
.waitToClick(selectors.itemsIndex.closeItemSummaryPreview) .waitToClick(selectors.itemsIndex.closeItemSummaryPreview)
.isVisible(selectors.itemSummary.basicData) .isVisible(selectors.itemSummary.basicData)
.then(result => { .then(result => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it(`should navigate to the one of the items detailed section`, () => { it(`should navigate to the one of the items detailed section`, done => {
return nightmare return nightmare
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
.waitForURL('summary') .waitForURL('summary')
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toContain('summary'); expect(url.hash).toContain('summary');
}); done();
}).catch(done.fail);
}); });
it(`should check the item summary shows fields from basic data section`, () => { it(`should check the item summary shows fields from basic data section`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time') .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time')
.getInnerText(selectors.itemSummary.basicData) .getInnerText(selectors.itemSummary.basicData)
.then(result => { .then(result => {
expect(result).toContain('Name: Gem of Time'); expect(result).toContain('Name: Gem of Time');
}); done();
}).catch(done.fail);
}); });
it(`should check the item summary shows fields from tags section`, () => { it(`should check the item summary shows fields from tags section`, done => {
return nightmare return nightmare
.getInnerText(selectors.itemSummary.tags) .getInnerText(selectors.itemSummary.tags)
.then(result => { .then(result => {
expect(result).toContain('Color: Yellow'); expect(result).toContain('Color: Yellow');
}); done();
}).catch(done.fail);
}); });
it(`should check the item summary shows fields from niches section`, () => { it(`should check the item summary shows fields from niches section`, done => {
return nightmare return nightmare
.getInnerText(selectors.itemSummary.niche) .getInnerText(selectors.itemSummary.niche)
.then(result => { .then(result => {
expect(result).toContain('Warehouse One: A1'); expect(result).toContain('Warehouse One: A1');
}); done();
}).catch(done.fail);
}); });
it(`should check the item summary shows fields from botanical section`, () => { it(`should check the item summary shows fields from botanical section`, done => {
return nightmare return nightmare
.getInnerText(selectors.itemSummary.botanical) .getInnerText(selectors.itemSummary.botanical)
.then(result => { .then(result => {
expect(result).toContain('Botanical: Hedera helix'); expect(result).toContain('Botanical: Hedera helix');
}); done();
}).catch(done.fail);
}); });
it(`should check the item summary shows fields from barcodes section`, () => { it(`should check the item summary shows fields from barcodes section`, done => {
return nightmare return nightmare
.getInnerText(selectors.itemSummary.barcode) .getInnerText(selectors.itemSummary.barcode)
.then(result => { .then(result => {
expect(result).toContain('1'); expect(result).toContain('1');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,17 +10,18 @@ describe('Item', () => {
.waitForLogin('buyer'); .waitForLogin('buyer');
}); });
it('should access to the items index by clicking the items button', () => { it('should access to the items index by clicking the items button', done => {
return nightmare return nightmare
.click(selectors.moduleAccessView.itemsSectionButton) .click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton) .wait(selectors.itemsIndex.createItemButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/item/index'); expect(url.hash).toEqual('#!/item/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the item Gem of Mind', () => { it('should search for the item Gem of Mind', done => {
return nightmare return nightmare
.wait(selectors.itemsIndex.searchResult) .wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Mind') .type(selectors.itemsIndex.searchItemInput, 'Gem of Mind')
@ -29,10 +30,11 @@ describe('Item', () => {
.countElement(selectors.itemsIndex.searchResult) .countElement(selectors.itemsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the item basic data`, () => { it(`should click on the search result to access to the item basic data`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind')
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
@ -41,10 +43,11 @@ describe('Item', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('data'); expect(url).toContain('data');
}); done();
}).catch(done.fail);
}); });
it(`should edit the item basic data`, () => { it(`should edit the item basic data`, done => {
return nightmare return nightmare
.clearInput(selectors.itemBasicData.nameInput) .clearInput(selectors.itemBasicData.nameInput)
.type(selectors.itemBasicData.nameInput, 'Rose of Purity') .type(selectors.itemBasicData.nameInput, 'Rose of Purity')
@ -65,10 +68,11 @@ describe('Item', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the item name was edited`, () => { it(`should confirm the item name was edited`, done => {
return nightmare return nightmare
.click(selectors.itemNiches.nicheButton) .click(selectors.itemNiches.nicheButton)
.wait(selectors.itemNiches.firstWarehouseDisabled) .wait(selectors.itemNiches.firstWarehouseDisabled)
@ -77,65 +81,73 @@ describe('Item', () => {
.getInputValue(selectors.itemBasicData.nameInput) .getInputValue(selectors.itemBasicData.nameInput)
.then(result => { .then(result => {
expect(result).toEqual('Rose of Purity'); expect(result).toEqual('Rose of Purity');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the item type was edited`, () => { it(`should confirm the item type was edited`, done => {
return nightmare return nightmare
.getInputValue(selectors.itemBasicData.typeSelect) .getInputValue(selectors.itemBasicData.typeSelect)
.then(result => { .then(result => {
expect(result).toEqual('Crisantemo'); expect(result).toEqual('Crisantemo');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the item intrastad was edited`, () => { it(`should confirm the item intrastad was edited`, done => {
return nightmare return nightmare
.getInputValue(selectors.itemBasicData.intrastatSelect) .getInputValue(selectors.itemBasicData.intrastatSelect)
.then(result => { .then(result => {
expect(result).toEqual('Coral y materiales similares'); expect(result).toEqual('Coral y materiales similares');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the item relevancy was edited`, () => { it(`should confirm the item relevancy was edited`, done => {
return nightmare return nightmare
.getInputValue(selectors.itemBasicData.relevancyInput) .getInputValue(selectors.itemBasicData.relevancyInput)
.then(result => { .then(result => {
expect(result).toEqual('1'); expect(result).toEqual('1');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the item origin was edited`, () => { it(`should confirm the item origin was edited`, done => {
return nightmare return nightmare
.getInputValue(selectors.itemBasicData.originSelect) .getInputValue(selectors.itemBasicData.originSelect)
.then(result => { .then(result => {
expect(result).toEqual('Spain'); expect(result).toEqual('Spain');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the item expence was edited`, () => { it(`should confirm the item expence was edited`, done => {
return nightmare return nightmare
.getInputValue(selectors.itemBasicData.expenceSelect) .getInputValue(selectors.itemBasicData.expenceSelect)
.then(result => { .then(result => {
expect(result).toEqual('Adquisición mercancia Extracomunitaria'); expect(result).toEqual('Adquisición mercancia Extracomunitaria');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the item long name was edited`, () => { it(`should confirm the item long name was edited`, done => {
return nightmare return nightmare
.getInputValue(selectors.itemBasicData.longNameInput) .getInputValue(selectors.itemBasicData.longNameInput)
.then(result => { .then(result => {
expect(result).toEqual('RS Rose of Purity'); expect(result).toEqual('RS Rose of Purity');
}); done();
}).catch(done.fail);
}); });
it('should confirm isActive checkbox is unchecked', () => { it('should confirm isActive checkbox is unchecked', done => {
return nightmare return nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.itemBasicData.isActiveCheckbox) }, selectors.itemBasicData.isActiveCheckbox)
.then(value => { .then(value => {
expect(value).toBeFalsy(); expect(value).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,17 +10,18 @@ describe('Item', () => {
.waitForLogin('buyer'); .waitForLogin('buyer');
}); });
it('should access to the items index by clicking the items button', () => { it('should access to the items index by clicking the items button', done => {
return nightmare return nightmare
.click(selectors.moduleAccessView.itemsSectionButton) .click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton) .wait(selectors.itemsIndex.createItemButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/item/index'); expect(url.hash).toEqual('#!/item/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the item Gem of Time', () => { it('should search for the item Gem of Time', done => {
return nightmare return nightmare
.wait(selectors.itemsIndex.searchResult) .wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time') .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
@ -29,10 +30,11 @@ describe('Item', () => {
.countElement(selectors.itemsIndex.searchResult) .countElement(selectors.itemsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the item tax`, () => { it(`should click on the search result to access to the item tax`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
@ -41,10 +43,11 @@ describe('Item', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('tax'); expect(url).toContain('tax');
}); done();
}).catch(done.fail);
}); });
it(`should add the item tax to all countries`, () => { it(`should add the item tax to all countries`, done => {
return nightmare return nightmare
.waitToClick(selectors.itemTax.firstClassSelect) .waitToClick(selectors.itemTax.firstClassSelect)
.waitToClick(selectors.itemTax.firstClassSelectOptionTwo) .waitToClick(selectors.itemTax.firstClassSelectOptionTwo)
@ -56,10 +59,11 @@ describe('Item', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the item tax class was edited`, () => { it(`should confirm the item tax class was edited`, done => {
return nightmare return nightmare
.click(selectors.itemTags.tagsButton) .click(selectors.itemTags.tagsButton)
.wait(selectors.itemTags.firstTagDisabled) .wait(selectors.itemTags.firstTagDisabled)
@ -79,7 +83,8 @@ describe('Item', () => {
}) })
.then(result => { .then(result => {
expect(result).toEqual('Reduced VAT'); expect(result).toEqual('Reduced VAT');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,17 +10,18 @@ describe('Item', () => {
.waitForLogin('buyer'); .waitForLogin('buyer');
}); });
it('should access to the items index by clicking the items button', () => { it('should access to the items index by clicking the items button', done => {
return nightmare return nightmare
.click(selectors.moduleAccessView.itemsSectionButton) .click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton) .wait(selectors.itemsIndex.createItemButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/item/index'); expect(url.hash).toEqual('#!/item/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the item Gem of Time', () => { it('should search for the item Gem of Time', done => {
return nightmare return nightmare
.wait(selectors.itemsIndex.searchResult) .wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time') .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
@ -29,10 +30,11 @@ describe('Item', () => {
.countElement(selectors.itemsIndex.searchResult) .countElement(selectors.itemsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the item tags`, () => { it(`should click on the search result to access to the item tags`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
@ -41,10 +43,11 @@ describe('Item', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('tags'); expect(url).toContain('tags');
}); done();
}).catch(done.fail);
}); });
it(`should create a new tag and delete a former one`, () => { it(`should create a new tag and delete a former one`, done => {
return nightmare return nightmare
.waitToClick(selectors.itemTags.firstRemoveTagButton) .waitToClick(selectors.itemTags.firstRemoveTagButton)
.waitToClick(selectors.itemTags.addItemTagButton) .waitToClick(selectors.itemTags.addItemTagButton)
@ -57,7 +60,8 @@ describe('Item', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it(`should reload tags form to check that the changes are saved`, () => { it(`should reload tags form to check that the changes are saved`, () => {

View File

@ -10,17 +10,18 @@ describe('Item', () => {
.waitForLogin('buyer'); .waitForLogin('buyer');
}); });
it('should access to the items index by clicking the items button', () => { it('should access to the items index by clicking the items button', done => {
return nightmare return nightmare
.click(selectors.moduleAccessView.itemsSectionButton) .click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton) .wait(selectors.itemsIndex.createItemButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/item/index'); expect(url.hash).toEqual('#!/item/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the item Gem of Time', () => { it('should search for the item Gem of Time', done => {
return nightmare return nightmare
.wait(selectors.itemsIndex.searchResult) .wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time') .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
@ -29,10 +30,11 @@ describe('Item', () => {
.countElement(selectors.itemsIndex.searchResult) .countElement(selectors.itemsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the item niches`, () => { it(`should click on the search result to access to the item niches`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
@ -41,10 +43,11 @@ describe('Item', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('niche'); expect(url).toContain('niche');
}); done();
}).catch(done.fail);
}); });
it(`should click create a new niche and delete a former one`, () => { it(`should click create a new niche and delete a former one`, done => {
return nightmare return nightmare
.waitToClick(selectors.itemNiches.addNicheButton) .waitToClick(selectors.itemNiches.addNicheButton)
.waitToClick(selectors.itemNiches.secondNicheRemoveButton) .waitToClick(selectors.itemNiches.secondNicheRemoveButton)
@ -55,10 +58,11 @@ describe('Item', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the first niche is the expected one`, () => { it(`should confirm the first niche is the expected one`, done => {
return nightmare return nightmare
.click(selectors.itemBasicData.basicDataButton) .click(selectors.itemBasicData.basicDataButton)
.wait(selectors.itemBasicData.nameInput) .wait(selectors.itemBasicData.nameInput)
@ -72,10 +76,11 @@ describe('Item', () => {
}) })
.then(result => { .then(result => {
expect(result).toEqual('A1'); expect(result).toEqual('A1');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the second niche is the expected one`, () => { it(`should confirm the second niche is the expected one`, done => {
return nightmare return nightmare
.getInputValue(selectors.itemNiches.secondWarehouseSelect) .getInputValue(selectors.itemNiches.secondWarehouseSelect)
.then(result => { .then(result => {
@ -85,10 +90,11 @@ describe('Item', () => {
}) })
.then(result => { .then(result => {
expect(result).toEqual('A3'); expect(result).toEqual('A3');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the third niche is the expected one`, () => { it(`should confirm the third niche is the expected one`, done => {
return nightmare return nightmare
.getInputValue(selectors.itemNiches.thirdWarehouseSelect) .getInputValue(selectors.itemNiches.thirdWarehouseSelect)
.then(result => { .then(result => {
@ -98,7 +104,8 @@ describe('Item', () => {
}) })
.then(result => { .then(result => {
expect(result).toEqual('A4'); expect(result).toEqual('A4');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,17 +10,18 @@ describe('Item', () => {
.waitForLogin('buyer'); .waitForLogin('buyer');
}); });
it('should access to the items index by clicking the items button', () => { it('should access to the items index by clicking the items button', done => {
return nightmare return nightmare
.click(selectors.moduleAccessView.itemsSectionButton) .click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton) .wait(selectors.itemsIndex.createItemButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/item/index'); expect(url.hash).toEqual('#!/item/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the item Mjolnir', () => { it('should search for the item Mjolnir', done => {
return nightmare return nightmare
.wait(selectors.itemsIndex.searchResult) .wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Mjolnir') .type(selectors.itemsIndex.searchItemInput, 'Mjolnir')
@ -29,10 +30,11 @@ describe('Item', () => {
.countElement(selectors.itemsIndex.searchResult) .countElement(selectors.itemsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the item botanical`, () => { it(`should click on the search result to access to the item botanical`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir')
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
@ -41,10 +43,11 @@ describe('Item', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('botanical'); expect(url).toContain('botanical');
}); done();
}).catch(done.fail);
}); });
it(`should create a new botanical for the item with id Mjolnir`, () => { it(`should create a new botanical for the item with id Mjolnir`, done => {
return nightmare return nightmare
.type(selectors.itemBotanical.botanicalInput, 'Cicuta maculata') .type(selectors.itemBotanical.botanicalInput, 'Cicuta maculata')
.waitToClick(selectors.itemBotanical.genusSelect) .waitToClick(selectors.itemBotanical.genusSelect)
@ -55,10 +58,11 @@ describe('Item', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the botanical for item Mjolnir was created`, () => { it(`should confirm the botanical for item Mjolnir was created`, done => {
return nightmare return nightmare
.click(selectors.itemBasicData.basicDataButton) .click(selectors.itemBasicData.basicDataButton)
.wait(selectors.itemBasicData.nameInput) .wait(selectors.itemBasicData.nameInput)
@ -67,27 +71,30 @@ describe('Item', () => {
.getInputValue(selectors.itemBotanical.botanicalInput) .getInputValue(selectors.itemBotanical.botanicalInput)
.then(result => { .then(result => {
expect(result).toEqual('Cicuta maculata'); expect(result).toEqual('Cicuta maculata');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the Genus for item Mjolnir was created`, () => { it(`should confirm the Genus for item Mjolnir was created`, done => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abelia') .waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abelia')
.getInputValue(selectors.itemBotanical.genusSelect) .getInputValue(selectors.itemBotanical.genusSelect)
.then(result => { .then(result => {
expect(result).toEqual('Abelia'); expect(result).toEqual('Abelia');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the Species for item Mjolnir was created`, () => { it(`should confirm the Species for item Mjolnir was created`, done => {
return nightmare return nightmare
.getInputValue(selectors.itemBotanical.speciesSelect) .getInputValue(selectors.itemBotanical.speciesSelect)
.then(result => { .then(result => {
expect(result).toEqual('dealbata'); expect(result).toEqual('dealbata');
}); done();
}).catch(done.fail);
}); });
it(`should edit botanical for the item Mjolnir`, () => { it(`should edit botanical for the item Mjolnir`, done => {
return nightmare return nightmare
.clearInput(selectors.itemBotanical.botanicalInput) .clearInput(selectors.itemBotanical.botanicalInput)
.type(selectors.itemBotanical.botanicalInput, 'Herp Derp') .type(selectors.itemBotanical.botanicalInput, 'Herp Derp')
@ -99,10 +106,11 @@ describe('Item', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the botanical for item Mjolnir was edited`, () => { it(`should confirm the botanical for item Mjolnir was edited`, done => {
return nightmare return nightmare
.click(selectors.itemBasicData.basicDataButton) .click(selectors.itemBasicData.basicDataButton)
.wait(selectors.itemBasicData.nameInput) .wait(selectors.itemBasicData.nameInput)
@ -111,24 +119,27 @@ describe('Item', () => {
.getInputValue(selectors.itemBotanical.botanicalInput) .getInputValue(selectors.itemBotanical.botanicalInput)
.then(result => { .then(result => {
expect(result).toEqual('Herp Derp'); expect(result).toEqual('Herp Derp');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the Genus for item Mjolnir was edited`, () => { it(`should confirm the Genus for item Mjolnir was edited`, done => {
return nightmare return nightmare
.waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abies') .waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abies')
.getInputValue(selectors.itemBotanical.genusSelect) .getInputValue(selectors.itemBotanical.genusSelect)
.then(result => { .then(result => {
expect(result).toEqual('Abies'); expect(result).toEqual('Abies');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the Species for item Mjolnir was edited`, () => { it(`should confirm the Species for item Mjolnir was edited`, done => {
return nightmare return nightmare
.getInputValue(selectors.itemBotanical.speciesSelect) .getInputValue(selectors.itemBotanical.speciesSelect)
.then(result => { .then(result => {
expect(result).toEqual('decurrens'); expect(result).toEqual('decurrens');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,17 +10,18 @@ describe('Item', () => {
.waitForLogin('buyer'); .waitForLogin('buyer');
}); });
it('should access to the items index by clicking the items button', () => { it('should access to the items index by clicking the items button', done => {
return nightmare return nightmare
.click(selectors.moduleAccessView.itemsSectionButton) .click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton) .wait(selectors.itemsIndex.createItemButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/item/index'); expect(url.hash).toEqual('#!/item/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the item Gem of Time', () => { it('should search for the item Gem of Time', done => {
return nightmare return nightmare
.wait(selectors.itemsIndex.searchResult) .wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time') .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
@ -29,10 +30,11 @@ describe('Item', () => {
.countElement(selectors.itemsIndex.searchResult) .countElement(selectors.itemsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the item barcodes`, () => { it(`should click on the search result to access to the item barcodes`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
@ -41,10 +43,11 @@ describe('Item', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('barcode'); expect(url).toContain('barcode');
}); done();
}).catch(done.fail);
}); });
it(`should click create a new code and delete a former one`, () => { it(`should click create a new code and delete a former one`, done => {
return nightmare return nightmare
.waitToClick(selectors.itemBarcodes.firstCodeRemoveButton) .waitToClick(selectors.itemBarcodes.firstCodeRemoveButton)
.waitToClick(selectors.itemBarcodes.addBarcodeButton) .waitToClick(selectors.itemBarcodes.addBarcodeButton)
@ -54,10 +57,11 @@ describe('Item', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, () => { it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, done => {
return nightmare return nightmare
.click(selectors.itemBasicData.basicDataButton) .click(selectors.itemBasicData.basicDataButton)
.wait(selectors.itemBasicData.nameInput) .wait(selectors.itemBasicData.nameInput)
@ -66,7 +70,8 @@ describe('Item', () => {
.getInputValue(selectors.itemBarcodes.thirdCodeInput) .getInputValue(selectors.itemBarcodes.thirdCodeInput)
.then(result => { .then(result => {
expect(result).toEqual('5'); expect(result).toEqual('5');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -9,17 +9,18 @@ describe('Item', () => {
.waitForLogin('buyer'); .waitForLogin('buyer');
}); });
it('should access to the items index by clicking the items button', () => { it('should access to the items index by clicking the items button', done => {
return nightmare return nightmare
.click(selectors.moduleAccessView.itemsSectionButton) .click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton) .wait(selectors.itemsIndex.createItemButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/item/index'); expect(url.hash).toEqual('#!/item/index');
}); done();
}).catch(done.fail);
}); });
it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, () => { it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, done => {
return nightmare return nightmare
.wait(selectors.itemsIndex.searchResult) .wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet') .type(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
@ -28,40 +29,44 @@ describe('Item', () => {
.countElement(selectors.itemsIndex.searchResult) .countElement(selectors.itemsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(0); expect(result).toEqual(0);
}); done();
}).catch(done.fail);
}); });
it('should access to the create item view by clicking the create floating button', () => { it('should access to the create item view by clicking the create floating button', done => {
return nightmare return nightmare
.click(selectors.itemsIndex.createItemButton) .click(selectors.itemsIndex.createItemButton)
.wait(selectors.itemCreateView.createButton) .wait(selectors.itemCreateView.createButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/item/create'); expect(url.hash).toEqual('#!/item/create');
}); done();
}).catch(done.fail);
}); });
it('should return to the item index by clickig the cancel button', () => { it('should return to the item index by clickig the cancel button', done => {
return nightmare return nightmare
.click(selectors.itemCreateView.cancelButton) .click(selectors.itemCreateView.cancelButton)
.wait(selectors.itemsIndex.createItemButton) .wait(selectors.itemsIndex.createItemButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/item/index'); expect(url.hash).toEqual('#!/item/index');
}); done();
}).catch(done.fail);
}); });
it('should now access to the create item view by clicking the create floating button', () => { it('should now access to the create item view by clicking the create floating button', done => {
return nightmare return nightmare
.click(selectors.itemsIndex.createItemButton) .click(selectors.itemsIndex.createItemButton)
.wait(selectors.itemCreateView.createButton) .wait(selectors.itemCreateView.createButton)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/item/create'); expect(url.hash).toEqual('#!/item/create');
}); done();
}).catch(done.fail);
}); });
it('should create the Infinity Gauntlet item', () => { it('should create the Infinity Gauntlet item', done => {
return nightmare return nightmare
.type(selectors.itemCreateView.name, 'Infinity Gauntlet') .type(selectors.itemCreateView.name, 'Infinity Gauntlet')
.waitToClick(selectors.itemCreateView.typeSelect) .waitToClick(selectors.itemCreateView.typeSelect)
@ -74,10 +79,11 @@ describe('Item', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should confirm Infinity Gauntlet item was created', () => { it('should confirm Infinity Gauntlet item was created', done => {
return nightmare return nightmare
.wait(selectors.itemBasicData.nameInput) .wait(selectors.itemBasicData.nameInput)
.getInputValue(selectors.itemBasicData.nameInput) .getInputValue(selectors.itemBasicData.nameInput)
@ -98,12 +104,13 @@ describe('Item', () => {
}) })
.then(result => { .then(result => {
expect(result).toBe('Spain'); expect(result).toBe('Spain');
}); done();
}).catch(done.fail);
}); });
}); });
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', done => {
return nightmare return nightmare
.click(selectors.itemBasicData.goToItemIndexButton) .click(selectors.itemBasicData.goToItemIndexButton)
.wait(selectors.itemsIndex.createItemButton) .wait(selectors.itemsIndex.createItemButton)
@ -111,10 +118,11 @@ describe('Item', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toContain('#!/item/index'); expect(url.hash).toContain('#!/item/index');
}); done();
}).catch(done.fail);
}); });
it(`should search for the item Infinity Gauntlet`, () => { it(`should search for the item Infinity Gauntlet`, done => {
return nightmare return nightmare
.wait(selectors.itemsIndex.searchResult) .wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet') .type(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
@ -123,10 +131,11 @@ describe('Item', () => {
.countElement(selectors.itemsIndex.searchResult) .countElement(selectors.itemsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should clone the Infinity Gauntlet`, () => { it(`should clone the Infinity Gauntlet`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet')
.click(selectors.itemsIndex.searchResultCloneButton) .click(selectors.itemsIndex.searchResultCloneButton)
@ -135,10 +144,11 @@ describe('Item', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toContain('tags'); expect(url.hash).toContain('tags');
}); done();
}).catch(done.fail);
}); });
it('should search for the item Infinity Gauntlet and find two', () => { it('should search for the item Infinity Gauntlet and find two', done => {
return nightmare return nightmare
.waitToClick(selectors.itemTags.goToItemIndexButton) .waitToClick(selectors.itemTags.goToItemIndexButton)
.wait(selectors.itemsIndex.searchResult) .wait(selectors.itemsIndex.searchResult)
@ -148,7 +158,8 @@ describe('Item', () => {
.countElement(selectors.itemsIndex.searchResult) .countElement(selectors.itemsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(2); expect(result).toEqual(2);
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,17 +10,18 @@ describe('Ticket', () => {
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should access to the tickets index by clicking the tickets button', () => { it('should access to the tickets index by clicking the tickets button', done => {
return nightmare return nightmare
.click(selectors.moduleAccessView.ticketsSectionButton) .click(selectors.moduleAccessView.ticketsSectionButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the ticket with id 1', () => { it('should search for the ticket with id 1', done => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchTicketInput) .wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1') .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
@ -29,10 +30,11 @@ describe('Ticket', () => {
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the ticket notes`, () => { it(`should click on the search result to access to the ticket notes`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1') .waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
@ -41,10 +43,11 @@ describe('Ticket', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('observation'); expect(url).toContain('observation');
}); done();
}).catch(done.fail);
}); });
it(`should click create a new note and delete a former one`, () => { it(`should click create a new note and delete a former one`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketNotes.firstNoteRemoveButton) .waitToClick(selectors.ticketNotes.firstNoteRemoveButton)
.waitToClick(selectors.ticketNotes.addNoteButton) .waitToClick(selectors.ticketNotes.addNoteButton)
@ -55,10 +58,11 @@ describe('Ticket', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the note is the expected one`, () => { it(`should confirm the note is the expected one`, done => {
return nightmare return nightmare
.click(selectors.ticketPackages.packagesButton) .click(selectors.ticketPackages.packagesButton)
.wait(selectors.ticketPackages.firstPackageSelect) .wait(selectors.ticketPackages.firstPackageSelect)
@ -71,7 +75,8 @@ describe('Ticket', () => {
}) })
.then(result => { .then(result => {
expect(result).toEqual('description'); expect(result).toEqual('description');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,17 +10,18 @@ describe('Ticket', () => {
.waitForLogin('production'); .waitForLogin('production');
}); });
it('should access to the tickets index by clicking the tickets button', () => { it('should access to the tickets index by clicking the tickets button', done => {
return nightmare return nightmare
.click(selectors.moduleAccessView.ticketsSectionButton) .click(selectors.moduleAccessView.ticketsSectionButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the ticket with id 1', () => { it('should search for the ticket with id 1', done => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchTicketInput) .wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1') .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
@ -29,10 +30,11 @@ describe('Ticket', () => {
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the ticket expeditions`, () => { it(`should click on the search result to access to the ticket expeditions`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1') .waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
@ -41,10 +43,11 @@ describe('Ticket', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('expedition'); expect(url).toContain('expedition');
}); done();
}).catch(done.fail);
}); });
it(`should delete a former expedition and confirm the remaining expedition is the expected one`, () => { it(`should delete a former expedition and confirm the remaining expedition is the expected one`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton) .waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton)
.click(selectors.ticketPackages.packagesButton) .click(selectors.ticketPackages.packagesButton)
@ -55,7 +58,8 @@ describe('Ticket', () => {
.then(value => { .then(value => {
expect(value).toContain('Iron Patriot'); expect(value).toContain('Iron Patriot');
expect(value).toContain('root'); expect(value).toContain('root');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -9,7 +9,7 @@ describe('Ticket List sale path', () => {
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should click on the Tickets button of the top bar menu', () => { it('should click on the Tickets button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -18,10 +18,11 @@ describe('Ticket List sale path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the ticket 1', () => { it('should search for the ticket 1', done => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1') .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
@ -30,10 +31,11 @@ describe('Ticket List sale path', () => {
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the ticket's sale`, () => { it(`should click on the search result to access to the ticket's sale`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
@ -42,87 +44,97 @@ describe('Ticket List sale path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('sale'); expect(url).toContain('sale');
}); done();
}).catch(done.fail);
}); });
it('should confirm the first ticket sale contains the colour', () => { it('should confirm the first ticket sale contains the colour', done => {
return nightmare return nightmare
.wait(selectors.ticketSales.firstSaleText) .wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSaleColour) .getInnerText(selectors.ticketSales.firstSaleColour)
.then(value => { .then(value => {
expect(value).toContain('Yellow'); expect(value).toContain('Yellow');
}); done();
}).catch(done.fail);
}); });
it('should confirm the first ticket sale contains the lenght', () => { it('should confirm the first ticket sale contains the lenght', done => {
return nightmare return nightmare
.wait(selectors.ticketSales.firstSaleText) .wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSaleText) .getInnerText(selectors.ticketSales.firstSaleText)
.then(value => { .then(value => {
expect(value).toContain('5'); expect(value).toContain('5');
}); done();
}).catch(done.fail);
}); });
it('should confirm the first ticket sale contains the price', () => { it('should confirm the first ticket sale contains the price', done => {
return nightmare return nightmare
.wait(selectors.ticketSales.firstSaleText) .wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSalePrice) .getInnerText(selectors.ticketSales.firstSalePrice)
.then(value => { .then(value => {
expect(value).toContain('9.10'); expect(value).toContain('9.10');
}); done();
}).catch(done.fail);
}); });
it('should confirm the first ticket sale contains the discount', () => { it('should confirm the first ticket sale contains the discount', done => {
return nightmare return nightmare
.wait(selectors.ticketSales.firstSaleText) .wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSaleDiscount) .getInnerText(selectors.ticketSales.firstSaleDiscount)
.then(value => { .then(value => {
expect(value).toContain('0 %'); expect(value).toContain('0 %');
}); done();
}).catch(done.fail);
}); });
it('should confirm the first ticket sale contains the total import', () => { it('should confirm the first ticket sale contains the total import', done => {
return nightmare return nightmare
.wait(selectors.ticketSales.firstSaleText) .wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSaleImport) .getInnerText(selectors.ticketSales.firstSaleImport)
.then(value => { .then(value => {
expect(value).toContain('45.50'); expect(value).toContain('45.50');
}); done();
}).catch(done.fail);
}); });
it('should confirm the second ticket sale contains the colour', () => { it('should confirm the second ticket sale contains the colour', done => {
return nightmare return nightmare
.wait(selectors.ticketSales.secondSaleText) .wait(selectors.ticketSales.secondSaleText)
.getInnerText(selectors.ticketSales.secondSaleColour) .getInnerText(selectors.ticketSales.secondSaleColour)
.then(value => { .then(value => {
expect(value).toContain('Red'); expect(value).toContain('Red');
}); done();
}).catch(done.fail);
}); });
it('should confirm the second ticket sale contains the price', () => { it('should confirm the second ticket sale contains the price', done => {
return nightmare return nightmare
.wait(selectors.ticketSales.secondSaleText) .wait(selectors.ticketSales.secondSaleText)
.getInnerText(selectors.ticketSales.secondSalePrice) .getInnerText(selectors.ticketSales.secondSalePrice)
.then(value => { .then(value => {
expect(value).toContain('1.07'); expect(value).toContain('1.07');
}); done();
}).catch(done.fail);
}); });
it('should confirm the second ticket sale contains the discount', () => { it('should confirm the second ticket sale contains the discount', done => {
return nightmare return nightmare
.wait(selectors.ticketSales.secondSaleText) .wait(selectors.ticketSales.secondSaleText)
.getInnerText(selectors.ticketSales.secondSaleDiscount) .getInnerText(selectors.ticketSales.secondSaleDiscount)
.then(value => { .then(value => {
expect(value).toContain('0 %'); expect(value).toContain('0 %');
}); done();
}).catch(done.fail);
}); });
it('should confirm the second ticket sale contains the total import', () => { it('should confirm the second ticket sale contains the total import', done => {
return nightmare return nightmare
.wait(selectors.ticketSales.secondSaleText) .wait(selectors.ticketSales.secondSaleText)
.getInnerText(selectors.ticketSales.secondSaleImport) .getInnerText(selectors.ticketSales.secondSaleImport)
.then(value => { .then(value => {
expect(value).toContain('10.70'); expect(value).toContain('10.70');
}); done();
}).catch(done.fail);
}); });
}); });

View File

@ -9,7 +9,7 @@ describe('Ticket Create packages path', () => {
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should click on the Tickets button of the top bar menu', () => { it('should click on the Tickets button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -18,10 +18,11 @@ describe('Ticket Create packages path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the ticket 1', () => { it('should search for the ticket 1', done => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1') .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
@ -30,10 +31,11 @@ describe('Ticket Create packages path', () => {
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the ticket packages`, () => { it(`should click on the search result to access to the ticket packages`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResultAddress, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResultAddress, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
@ -42,10 +44,11 @@ describe('Ticket Create packages path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('package/index'); expect(url).toContain('package/index');
}); done();
}).catch(done.fail);
}); });
it(`should delete the first package and receive and error to save a new one with blank quantity`, () => { it(`should delete the first package and receive and error to save a new one with blank quantity`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketPackages.firstRemovePackageButton) .waitToClick(selectors.ticketPackages.firstRemovePackageButton)
.waitToClick(selectors.ticketPackages.addPackageButton) .waitToClick(selectors.ticketPackages.addPackageButton)
@ -55,20 +58,22 @@ describe('Ticket Create packages path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Some fields are invalid'); expect(result).toEqual('Some fields are invalid');
}); done();
}).catch(done.fail);
}); });
it(`should attempt create a new package but receive an error if quantity is a string`, () => { it(`should attempt create a new package but receive an error if quantity is a string`, done => {
return nightmare return nightmare
.type(selectors.ticketPackages.firstQuantityInput, 'ninety 9') .type(selectors.ticketPackages.firstQuantityInput, 'ninety 9')
.click(selectors.ticketPackages.savePackagesButton) .click(selectors.ticketPackages.savePackagesButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Some fields are invalid'); expect(result).toEqual('Some fields are invalid');
}); done();
}).catch(done.fail);
}); });
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 0`, done => {
return nightmare return nightmare
.clearInput(selectors.ticketPackages.firstQuantityInput) .clearInput(selectors.ticketPackages.firstQuantityInput)
.type(selectors.ticketPackages.firstQuantityInput, 0) .type(selectors.ticketPackages.firstQuantityInput, 0)
@ -76,10 +81,11 @@ describe('Ticket Create packages path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Some fields are invalid'); expect(result).toEqual('Some fields are invalid');
}); done();
}).catch(done.fail);
}); });
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 package is blank`, done => {
return nightmare return nightmare
.clearInput(selectors.ticketPackages.firstQuantityInput) .clearInput(selectors.ticketPackages.firstQuantityInput)
.type(selectors.ticketPackages.firstQuantityInput, 99) .type(selectors.ticketPackages.firstQuantityInput, 99)
@ -88,10 +94,11 @@ describe('Ticket Create packages path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Package cannot be blank'); expect(result).toEqual('Package cannot be blank');
}); done();
}).catch(done.fail);
}); });
it(`should create a new package with correct data`, () => { it(`should create a new package with correct data`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketPackages.firstPackageSelect) .waitToClick(selectors.ticketPackages.firstPackageSelect)
.waitToClick(selectors.ticketPackages.firstPackageSelectOptionTwo) .waitToClick(selectors.ticketPackages.firstPackageSelectOptionTwo)
@ -100,10 +107,11 @@ describe('Ticket Create packages path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the first select is the expected one`, () => { it(`should confirm the first select is the expected one`, done => {
return nightmare return nightmare
.click(selectors.ticketSales.saleButton) .click(selectors.ticketSales.saleButton)
.wait(selectors.ticketSales.firstPackageSelect) .wait(selectors.ticketSales.firstPackageSelect)
@ -112,15 +120,17 @@ describe('Ticket Create packages path', () => {
.getInputValue(selectors.ticketPackages.firstPackageSelect) .getInputValue(selectors.ticketPackages.firstPackageSelect)
.then(result => { .then(result => {
expect(result).toEqual('Legendary Box'); expect(result).toEqual('Legendary Box');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the first quantity is the expected one`, () => { it(`should confirm the first quantity is the expected one`, done => {
return nightmare return nightmare
.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99') .waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99')
.getInputValue(selectors.ticketPackages.firstQuantityInput) .getInputValue(selectors.ticketPackages.firstQuantityInput)
.then(result => { .then(result => {
expect(result).toEqual('99'); expect(result).toEqual('99');
}); done();
}).catch(done.fail);
}); });
}); });

View File

@ -10,7 +10,7 @@ describe('Ticket', () => {
.waitForLogin('production'); .waitForLogin('production');
}); });
it('should click on the Tickets button of the top bar menu', () => { it('should click on the Tickets button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -19,10 +19,11 @@ describe('Ticket', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the ticket 1', () => { it('should search for the ticket 1', done => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1') .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
@ -31,10 +32,11 @@ describe('Ticket', () => {
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the ticket Tracking`, () => { it(`should click on the search result to access to the ticket Tracking`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
@ -43,29 +45,32 @@ describe('Ticket', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('tracking/index'); expect(url).toContain('tracking/index');
}); done();
}).catch(done.fail);
}); });
it('should access to the create state view by clicking the create floating button', () => { it('should access to the create state view by clicking the create floating button', done => {
return nightmare return nightmare
.click(selectors.ticketTracking.createStateButton) .click(selectors.ticketTracking.createStateButton)
.wait(selectors.createStateView.stateInput) .wait(selectors.createStateView.stateInput)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toContain('tracking/edit'); expect(url.hash).toContain('tracking/edit');
}); done();
}).catch(done.fail);
}); });
it(`should attempt create a new state but receive an error if state is empty`, () => { it(`should attempt create a new state but receive an error if state is empty`, done => {
return nightmare return nightmare
.click(selectors.createStateView.saveStateButton) .click(selectors.createStateView.saveStateButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('No changes to save'); expect(result).toEqual('No changes to save');
}); done();
}).catch(done.fail);
}); });
it(`should attempt create a new state then clear and save it`, () => { it(`should attempt create a new state then clear and save it`, done => {
return nightmare return nightmare
.waitToClick(selectors.createStateView.stateInput) .waitToClick(selectors.createStateView.stateInput)
.waitToClick(selectors.createStateView.stateInputOptionOne) .waitToClick(selectors.createStateView.stateInputOptionOne)
@ -74,20 +79,22 @@ describe('Ticket', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should again access to the create state view by clicking the create floating button', () => { it('should again access to the create state view by clicking the create floating button', done => {
return nightmare return nightmare
.click(selectors.ticketTracking.createStateButton) .click(selectors.ticketTracking.createStateButton)
.wait(selectors.createStateView.stateInput) .wait(selectors.createStateView.stateInput)
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toContain('tracking/edit'); expect(url.hash).toContain('tracking/edit');
}); done();
}).catch(done.fail);
}); });
it(`should create a new state`, () => { it(`should create a new state`, done => {
return nightmare return nightmare
.waitToClick(selectors.createStateView.stateInput) .waitToClick(selectors.createStateView.stateInput)
.waitToClick(selectors.createStateView.stateInputOptionOne) .waitToClick(selectors.createStateView.stateInputOptionOne)
@ -95,7 +102,8 @@ describe('Ticket', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -10,7 +10,7 @@ describe('Ticket', () => {
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should click on the Tickets button of the top bar menu', () => { it('should click on the Tickets button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -19,10 +19,11 @@ describe('Ticket', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the ticket 11', () => { it('should search for the ticket 11', done => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:11') .type(selectors.ticketsIndex.searchTicketInput, 'id:11')
@ -31,10 +32,11 @@ describe('Ticket', () => {
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the ticket Basic Data`, () => { it(`should click on the search result to access to the ticket Basic Data`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') // should be Bruce Wayne .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') // should be Bruce Wayne
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
@ -43,10 +45,11 @@ describe('Ticket', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('data/step-one'); expect(url).toContain('data/step-one');
}); done();
}).catch(done.fail);
}); });
it(`should edit the client and address of the ticket then click next`, () => { it(`should edit the client and address of the ticket then click next`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketBasicData.clientSelect) .waitToClick(selectors.ticketBasicData.clientSelect)
.waitToClick(selectors.ticketBasicData.clientSelectThirdOption) .waitToClick(selectors.ticketBasicData.clientSelectThirdOption)
@ -59,28 +62,31 @@ describe('Ticket', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('data/step-two'); expect(url).toContain('data/step-two');
}); done();
}).catch(done.fail);
}); });
it(`should have no price diference`, () => { it(`should have no price diference`, done => {
return nightmare return nightmare
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif) .getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif)
.then(result => { .then(result => {
expect(result).toContain('0'); expect(result).toContain('0');
}); done();
}).catch(done.fail);
}); });
it(`should click next to move on to step three`, () => { it(`should click next to move on to step three`, done => {
return nightmare return nightmare
.click(selectors.ticketBasicData.nextStepButton) .click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-three') .waitForURL('data/step-three')
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('data/step-three'); expect(url).toContain('data/step-three');
}); done();
}).catch(done.fail);
}); });
it(`should select a reason for the changes made then click on finalize`, () => { it(`should select a reason for the changes made then click on finalize`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketBasicData.chargesReason) .waitToClick(selectors.ticketBasicData.chargesReason)
.waitToClick(selectors.ticketBasicData.chargesReasonFourthOption) .waitToClick(selectors.ticketBasicData.chargesReasonFourthOption)
@ -90,20 +96,22 @@ describe('Ticket', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('summary'); expect(url).toContain('summary');
}); done();
}).catch(done.fail);
}); });
it(`should go back to ticket.basicData section`, () => { it(`should go back to ticket.basicData section`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketBasicData.basicDataButton) .waitToClick(selectors.ticketBasicData.basicDataButton)
.waitForURL('data/step-one') .waitForURL('data/step-one')
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('data/step-one'); expect(url).toContain('data/step-one');
}); done();
}).catch(done.fail);
}); });
it(`should edit the ticket agency then click next`, () => { it(`should edit the ticket agency then click next`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketBasicData.agencySelect) .waitToClick(selectors.ticketBasicData.agencySelect)
.waitToClick(selectors.ticketBasicData.agencySelectOptionSix) .waitToClick(selectors.ticketBasicData.agencySelectOptionSix)
@ -113,28 +121,31 @@ describe('Ticket', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('data/step-two'); expect(url).toContain('data/step-two');
}); done();
}).catch(done.fail);
}); });
it(`should have a price diference`, () => { it(`should have a price diference`, done => {
return nightmare return nightmare
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif) .getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif)
.then(result => { .then(result => {
expect(result).toContain('-20.65'); expect(result).toContain('-20.65');
}); done();
}).catch(done.fail);
}); });
it(`should then click next to move on to step three`, () => { it(`should then click next to move on to step three`, done => {
return nightmare return nightmare
.click(selectors.ticketBasicData.nextStepButton) .click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-three') .waitForURL('data/step-three')
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('data/step-three'); expect(url).toContain('data/step-three');
}); done();
}).catch(done.fail);
}); });
it(`should select a new reason for the changes made then click on finalize`, () => { it(`should select a new reason for the changes made then click on finalize`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketBasicData.chargesReason) .waitToClick(selectors.ticketBasicData.chargesReason)
.waitToClick(selectors.ticketBasicData.chargesReasonFirstOption) .waitToClick(selectors.ticketBasicData.chargesReasonFirstOption)
@ -144,7 +155,8 @@ describe('Ticket', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('summary'); expect(url).toContain('summary');
}); done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -1,8 +1,7 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
// #633 descriptor-popover bug describe('Ticket Edit sale path', () => {
xdescribe('Ticket Edit sale path', () => {
const nightmare = createNightmare(); const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
@ -10,7 +9,7 @@ xdescribe('Ticket Edit sale path', () => {
.waitForLogin('salesPerson'); .waitForLogin('salesPerson');
}); });
it('should click on the Tickets button of the top bar menu', () => { it('should click on the Tickets button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -19,10 +18,11 @@ xdescribe('Ticket Edit sale path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
}); done();
}).catch(done.fail);
}); });
it('should search for a specific ticket', () => { it('should search for a specific ticket', done => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:16') .type(selectors.ticketsIndex.searchTicketInput, 'id:16')
@ -31,10 +31,11 @@ xdescribe('Ticket Edit sale path', () => {
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the ticket Sale`, () => { it(`should click on the search result to access to the ticket Sale`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
@ -43,130 +44,91 @@ xdescribe('Ticket Edit sale path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
}); done();
}).catch(done.fail);
}); });
describe('Before tests begings', () => { it(`should check the zoomed image isnt present`, done => {
it(`should check the quantity in the 1st line which we will be using in the further tests`, () => {
return nightmare
.wait(selectors.ticketSales.firstSaleText)
.getInputValue(selectors.ticketSales.firstSaleQuantity)
.then(value => {
expect(value).toEqual('5');
});
});
it(`should check the Price in the 1st line which we will be using in the further tests`, () => {
return nightmare
.wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSalePrice)
.then(value => {
expect(value).toContain('9.10');
});
});
it(`should check the Discount in the 1st line which we will be using in the further tests`, () => {
return nightmare
.wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSaleDiscount)
.then(value => {
expect(value).toEqual('0 %');
});
});
it(`should check the Import in the 1st line which we will be using in the further tests`, () => {
return nightmare
.wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSaleImport)
.then(value => {
expect(value).toContain('45.50');
});
});
it(`should count the ticket lines to verify there are 4 for further testing`, () => {
return nightmare
.countElement(selectors.ticketSales.saleLine)
.then(result => {
expect(result).toEqual(4);
});
});
});
it(`should check the zoomed image isnt present`, () => {
return nightmare return nightmare
.countElement(selectors.ticketSales.firstSaleZoomedImage) .countElement(selectors.ticketSales.firstSaleZoomedImage)
.then(result => { .then(result => {
expect(result).toEqual(0); expect(result).toEqual(0);
}); done();
}).catch(done.fail);
}); });
it(`should click on the thumbnail image of the 1st sale and see the zoomed image`, () => { it(`should click on the thumbnail image of the 1st sale and see the zoomed image`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleThumbnailImage) .waitToClick(selectors.ticketSales.firstSaleThumbnailImage)
.countElement(selectors.ticketSales.firstSaleZoomedImage) .countElement(selectors.ticketSales.firstSaleZoomedImage)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the zoomed image to close it`, () => { it(`should click on the zoomed image to close it`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleZoomedImage) .waitToClick(selectors.ticketSales.firstSaleZoomedImage)
.countElement(selectors.ticketSales.firstSaleZoomedImage) .countElement(selectors.ticketSales.firstSaleZoomedImage)
.then(result => { .then(result => {
expect(result).toEqual(0); expect(result).toEqual(0);
}); done();
}).catch(done.fail);
}); });
it(`should confirm the item descriptor insnt visible yet`, () => { it(`should confirm the item descriptor insnt visible yet`, done => {
return nightmare return nightmare
.isVisible(selectors.ticketSales.saleDescriptorPopover) .isVisible(selectors.ticketSales.saleDescriptorPopover)
.then(result => { .then(visible => {
expect(result).toBeFalsy(); expect(visible).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it(`should click on the first sale ID making the item descriptor visible`, () => { it(`should click on the first sale ID making the item descriptor visible`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleID) .waitToClick(selectors.ticketSales.firstSaleID)
.waitToClick(selectors.ticketSales.firstSaleID) .wait(1000)
.waitToClick(selectors.ticketSales.firstSaleID)
.waitToClick(selectors.ticketSales.firstSaleID)
.isVisible(selectors.ticketSales.saleDescriptorPopover) .isVisible(selectors.ticketSales.saleDescriptorPopover)
.then(result => { .then(visible => {
expect(result).toBeTruthy(); expect(visible).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it(`should click on the descriptor image of the 1st sale and see the zoomed image`, () => { it(`should click on the descriptor image of the 1st sale and see the zoomed image`, done => {
return nightmare return nightmare
.waitToClick('vn-item-descriptor img') .waitToClick('vn-item-descriptor img')
.countElement(selectors.ticketSales.firstSaleZoomedImage) .countElement(selectors.ticketSales.firstSaleZoomedImage)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the zoomed image to close it`, () => { it(`should click on the zoomed image to close it`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleZoomedImage) .waitToClick(selectors.ticketSales.firstSaleZoomedImage)
.countElement(selectors.ticketSales.firstSaleZoomedImage) .countElement(selectors.ticketSales.firstSaleZoomedImage)
.then(result => { .then(result => {
expect(result).toEqual(0); expect(result).toEqual(0);
}); done();
}).catch(done.fail);
}); });
it(`should click on the summary icon of the item-descriptor to access to the item summary`, () => { it(`should click on the summary icon of the item-descriptor to access to the item summary`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.saleDescriptorPopoverSummaryButton) .waitToClick(selectors.ticketSales.saleDescriptorPopoverSummaryButton)
.waitForURL('/summary') .waitForURL('/summary')
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/summary'); expect(url).toContain('/summary');
}); done();
}).catch(done.fail);
}); });
it('should return to ticket sales section', () => { it('should return to ticket sales section', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -182,30 +144,33 @@ xdescribe('Ticket Edit sale path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
}); done();
}).catch(done.fail);
}); });
it('should try to add a higher quantity value and then receive an error', () => { it('should try to add a higher quantity value and then receive an error', done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleQuantityClearInput) .waitToClick(selectors.ticketSales.firstSaleQuantityClearInput)
.type(selectors.ticketSales.firstSaleQuantity, '9\u000d') .type(selectors.ticketSales.firstSaleQuantity, '9\u000d')
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('The new quantity should be smaller than the old one'); expect(result).toEqual('The new quantity should be smaller than the old one');
}); done();
}).catch(done.fail);
}); });
it('should remove 1 from quantity', () => { it('should remove 1 from quantity', done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleQuantityClearInput) .waitToClick(selectors.ticketSales.firstSaleQuantityClearInput)
.type(selectors.ticketSales.firstSaleQuantity, '4\u000d') .type(selectors.ticketSales.firstSaleQuantity, '4\u000d')
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should update the price', () => { it('should update the price', done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSalePrice) .waitToClick(selectors.ticketSales.firstSalePrice)
.wait(selectors.ticketSales.firstSalePriceInput) .wait(selectors.ticketSales.firstSalePriceInput)
@ -214,26 +179,29 @@ xdescribe('Ticket Edit sale path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should confirm the price have been updated', () => { it('should confirm the price have been updated', done => {
return nightmare return nightmare
.getInnerText(selectors.ticketSales.firstSalePrice) .getInnerText(selectors.ticketSales.firstSalePrice)
.then(result => { .then(result => {
expect(result).toContain('5.00'); expect(result).toContain('5.00');
}); done();
}).catch(done.fail);
}); });
it('should confirm the total price for that item have been updated', () => { it('should confirm the total price for that item have been updated', done => {
return nightmare return nightmare
.getInnerText(selectors.ticketSales.firstSaleImport) .getInnerText(selectors.ticketSales.firstSaleImport)
.then(result => { .then(result => {
expect(result).toContain('20.00'); expect(result).toContain('20.00');
}); done();
}).catch(done.fail);
}); });
it('should update the discount', () => { it('should update the discount', done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleDiscount) .waitToClick(selectors.ticketSales.firstSaleDiscount)
.wait('vn-textfield[label="Discount"] > div[class="container selected"]') // a function selects the text after it's loaded .wait('vn-textfield[label="Discount"] > div[class="container selected"]') // a function selects the text after it's loaded
@ -242,30 +210,33 @@ xdescribe('Ticket Edit sale path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it('should confirm the discount have been updated', () => { it('should confirm the discount have been updated', done => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketSales.firstSaleDiscount, '50 %') .waitForTextInElement(selectors.ticketSales.firstSaleDiscount, '50 %')
.getInnerText(selectors.ticketSales.firstSaleDiscount) .getInnerText(selectors.ticketSales.firstSaleDiscount)
.then(result => { .then(result => {
expect(result).toContain('50 %'); expect(result).toContain('50 %');
}); done();
}).catch(done.fail);
}); });
it('should confirm the total import for that item have been updated', () => { it('should confirm the total import for that item have been updated', done => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketSales.firstSaleImport, '10.00') .waitForTextInElement(selectors.ticketSales.firstSaleImport, '10.00')
.getInnerText(selectors.ticketSales.firstSaleImport) .getInnerText(selectors.ticketSales.firstSaleImport)
.then(result => { .then(result => {
expect(result).toContain('10.00'); expect(result).toContain('10.00');
}); done();
}).catch(done.fail);
}); });
it('should select the third sale and create a claim of it', () => { it('should select the third sale and create a claim of it', done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox) .waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.moreMenuButton) .waitToClick(selectors.ticketSales.moreMenuButton)
.waitToClick(selectors.ticketSales.moreMenuCreateClaim) .waitToClick(selectors.ticketSales.moreMenuCreateClaim)
.waitForLogin('salesPerson') .waitForLogin('salesPerson')
@ -276,10 +247,11 @@ xdescribe('Ticket Edit sale path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/claim/index'); expect(url.hash).toEqual('#!/claim/index');
}); done();
}).catch(done.fail);
}); });
it('should click on the Claims button of the top bar menu', () => { it('should click on the Claims button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -288,10 +260,11 @@ xdescribe('Ticket Edit sale path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/claim/index'); expect(url.hash).toEqual('#!/claim/index');
}); done();
}).catch(done.fail);
}); });
it('should search for the claim with id 4', () => { it('should search for the claim with id 4', done => {
return nightmare return nightmare
.wait(selectors.claimsIndex.searchResult) .wait(selectors.claimsIndex.searchResult)
.type(selectors.claimsIndex.searchClaimInput, 4) .type(selectors.claimsIndex.searchClaimInput, 4)
@ -300,10 +273,11 @@ xdescribe('Ticket Edit sale path', () => {
.countElement(selectors.claimsIndex.searchResult) .countElement(selectors.claimsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it('should click the Tickets button of the top bar menu', () => { it('should click the Tickets button of the top bar menu', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -312,10 +286,11 @@ xdescribe('Ticket Edit sale path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
}); done();
}).catch(done.fail);
}); });
it('should search the ticket', () => { it('should search the ticket', done => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:16') .type(selectors.ticketsIndex.searchTicketInput, 'id:16')
@ -324,10 +299,11 @@ xdescribe('Ticket Edit sale path', () => {
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the result to access to the ticket Sale`, () => { it(`should click on the result to access to the ticket Sale`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
@ -336,10 +312,11 @@ xdescribe('Ticket Edit sale path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
}); done();
}).catch(done.fail);
}); });
it('should select the third sale and delete it', () => { it('should select the third sale and delete it', done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.thirdSaleCheckbox) .waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.deleteSaleButton) .waitToClick(selectors.ticketSales.deleteSaleButton)
@ -347,18 +324,20 @@ xdescribe('Ticket Edit sale path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the third sale was deleted`, () => { it(`should confirm the third sale was deleted`, done => {
return nightmare return nightmare
.countElement(selectors.ticketSales.saleLine) .countElement(selectors.ticketSales.saleLine)
.then(result => { .then(result => {
expect(result).toEqual(3); expect(result).toEqual(3);
}); done();
}).catch(done.fail);
}); });
it('should select the third sale and attempt to send it to a frozen client ticket', () => { it('should select the third sale and attempt to send it to a frozen client ticket', done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.thirdSaleCheckbox) .waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.transferSaleButton) .waitToClick(selectors.ticketSales.transferSaleButton)
@ -368,10 +347,11 @@ xdescribe('Ticket Edit sale path', () => {
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual(`The sales of this ticket can't be modified`); expect(result).toEqual(`The sales of this ticket can't be modified`);
}); done();
}).catch(done.fail);
}); });
it('should transfer the sale to a valid ticket', () => { it('should transfer the sale to a valid ticket', done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.moveToTicketInputClearButton) .waitToClick(selectors.ticketSales.moveToTicketInputClearButton)
.type(selectors.ticketSales.moveToTicketInput, 12) .type(selectors.ticketSales.moveToTicketInput, 12)
@ -380,19 +360,21 @@ xdescribe('Ticket Edit sale path', () => {
.url() .url()
.then(result => { .then(result => {
expect(result).toContain(`ticket/12/sale`); expect(result).toContain(`ticket/12/sale`);
}); done();
}).catch(done.fail);
}); });
it('should confirm the transfered line is the correct one', () => { it('should confirm the transfered line is the correct one', done => {
return nightmare return nightmare
.wait(selectors.ticketSales.firstSaleText) .wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSaleText) .getInnerText(selectors.ticketSales.firstSaleText)
.then(result => { .then(result => {
expect(result).toContain(`Mark I`); expect(result).toContain(`Mark I`);
}); done();
}).catch(done.fail);
}); });
it('should go back to the original ticket sales section', () => { it('should go back to the original ticket sales section', done => {
return nightmare return nightmare
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton) .waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
@ -406,19 +388,21 @@ xdescribe('Ticket Edit sale path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
}); done();
}).catch(done.fail);
}); });
it(`should confirm the original ticket has only two lines now`, () => { it(`should confirm the original ticket has only two lines now`, done => {
return nightmare return nightmare
.wait(selectors.ticketSales.saleLine) .wait(selectors.ticketSales.saleLine)
.countElement(selectors.ticketSales.saleLine) .countElement(selectors.ticketSales.saleLine)
.then(result => { .then(result => {
expect(result).toEqual(2); expect(result).toEqual(2);
}); done();
}).catch(done.fail);
}); });
it('should go back to the receiver ticket sales section', () => { it('should go back to the receiver ticket sales section', done => {
return nightmare return nightmare
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton) .waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
@ -432,10 +416,11 @@ xdescribe('Ticket Edit sale path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
}); done();
}).catch(done.fail);
}); });
it('should transfer the sale back to the original ticket', () => { it('should transfer the sale back to the original ticket', done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox) .waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.transferSaleButton) .waitToClick(selectors.ticketSales.transferSaleButton)
@ -446,19 +431,21 @@ xdescribe('Ticket Edit sale path', () => {
.url() .url()
.then(result => { .then(result => {
expect(result).toContain(`ticket/16/sale`); expect(result).toContain(`ticket/16/sale`);
}); done();
}).catch(done.fail);
}); });
it('should confirm the original ticket received the line', () => { it('should confirm the original ticket received the line', done => {
return nightmare return nightmare
.wait(selectors.ticketSales.saleLine) .wait(selectors.ticketSales.saleLine)
.countElement(selectors.ticketSales.saleLine) .countElement(selectors.ticketSales.saleLine)
.then(result => { .then(result => {
expect(result).toEqual(3); expect(result).toEqual(3);
}); done();
}).catch(done.fail);
}); });
it('should select the second and third sale and tranfer them to a new ticket then get to the ticket index', () => { it('should select the second and third sale and tranfer them to a new ticket then get to the ticket index', done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.secondSaleCheckbox) .waitToClick(selectors.ticketSales.secondSaleCheckbox)
.waitToClick(selectors.ticketSales.thirdSaleCheckbox) .waitToClick(selectors.ticketSales.thirdSaleCheckbox)
@ -472,10 +459,11 @@ xdescribe('Ticket Edit sale path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
}); done();
}).catch(done.fail);
}); });
it('should search for a specific created ticket', () => { it('should search for a specific created ticket', done => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:22') .type(selectors.ticketsIndex.searchTicketInput, 'id:22')
@ -484,10 +472,11 @@ xdescribe('Ticket Edit sale path', () => {
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the ticket Sale`, () => { it(`should click on the search result to access to the ticket Sale`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
@ -496,26 +485,29 @@ xdescribe('Ticket Edit sale path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
}); done();
}).catch(done.fail);
}); });
it('should confirm the new ticket received both lines', () => { it('should confirm the new ticket received both lines', done => {
return nightmare return nightmare
.countElement(selectors.ticketSales.saleLine) .countElement(selectors.ticketSales.saleLine)
.then(result => { .then(result => {
expect(result).toEqual(2); expect(result).toEqual(2);
}); done();
}).catch(done.fail);
}); });
it('should check the first sale reserved icon isnt visible', () => { it('should check the first sale reserved icon isnt visible', done => {
return nightmare return nightmare
.isVisible(selectors.ticketSales.firstSaleReservedIcon) .isVisible(selectors.ticketSales.firstSaleReservedIcon)
.then(result => { .then(result => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it('should mark the first sale as reserved', () => { it('should mark the first sale as reserved', done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox) .waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.moreMenuButton) .waitToClick(selectors.ticketSales.moreMenuButton)
@ -524,10 +516,11 @@ xdescribe('Ticket Edit sale path', () => {
.isVisible(selectors.ticketSales.firstSaleReservedIcon) .isVisible(selectors.ticketSales.firstSaleReservedIcon)
.then(result => { .then(result => {
expect(result).toBeTruthy(); expect(result).toBeTruthy();
}); done();
}).catch(done.fail);
}); });
it('should unmark the first sale as reserved', () => { it('should unmark the first sale as reserved', done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox) .waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.moreMenuButton) .waitToClick(selectors.ticketSales.moreMenuButton)
@ -536,25 +529,28 @@ xdescribe('Ticket Edit sale path', () => {
.isVisible(selectors.ticketSales.firstSaleReservedIcon) .isVisible(selectors.ticketSales.firstSaleReservedIcon)
.then(result => { .then(result => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it('should update all sales discount', () => { // #744 fix edit sale bug, boton MAS descuento
return nightmare // it('should update all sales discount', done => {
.waitToClick(selectors.ticketSales.selectAllSalesCheckbox) // return nightmare
.waitToClick(selectors.ticketSales.moreMenuButton) // .waitToClick(selectors.ticketSales.selectAllSalesCheckbox)
.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount) // .waitToClick(selectors.ticketSales.moreMenuButton)
.wait(selectors.ticketSales.moreMenuUpdateDiscountInput) // .waitToClick(selectors.ticketSales.moreMenuUpdateDiscount)
.type(selectors.ticketSales.moreMenuUpdateDiscountInput, 100) // .wait(selectors.ticketSales.moreMenuUpdateDiscountInput)
.type('body', '\u000d') // simulates enter // .type(selectors.ticketSales.moreMenuUpdateDiscountInput, 100)
.waitForTextInElement(selectors.ticketSales.totalImport, '0.00') // .type('body', '\u000d') // simulates enter
.getInnerText(selectors.ticketSales.totalImport) // .waitForTextInElement(selectors.ticketSales.totalImport, '0.00')
.then(result => { // .getInnerText(selectors.ticketSales.totalImport)
expect(result).toContain('0.00'); // .then(result => {
}); // expect(result).toContain('0.00');
}); // done();
// }).catch(done.fail);
// });
it('should log in as Production role and go to the ticket index', () => { it('should log in as Production role and go to the ticket index', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.logOutButton) .waitToClick(selectors.globalItems.logOutButton)
.waitForLogin('production') .waitForLogin('production')
@ -565,10 +561,11 @@ xdescribe('Ticket Edit sale path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
}); done();
}).catch(done.fail);
}); });
it('should now search for a specific ticket', () => { it('should now search for a specific ticket', done => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:16') .type(selectors.ticketsIndex.searchTicketInput, 'id:16')
@ -577,10 +574,11 @@ xdescribe('Ticket Edit sale path', () => {
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should now click on the search result to access to the ticket Tracking`, () => { it(`should now click on the search result to access to the ticket Tracking`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
@ -589,20 +587,22 @@ xdescribe('Ticket Edit sale path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/tracking/index'); expect(url).toContain('/tracking/index');
}); done();
}).catch(done.fail);
}); });
it(`should click on the edit ticket tracking state button`, () => { it(`should click on the edit ticket tracking state button`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketTracking.createStateButton) .waitToClick(selectors.ticketTracking.createStateButton)
.waitForURL('/tracking/edit') .waitForURL('/tracking/edit')
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/tracking/edit'); expect(url).toContain('/tracking/edit');
}); done();
}).catch(done.fail);
}); });
it(`should set the state of the ticket to preparation`, () => { it(`should set the state of the ticket to preparation`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketTracking.stateSelect) .waitToClick(selectors.ticketTracking.stateSelect)
.wait(selectors.ticketTracking.stateSelectInput) .wait(selectors.ticketTracking.stateSelectInput)
@ -614,48 +614,53 @@ xdescribe('Ticket Edit sale path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/tracking/index'); expect(url).toContain('/tracking/index');
}); done();
}).catch(done.fail);
}); });
it(`should click on the ticket Sale menu button`, () => { it(`should click on the ticket Sale menu button`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
}); done();
}).catch(done.fail);
}); });
describe('when state is preparation and loged as Production', () => { describe('when state is preparation and loged as Production', () => {
it(`should not be able to edit the sale price`, () => { it(`should not be able to edit the sale price`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSalePrice) .waitToClick(selectors.ticketSales.firstSalePrice)
.exists(selectors.ticketSales.firstSalePriceInput) .exists(selectors.ticketSales.firstSalePriceInput)
.then(result => { .then(result => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it(`should not be able to edit the sale discount`, () => { it(`should not be able to edit the sale discount`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleDiscount) .waitToClick(selectors.ticketSales.firstSaleDiscount)
.exists(selectors.ticketSales.firstSaleDiscountInput) .exists(selectors.ticketSales.firstSaleDiscountInput)
.then(result => { .then(result => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it(`should not be able to edit the sale state`, () => { it(`should not be able to edit the sale state`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.stateMenuButton) .waitToClick(selectors.ticketSales.stateMenuButton)
.exists(selectors.ticketSales.stateMenuOptions) .exists(selectors.ticketSales.stateMenuOptions)
.then(result => { .then(result => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it('should log in as salesPerson role and go to the ticket index', () => { it('should log in as salesPerson role and go to the ticket index', done => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.logOutButton) .waitToClick(selectors.globalItems.logOutButton)
.waitForLogin('salesPerson') .waitForLogin('salesPerson')
@ -666,10 +671,11 @@ xdescribe('Ticket Edit sale path', () => {
.parsedUrl() .parsedUrl()
.then(url => { .then(url => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
}); done();
}).catch(done.fail);
}); });
it('should again search for a specific ticket', () => { it('should again search for a specific ticket', done => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:16') .type(selectors.ticketsIndex.searchTicketInput, 'id:16')
@ -678,10 +684,11 @@ xdescribe('Ticket Edit sale path', () => {
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should again click on the search result to access to the ticket Sales`, () => { it(`should again click on the search result to access to the ticket Sales`, done => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
@ -690,39 +697,43 @@ xdescribe('Ticket Edit sale path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
}); done();
}).catch(done.fail);
}); });
}); });
describe('when state is preparation and loged as salesPerson', () => { describe('when state is preparation and loged as salesPerson', () => {
it(`shouldnt be able to edit the sale price`, () => { it(`shouldnt be able to edit the sale price`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSalePrice) .waitToClick(selectors.ticketSales.firstSalePrice)
.exists(selectors.ticketSales.firstSalePriceInput) .exists(selectors.ticketSales.firstSalePriceInput)
.then(result => { .then(result => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it(`shouldnt be able to edit the sale discount`, () => { it(`shouldnt be able to edit the sale discount`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleDiscount) .waitToClick(selectors.ticketSales.firstSaleDiscount)
.exists(selectors.ticketSales.firstSaleDiscountInput) .exists(selectors.ticketSales.firstSaleDiscountInput)
.then(result => { .then(result => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it(`shouldnt be able to edit the sale state`, () => { it(`shouldnt be able to edit the sale state`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.stateMenuButton) .waitToClick(selectors.ticketSales.stateMenuButton)
.exists(selectors.ticketSales.stateMenuOptions) .exists(selectors.ticketSales.stateMenuOptions)
.then(result => { .then(result => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); done();
}).catch(done.fail);
}); });
it('should go to another ticket sales section', () => { it('should go to another ticket sales section', done => {
return nightmare return nightmare
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton) .waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
@ -736,10 +747,11 @@ xdescribe('Ticket Edit sale path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
}); done();
}).catch(done.fail);
}); });
it(`should be able to delete the ticket`, () => { it(`should be able to delete the ticket`, done => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.moreMenuButton) .waitToClick(selectors.ticketSales.moreMenuButton)
.waitToClick(selectors.ticketSales.moreMenuDeleteOption) .waitToClick(selectors.ticketSales.moreMenuDeleteOption)
@ -748,10 +760,11 @@ xdescribe('Ticket Edit sale path', () => {
.url() .url()
.then(url => { .then(url => {
expect(url).toContain('/ticket/index'); expect(url).toContain('/ticket/index');
}); done();
}).catch(done.fail);
}); });
it(`should search for the deleted ticket`, () => { it(`should search for the deleted ticket`, done => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:17') .type(selectors.ticketsIndex.searchTicketInput, 'id:17')
@ -760,16 +773,18 @@ xdescribe('Ticket Edit sale path', () => {
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); done();
}).catch(done.fail);
}); });
it(`should search for the deleted ticket`, () => { it(`should search for the deleted ticket`, done => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResultDate) .wait(selectors.ticketsIndex.searchResultDate)
.getInnerText(selectors.ticketsIndex.searchResultDate) .getInnerText(selectors.ticketsIndex.searchResultDate)
.then(result => { .then(result => {
expect(result).toContain(2000); expect(result).toContain(2000);
}); done();
}).catch(done.fail);
}); });
}); });
}); });