From 27104b44a7f8cc64f8978a1b2b7dfdc99ea65c32 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 28 Jun 2019 12:51:34 +0200 Subject: [PATCH] #1536 e2e claim summary --- e2e/helpers/selectors.js | 11 +++ ...sic_data.spec.js => 01_basic_data.spec.js} | 0 ...lopment.spec.js => 02_development.spec.js} | 0 e2e/paths/06-claim-module/05_summary.spec.js | 86 +++++++++++++++++++ 4 files changed, 97 insertions(+) rename e2e/paths/06-claim-module/{01_edit_basic_data.spec.js => 01_basic_data.spec.js} (100%) rename e2e/paths/06-claim-module/{02_create_development.spec.js => 02_development.spec.js} (100%) create mode 100644 e2e/paths/06-claim-module/05_summary.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index e6eb3a177..da9aa3112 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -494,6 +494,17 @@ export default { searchResult: 'vn-claim-index vn-card > div > vn-table > div > vn-tbody > a', searchButton: 'vn-claim-index vn-searchbar vn-icon[icon="search"]' }, + claimSummary: { + header: 'vn-claim-summary > vn-card > div > h5', + state: 'vn-claim-summary vn-label-value[label="State"] > section > span', + observation: 'vn-claim-summary vn-textarea[model="$ctrl.summary.claim.observation"] > div > textarea', + firstSaleItemId: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(4) > vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(1) > span', + firstSaleDescriptorImage: 'vn-claim-summary vn-item-descriptor-popover > vn-popover vn-item-descriptor img', + itemDescriptorPopover: 'vn-claim-summary vn-item-descriptor-popover > vn-popover', + itemDescriptorPopoverItemDiaryButton: 'vn-claim-summary > vn-item-descriptor-popover a[href="#!/item/2/diary"]', + firstDevelopmentWorker: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(5) > vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > span', + firstdevelopmentWorkerGoToClientButton: 'vn-claim-summary > vn-worker-descriptor-popover > vn-popover vn-worker-descriptor div.quicklinks > a[href="#!/client/21/summary"]' + }, claimBasicData: { claimStateAutocomplete: 'vn-claim-basic-data vn-autocomplete[field="$ctrl.claim.claimStateFk"]', responsabilityInputRange: 'vn-input-range', diff --git a/e2e/paths/06-claim-module/01_edit_basic_data.spec.js b/e2e/paths/06-claim-module/01_basic_data.spec.js similarity index 100% rename from e2e/paths/06-claim-module/01_edit_basic_data.spec.js rename to e2e/paths/06-claim-module/01_basic_data.spec.js diff --git a/e2e/paths/06-claim-module/02_create_development.spec.js b/e2e/paths/06-claim-module/02_development.spec.js similarity index 100% rename from e2e/paths/06-claim-module/02_create_development.spec.js rename to e2e/paths/06-claim-module/02_development.spec.js diff --git a/e2e/paths/06-claim-module/05_summary.spec.js b/e2e/paths/06-claim-module/05_summary.spec.js new file mode 100644 index 000000000..7843f8ce9 --- /dev/null +++ b/e2e/paths/06-claim-module/05_summary.spec.js @@ -0,0 +1,86 @@ +import selectors from '../../helpers/selectors.js'; +import createNightmare from '../../helpers/nightmare'; + +describe('claim Summary path', () => { + const nightmare = createNightmare(); + const claimId = 4; + + it('should navigate to the target claim summary section', async() => { + let url = await nightmare + .loginAndModule('employee', 'claim') + .accessToSearchResult(claimId) + .waitForURL('/summary') + .parsedUrl(); + + expect(url.hash).toContain('/summary'); + }); + + it(`should display details from the claim and it's client on the top of the header`, async() => { + let result = await nightmare + .waitForSpinnerLoad() + .waitToGetProperty(selectors.claimSummary.header, 'innerText'); + + expect(result).toContain('4 -'); + expect(result).toContain('Tony Stark'); + }); + + it('should display the claim state', async() => { + let result = await nightmare + .waitToGetProperty(selectors.claimSummary.state, 'innerText'); + + expect(result).toContain('Resuelto'); + }); + + it('should display the observation', async() => { + let result = await nightmare + .waitToGetProperty(selectors.claimSummary.observation, 'value'); + + expect(result).toContain('observation four'); + }); + + it('should display the claimed line(s)', async() => { + let result = await nightmare + .waitToGetProperty(selectors.claimSummary.firstSaleItemId, 'innerText'); + + expect(result).toContain('000002'); + }); + + it(`should click on the first sale ID making the item descriptor visible`, async() => { + const visible = await nightmare + .waitToClick(selectors.claimSummary.firstSaleItemId) + .waitImgLoad(selectors.claimSummary.firstSaleDescriptorImage) + .isVisible(selectors.claimSummary.itemDescriptorPopover); + + expect(visible).toBeTruthy(); + }); + + it(`should check the url for the item diary link of the descriptor is for the right item id`, async() => { + const exists = await nightmare + .exists(selectors.claimSummary.itemDescriptorPopoverItemDiaryButton); + + expect(exists).toBeTruthy(); + }); + + it('should display the claim development details', async() => { + let result = await nightmare + .waitToGetProperty(selectors.claimSummary.firstDevelopmentWorker, 'innerText'); + + expect(result).toContain('salesAssistantNick'); + }); + + it(`should click on the first development worker making the worker descriptor visible`, async() => { + const visible = await nightmare + .waitToClick(selectors.claimSummary.firstDevelopmentWorker) + .wait(selectors.claimSummary.firstdevelopmentWorkerGoToClientButton) + .isVisible(selectors.claimSummary.firstdevelopmentWorkerGoToClientButton); + + expect(visible).toBeTruthy(); + }); + + it(`should check the url for the go to clientlink of the descriptor is for the right client id`, async() => { + const exists = await nightmare + .exists(selectors.claimSummary.firstdevelopmentWorkerGoToClientButton); + + expect(exists).toBeTruthy(); + }); +});