diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 45a3d4e3e..bd850ef3f 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -468,6 +468,17 @@ export default { secondClaimRedeliveryAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.claimRedeliveryFk"]', saveDevelopmentButton: `${components.vnSubmit}` }, + claimAction: { + importClaimButton: 'vn-claim-action vn-button[label="Import claim"]', + importTicketButton: 'vn-claim-action vn-button[label="Import ticket"]', + secondImportableTicket: 'vn-claim-action > vn-vertical > vn-popover > div > div.content > div > vn-table > div > vn-tbody > vn-tr:nth-child(2)', + firstLineDestination: 'vn-claim-action vn-tr:nth-child(1) vn-autocomplete[field="saleClaimed.claimDestinationFk"]', + thirdLineDestination: 'vn-claim-action vn-tr:nth-child(3) vn-autocomplete[field="saleClaimed.claimDestinationFk"]', + firstDeleteLine: 'vn-claim-action vn-tr:nth-child(1) vn-icon-button[icon="delete"]', + secondDeleteLine: 'vn-claim-action vn-tr:nth-child(2) vn-icon-button[icon="delete"]', + thirdDeleteLine: 'vn-claim-action vn-tr:nth-child(3) vn-icon-button[icon="delete"]' + + }, ordersIndex: { searchResult: `vn-order-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr`, searchResultDate: `vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)`, diff --git a/e2e/paths/claim-module/04_claim_action.spec.js b/e2e/paths/claim-module/04_claim_action.spec.js new file mode 100644 index 000000000..2a61c088f --- /dev/null +++ b/e2e/paths/claim-module/04_claim_action.spec.js @@ -0,0 +1,63 @@ +import selectors from '../../helpers/selectors.js'; +import createNightmare from '../../helpers/nightmare'; + +describe('Claim edit basic data path', () => { + const nightmare = createNightmare(); + + beforeAll(() => { + nightmare + .loginAndModule('administrative', 'claim') + .accessToSearchResult('4') + .accessToSection('claim.card.action'); + }); + + it('should import the claim', async() => { + const result = await nightmare + .waitToClick(selectors.claimAction.importClaimButton) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should import the eighth ticket', async() => { + const result = await nightmare + .waitToClick(selectors.claimAction.importTicketButton) + .waitToClick(selectors.claimAction.secondImportableTicket) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should edit the fourth line destination field', async() => { + const result = await nightmare + .autocompleteSearch(selectors.claimAction.thirdLineDestination, 'Bueno') + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should delete two first lines', async() => { + const result = await nightmare + .waitToClick(selectors.claimAction.secondDeleteLine) + .waitToClick(selectors.claimAction.firstDeleteLine) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should refresh the view to check the remaining line is the expected one', async() => { + const result = await nightmare + .reloadSection('claim.card.action') + .waitToGetProperty(`${selectors.claimAction.firstLineDestination} input`, 'value'); + + expect(result).toEqual('Bueno'); + }); + + it('should delete the current first line', async() => { + const result = await nightmare + .waitToClick(selectors.claimAction.firstDeleteLine) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); +});