Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2087-snackbar_show_counter

This commit is contained in:
Carlos Jimenez Ruiz 2020-02-20 11:24:02 +01:00
commit bb66f35f2f
6 changed files with 78 additions and 20 deletions

View File

@ -1530,7 +1530,7 @@ INSERT INTO `vn`.`ticketRequest`(`id`, `description`, `requesterFk`, `attenderFk
VALUES
(1, 'Ranged weapon longbow 2m', 18, 35, 5, 1, 9.10, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
(2, 'Melee weapon combat first 15cm', 18, 35, 10, 2, 1.07, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
(3, 'Melee weapon heavy shield 1x0.5m', 18, 35, 20, 4, 3.06, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
(3, 'Melee weapon heavy shield 1x0.5m', 18, 35, 20, NULL, 3.06, NULL, NULL, 23, CURDATE()),
(4, 'Melee weapon combat first 15cm', 18, 35, 15, NULL, 1.30, NULL, NULL, 11, CURDATE()),
(5, 'Melee weapon combat first 15cm', 18, 35, 15, 4, 1.30, 0, NULL, 18, CURDATE());

View File

@ -179,6 +179,13 @@ let actions = {
await this.click(selector);
},
writeOnEditableTD: async function(selector, text) {
let builtSelector = await this.selectorFormater(selector);
await this.waitToClick(selector);
await this.type(builtSelector, text);
await this.keyboard.press('Enter');
},
focusElement: async function(selector) {
await this.wait(selector);
return await this.evaluate(selector => {
@ -284,22 +291,14 @@ let actions = {
}, {}, selector, text);
},
selectorFormater: async function(selector) {
let builtSelector = `${selector} input`;
if (selector.includes('vn-autocomplete'))
return builtSelector = `${selector} input`;
selectorFormater: function(selector) {
if (selector.includes('vn-textarea'))
return builtSelector = `${selector} textarea`;
if (selector.includes('vn-textfield'))
return builtSelector = `${selector} input`;
return `${selector} textarea`;
if (selector.includes('vn-input-file'))
return builtSelector = `${selector} section`;
return `${selector} section`;
return builtSelector;
return `${selector} input`;
},
waitForTextInField: async function(selector, text) {

View File

@ -250,6 +250,17 @@ export default {
inactiveIcon: 'vn-item-descriptor vn-icon[icon="icon-unavailable"]',
navigateBackToIndex: 'vn-item-descriptor vn-icon[icon="chevron_left"]'
},
itemRequest: {
firstRequestItemID: 'vn-item-request vn-tbody > vn-tr:nth-child(1) > vn-td-editable:nth-child(7)',
firstRequestQuantity: 'vn-item-request vn-tbody > vn-tr:nth-child(1) > vn-td-editable:nth-child(8)',
firstRequestConcept: 'vn-item-request vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(9)',
secondRequestStatus: 'vn-item-request vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(10)',
firstRequestStatus: 'vn-item-request vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(10)',
secondRequestDecline: 'vn-item-request vn-tbody > vn-tr:nth-child(1) vn-icon-button[icon="thumb_down"]',
declineReason: 'vn-textarea[ng-model="$ctrl.denyObservation"]',
acceptDeclineReason: 'button[response="accept"]',
},
itemBasicData: {
basicDataButton: 'vn-left-menu a[ui-sref="item.card.basicData"]',
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',

View File

@ -0,0 +1,48 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Item request path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'item');
await page.accessToSection('item.request');
});
afterAll(async() => {
await browser.close();
});
it('should reach the item request section', async() => {
const result = await page.expectURL('/item/request');
expect(result).toBe(true);
});
it('should fill the id and quantity then check the concept was updated', async() => {
await page.writeOnEditableTD(selectors.itemRequest.firstRequestItemID, '4');
await page.writeOnEditableTD(selectors.itemRequest.firstRequestQuantity, '10');
await page.waitForTextInElement(selectors.itemRequest.firstRequestConcept, 'Melee weapon heavy shield 1x0.5m');
let filledConcept = await page.waitToGetProperty(selectors.itemRequest.firstRequestConcept, 'innerText');
expect(filledConcept).toContain('Melee weapon heavy shield 1x0.5m');
});
it('should the status of the request should now be accepted', async() => {
let status = await page.waitToGetProperty(selectors.itemRequest.firstRequestStatus, 'innerText');
expect(status).toContain('Aceptada');
});
it('should now click on the second declain request icon then type the reason', async() => {
await page.waitToClick(selectors.itemRequest.secondRequestDecline);
await page.write(selectors.itemRequest.declineReason, 'not quite as expected');
await page.waitToClick(selectors.itemRequest.acceptDeclineReason);
await page.waitForContentLoaded();
let status = await page.waitToGetProperty(selectors.itemRequest.firstRequestStatus, 'innerText');
expect(status).toContain('Denegada');
});
});

View File

@ -85,7 +85,7 @@
<vn-td>
<vn-icon
ng-if="request.response.length"
ranslate-attr="{title: request.response}"
translate-attr="{title: request.response}"
icon="insert_drive_file">
</vn-icon>
<vn-icon-button

View File

@ -1,12 +1,12 @@
const app = require('vn-loopback/server/server');
describe('ticket-request filter()', () => {
it('should return all ticket requests', async() => {
it('should now return all ticket requests', async() => {
let ctx = {req: {accessToken: {userId: 9}}, args: {}};
let result = await app.models.TicketRequest.filter(ctx);
expect(result.length).toEqual(2);
expect(result.length).toEqual(3);
});
it('should return the ticket request matching a generic search value which is the ticket ID', async() => {
@ -42,7 +42,7 @@ describe('ticket-request filter()', () => {
let result = await app.models.TicketRequest.filter(ctx);
let requestId = result[0].id;
expect(requestId).toEqual(4);
expect(requestId).toEqual(3);
});
it('should return the ticket request matching the isOk triple-state', async() => {
@ -51,7 +51,7 @@ describe('ticket-request filter()', () => {
let result = await app.models.TicketRequest.filter(ctx);
let requestId = result[0].id;
expect(requestId).toEqual(4);
expect(requestId).toEqual(3);
});
it('should return the ticket request matching the client ID', async() => {
@ -69,7 +69,7 @@ describe('ticket-request filter()', () => {
let result = await app.models.TicketRequest.filter(ctx);
let requestId = result[0].id;
expect(requestId).toEqual(4);
expect(requestId).toEqual(3);
});
it('should return the ticket request matching the salesPerson ID', async() => {
@ -78,6 +78,6 @@ describe('ticket-request filter()', () => {
let result = await app.models.TicketRequest.filter(ctx);
let requestId = result[0].id;
expect(requestId).toEqual(4);
expect(requestId).toEqual(3);
});
});