Merge branch '2006-e2e-route-summary' of verdnatura/salix into dev
gitea/salix/dev There was a failure building this commit Details

This commit is contained in:
Bernat Exposito 2020-02-13 06:24:51 +00:00 committed by Gitea
commit a3e0d0d628
14 changed files with 111 additions and 46 deletions

View File

@ -35,7 +35,7 @@ INSERT INTO `vn`.`packagingConfig`(`upperGap`)
UPDATE `account`.`role` SET id = 100 WHERE id = 0; UPDATE `account`.`role` SET id = 100 WHERE id = 0;
INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`, `lang`) INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`, `lang`)
SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com'), 'es' SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com'), 'EN'
FROM `account`.`role` WHERE id <> 20 FROM `account`.`role` WHERE id <> 20
ORDER BY id; ORDER BY id;
@ -55,18 +55,18 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType`
INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`) INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`)
VALUES VALUES
(101, 'BruceWayne', 'Bruce Wayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es'), (101, 'BruceWayne', 'Bruce Wayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'ES'),
(102, 'PetterParker', 'Petter Parker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en'), (102, 'PetterParker', 'Petter Parker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'EN'),
(103, 'ClarkKent', 'Clark Kent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr'), (103, 'ClarkKent', 'Clark Kent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'FR'),
(104, 'TonyStark', 'Tony Stark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'es'), (104, 'TonyStark', 'Tony Stark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'ES'),
(105, 'MaxEisenhardt', 'Max Eisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt'), (105, 'MaxEisenhardt', 'Max Eisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'PT'),
(106, 'DavidCharlesHaller', 'David Charles Haller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'es'), (106, 'DavidCharlesHaller', 'David Charles Haller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'EN'),
(107, 'HankPym', 'Hank Pym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'es'), (107, 'HankPym', 'Hank Pym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'EN'),
(108, 'CharlesXavier', 'Charles Xavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'es'), (108, 'CharlesXavier', 'Charles Xavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'EN'),
(109, 'BruceBanner', 'Bruce Banner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'es'), (109, 'BruceBanner', 'Bruce Banner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'EN'),
(110, 'JessicaJones', 'Jessica Jones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'es'), (110, 'JessicaJones', 'Jessica Jones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'EN'),
(111, 'Missing', 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'), (111, 'Missing', 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'EN'),
(112, 'Trash', 'Trash', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'); (112, 'Trash', 'Trash', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'EN');
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`) INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`)
VALUES VALUES

View File

@ -1,4 +1,3 @@
/* eslint no-invalid-this: "off" */
import {url as defaultURL} from './config'; import {url as defaultURL} from './config';
let actions = { let actions = {
@ -31,20 +30,6 @@ let actions = {
}, selector); }, selector);
}, },
changeLanguageToEnglish: async function() {
let langSelector = '.user-popover vn-autocomplete[ng-model="$ctrl.lang"]';
await this.waitToClick('#user');
await this.waitForSelector(`${langSelector} input`, {});
let lang = await this.waitToGetProperty(langSelector, 'value');
if (lang !== 'English')
await this.autocompleteSearch(langSelector, 'English');
await this.keyboard.press('Escape');
await this.waitForSelector(langSelector, {hidden: true});
},
doLogin: async function(userName, password = 'nightmare') { doLogin: async function(userName, password = 'nightmare') {
await this.waitForSelector(`vn-login vn-textfield[ng-model="$ctrl.user"]`, {visible: true}); await this.waitForSelector(`vn-login vn-textfield[ng-model="$ctrl.user"]`, {visible: true});
await this.clearInput(`vn-login vn-textfield[ng-model="$ctrl.user"]`); await this.clearInput(`vn-login vn-textfield[ng-model="$ctrl.user"]`);
@ -70,7 +55,6 @@ let actions = {
await this.waitForFunction(() => { await this.waitForFunction(() => {
return document.location.hash === '#!/'; return document.location.hash === '#!/';
}, {}); }, {});
await this.changeLanguageToEnglish();
}, },
selectModule: async function(moduleName) { selectModule: async function(moduleName) {
@ -534,6 +518,13 @@ let actions = {
}, selector); }, selector);
}, },
closePopup: async function(selector) {
await Promise.all([
this.keyboard.press('Escape'),
this.waitForSelector('.vn-popup', {hidden: true}),
]);
},
waitForContentLoaded: async function() { waitForContentLoaded: async function() {
await this.waitFor(1000); await this.waitFor(1000);
// to be implemented in base of a directive loaded once al modules are done loading, further investigation required. // to be implemented in base of a directive loaded once al modules are done loading, further investigation required.

View File

@ -15,6 +15,18 @@ export async function getBrowser() {
slowMo: 0, // slow down by ms slowMo: 0, // slow down by ms
}); });
let page = (await browser.pages())[0]; let page = (await browser.pages())[0];
await page.evaluateOnNewDocument(() => {
Object.defineProperty(navigator, 'language', {
get: function() {
return 'en';
}
});
Object.defineProperty(navigator, 'languages', {
get: function() {
return ['en'];
}
});
});
page = extendPage(page); page = extendPage(page);
page.setDefaultTimeout(5000); page.setDefaultTimeout(5000);
await page.goto(defaultURL, {waitUntil: 'networkidle0'}); await page.goto(defaultURL, {waitUntil: 'networkidle0'});

View File

@ -643,7 +643,13 @@ export default {
volume: 'vn-route-descriptor vn-label-value[label="Volume"] > section > span' volume: 'vn-route-descriptor vn-label-value[label="Volume"] > section > span'
}, },
routeSummary: { routeSummary: {
routeId: 'vn-route-summary > vn-card > vn-horizontal > vn-one:nth-child(1) > vn-label-value:nth-child(1) > section > span' header: 'vn-route-summary > vn-card > h5',
routeId: 'vn-route-summary > vn-card > vn-horizontal > vn-one:nth-child(1) > vn-label-value:nth-child(1) > section > span',
cost: 'vn-route-summary vn-label-value[label="Cost"]',
firstTicketID: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(2) > span',
firstTicketDescriptor: '.vn-popover.shown vn-ticket-descriptor',
firstAlias: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(3) > span',
firstClientDescriptor: '.vn-popover.shown vn-client-descriptor',
}, },
routeBasicData: { routeBasicData: {
worker: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.workerFk"]', worker: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.workerFk"]',

View File

@ -39,7 +39,7 @@ describe('Client balance path', () => {
}); });
it('should click the new payment button', async() => { it('should click the new payment button', async() => {
await page.keyboard.press('Escape'); await page.closePopup();
await page.reloadSection('client.card.balance.index'); await page.reloadSection('client.card.balance.index');
let url = await page.expectURL('/balance'); let url = await page.expectURL('/balance');

View File

@ -27,7 +27,7 @@ describe('Client DMS', () => {
it(`should click on the first document line worker name making the descriptor visible`, async() => { it(`should click on the first document line worker name making the descriptor visible`, async() => {
await page.waitToClick(selectors.dms.firstDocWorker); await page.waitToClick(selectors.dms.firstDocWorker);
await page.wait(selectors.dms.firstDocWorkerDescriptor); await page.waitForSelector(selectors.dms.firstDocWorkerDescriptor);
const visible = await page.isVisible(selectors.dms.firstDocWorkerDescriptor); const visible = await page.isVisible(selectors.dms.firstDocWorkerDescriptor);
expect(visible).toBeTruthy(); expect(visible).toBeTruthy();

View File

@ -68,9 +68,8 @@ describe('Item summary path', () => {
}); });
it(`should close the summary popup`, async() => { it(`should close the summary popup`, async() => {
await page.keyboard.press('Escape'); await page.closePopup();
await page.waitUntilNotPresent(selectors.itemSummary.basicData); await page.waitForSelector(selectors.itemSummary.basicData, {hidden: true});
await page.waitFor(selectors.itemSummary.basicData, {hidden: true});
}); });
it('should search for other item', async() => { it('should search for other item', async() => {
@ -125,7 +124,7 @@ describe('Item summary path', () => {
}); });
it(`should now close the summary popup`, async() => { it(`should now close the summary popup`, async() => {
await page.keyboard.press('Escape'); await page.closePopup();
await page.waitForSelector(selectors.itemSummary.basicData, {hidden: true}); await page.waitForSelector(selectors.itemSummary.basicData, {hidden: true});
}); });

View File

@ -27,8 +27,7 @@ describe('Item regularize path', () => {
const userLocalWarehouse = await page const userLocalWarehouse = await page
.waitToGetProperty(selectors.globalItems.userLocalWarehouse, 'value'); .waitToGetProperty(selectors.globalItems.userLocalWarehouse, 'value');
await page.keyboard.press('Escape'); await page.closePopup();
await page.waitForSelector('.user-popover.vn-popover', {hidden: true});
expect(userLocalWarehouse).toContain('Warehouse Four'); expect(userLocalWarehouse).toContain('Warehouse Four');
}); });

View File

@ -60,8 +60,7 @@ describe('claim Summary path', () => {
it(`should check the url for the item diary link of the descriptor is for the right item id`, async() => { it(`should check the url for the item diary link of the descriptor is for the right item id`, async() => {
await page.waitForSelector(selectors.claimSummary.itemDescriptorPopoverItemDiaryButton, {visible: true}); await page.waitForSelector(selectors.claimSummary.itemDescriptorPopoverItemDiaryButton, {visible: true});
await page.keyboard.press('Escape'); await page.closePopup();
await page.waitFor(1000);
}); });
it('should display the claim development details', async() => { it('should display the claim development details', async() => {
@ -81,8 +80,7 @@ describe('claim Summary path', () => {
it(`should check the url for the go to clientlink of the descriptor is for the right client id`, async() => { it(`should check the url for the go to clientlink of the descriptor is for the right client id`, async() => {
await page.waitForSelector(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton, {visible: true}); await page.waitForSelector(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton, {visible: true});
await page.keyboard.press('Escape'); await page.closePopup();
await page.waitFor(1000);
}); });
it(`should click on the first action ticket ID making the ticket descriptor visible`, async() => { it(`should click on the first action ticket ID making the ticket descriptor visible`, async() => {

View File

@ -0,0 +1,61 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Route summary path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'route');
await page.waitToClick('vn-route-index vn-tbody > a:nth-child(1)');
});
afterAll(async() => {
await browser.close();
});
it('should reach the first route summary section', async() => {
let url = await page.expectURL('#!/route/1/summary');
expect(url).toBe(true);
});
it(`should display details from the route on the header`, async() => {
await page.waitForTextInElement(selectors.routeSummary.header, 'first route');
const result = await page.waitToGetProperty(selectors.routeSummary.header, 'innerText');
expect(result).toContain('first route');
});
it('should display some route details like the cost', async() => {
const result = await page.waitToGetProperty(selectors.routeSummary.cost, 'innerText');
expect(result).toContain('€10.00');
});
it('should click on the first ticket ID making the descriptor popover visible', async() => {
await page.waitToClick(selectors.routeSummary.firstTicketID);
await page.waitForSelector(selectors.routeSummary.firstTicketDescriptor);
const visible = await page.isVisible(selectors.routeSummary.firstTicketDescriptor);
expect(visible).toBe(true);
});
it('should close the ticket descriptor', async() => {
await page.closePopup();
});
it('should click on the first alias making the client descriptor popover visible', async() => {
await page.waitToClick(selectors.routeSummary.firstAlias);
await page.waitForSelector(selectors.routeSummary.firstClientDescriptor);
const visible = await page.isVisible(selectors.routeSummary.firstClientDescriptor);
expect(visible).toBe(true);
});
it('should close the client descriptor', async() => {
await page.closePopup();
});
});

View File

@ -37,7 +37,6 @@ describe('Route create path', () => {
beforeAll(async() => { beforeAll(async() => {
await page.login('delivery'); await page.login('delivery');
await page.selectModule('route'); await page.selectModule('route');
await page.changeLanguageToEnglish();
}); });
it('should again click on the add new route button and open the creation form', async() => { it('should again click on the add new route button and open the creation form', async() => {

View File

@ -80,7 +80,7 @@ export function config($translateProvider, $translatePartialLoaderProvider, $ani
let langs = ['en', 'es']; let langs = ['en', 'es'];
let langAliases = { let langAliases = {
en_US: 'en', en_US: 'en',
en_UK: 'en', en_GB: 'en',
es_ES: 'es', es_ES: 'es',
es_AR: 'es' es_AR: 'es'
}; };

View File

@ -84,8 +84,8 @@
<vn-td number shrink>{{ticket.packages}}</vn-td> <vn-td number shrink>{{ticket.packages}}</vn-td>
<vn-td shrink>{{ticket.volume}}</vn-td> <vn-td shrink>{{ticket.volume}}</vn-td>
<vn-td shrink>{{ticket.warehouse.name}}</vn-td> <vn-td shrink>{{ticket.warehouse.name}}</vn-td>
<vn-td shrink>{{ticket.client.postcode}}</vn-td> <vn-td shrink>{{ticket.address.postalCode}}</vn-td>
<vn-td expand title="{{ticket.client.street}}">{{ticket.client.street}}</vn-td> <vn-td expand title="{{ticket.address.street}}">{{ticket.address.street}}</vn-td>
<vn-td shrink> <vn-td shrink>
<vn-icon <vn-icon
ng-if="ticket.notes.length" ng-if="ticket.notes.length"