Merge branch 'dev' into 2729-prices_popover
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2021-04-19 07:59:09 +00:00
commit 857c508391
9 changed files with 159 additions and 32 deletions

View File

@ -904,6 +904,25 @@ export default {
ticketOne: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(1)',
ticketTwo: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(2)'
},
invoiceInSummary: {
supplierRef: 'vn-invoice-in-summary vn-label-value:nth-child(2) > section > span'
},
invoiceInDescriptor: {
moreMenu: 'vn-invoice-in-descriptor vn-icon-button[icon=more_vert]',
moreMenuDeleteInvoiceIn: '.vn-menu [name="deleteInvoice"]',
acceptDeleteButton: '.vn-confirm.shown button[response="accept"]'
},
invoiceInBasicData: {
issued: 'vn-invoice-in-basic-data vn-date-picker[ng-model="$ctrl.invoiceIn.issued"]',
operated: 'vn-invoice-in-basic-data vn-date-picker[ng-model="$ctrl.invoiceIn.operated"]',
supplier: 'vn-invoice-in-basic-data vn-autocomplete[ng-model="$ctrl.invoiceIn.supplierFk"]',
supplierRef: 'vn-invoice-in-basic-data vn-textfield[ng-model="$ctrl.invoiceIn.supplierRef"]',
bookEntried: 'vn-invoice-in-basic-data vn-date-picker[ng-model="$ctrl.invoiceIn.bookEntried"]',
booked: 'vn-invoice-in-basic-data vn-date-picker[ng-model="$ctrl.invoiceIn.booked"]',
currency: 'vn-invoice-in-basic-data vn-autocomplete[ng-model="$ctrl.invoiceIn.currencyFk"]',
company: 'vn-invoice-in-basic-data vn-autocomplete[ng-model="$ctrl.invoiceIn.companyFk"]',
save: 'vn-invoice-in-basic-data button[type=submit]'
},
travelIndex: {
anySearchResult: 'vn-travel-index vn-tbody > a',
firstSearchResult: 'vn-travel-index vn-tbody > a:nth-child(1)',

View File

@ -184,7 +184,7 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.sendSMSbutton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('SMS sent!');
expect(message).toBeDefined();
});
it('should send the import SMS using the descriptor menu', async() => {
@ -196,7 +196,7 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.sendSMSbutton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('SMS sent!');
expect(message).toBeDefined();
});
});
});

View File

@ -0,0 +1,28 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('InvoiceIn summary path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('administrative', 'invoiceIn');
await page.accessToSearchResult('1');
});
afterAll(async() => {
await browser.close();
});
it('should reach the summary section', async() => {
await page.waitForState('invoiceIn.card.summary');
});
it('should contain some basic data from the invoice', async() => {
const result = await page.waitToGetProperty(selectors.invoiceInSummary.supplierRef, 'innerText');
expect(result).toEqual('1234');
});
});

View File

@ -0,0 +1,38 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('InvoiceIn descriptor path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('administrative', 'invoiceIn');
await page.accessToSearchResult('10');
});
afterAll(async() => {
await browser.close();
});
it('should delete the invoiceIn using the descriptor more menu', async() => {
await page.waitToClick(selectors.invoiceInDescriptor.moreMenu);
await page.waitToClick(selectors.invoiceInDescriptor.moreMenuDeleteInvoiceIn);
await page.waitToClick(selectors.invoiceInDescriptor.acceptDeleteButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('InvoiceIn deleted');
});
it('should have been relocated to the invoiceOut index', async() => {
await page.waitForState('invoiceIn.index');
});
it(`should search for the deleted invouceOut to find no results`, async() => {
await page.doSearch('10');
const nResults = await page.countElement(selectors.invoiceOutIndex.searchResult);
expect(nResults).toEqual(0);
});
});

View File

