From 80e32e1c5c80d25269fb59905696e58893b2109e Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 20 May 2020 16:34:53 +0200 Subject: [PATCH 1/2] zone descriptor path --- e2e/paths/11-zone/02_descriptor.spec.js | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 e2e/paths/11-zone/02_descriptor.spec.js diff --git a/e2e/paths/11-zone/02_descriptor.spec.js b/e2e/paths/11-zone/02_descriptor.spec.js new file mode 100644 index 000000000..fab9b308b --- /dev/null +++ b/e2e/paths/11-zone/02_descriptor.spec.js @@ -0,0 +1,33 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Zone descriptor path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('deliveryBoss', 'zone'); + await page.accessToSearchResult('10'); + await page.accessToSection('zone.card.basicData'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should reach the basic data section', async() => { + await page.waitForState('zone.card.basicData'); + }); + + it('should edit de form and then save', async() => { + await page.clearInput(selectors.zoneBasicData.name); + await page.write(selectors.zoneBasicData.name, 'Brimstone teleportation'); + await page.autocompleteSearch(selectors.zoneBasicData.agency, 'Quantum break device'); + await page.write(selectors.zoneBasicData.maxVolume, '10'); + const message = await page.waitForSnackbar(); + + expect(message.type).toBe('success'); + }); +}); From 3a723a2e3d6d5248734d285f67060cacb383f0be Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 14 Aug 2020 15:35:50 +0200 Subject: [PATCH 2/2] zone descriptor e2e --- db/dump/fixtures.sql | 2 +- e2e/helpers/selectors.js | 8 +++++++ e2e/paths/11-zone/02_descriptor.spec.js | 31 ++++++++++++++++--------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 2e4384b40..ccc1b7d1d 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -560,7 +560,7 @@ INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeF (16, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()), (17, 1, 7, 2, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()), (18, 1, 4, 4, 4, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 'Cerebro', 128, NULL, 0, 12, CURDATE()), - (19, 1, 5, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 1, 13, CURDATE()), + (19, 1, 5, 5, NULL, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 1, 13, CURDATE()), (20, 1, 5, 5, 3, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), (21, NULL, 5, 5, 5, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Holland', 102, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), (22, NULL, 5, 5, 5, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Japan', 103, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index e1b6b1c65..93755d724 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -544,6 +544,7 @@ export default { logButton: 'vn-left-menu a[ui-sref="ticket.card.log"]', changedBy: 'vn-ticket-log > vn-log vn-tr:nth-child(1) > vn-td:nth-child(2) > span', actionTaken: 'vn-ticket-log > vn-log vn-td:nth-child(1) > div > div:nth-child(3) > span.value', + changes: 'vn-ticket-log vn-data-viewer vn-tbody > vn-tr > vn-td:nth-child(7)', id: 'vn-ticket-log > vn-log vn-td.before > vn-one:nth-child(1) > div > span.value' }, ticketService: { @@ -852,6 +853,13 @@ export default { createdThermograph: 'vn-travel-thermograph-index vn-tbody > vn-tr', upload: 'vn-travel-thermograph-create button[type=submit]' }, + zoneIndex: { + searchResult: 'vn-zone-index a.vn-tr', + }, + zoneDescriptor: { + menu: 'vn-zone-descriptor vn-icon-button[vn-popover="menu"]', + deleteZone: 'slot-menu vn-item[ng-click="$ctrl.onDelete()"]' + }, zoneBasicData: { name: 'vn-zone-basic-data vn-textfield[ng-model="$ctrl.zone.name"]', agency: 'vn-zone-basic-data vn-autocomplete[ng-model="$ctrl.zone.agencyModeFk"]', diff --git a/e2e/paths/11-zone/02_descriptor.spec.js b/e2e/paths/11-zone/02_descriptor.spec.js index fab9b308b..1de84d601 100644 --- a/e2e/paths/11-zone/02_descriptor.spec.js +++ b/e2e/paths/11-zone/02_descriptor.spec.js @@ -9,25 +9,34 @@ describe('Zone descriptor path', () => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('deliveryBoss', 'zone'); - await page.accessToSearchResult('10'); - await page.accessToSection('zone.card.basicData'); + await page.accessToSearchResult('13'); }); afterAll(async() => { await browser.close(); }); - it('should reach the basic data section', async() => { - await page.waitForState('zone.card.basicData'); + it('should eliminate the zone using the descriptor option', async() => { + await page.waitToClick(selectors.zoneDescriptor.menu); + await page.waitToClick(selectors.zoneDescriptor.deleteZone); + await page.respondToDialog('accept'); + await page.waitForState('zone.index'); }); - it('should edit de form and then save', async() => { - await page.clearInput(selectors.zoneBasicData.name); - await page.write(selectors.zoneBasicData.name, 'Brimstone teleportation'); - await page.autocompleteSearch(selectors.zoneBasicData.agency, 'Quantum break device'); - await page.write(selectors.zoneBasicData.maxVolume, '10'); - const message = await page.waitForSnackbar(); + it('should search for the deleted zone to find no results', async() => { + await page.doSearch('13'); + const count = await page.countElement(selectors.zoneIndex.searchResult); - expect(message.type).toBe('success'); + expect(count).toEqual(0); + }); + + it('should check the ticket whom lost the zone and see evidence on the logs', async() => { + await page.waitToClick(selectors.globalItems.homeButton); + await page.selectModule('ticket'); + await page.accessToSearchResult('20'); + await page.accessToSection('ticket.card.log'); + const lastChanges = await page.waitToGetProperty(selectors.ticketLog.changes, 'innerText'); + + expect(lastChanges).toContain('Arreglar'); }); });