diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 0c35362be..b96ff7798 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -219,7 +219,7 @@ export default { fourthTagAutocomplete: `vn-item-tags vn-horizontal:nth-child(5) > vn-autocomplete[field="itemTag.tagFk"]`, fourthValueInput: `vn-item-tags vn-horizontal:nth-child(5) > vn-textfield[label="Value"] input`, fourthRelevancyInput: `vn-horizontal:nth-child(5) > vn-textfield[label="Relevancy"] input`, - fifthTagSelect: `vn-item-tags vn-horizontal:nth-child(6) > vn-autocomplete[field="itemTag.tagFk"] input`, + fifthTagAutocomplete: `vn-item-tags vn-horizontal:nth-child(6) > vn-autocomplete[field="itemTag.tagFk"]`, fifthValueInput: `vn-item-tags vn-horizontal:nth-child(6) > vn-textfield[label="Value"] input`, fifthRelevancyInput: `vn-horizontal:nth-child(6) > vn-textfield[label="Relevancy"] input`, seventhTagAutocomplete: `vn-item-tags vn-horizontal:nth-child(8) > vn-autocomplete[field="itemTag.tagFk"]`, @@ -245,9 +245,9 @@ export default { itemNiches: { nicheButton: `vn-left-menu a[ui-sref="item.card.niche"]`, addNicheButton: `vn-icon[icon="add_circle"]`, - firstWarehouseAutocomplete: `vn-autocomplete[field="niche.warehouseFk"] input`, + firstWarehouseAutocomplete: `vn-autocomplete[field="niche.warehouseFk"]`, firstCodeInput: `vn-horizontal:nth-child(2) > vn-textfield[label="Code"] input`, - secondWarehouseSelect: `vn-horizontal:nth-child(3) > vn-autocomplete[field="niche.warehouseFk"] input`, + secondWarehouseAutocomplete: `vn-horizontal:nth-child(3) > vn-autocomplete[field="niche.warehouseFk"]`, secondCodeInput: `vn-horizontal:nth-child(3) > vn-textfield[label="Code"] input`, secondNicheRemoveButton: `vn-horizontal:nth-child(3) > vn-none > vn-icon[icon="delete"]`, thirdWarehouseAutocomplete: `vn-horizontal:nth-child(4) > vn-autocomplete[field="niche.warehouseFk"]`, @@ -322,7 +322,7 @@ export default { firstQuantityInput: `vn-textfield[label="Quantity"] input`, firstRemovePackageButton: `vn-icon[vn-tooltip="Remove package"]`, addPackageButton: `vn-icon-button[vn-tooltip="Add package"]`, - clearPackageSelectButton: `vn-autocomplete[label="Package"] > div > div > div > vn-icon > i`, + clearPackageAutocompleteButton: `vn-autocomplete[label="Package"] > div > div > div > vn-icon > i`, savePackagesButton: `${components.vnSubmit}` }, ticketSales: { @@ -377,25 +377,18 @@ export default { ticketTracking: { trackingButton: `vn-left-menu a[ui-sref="ticket.card.tracking.index"]`, createStateButton: `${components.vnFloatButton}`, - stateSelect: 'vn-ticket-tracking-edit vn-autocomplete[field="$ctrl.ticket.stateFk"] input', - stateSelectInput: 'vn-ticket-tracking-edit vn-autocomplete > vn-drop-down > vn-popover vn-textfield input', - stateSelectFirstResult: 'vn-ticket-tracking-edit vn-autocomplete > vn-drop-down > vn-popover ul > li:nth-child(1)', + stateAutocomplete: 'vn-ticket-tracking-edit vn-autocomplete[field="$ctrl.ticket.stateFk"]', saveButton: `${components.vnSubmit}` }, ticketBasicData: { basicDataButton: `vn-left-menu a[ui-sref="ticket.card.data.stepOne"]`, - clientSelect: `vn-autocomplete[field="$ctrl.clientFk"] input`, - clientSelectThirdOption: `vn-autocomplete[field="$ctrl.clientFk"] vn-drop-down ul > li:nth-child(3)`, - addressSelect: `vn-autocomplete[field="$ctrl.ticket.addressFk"] input`, - addressSelectSecondOption: `vn-autocomplete[field="$ctrl.ticket.addressFk"] vn-drop-down ul > li:nth-child(2)`, - agencySelect: `vn-autocomplete[field="$ctrl.ticket.agencyModeFk"] input`, - agencySelectOptionSix: `vn-autocomplete[field="$ctrl.ticket.agencyModeFk"] vn-drop-down ul > li:nth-child(6)`, + clientAutocomplete: `vn-autocomplete[field="$ctrl.clientFk"]`, + addressAutocomplete: `vn-autocomplete[field="$ctrl.ticket.addressFk"]`, + agencyAutocomplete: `vn-autocomplete[field="$ctrl.ticket.agencyModeFk"]`, nextStepButton: `vn-step-control > section > section.buttons > section:nth-child(2) > vn-button`, finalizeButton: `vn-step-control > section > section.buttons > section:nth-child(2) > vn-submit`, stepTwoTotalPriceDif: `vn-ticket-data-step-two > form > vn-card > div > vn-horizontal > table > tfoot > tr > td:nth-child(4)`, - chargesReason: `vn-autocomplete[field="$ctrl.ticket.option"] input`, - chargesReasonFourthOption: `vn-autocomplete[field="$ctrl.ticket.option"] vn-drop-down ul > li:nth-child(4)`, - chargesReasonFirstOption: `vn-autocomplete[field="$ctrl.ticket.option"] vn-drop-down ul > li:nth-child(1)` + chargesReasonAutocomplete: `vn-autocomplete[field="$ctrl.ticket.option"]`, }, ticketComponents: { componentsButton: `vn-left-menu a[ui-sref="ticket.card.components"]`, @@ -419,8 +412,7 @@ export default { }, createStateView: { - stateInput: `vn-autocomplete[field="$ctrl.ticket.stateFk"] > div > div > input`, - stateInputOptionOne: `vn-autocomplete[field="$ctrl.ticket.stateFk"] vn-drop-down ul > li:nth-child(1)`, + stateAutocomplete: `vn-autocomplete[field="$ctrl.ticket.stateFk"]`, clearStateInputButton: `vn-autocomplete[field="$ctrl.ticket.stateFk"] > div > div > div > vn-icon > i`, saveStateButton: `${components.vnSubmit}` }, diff --git a/e2e/paths/item-module/04_create_item_tags.spec.js b/e2e/paths/item-module/04_create_item_tags.spec.js index 27a07ec27..85519eeb3 100644 --- a/e2e/paths/item-module/04_create_item_tags.spec.js +++ b/e2e/paths/item-module/04_create_item_tags.spec.js @@ -93,7 +93,7 @@ describe('Item create tags path', () => { it(`should confirm the fifth row data is the expected one`, async() => { let tag = await nightmare - .waitToGetProperty(selectors.itemTags.fifthTagSelect, 'value'); + .waitToGetProperty(`${selectors.itemTags.fifthTagAutocomplete} input`, 'value'); let value = await nightmare .waitToGetProperty(selectors.itemTags.fifthValueInput, 'value'); diff --git a/e2e/paths/item-module/05_create_item_niche.spec.js b/e2e/paths/item-module/05_create_item_niche.spec.js index 8a1d91c5a..65483561b 100644 --- a/e2e/paths/item-module/05_create_item_niche.spec.js +++ b/e2e/paths/item-module/05_create_item_niche.spec.js @@ -28,8 +28,8 @@ describe('Item create niche path', () => { .click(selectors.itemBasicData.basicDataButton) .wait(selectors.itemBasicData.nameInput) .click(selectors.itemNiches.nicheButton) - .waitForTextInInput(`${selectors.itemNiches.firstWarehouseAutocomplete}`, 'Warehouse One') - .waitToGetProperty(`${selectors.itemNiches.firstWarehouseAutocomplete}`, 'value'); + .waitForTextInInput(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'Warehouse One') + .waitToGetProperty(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'value'); expect(result).toEqual('Warehouse One'); result = await nightmare @@ -40,7 +40,7 @@ describe('Item create niche path', () => { it(`should confirm the second niche is the expected one`, async() => { let result = await nightmare - .waitToGetProperty(selectors.itemNiches.secondWarehouseSelect, 'value'); + .waitToGetProperty(`${selectors.itemNiches.secondWarehouseAutocomplete} input`, 'value'); expect(result).toEqual('Warehouse Three'); result = await nightmare diff --git a/e2e/paths/ticket-module/04_create_ticket_packages.spec.js b/e2e/paths/ticket-module/04_create_ticket_packages.spec.js index b9bd82453..39536da61 100644 --- a/e2e/paths/ticket-module/04_create_ticket_packages.spec.js +++ b/e2e/paths/ticket-module/04_create_ticket_packages.spec.js @@ -45,7 +45,7 @@ describe('Ticket Create packages path', () => { const result = await nightmare .clearInput(selectors.ticketPackages.firstQuantityInput) .type(selectors.ticketPackages.firstQuantityInput, 99) - .click(selectors.ticketPackages.clearPackageSelectButton) + .click(selectors.ticketPackages.clearPackageAutocompleteButton) .click(selectors.ticketPackages.savePackagesButton) .waitForLastSnackbar(); diff --git a/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js b/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js index 7af14fb6d..44f3dae51 100644 --- a/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js +++ b/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js @@ -11,16 +11,16 @@ describe('Ticket Create new tracking state path', () => { .accessToSection('ticket.card.tracking.index'); }); - it('should access to the create state view by clicking the create floating button', async () => { + it('should access to the create state view by clicking the create floating button', async() => { let url = await nightmare .waitToClick(selectors.ticketTracking.createStateButton) - .wait(selectors.createStateView.stateInput) + .wait(selectors.createStateView.stateAutocomplete) .parsedUrl(); expect(url.hash).toContain('tracking/edit'); }); - it(`should attempt create a new state but receive an error if state is empty`, async () => { + it(`should attempt create a new state but receive an error if state is empty`, async() => { let result = await nightmare .click(selectors.createStateView.saveStateButton) .waitForLastSnackbar(); @@ -28,10 +28,9 @@ describe('Ticket Create new tracking state path', () => { expect(result).toEqual('No changes to save'); }); - it(`should attempt create a new state then clear and save it`, async () => { + it(`should attempt create a new state then clear and save it`, async() => { let result = await nightmare - .waitToClick(selectors.createStateView.stateInput) - .waitToClick(selectors.createStateView.stateInputOptionOne) + .autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?') .waitToClick(selectors.createStateView.clearStateInputButton) .click(selectors.createStateView.saveStateButton) .waitForLastSnackbar(); @@ -39,19 +38,18 @@ describe('Ticket Create new tracking state path', () => { expect(result).toEqual('Data saved!'); }); - it('should again access to the create state view by clicking the create floating button', async () => { + it('should again access to the create state view by clicking the create floating button', async() => { let url = await nightmare .click(selectors.ticketTracking.createStateButton) - .wait(selectors.createStateView.stateInput) + .wait(selectors.createStateView.stateAutocomplete) .parsedUrl(); expect(url.hash).toContain('tracking/edit'); }); - it(`should create a new state`, async () => { + it(`should create a new state`, async() => { let result = await nightmare - .waitToClick(selectors.createStateView.stateInput) - .waitToClick(selectors.createStateView.stateInputOptionOne) + .autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?') .click(selectors.createStateView.saveStateButton) .waitForLastSnackbar(); diff --git a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js index 33d426388..8606dfbcb 100644 --- a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js +++ b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js @@ -11,14 +11,11 @@ describe('Ticket Edit basic data path', () => { .accessToSection('ticket.card.data.stepOne'); }); - it(`should edit the client and address of the ticket then click next`, async () => { + it(`should edit the client and address of the ticket then click next`, async() => { let url = await nightmare - .waitToClick(selectors.ticketBasicData.clientSelect) - .waitToClick(selectors.ticketBasicData.clientSelectThirdOption) + .autocompleteSearch(selectors.ticketBasicData.clientAutocomplete, 'Charles Xavier') .wait(500) - .waitToClick(selectors.ticketBasicData.addressSelect) - .waitToClick(selectors.ticketBasicData.addressSelectSecondOption) - .waitForTextInInput(selectors.ticketBasicData.addressSelect, 'Charles Xavier') + .autocompleteSearch(selectors.ticketBasicData.addressAutocomplete, 'Charles Xavier') .click(selectors.ticketBasicData.nextStepButton) .waitForURL('data/step-two') .parsedUrl(); @@ -26,14 +23,14 @@ describe('Ticket Edit basic data path', () => { expect(url.hash).toContain('data/step-two'); }); - it(`should have no price diference`, async () => { + it(`should have no price diference`, async() => { const result = await nightmare .waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText'); expect(result).toContain('0'); }); - it(`should click next to move on to step three`, async () => { + it(`should click next to move on to step three`, async() => { let url = await nightmare .click(selectors.ticketBasicData.nextStepButton) .waitForURL('data/step-three') @@ -42,11 +39,9 @@ describe('Ticket Edit basic data path', () => { expect(url.hash).toContain('data/step-three'); }); - it(`should select a reason for the changes made then click on finalize`, async () => { + it(`should select a reason for the changes made then click on finalize`, async() => { let url = await nightmare - .waitToClick(selectors.ticketBasicData.chargesReason) - .waitToClick(selectors.ticketBasicData.chargesReasonFourthOption) - .waitForTextInInput(selectors.ticketBasicData.chargesReason, 'No realizar modificaciones en precios') + .autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'No realizar modificaciones en precios') .waitToClick(selectors.ticketBasicData.finalizeButton) .waitForURL('summary') .parsedUrl(); @@ -54,7 +49,7 @@ describe('Ticket Edit basic data path', () => { expect(url.hash).toContain('summary'); }); - it(`should go back to ticket.basicData section`, async () => { + it(`should go back to ticket.basicData section`, async() => { let url = await nightmare .waitToClick(selectors.ticketBasicData.basicDataButton) .waitForURL('data/step-one') @@ -63,11 +58,9 @@ describe('Ticket Edit basic data path', () => { expect(url.hash).toContain('data/step-one'); }); - it(`should edit the ticket agency then click next`, async () => { + it(`should edit the ticket agency then click next`, async() => { let url = await nightmare - .waitToClick(selectors.ticketBasicData.agencySelect) - .waitToClick(selectors.ticketBasicData.agencySelectOptionSix) - .waitForTextInInput(selectors.ticketBasicData.agencySelect, 'Expensive') + .autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Silla247Expensive') .click(selectors.ticketBasicData.nextStepButton) .waitForURL('data/step-two') .parsedUrl(); @@ -75,14 +68,14 @@ describe('Ticket Edit basic data path', () => { expect(url.hash).toContain('data/step-two'); }); - it(`should have a price diference`, async () => { + it(`should have a price diference`, async() => { const result = await nightmare .waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText'); expect(result).toContain('-20.65 €'); }); - it(`should then click next to move on to step three`, async () => { + it(`should then click next to move on to step three`, async() => { let url = await nightmare .click(selectors.ticketBasicData.nextStepButton) .waitForURL('data/step-three') @@ -91,11 +84,9 @@ describe('Ticket Edit basic data path', () => { expect(url.hash).toContain('data/step-three'); }); - it(`should select a new reason for the changes made then click on finalize`, async () => { + it(`should select a new reason for the changes made then click on finalize`, async() => { let url = await nightmare - .waitToClick(selectors.ticketBasicData.chargesReason) - .waitToClick(selectors.ticketBasicData.chargesReasonFirstOption) - .waitForTextInInput(selectors.ticketBasicData.chargesReason, 'Cambiar los precios en el ticket') + .autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'Cambiar los precios en el ticket') .click(selectors.ticketBasicData.finalizeButton) .waitForURL('summary') .parsedUrl(); diff --git a/e2e/paths/ticket-module/07_edit_sale.spec.js b/e2e/paths/ticket-module/07_edit_sale.spec.js index f75ffc885..9ef21ed1d 100644 --- a/e2e/paths/ticket-module/07_edit_sale.spec.js +++ b/e2e/paths/ticket-module/07_edit_sale.spec.js @@ -530,11 +530,7 @@ describe('Ticket Edit sale path', () => { it(`should set the state of the ticket to preparation`, async() => { const url = await nightmare - .waitToClick(selectors.ticketTracking.stateSelect) - .wait(selectors.ticketTracking.stateSelectInput) - .type(selectors.ticketTracking.stateSelectInput, 'Preparación') - .waitToClick(selectors.ticketTracking.stateSelectFirstResult) - .waitForTextInInput(selectors.ticketTracking.stateSelectInput, 'Preparación') + .autocompleteSearch(selectors.ticketTracking.stateAutocomplete, 'Preparación') .click(selectors.ticketTracking.saveButton) .waitForURL('/tracking/index') .parsedUrl(); diff --git a/e2e/paths/ticket-module/10_ticket_request.spec.js b/e2e/paths/ticket-module/10_ticket_request.spec.js index 47515c6c4..fcc7eb0a4 100644 --- a/e2e/paths/ticket-module/10_ticket_request.spec.js +++ b/e2e/paths/ticket-module/10_ticket_request.spec.js @@ -11,7 +11,7 @@ describe('Ticket purchase request path', () => { .accessToSection('ticket.card.request.index'); }); - it(`should add a new request`, async () => { + it(`should add a new request`, async() => { const result = await nightmare .waitToClick(selectors.ticketRequests.addRequestButton) .wait(selectors.ticketRequests.descriptionInput) @@ -26,7 +26,7 @@ describe('Ticket purchase request path', () => { expect(result).toEqual('Data saved!'); }); - it(`should have been redirected to the request index`, async () => { + it(`should have been redirected to the request index`, async() => { const url = await nightmare .waitForURL('/request') .parsedUrl(); @@ -34,17 +34,17 @@ describe('Ticket purchase request path', () => { expect(url.hash).toContain('/request'); }); - it(`should confirm the new request was added`, async () => { + it(`should confirm the new request was added`, async() => { const result = await nightmare .waitToClick(selectors.ticketBasicData.basicDataButton) - .wait(selectors.ticketBasicData.clientSelect) + .wait(selectors.ticketBasicData.clientAutocomplete) .waitToClick(selectors.ticketRequests.requestButton) .waitToGetProperty(selectors.ticketRequests.firstDescription, 'innerText'); expect(result).toEqual('New stuff'); }); - it(`should delete the added request`, async () => { + it(`should delete the added request`, async() => { const result = await nightmare .waitToClick(selectors.ticketRequests.firstRemoveRequestButton) .waitForLastSnackbar(); @@ -52,10 +52,10 @@ describe('Ticket purchase request path', () => { expect(result).toEqual('Data saved!'); }); - it(`should confirm the request was deleted`, async () => { + it(`should confirm the request was deleted`, async() => { const result = await nightmare .waitToClick(selectors.ticketBasicData.basicDataButton) - .wait(selectors.ticketBasicData.clientSelect) + .wait(selectors.ticketBasicData.clientAutocomplete) .waitToClick(selectors.ticketRequests.requestButton) .wait(selectors.ticketRequests.addRequestButton) .exists(selectors.ticketRequests.request);