From 68f2976c2de94494b65e90e31205cd9ec2fdf97c Mon Sep 17 00:00:00 2001 From: carlosjr Date: Thu, 24 Dec 2020 13:15:14 +0100 Subject: [PATCH] e2e path updated for clonation --- e2e/helpers/selectors.js | 9 +++++++- ...te.spec.js => 03_create_and_clone.spec.js} | 21 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) rename e2e/paths/08-route/{03_create.spec.js => 03_create_and_clone.spec.js} (68%) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 11087d2d4..0ed3607ad 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -674,7 +674,14 @@ export default { confirmButton: '.vn-confirm.shown button[response="accept"]', }, routeIndex: { - addNewRouteButton: 'vn-route-index a[ui-sref="route.create"]' + anyResult: 'vn-table a', + firstRouteCheckbox: 'a:nth-child(1) vn-td:nth-child(1) > vn-check', + addNewRouteButton: 'vn-route-index a[ui-sref="route.create"]', + cloneButton: 'vn-route-index button > vn-icon[icon="icon-clone"]', + submitClonationButton: 'tpl-buttons > button[response="accept"]', + openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]', + searchAgencyAutocomlete: 'vn-route-search-panel vn-autocomplete[ng-model="filter.agencyModeFk"]', + advancedSearchButton: 'vn-route-search-panel button[type=submit]', }, createRouteView: { worker: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.workerFk"]', diff --git a/e2e/paths/08-route/03_create.spec.js b/e2e/paths/08-route/03_create_and_clone.spec.js similarity index 68% rename from e2e/paths/08-route/03_create.spec.js rename to e2e/paths/08-route/03_create_and_clone.spec.js index 670f7e17b..f2de57a85 100644 --- a/e2e/paths/08-route/03_create.spec.js +++ b/e2e/paths/08-route/03_create_and_clone.spec.js @@ -57,5 +57,26 @@ describe('Route create path', () => { it(`should confirm the redirection to the created route summary`, async() => { await page.waitForState('route.card.summary'); }); + + it(`should navigate back to the route index`, async() => { + await page.waitToClick(selectors.globalItems.returnToModuleIndexButton); + await page.waitForState('route.index'); + }); + + it(`should clone the first route`, async() => { + await page.waitToClick(selectors.routeIndex.firstRouteCheckbox); + await page.waitToClick(selectors.routeIndex.cloneButton); + await page.waitToClick(selectors.routeIndex.submitClonationButton); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); + + it(`should search for the agency of the cloned routes and find two results`, async() => { + await page.waitToClick(selectors.routeIndex.openAdvancedSearchButton); + await page.autocompleteSearch(selectors.routeIndex.searchAgencyAutocomlete, 'inhouse pickup'); + await page.waitToClick(selectors.routeIndex.advancedSearchButton); + await page.waitForNumberOfElements(selectors.routeIndex.anyResult, 2); + }); }); });