diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index be9914ef6..0515cf510 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -287,6 +287,7 @@ let actions = { this.wait(`vn-searchbar input`) .type(`vn-searchbar input`, searchValue) .click(`vn-searchbar vn-icon[icon="search"]`) + .waitForNumberOfElements('.searchResult', 1) .evaluate(() => { return document.querySelector('ui-view vn-card vn-table') != null; }) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 5e54f4fd5..e020bdf61 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -459,7 +459,10 @@ export default { detailButton: `vn-left-menu a[ui-sref="claim.card.detail"]`, addItemButton: `vn-claim-detail a vn-float-button`, firstClaimableSaleFromTicket: 'vn-claim-detail > vn-dialog vn-tbody > vn-tr', - claimDetailLine: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr' + claimDetailLine: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr', + secondItemQuantityInput: 'vn-claim-detail vn-tr:nth-child(2) vn-textfield[model="saleClaimed.quantity"] input', + totalClaimed: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-horizontal > div > vn-label-value:nth-child(2) > section > span', + secondItemDeleteButton: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(9) > vn-icon-button > button > vn-icon > i' }, claimDevelopment: { developmentButton: 'vn-left-menu a[ui-sref="claim.card.development"]', diff --git a/e2e/paths/claim-module/01_edit_basic_data.spec.js b/e2e/paths/claim-module/01_edit_basic_data.spec.js index 3c9355bb6..6bc5b87ba 100644 --- a/e2e/paths/claim-module/01_edit_basic_data.spec.js +++ b/e2e/paths/claim-module/01_edit_basic_data.spec.js @@ -25,8 +25,8 @@ describe('Claim edit basic data path', () => { it('should confirm the claim state was edited', async() => { const result = await nightmare - .click(selectors.claimDetails.detailsButton) - .wait(selectors.claimDetails.addItemButton) + .click(selectors.claimDetail.detailButton) + .wait(selectors.claimDetail.addItemButton) .click(selectors.claimBasicData.basicDataButton) .wait(selectors.claimBasicData.claimStateAutocomplete) .waitToGetProperty(`${selectors.claimBasicData.claimStateAutocomplete} input`, 'value'); diff --git a/e2e/paths/claim-module/03_detail.spec.js b/e2e/paths/claim-module/03_detail.spec.js new file mode 100644 index 000000000..ae27f3b34 --- /dev/null +++ b/e2e/paths/claim-module/03_detail.spec.js @@ -0,0 +1,64 @@ +import selectors from '../../helpers/selectors.js'; +import createNightmare from '../../helpers/nightmare'; + +describe('Claim detail', () => { + const nightmare = createNightmare(); + + beforeAll(() => { + nightmare + .loginAndModule('salesPerson', 'claim') + .accessToSearchResult('4') + .accessToSection('claim.card.detail'); + }); + + it('should add the first claimable item from ticket to the claim', async() => { + const result = await nightmare + .waitToClick(selectors.claimDetail.addItemButton) + .waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should confirm the claim contains now two items', async() => { + const result = await nightmare + .countElement(selectors.claimDetail.claimDetailLine); + + expect(result).toEqual(2); + }); + + it('should edit de second item claimed quantity', async() => { + const result = await nightmare + .write(selectors.claimDetail.secondItemQuantityInput, 10) + .type('body', '\u000d') // simulates enter + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should confirm the second item, and the claimed total were correctly edited', async() => { + const claimedQuantity = await nightmare + .getProperty(selectors.claimDetail.secondItemQuantityInput, 'value'); + + const totalClaimed = await nightmare + .getProperty(selectors.claimDetail.totalClaimed, 'innerText'); + + expect(claimedQuantity).toEqual('10'); + expect(totalClaimed).toEqual('29.50 €'); + }); + + it('should delete the second item from the claim', async() => { + const result = await nightmare + .waitToClick(selectors.claimDetail.secondItemDeleteButton) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should confirm the claim contains now one item', async() => { + const result = await nightmare + .countElement(selectors.claimDetail.claimDetailLine); + + expect(result).toEqual(1); + }); +}); diff --git a/modules/agency/front/index/index.html b/modules/agency/front/index/index.html index 7257c89d2..3675119eb 100644 --- a/modules/agency/front/index/index.html +++ b/modules/agency/front/index/index.html @@ -31,7 +31,7 @@ - + {{::zone.id}} {{::zone.name}} {{::zone.agencyMode.name}} diff --git a/modules/claim/front/index/index.html b/modules/claim/front/index/index.html index a6ed8c4e0..ef6504054 100644 --- a/modules/claim/front/index/index.html +++ b/modules/claim/front/index/index.html @@ -33,7 +33,7 @@ {{::claim.id}} diff --git a/modules/client/front/index/index.html b/modules/client/front/index/index.html index 9ac8a282e..0e5fa3f3e 100644 --- a/modules/client/front/index/index.html +++ b/modules/client/front/index/index.html @@ -18,6 +18,7 @@ diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index 6cc73b7c4..57ab0f15c 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -19,6 +19,7 @@ diff --git a/modules/order/front/index/index.html b/modules/order/front/index/index.html index 9dd353a52..37f1eb9e7 100644 --- a/modules/order/front/index/index.html +++ b/modules/order/front/index/index.html @@ -30,7 +30,7 @@ - {{::order.id}} diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index a8d21c5cd..1953e3cfc 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -50,7 +50,7 @@ - - + {{::travel.id}} {{::travel.ref}} {{::travel.agency.name}}