@ -0,0 +1,64 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('InvoiceIn basic data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('administrative', 'invoiceIn');
await page.accessToSearchResult('1');
await page.accessToSection('invoiceIn.card.basicData');
});
afterAll(async() => {
await browser.close();
});
it(`should edit the invoiceIn basic data`, async() => {
const now = new Date();
await page.pickDate(selectors.invoiceInBasicData.issued, now);
await page.pickDate(selectors.invoiceInBasicData.operated, now);
await page.autocompleteSearch(selectors.invoiceInBasicData.supplier, 'Verdnatura');
await page.clearInput(selectors.invoiceInBasicData.supplierRef);
await page.write(selectors.invoiceInBasicData.supplierRef, '9999');
await page.pickDate(selectors.invoiceInBasicData.bookEntried, now);
await page.pickDate(selectors.invoiceInBasicData.booked, now);
await page.autocompleteSearch(selectors.invoiceInBasicData.currency, 'Dollar USA');
await page.autocompleteSearch(selectors.invoiceInBasicData.company, 'ORN');
await page.waitToClick(selectors.invoiceInBasicData.save);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should confirm the invoiceIn supplier was edited`, async() => {
await page.reloadSection('invoiceIn.card.basicData');
const result = await page.waitToGetProperty(selectors.invoiceInBasicData.supplier, 'value');
expect(result).toContain('Verdnatura');
});
it(`should confirm the invoiceIn supplierRef was edited`, async() => {
const result = await page
.waitToGetProperty(selectors.invoiceInBasicData.supplierRef, 'value');
expect(result).toEqual('9999');
});
it(`should confirm the invoiceIn currency was edited`, async() => {
const result = await page
.waitToGetProperty(selectors.invoiceInBasicData.currency, 'value');
expect(result).toEqual('Dollar USA');
});
it(`should confirm the invoiceIn company was edited`, async() => {
const result = await page
.waitToGetProperty(selectors.invoiceInBasicData.company, 'value');
expect(result).toEqual('ORN');
});
});

View File

@ -58,24 +58,21 @@
label="Save">
</vn-submit>
<vn-button
disabled="!watcher.dataChanged()"
label="Synchronize all"
ng-click="$ctrl.onSynchronizeAll()">
</vn-button>
<vn-button
disabled="!watcher.dataChanged()"
label="Synchronize user"
ng-click="syncUser.show()">
</vn-button>
<vn-button
disabled="!watcher.dataChanged()"
label="Synchronize roles"
ng-click="$ctrl.onSynchronizeRoles()">
</vn-button>
<vn-button
disabled="!watcher.dataChanged()"
class="cancel"
label="Undo changes"
disabled="!watcher.dataChanged()"
ng-click="watcher.loadOriginalData()">
</vn-button>
</vn-button-bar>

View File

@ -1,4 +1,5 @@
const app = require('vn-loopback/server/server');
const soap = require('soap');
describe('client sendSms()', () => {
let createdLog;
@ -9,7 +10,8 @@ describe('client sendSms()', () => {
done();
});
it('should send a message and log it', async() => {
it('should now send a message and log it', async() => {
spyOn(soap, 'createClientAsync').and.returnValue('a so fake client');
let ctx = {req: {accessToken: {userId: 9}}};
let id = 101;
let destination = 222222222;

View File

@ -4,34 +4,11 @@ const soap = require('soap');
describe('sms send()', () => {
it('should return the expected message and status code', async() => {
const code = 200;
const smsConfig = await app.models.SmsConfig.findOne();
const soapClient = await soap.createClientAsync(smsConfig.uri);
spyOn(soap, 'createClientAsync').and.returnValue(soapClient);
spyOn(soapClient, 'sendSMSAsync').and.returnValue([{
result: {
$value:
`<xtratelecom-sms-response>
<sms>
<codigo>
${code}
</codigo>
<descripcion>
Envio en procesamiento
</descripcion>
<messageId>
1
</messageId>
</sms>
<procesoId>
444328681
</procesoId>
</xtratelecom-sms-response>`
}
}]);
spyOn(soap, 'createClientAsync').and.returnValue('a so fake client');
let ctx = {req: {accessToken: {userId: 1}}};
let result = await app.models.Sms.send(ctx, 105, 'destination', 'My SMS Body');
expect(result.statusCode).toEqual(200);
expect(result.statusCode).toEqual(code);
expect(result.status).toContain('Fake response');
});
});

View File

@ -1,4 +1,5 @@
const app = require('vn-loopback/server/server');
const soap = require('soap');
describe('ticket sendSms()', () => {
let logId;
@ -10,6 +11,7 @@ describe('ticket sendSms()', () => {
});
it('should send a message and log it', async() => {
spyOn(soap, 'createClientAsync').and.returnValue('a so fake client');
let ctx = {req: {accessToken: {userId: 9}}};
let id = 11;
let destination = 222222222;