Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2557-export_production
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Bernat Exposito 2020-11-12 08:04:38 +01:00
commit 5be616ad91
182 changed files with 2624 additions and 35140 deletions

View File

@ -24,8 +24,6 @@ module.exports = Self => {
const conn = Self.dataSource.connector; const conn = Self.dataSource.connector;
const minDate = new Date(); const minDate = new Date();
minDate.setFullYear(minDate.getFullYear() - 1); minDate.setFullYear(minDate.getFullYear() - 1);
minDate.setMonth(0);
minDate.setDate(1);
const where = {dated: {gte: minDate}}; const where = {dated: {gte: minDate}};
filter = mergeFilters(filter, {where}); filter = mergeFilters(filter, {where});

View File

@ -2,24 +2,18 @@ const app = require('vn-loopback/server/server');
describe('campaign latest()', () => { describe('campaign latest()', () => {
it('should return the campaigns from the last year', async() => { it('should return the campaigns from the last year', async() => {
let result = await app.models.Campaign.latest(); const now = new Date();
const result = await app.models.Campaign.latest();
const lastYearDate = new Date();
lastYearDate.setFullYear(lastYearDate.getFullYear() - 1);
const lastYear = lastYearDate.getFullYear();
const randomIndex = Math.floor(Math.random() * result.length); const randomIndex = Math.floor(Math.random() * result.length);
const campaignDated = result[randomIndex].dated; const campaignDated = result[randomIndex].dated;
const campaignYear = campaignDated.getFullYear();
expect(result.length).toEqual(3); expect(result.length).toEqual(3);
expect(campaignYear).toEqual(lastYear); expect(campaignDated).toBeLessThanOrEqual(now);
}); });
it('should return the campaigns from the current year', async() => { it('should return the campaigns from the current year', async() => {
const currentDate = new Date(); const now = new Date();
const currentYear = currentDate.getFullYear(); const currentYear = now.getFullYear();
const result = await app.models.Campaign.latest({ const result = await app.models.Campaign.latest({
where: {dated: {like: `%${currentYear}%`}} where: {dated: {like: `%${currentYear}%`}}
}); });

View File

@ -2,15 +2,11 @@ const app = require('vn-loopback/server/server');
describe('campaign upcoming()', () => { describe('campaign upcoming()', () => {
it('should return the upcoming campaign but from the last year', async() => { it('should return the upcoming campaign but from the last year', async() => {
let response = await app.models.Campaign.upcoming(); const response = await app.models.Campaign.upcoming();
const lastYearDate = new Date();
lastYearDate.setFullYear(lastYearDate.getFullYear() - 1);
const lastYear = lastYearDate.getFullYear();
const campaignDated = response.dated; const campaignDated = response.dated;
const campaignYear = campaignDated.getFullYear(); const now = new Date();
expect(campaignYear).toEqual(lastYear); expect(campaignDated).toEqual(jasmine.any(Date));
expect(campaignDated).toBeLessThanOrEqual(now);
}); });
}); });

View File

@ -1,13 +1,62 @@
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
// #2495 updateCollectionSale reparar polución de unitarios describe('updateCollectionSale()', () => {
xdescribe('updateCollectionSale()', () => { it('should return a new collection', async() => {
it('return a new collection', async() => { const sectorOneWarehouseID = 1;
let ctx = {req: {accessToken: {userId: 106}}}; let ctx = {req: {accessToken: {userId: 106}}};
let response = await app.models.Collection.updateCollectionSale(ctx, 1, 5, 5, 5, 1, 4, false, 'UXN', 1, 1); ctx.args = {
sale: 1,
originalQuantity: 5,
quantity: 5,
quantityPicked: 5,
ticketFk: 1,
stateFk: 4,
isNicho: false,
shelvingFk: 'UXN',
itemFk: 1,
sectorFk: 1
};
let originalSaleTracking = await app.models.SaleTracking.findOne({
where: {
saleFk: ctx.args.sale,
stateFk: ctx.args.stateFk
}
});
let itemPlacement = await app.models.ItemPlacement.findOne({
where: {
itemFk: ctx.args.itemFk,
warehouseFk: sectorOneWarehouseID
}
});
const originalSale = await app.models.Sale.findById(ctx.args.sale);
const originalItemShelving = await app.models.ItemShelving.findOne({where: {shelvingFk: ctx.args.shelvingFk, itemFk: ctx.args.itemFk}});
const originalTicketLastState = await app.models.TicketLastState.findById(ctx.args.ticketFk);
let response = await app.models.Collection.updateCollectionSale(ctx);
expect(response.length).toBeGreaterThan(0); expect(response.length).toBeGreaterThan(0);
expect(response[0][0].id).toEqual(1); expect(response[0][0].id).toEqual(1);
expect(response[0][0].quantity).toEqual(5); expect(response[0][0].quantity).toEqual(5);
// restores
if (originalSaleTracking)
await originalSaleTracking.save();
else {
originalSaleTracking = await app.models.SaleTracking.findOne({
where: {
saleFk: ctx.args.sale,
stateFk: ctx.args.stateFk
}
});
await originalSaleTracking.destroy();
}
await originalSale.save();
const itemShelvingsToDestroy = await app.models.ItemShelving.find({where: {shelvingFk: ctx.args.shelvingFk, itemFk: ctx.args.itemFk}});
for (itemShelving of itemShelvingsToDestroy)
await itemShelving.destroy();
await originalItemShelving.save();
await originalTicketLastState.save();
await itemPlacement.save();
}); });
}); });

View File

@ -65,25 +65,26 @@ module.exports = Self => {
} }
}); });
Self.updateCollectionSale = async(ctx, sale, originalQuantity, quantity, quantityPicked, ticketFk, stateFk, isNicho, shelvingFk, itemFk, sectorFk) => { Self.updateCollectionSale = async ctx => {
const userId = ctx.req.accessToken.userId; const userId = ctx.req.accessToken.userId;
const args = ctx.args;
if (originalQuantity == quantity) { if (args.originalQuantity == args.quantity) {
query = `CALL vn.collection_updateSale(?,?,?,?,?)`; query = `CALL vn.collection_updateSale(?,?,?,?,?)`;
await Self.rawSql(query, [sale, originalQuantity, userId, stateFk, ticketFk]); await Self.rawSql(query, [args.sale, args.originalQuantity, userId, args.stateFk, args.ticketFk]);
} }
if (!isNicho) { if (!args.isNicho) {
query = `CALL vn.collection_faults(?,?,?)`; query = `CALL vn.collection_faults(?,?,?)`;
await Self.rawSql(query, [shelvingFk, quantityPicked, itemFk]); await Self.rawSql(query, [args.shelvingFk, args.quantityPicked, args.itemFk]);
} else { } else {
query = `CALL vn.sector_getWarehouse(?)`; query = `CALL vn.sector_getWarehouse(?)`;
const [result] = await Self.rawSql(query, [sectorFk]); const [result] = await Self.rawSql(query, [args.sectorFk]);
query = `CALL vn.itemPlacementSave(?,?,?)`; query = `CALL vn.itemPlacementSave(?,?,?)`;
await Self.rawSql(query, [shelvingFk, quantityPicked, result[0]['warehouseFk']]); await Self.rawSql(query, [args.shelvingFk, args.quantityPicked, result[0]['warehouseFk']]);
} }
query = `CALL vn.sale_updateOriginalQuantity(?,?)`; query = `CALL vn.sale_updateOriginalQuantity(?,?)`;
return await Self.rawSql(query, [sale, quantity]); return await Self.rawSql(query, [args.sale, args.quantity]);
}; };
}; };

View File

@ -56,6 +56,9 @@
"Sip": { "Sip": {
"dataSource": "vn" "dataSource": "vn"
}, },
"SageWithholding": {
"dataSource": "vn"
},
"UserConfigView": { "UserConfigView": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -0,0 +1,33 @@
{
"name": "SageWithholding",
"base": "VnModel",
"options": {
"mysql": {
"table": "sage.TiposRetencion"
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier",
"mysql": {
"columnName": "CodigoRetencion"
}
},
"withholding": {
"type": "string",
"mysql": {
"columnName": "Retencion"
}
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -202,7 +202,8 @@ BEGIN
JSON_OBJECT( JSON_OBJECT(
'mysql_old_password', JSON_VALUE(t.`Priv`, '$.mysql_old_password'), 'mysql_old_password', JSON_VALUE(t.`Priv`, '$.mysql_old_password'),
'mysql_native_password', JSON_VALUE(t.`Priv`, '$.mysql_native_password'), 'mysql_native_password', JSON_VALUE(t.`Priv`, '$.mysql_native_password'),
'authentication_string', JSON_VALUE(t.`Priv`, '$.authentication_string') 'authentication_string', JSON_VALUE(t.`Priv`, '$.authentication_string'),
'ssl_type', JSON_VALUE(t.`Priv`, '$.ssl_type')
) )
) )
FROM tRole r FROM tRole r

View File

@ -0,0 +1,4 @@
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Supplier', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Supplier', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('SupplierLog', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('SupplierContact', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative');

View File

@ -0,0 +1,43 @@
DROP PROCEDURE IF EXISTS `vn`.`timeControl_calculate`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`timeControl_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
SET @vIsOdd := TRUE;
SET @vUser := NULL;
SET @vDated := NULL;
DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate;
CREATE TEMPORARY TABLE tmp.timeControlCalculate
SELECT
userFk,
dated,
IF( timeWork >= 18000, @timeWork:=timeWork + 1200, @timeWork:=timeWork) timeWorkSeconds,
SEC_TO_TIME(@timeWork ) timeWorkSexagesimal,
@timeWork / 3600 timeWorkDecimal,
timed
FROM (SELECT SUM(timeWork) timeWork,
userFk,
dated,
GROUP_CONCAT(DATE_FORMAT(sub.timed,"%H:%i") ORDER BY sub.timed ASC SEPARATOR ' - ') timed
FROM (SELECT IF(@vUser = wtc.userFk, @vUser :=@vUser, @vUser := wtc.userFk),
IF(@vIsOdd, @vIsOdd := FALSE, @vIsOdd := TRUE),
IF(direction='in', @vIsOdd := TRUE, @vIsOdd := @vIsOdd),
IF(@vIsOdd, @vLastTimed:=UNIX_TIMESTAMP(timed),@vLastTimed:=@vLastTimed),
IF(@vIsOdd, 0, UNIX_TIMESTAMP(timed)-@vLastTimed) timeWork,
IF(direction='in', @vDated := DATE(wtc.timed), @vDated :=@vDated) dated,
wtc.timed timed,
wtc.userFk,
direction
FROM (SELECT DISTINCT(wtc.id), wtc.userFk, wtc.timed, wtc.direction
FROM workerTimeControl wtc
JOIN tmp.`user` w ON w.userFk = wtc.userFk
WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo
ORDER BY userFk, timed ASC
) wtc
WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo
) sub
GROUP BY userFk, dated
)sub2;
END$$
DELIMITER ;

View File

@ -614,6 +614,24 @@ INSERT INTO `TiposRetencion` VALUES (1,'RETENCION ESTIMACION OBJETIVA',1.0000000
UNLOCK TABLES; UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
--
-- Dumping data for table `TiposRetencion`
--
LOCK TABLES `TiposRetencion` WRITE;
/*!40000 ALTER TABLE `TiposRetencion` DISABLE KEYS */;
INSERT INTO `TiposRetencion` (`CodigoRetencion`, `Retencion`, `PorcentajeRetencion`, `CuentaCargo`, `CuentaAbono`, `ClaveIrpf`, `CuentaCargoANT_`, `CuentaAbonoANT_`, `IdTipoRetencion`) VALUES
(1, 'RETENCION ESTIMACION OBJETIVA', '1.0000000000', '4730000000', '4751000000', NULL, NULL, NULL, '03811652-0F3A-44A1-AE1C-B19624525D7F'),
(2, 'ACTIVIDADES AGRICOLAS O GANADERAS', '2.0000000000', '4730000000', '4751000000', NULL, NULL, NULL, 'F3F91EF3-FED6-444D-B03C-75B639D13FB4'),
(9, 'ACTIVIDADES PROFESIONALES 2 PRIMEROS AÑOS', '9.0000000000', '4730000000', '4751000000', NULL, NULL, NULL, '73F95642-E951-4C91-970A-60C503A4792B'),
(15, 'ACTIVIDADES PROFESIONALES', '15.0000000000', '4730000000', '4751000000', '6', NULL, NULL, 'F6BDE0EE-3B01-4023-8FFF-A73AE9AC50D7'),
(19, 'ARRENDAMIENTO Y SUBARRENDAMIENTO', '19.0000000000', '4730000000', '4751000000', '8', NULL, NULL, '09B033AE-16E5-4057-8D4A-A7710C8A4FB9');
/*!40000 ALTER TABLE `TiposRetencion` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;

View File

@ -718,11 +718,13 @@ INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk
INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`) INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`)
VALUES VALUES
('YEL', 'Yellow', 1, 1, 'F4D03F'), ('YEL', 'Yellow', 1, 1, 'F4D03F'),
('BLU', 'Blue', 1, 2, '5DADE2'), ('BLU', 'Blue', 1, 2, '5DADE2'),
('RED', 'Red', 1, 3, 'EC7063'), ('RED', 'Red', 1, 3, 'EC7063'),
('SLV', 'Silver', 1, 4, 'CACFD2'), ('SLV', 'Silver', 1, 4, 'CACFD2'),
('BRW', 'Brown', 1, 5, 'DC7633'); ('BRW', 'Brown', 1, 5, 'DC7633'),
('BLK', 'Black', 1, 6, '000000'),
('BAS', 'Blue/Silver', 1, 7, '5DADE2');
INSERT INTO `vn`.`origin`(`id`,`code`, `name`) INSERT INTO `vn`.`origin`(`id`,`code`, `name`)
VALUES VALUES
@ -1211,11 +1213,11 @@ INSERT INTO `vn`.`annualAverageInvoiced`(`clientFk`, `invoiced`)
(104, 500), (104, 500),
(105, 5000); (105, 5000);
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`,`isFarmer`,`commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `transactionTypeSageFk`) INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`,`isFarmer`,`commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`)
VALUES VALUES
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, 0, CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, NULL, NULL), (1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, 0, CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1),
(2, 'Farmer King', 'The farmer', 4000020002, 1, 'B22222222', 1, 0, CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 8), (2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 1, 0, CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 2, 8),
(442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, 'C33333333', 0, 0, CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, NULL, NULL); (442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, 0, CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3);
INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`) INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`)
VALUES VALUES

View File

@ -123,15 +123,20 @@ let actions = {
}, },
waitForState: async function(state) { waitForState: async function(state) {
await this.waitFor(state => { await this.waitForFunction(state => {
let $state = angular.element(document.body).injector().get('$state'); let $state = angular.element(document.body).injector().get('$state');
return !$state.transition && $state.is(state); return !$state.transition && $state.is(state);
}, {}, state); }, {}, state);
await this.waitForFunction(() => {
return angular.element(() => {
return true;
});
});
await this.waitForSpinnerLoad(); await this.waitForSpinnerLoad();
}, },
waitForTransition: async function() { waitForTransition: async function() {
await this.waitFor(() => { await this.waitForFunction(() => {
const $state = angular.element(document.body).injector().get('$state'); const $state = angular.element(document.body).injector().get('$state');
return !$state.transition; return !$state.transition;
}); });
@ -242,7 +247,7 @@ let actions = {
write: async function(selector, text) { write: async function(selector, text) {
let builtSelector = await this.selectorFormater(selector); let builtSelector = await this.selectorFormater(selector);
await this.waitForSelector(selector, {}); await this.waitForSelector(selector);
await this.type(builtSelector, text); await this.type(builtSelector, text);
await this.waitForTextInField(selector, text); await this.waitForTextInField(selector, text);
}, },
@ -335,6 +340,31 @@ let actions = {
}); });
}, },
waitForTextInField: async function(selector, text) {
let builtSelector = await this.selectorFormater(selector);
await this.waitForSelector(builtSelector);
const expectedText = text.toLowerCase();
return new Promise((resolve, reject) => {
let attempts = 0;
const interval = setInterval(async() => {
const currentText = await this.evaluate(selector => {
return document.querySelector(selector).value.toLowerCase();
}, builtSelector);
if (currentText === expectedText || attempts === 40) {
clearInterval(interval);
resolve(currentText);
}
attempts += 1;
}, 100);
}).then(result => {
if (result === '')
return expect(result).toEqual(expectedText);
return expect(result).toContain(expectedText);
});
},
selectorFormater: function(selector) { selectorFormater: function(selector) {
if (selector.includes('vn-textarea')) if (selector.includes('vn-textarea'))
return `${selector} textarea`; return `${selector} textarea`;
@ -345,14 +375,6 @@ let actions = {
return `${selector} input`; return `${selector} input`;
}, },
waitForTextInField: async function(selector, text) {
let builtSelector = await this.selectorFormater(selector);
await this.waitForSelector(builtSelector);
return await this.waitForFunction((selector, text) => {
return document.querySelector(selector).value.toLowerCase().includes(text.toLowerCase());
}, {}, builtSelector, text);
},
waitForInnerText: async function(selector) { waitForInnerText: async function(selector) {
await this.waitForSelector(selector, {}); await this.waitForSelector(selector, {});
await this.waitForFunction(selector => { await this.waitForFunction(selector => {
@ -522,7 +544,7 @@ let actions = {
}, },
waitForSpinnerLoad: async function() { waitForSpinnerLoad: async function() {
await this.waitFor('vn-topbar vn-spinner', {hidden: true}); await this.waitForSelector('vn-topbar vn-spinner', {hidden: true});
}, },
waitForWatcherData: async function(selector) { waitForWatcherData: async function(selector) {

View File

@ -413,7 +413,7 @@ export default {
stateLabelValue: 'vn-ticket-descriptor vn-label-value[label="State"]', stateLabelValue: 'vn-ticket-descriptor vn-label-value[label="State"]',
isDeletedIcon: 'vn-ticket-descriptor vn-icon[icon="icon-deletedTicket"]', isDeletedIcon: 'vn-ticket-descriptor vn-icon[icon="icon-deletedTicket"]',
goBackToModuleIndexButton: 'vn-ticket-descriptor a[ui-sref="ticket.index"]', goBackToModuleIndexButton: 'vn-ticket-descriptor a[ui-sref="ticket.index"]',
moreMenu: 'vn-ticket-descriptor vn-icon-button[icon=more_vert]', moreMenu: 'vn-ticket-descriptor vn-ticket-descriptor-menu > vn-icon-button[icon=more_vert]',
moreMenuAddStowaway: '.vn-menu [name="addStowaway"]', moreMenuAddStowaway: '.vn-menu [name="addStowaway"]',
moreMenuDeleteStowawayButton: '.vn-menu [name="deleteStowaway"]', moreMenuDeleteStowawayButton: '.vn-menu [name="deleteStowaway"]',
moreMenuAddToTurn: '.vn-menu [name="addTurn"]', moreMenuAddToTurn: '.vn-menu [name="addTurn"]',
@ -482,7 +482,7 @@ export default {
firstSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(1) vn-check[ng-model="sale.checked"]', firstSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(1) vn-check[ng-model="sale.checked"]',
secondSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(2)', secondSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(2)',
secondSaleId: 'vn-ticket-sale:nth-child(2) vn-td-editable:nth-child(4) text > span', secondSaleId: 'vn-ticket-sale:nth-child(2) vn-td-editable:nth-child(4) text > span',
secondSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete', secondSaleIdAutocomplete: 'vn-ticket-sale vn-tr:nth-child(2) vn-autocomplete[ng-model="sale.itemFk"]',
secondSaleQuantity: 'vn-ticket-sale vn-table vn-tr:nth-child(2) vn-input-number', secondSaleQuantity: 'vn-ticket-sale vn-table vn-tr:nth-child(2) vn-input-number',
secondSaleQuantityCell: 'vn-ticket-sale > div > vn-card > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td-editable:nth-child(5)', secondSaleQuantityCell: 'vn-ticket-sale > div > vn-card > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td-editable:nth-child(5)',
secondSaleConceptCell: 'vn-ticket-sale vn-tbody > :nth-child(2) > :nth-child(6)', secondSaleConceptCell: 'vn-ticket-sale vn-tbody > :nth-child(2) > :nth-child(6)',
@ -923,5 +923,24 @@ export default {
thirdContactNotes: 'vn-supplier-contact div:nth-child(3) vn-textfield[ng-model="contact.observation"]', thirdContactNotes: 'vn-supplier-contact div:nth-child(3) vn-textfield[ng-model="contact.observation"]',
saveButton: 'vn-supplier-contact button[type="submit"]', saveButton: 'vn-supplier-contact button[type="submit"]',
thirdContactDeleteButton: 'vn-supplier-contact div:nth-child(3) vn-icon-button[icon="delete"]' thirdContactDeleteButton: 'vn-supplier-contact div:nth-child(3) vn-icon-button[icon="delete"]'
},
supplierBasicData: {
alias: 'vn-supplier-basic-data vn-textfield[ng-model="$ctrl.supplier.nickname"]',
isOfficial: 'vn-supplier-basic-data vn-check[ng-model="$ctrl.supplier.isOfficial"]',
isActive: 'vn-supplier-basic-data vn-check[ng-model="$ctrl.supplier.isActive"]',
notes: 'vn-supplier-basic-data vn-textarea[ng-model="$ctrl.supplier.note"]',
saveButton: 'vn-supplier-basic-data button[type="submit"]',
},
supplierFiscalData: {
socialName: 'vn-supplier-fiscal-data vn-textfield[ng-model="$ctrl.supplier.name"]',
taxNumber: 'vn-supplier-fiscal-data vn-textfield[ng-model="$ctrl.supplier.nif"]',
account: 'vn-supplier-fiscal-data vn-textfield[ng-model="$ctrl.supplier.account"]',
sageTaxType: 'vn-supplier-fiscal-data vn-autocomplete[ng-model="$ctrl.supplier.sageTaxTypeFk"]',
sageWihholding: 'vn-supplier-fiscal-data vn-autocomplete[ng-model="$ctrl.supplier.sageWithholdingFk"]',
postCode: 'vn-supplier-fiscal-data vn-datalist[ng-model="$ctrl.supplier.postCode"]',
city: 'vn-supplier-fiscal-data vn-datalist[ng-model="$ctrl.supplier.city"]',
province: 'vn-supplier-fiscal-data vn-autocomplete[ng-model="$ctrl.supplier.provinceFk"]',
country: 'vn-supplier-fiscal-data vn-autocomplete[ng-model="$ctrl.supplier.countryFk"]',
saveButton: 'vn-supplier-fiscal-data button[type="submit"]',
} }
}; };

View File

@ -19,7 +19,7 @@ describe('Login path', async() => {
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
const state = await page.getState(); const state = await page.getState();
expect(message.text).toBe('Invalid login, remember that distinction is made between uppercase and lowercase'); expect(message.text).toContain('Invalid login, remember that distinction is made between uppercase and lowercase');
expect(state).toBe('login'); expect(state).toBe('login');
}); });
@ -28,7 +28,7 @@ describe('Login path', async() => {
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
const state = await page.getState(); const state = await page.getState();
expect(message.text).toBe('Invalid login, remember that distinction is made between uppercase and lowercase'); expect(message.text).toContain('Invalid login, remember that distinction is made between uppercase and lowercase');
expect(state).toBe('login'); expect(state).toBe('login');
}); });
@ -37,7 +37,7 @@ describe('Login path', async() => {
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
const state = await page.getState(); const state = await page.getState();
expect(message.text).toBe('Please enter your username'); expect(message.text).toContain('Please enter your username');
expect(state).toBe('login'); expect(state).toBe('login');
}); });
}); });

View File

@ -31,7 +31,7 @@ describe('Client create path', () => {
await page.waitToClick(selectors.createClientView.createButton); await page.waitToClick(selectors.createClientView.createButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Some fields are invalid'); expect(message.text).toContain('Some fields are invalid');
}); });
it('should receive an error when clicking the create button having name and Business name fields empty', async() => { it('should receive an error when clicking the create button having name and Business name fields empty', async() => {
@ -42,7 +42,7 @@ describe('Client create path', () => {
await page.waitToClick(selectors.createClientView.createButton); await page.waitToClick(selectors.createClientView.createButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Some fields are invalid'); expect(message.text).toContain('Some fields are invalid');
}); });
it(`should create a new province`, async() => { it(`should create a new province`, async() => {
@ -53,7 +53,7 @@ describe('Client create path', () => {
await page.waitToClick(selectors.createClientView.saveNewProvicenButton); await page.waitToClick(selectors.createClientView.saveNewProvicenButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('The province has been created'); expect(message.text).toContain('The province has been created');
}); });
it(`should create a new city`, async() => { it(`should create a new city`, async() => {
@ -63,7 +63,7 @@ describe('Client create path', () => {
await page.waitToClick(selectors.createClientView.saveNewCityButton); await page.waitToClick(selectors.createClientView.saveNewCityButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('The city has been created'); expect(message.text).toContain('The city has been created');
}); });
it(`should create a new post code`, async() => { it(`should create a new post code`, async() => {
@ -72,7 +72,7 @@ describe('Client create path', () => {
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('The postcode has been created. You can save the data now'); expect(message.text).toContain('The postcode has been created. You can save the data now');
}); });
it(`should attempt to create a new user with all it's data but wrong email`, async() => { it(`should attempt to create a new user with all it's data but wrong email`, async() => {
@ -84,7 +84,7 @@ describe('Client create path', () => {
await page.waitToClick(selectors.createClientView.createButton); await page.waitToClick(selectors.createClientView.createButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Some fields are invalid'); expect(message.text).toContain('Some fields are invalid');
}); });
it(`should attempt to create a new user with all it's data but wrong postal code`, async() => { it(`should attempt to create a new user with all it's data but wrong postal code`, async() => {
@ -95,7 +95,7 @@ describe('Client create path', () => {
await page.waitToClick(selectors.createClientView.createButton); await page.waitToClick(selectors.createClientView.createButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe(`The postcode doesn't exist. Please enter a correct one`); expect(message.text).toContain(`The postcode doesn't exist. Please enter a correct one`);
}); });
it(`should check for autocompleted city, province and country`, async() => { it(`should check for autocompleted city, province and country`, async() => {
@ -119,7 +119,7 @@ describe('Client create path', () => {
await page.waitToClick(selectors.createClientView.createButton); await page.waitToClick(selectors.createClientView.createButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should click on the Clients button of the top bar menu', async() => { it('should click on the Clients button of the top bar menu', async() => {

View File

@ -37,7 +37,7 @@ describe('Client Edit basicData path', () => {
await page.waitToClick(selectors.clientBasicData.saveButton); await page.waitToClick(selectors.clientBasicData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the name have been edited', async() => { it('should confirm the name have been edited', async() => {
@ -101,7 +101,7 @@ describe('Client Edit basicData path', () => {
await page.waitToClick(selectors.clientBasicData.saveButton); await page.waitToClick(selectors.clientBasicData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should now confirm the name have been edited', async() => { it('should now confirm the name have been edited', async() => {

View File

@ -83,7 +83,7 @@ describe('Client Edit fiscalData path', () => {
await page.waitToClick(selectors.globalItems.acceptButton); await page.waitToClick(selectors.globalItems.acceptButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Invalid Tax number'); expect(message.text).toContain('Invalid Tax number');
}); });
it(`should edit the fiscal this time with a valid fiscal id`, async() => { it(`should edit the fiscal this time with a valid fiscal id`, async() => {
@ -93,14 +93,14 @@ describe('Client Edit fiscalData path', () => {
await page.waitToClick(selectors.globalItems.acceptButton); await page.waitToClick(selectors.globalItems.acceptButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should propagate the Equalization tax', async() => { it('should propagate the Equalization tax', async() => {
await page.waitToClick(selectors.globalItems.acceptButton); await page.waitToClick(selectors.globalItems.acceptButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Equivalent tax spreaded'); expect(message.text).toContain('Equivalent tax spreaded');
}); });
it('should receive an error if the fiscal id contains A or B at the beginning', async() => { it('should receive an error if the fiscal id contains A or B at the beginning', async() => {
@ -110,7 +110,7 @@ describe('Client Edit fiscalData path', () => {
await page.waitToClick(selectors.clientFiscalData.saveButton); await page.waitToClick(selectors.clientFiscalData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Cannot check Equalization Tax in this NIF/CIF'); expect(message.text).toContain('Cannot check Equalization Tax in this NIF/CIF');
}); });
it('should finally edit the fixcal data correctly as VIES isnt checked and fiscal id is valid for EQtax', async() => { it('should finally edit the fixcal data correctly as VIES isnt checked and fiscal id is valid for EQtax', async() => {
@ -119,7 +119,7 @@ describe('Client Edit fiscalData path', () => {
await page.waitToClick(selectors.clientFiscalData.saveButton); await page.waitToClick(selectors.clientFiscalData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
// confirm all addresses have now EQtax checked step 1 // confirm all addresses have now EQtax checked step 1
@ -155,7 +155,7 @@ describe('Client Edit fiscalData path', () => {
await page.waitToClick(selectors.clientFiscalData.saveButton); await page.waitToClick(selectors.clientFiscalData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should propagate the Equalization tax changes', async() => { it('should propagate the Equalization tax changes', async() => {
@ -163,7 +163,7 @@ describe('Client Edit fiscalData path', () => {
await page.waitToClick(selectors.globalItems.acceptButton); await page.waitToClick(selectors.globalItems.acceptButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Equivalent tax spreaded'); expect(message.text).toContain('Equivalent tax spreaded');
}); });
it('should confirm its name have been edited', async() => { it('should confirm its name have been edited', async() => {
@ -289,7 +289,7 @@ describe('Client Edit fiscalData path', () => {
await page.waitToClick(selectors.clientAddresses.saveButton); await page.waitToClick(selectors.clientAddresses.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 3 // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 3

View File

@ -28,7 +28,7 @@ describe('Client Edit billing data path', () => {
await page.waitToClick(selectors.clientBillingData.saveButton); await page.waitToClick(selectors.clientBillingData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('That payment method requires an IBAN'); expect(message.text).toContain('That payment method requires an IBAN');
}); });
// 2256: Windows (hidden mode): Entity code doesn't get the focus, '9999' is written in entity name. // 2256: Windows (hidden mode): Entity code doesn't get the focus, '9999' is written in entity name.
@ -65,7 +65,7 @@ describe('Client Edit billing data path', () => {
await page.waitToClick(selectors.clientBillingData.saveButton); await page.waitToClick(selectors.clientBillingData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Notification sent!'); expect(message.text).toContain('Notification sent!');
}); });
it('should confirm the due day have been edited', async() => { it('should confirm the due day have been edited', async() => {

View File

@ -31,7 +31,7 @@ describe('Client Add address path', () => {
await page.waitToClick(selectors.clientFiscalData.saveButton); await page.waitToClick(selectors.clientFiscalData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Some fields are invalid'); expect(message.text).toContain('Some fields are invalid');
}); });
it('should confirm that the city and province are propertly filled', async() => { it('should confirm that the city and province are propertly filled', async() => {
@ -51,7 +51,7 @@ describe('Client Add address path', () => {
await page.waitToClick(selectors.clientAddresses.saveButton); await page.waitToClick(selectors.clientAddresses.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Incoterms is required for a non UEE member'); expect(message.text).toContain('Incoterms is required for a non UEE member');
}); });
it(`should receive an error after clicking save button as customsAgent is empty`, async() => { it(`should receive an error after clicking save button as customsAgent is empty`, async() => {
@ -59,7 +59,7 @@ describe('Client Add address path', () => {
await page.waitToClick(selectors.clientAddresses.saveButton); await page.waitToClick(selectors.clientAddresses.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Customs agent is required for a non UEE member'); expect(message.text).toContain('Customs agent is required for a non UEE member');
}); });
it(`should create a new custom agent and then save the address`, async() => { it(`should create a new custom agent and then save the address`, async() => {
@ -73,7 +73,7 @@ describe('Client Add address path', () => {
await page.waitToClick(selectors.clientAddresses.saveButton); await page.waitToClick(selectors.clientAddresses.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should navigate back to the addresses index`, async() => { it(`should navigate back to the addresses index`, async() => {
@ -91,7 +91,7 @@ describe('Client Add address path', () => {
await page.waitToClick(selectors.clientAddresses.secondMakeDefaultStar); await page.waitToClick(selectors.clientAddresses.secondMakeDefaultStar);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the default address is the expected one`, async() => { it(`should confirm the default address is the expected one`, async() => {
@ -113,7 +113,7 @@ describe('Client Add address path', () => {
await page.waitToClick(selectors.clientAddresses.saveButton); await page.waitToClick(selectors.clientAddresses.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('The default consignee can not be unchecked'); expect(message.text).toContain('The default consignee can not be unchecked');
}); });
it(`should go back to the addreses section by clicking the cancel button`, async() => { it(`should go back to the addreses section by clicking the cancel button`, async() => {

View File

@ -28,7 +28,7 @@ describe('Client add address notes path', () => {
await page.waitToClick(selectors.clientAddresses.saveButton); await page.waitToClick(selectors.clientAddresses.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Some fields are invalid'); expect(message.text).toContain('Some fields are invalid');
}); });
it('should not save an observation type without description', async() => { it('should not save an observation type without description', async() => {
@ -37,7 +37,7 @@ describe('Client add address notes path', () => {
await page.waitToClick(selectors.clientAddresses.saveButton); await page.waitToClick(selectors.clientAddresses.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Some fields are invalid'); expect(message.text).toContain('Some fields are invalid');
}); });
it('should create two new observations', async() => { it('should create two new observations', async() => {
@ -48,6 +48,6 @@ describe('Client add address notes path', () => {
await page.waitToClick(selectors.clientAddresses.saveButton); await page.waitToClick(selectors.clientAddresses.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
}); });

View File

@ -23,7 +23,7 @@ describe('Client Edit web access path', () => {
await page.waitToClick(selectors.clientWebAccess.saveButton); await page.waitToClick(selectors.clientWebAccess.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm web access is now unchecked', async() => { it('should confirm web access is now unchecked', async() => {

View File

@ -31,7 +31,7 @@ describe('Client Add notes path', () => {
await page.waitToClick(selectors.clientNotes.saveButton); await page.waitToClick(selectors.clientNotes.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the note was created', async() => { it('should confirm the note was created', async() => {

View File

@ -27,7 +27,7 @@ describe('Client Add credit path', () => {
await page.waitToClick(selectors.clientCredit.saveButton); await page.waitToClick(selectors.clientCredit.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the credit was updated', async() => { it('should confirm the credit was updated', async() => {

View File

@ -26,7 +26,7 @@ describe('Client Add greuge path', () => {
await page.waitToClick(selectors.clientGreuge.saveButton); await page.waitToClick(selectors.clientGreuge.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Some fields are invalid'); expect(message.text).toContain('Some fields are invalid');
}); });
it(`should create a new greuge with all its data`, async() => { it(`should create a new greuge with all its data`, async() => {
@ -36,7 +36,7 @@ describe('Client Add greuge path', () => {
await page.waitToClick(selectors.clientGreuge.saveButton); await page.waitToClick(selectors.clientGreuge.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the greuge was added to the list', async() => { it('should confirm the greuge was added to the list', async() => {

View File

@ -32,7 +32,7 @@ describe('Client lock verified data path', () => {
await page.waitToClick(selectors.clientFiscalData.saveButton); await page.waitToClick(selectors.clientFiscalData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the social name have been edited', async() => { it('should confirm the social name have been edited', async() => {
@ -57,12 +57,14 @@ describe('Client lock verified data path', () => {
}); });
it('should check the Verified data checkbox', async() => { it('should check the Verified data checkbox', async() => {
await page.autocompleteSearch(selectors.clientFiscalData.sageTax, 'operaciones no sujetas');
await page.autocompleteSearch(selectors.clientFiscalData.sageTransaction, 'regularización de inversiones');
await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox); await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox);
await page.waitToClick(selectors.clientFiscalData.saveButton); await page.waitToClick(selectors.clientFiscalData.saveButton);
await page.waitToClick(selectors.globalItems.acceptButton); await page.waitToClick(selectors.globalItems.acceptButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm Verified data checkbox is checked', async() => { it('should confirm Verified data checkbox is checked', async() => {
@ -79,7 +81,7 @@ describe('Client lock verified data path', () => {
await page.waitToClick(selectors.clientFiscalData.saveButton); await page.waitToClick(selectors.clientFiscalData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should again confirm the social name have been edited', async() => { it('should again confirm the social name have been edited', async() => {
@ -109,7 +111,7 @@ describe('Client lock verified data path', () => {
await page.waitToClick(selectors.clientFiscalData.saveButton); await page.waitToClick(selectors.clientFiscalData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe(`You can't make changes on a client with verified data`); expect(message.text).toContain(`You can't make changes on a client with verified data`);
}); });
}); });
@ -133,7 +135,7 @@ describe('Client lock verified data path', () => {
await page.waitToClick(selectors.clientFiscalData.saveButton); await page.waitToClick(selectors.clientFiscalData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should now confirm the social name have been edited once and for all', async() => { it('should now confirm the social name have been edited once and for all', async() => {

View File

@ -22,7 +22,7 @@ describe('Client log path', () => {
await page.waitToClick(selectors.clientBasicData.saveButton); await page.waitToClick(selectors.clientBasicData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should navigate to the log section', async() => { it('should navigate to the log section', async() => {

View File

@ -20,7 +20,7 @@ describe('Client balance path', () => {
await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs'); await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should access to the balance section to check the data shown matches the local settings', async() => { it('should access to the balance section to check the data shown matches the local settings', async() => {
@ -35,7 +35,7 @@ describe('Client balance path', () => {
await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete); await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should click the new payment button', async() => { it('should click the new payment button', async() => {
@ -51,7 +51,7 @@ describe('Client balance path', () => {
await page.waitToClick(selectors.clientBalance.saveButton); await page.waitToClick(selectors.clientBalance.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should edit the 1st line reference', async() => { it('should edit the 1st line reference', async() => {
@ -60,7 +60,7 @@ describe('Client balance path', () => {
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should check balance is now 0, the reference was saved and the company is now VNL becouse the user local settings were removed', async() => { it('should check balance is now 0, the reference was saved and the company is now VNL becouse the user local settings were removed', async() => {
@ -85,7 +85,7 @@ describe('Client balance path', () => {
await page.waitToClick(selectors.clientBalance.saveButton); await page.waitToClick(selectors.clientBalance.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should check balance is now -100', async() => { it('should check balance is now -100', async() => {
@ -101,7 +101,7 @@ describe('Client balance path', () => {
await page.waitToClick(selectors.clientBalance.saveButton); await page.waitToClick(selectors.clientBalance.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should check balance is now 50', async() => { it('should check balance is now 50', async() => {

View File

@ -22,7 +22,7 @@ describe('Client DMS', () => {
await page.respondToDialog('accept'); await page.respondToDialog('accept');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
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() => {

View File

@ -24,7 +24,7 @@ describe('Client contacts', () => {
await page.waitToClick(selectors.clientContacts.saveButton); await page.waitToClick(selectors.clientContacts.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should delete de contact', async() => { it('should delete de contact', async() => {
@ -33,6 +33,6 @@ describe('Client contacts', () => {
await page.waitToClick(selectors.clientContacts.saveButton); await page.waitToClick(selectors.clientContacts.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
}); });

View File

@ -26,7 +26,7 @@ describe('Worker basic data path', () => {
await page.waitToClick(selectors.workerBasicData.saveButton); await page.waitToClick(selectors.workerBasicData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should reload the section then check the name was edited', async() => { it('should reload the section then check the name was edited', async() => {

View File

@ -21,7 +21,7 @@ describe('Worker pbx path', () => {
await page.waitToClick(selectors.workerPbx.saveButton); await page.waitToClick(selectors.workerPbx.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Extension format is invalid'); expect(message.text).toContain('Extension format is invalid');
}); });
it('should sucessfully save the changes', async() => { it('should sucessfully save the changes', async() => {
@ -30,6 +30,6 @@ describe('Worker pbx path', () => {
await page.waitToClick(selectors.workerPbx.saveButton); await page.waitToClick(selectors.workerPbx.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved! User must access web'); expect(message.text).toContain('Data saved! User must access web');
}); });
}); });

View File

@ -59,7 +59,7 @@ describe('Worker time control path', () => {
await page.respondToDialog('accept'); await page.respondToDialog('accept');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Entry removed'); expect(message.text).toContain('Entry removed');
}); });
it(`should scan out Hank Pym to leave early`, async() => { it(`should scan out Hank Pym to leave early`, async() => {

View File

@ -38,7 +38,7 @@ describe('Item Edit basic data path', () => {
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should create a new intrastat`, async() => { it(`should create a new intrastat`, async() => {
@ -57,7 +57,7 @@ describe('Item Edit basic data path', () => {
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the item name was edited`, async() => { it(`should confirm the item name was edited`, async() => {

View File

@ -23,7 +23,7 @@ describe('Item edit tax path', () => {
await page.waitToClick(selectors.itemTax.submitTaxButton); await page.waitToClick(selectors.itemTax.submitTaxButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the first item tax class was edited`, async() => { it(`should confirm the first item tax class was edited`, async() => {

View File

@ -26,7 +26,7 @@ describe('Item create tags path', () => {
await page.waitToClick(selectors.itemTags.submitItemTagsButton); await page.waitToClick(selectors.itemTags.submitItemTagsButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the fourth row data is the expected one`, async() => { it(`should confirm the fourth row data is the expected one`, async() => {

View File

@ -25,7 +25,7 @@ describe('Item create niche path', () => {
await page.waitToClick(selectors.itemNiches.submitNichesButton); await page.waitToClick(selectors.itemNiches.submitNichesButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the first niche is the expected one`, async() => { it(`should confirm the first niche is the expected one`, async() => {

View File

@ -23,7 +23,7 @@ describe('Item Create botanical path', () => {
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton); await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the botanical for the item was created`, async() => { it(`should confirm the botanical for the item was created`, async() => {
@ -58,7 +58,7 @@ describe('Item Create botanical path', () => {
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton); await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the botanical for the item was edited`, async() => { it(`should confirm the botanical for the item was edited`, async() => {

View File

@ -23,7 +23,7 @@ describe('Item Create barcodes path', () => {
await page.waitToClick(selectors.itemBarcodes.submitBarcodesButton); await page.waitToClick(selectors.itemBarcodes.submitBarcodesButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, async() => { it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, async() => {

View File

@ -45,7 +45,7 @@ describe('Item Create/Clone path', () => {
await page.waitToClick(selectors.itemCreateView.createButton); await page.waitToClick(selectors.itemCreateView.createButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm Infinity Gauntlet item was created', async() => { it('should confirm Infinity Gauntlet item was created', async() => {

View File

@ -20,7 +20,7 @@ describe('Item regularize path', () => {
await page.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four'); await page.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should check the local settings were saved', async() => { it('should check the local settings were saved', async() => {
@ -51,7 +51,7 @@ describe('Item regularize path', () => {
await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton); await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should click on the Tickets button of the top bar menu', async() => { it('should click on the Tickets button of the top bar menu', async() => {
@ -70,7 +70,7 @@ describe('Item regularize path', () => {
await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete); await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should search for the ticket with alias missing', async() => { it('should search for the ticket with alias missing', async() => {
@ -114,7 +114,7 @@ describe('Item regularize path', () => {
await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton); await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should again click on the Tickets button of the top bar menu', async() => { it('should again click on the Tickets button of the top bar menu', async() => {

View File

@ -36,7 +36,7 @@ describe('Item index path', () => {
await page.waitToClick(selectors.itemsIndex.saveFieldsButton); await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should navigate forth and back to see the images column is still visible', async() => { it('should navigate forth and back to see the images column is still visible', async() => {
@ -70,7 +70,7 @@ describe('Item index path', () => {
await page.waitToClick(selectors.itemsIndex.saveFieldsButton); await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should now navigate forth and back to see the ids column is now visible', async() => { it('should now navigate forth and back to see the ids column is now visible', async() => {

View File

@ -34,7 +34,7 @@ describe('Item log path', () => {
await page.waitToClick(selectors.itemCreateView.createButton); await page.waitToClick(selectors.itemCreateView.createButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should return to the items index by clicking the return to items button', async() => { it('should return to the items index by clicking the return to items button', async() => {

View File

@ -29,7 +29,7 @@ describe('Item descriptor path', () => {
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should reload the section and check the inactive icon is bright', async() => { it('should reload the section and check the inactive icon is bright', async() => {
@ -45,6 +45,6 @@ describe('Item descriptor path', () => {
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
}); });

View File

@ -55,29 +55,13 @@ describe('Ticket List sale path', () => {
it('should select a valid item to be added as the second item in the sales list', async() => { it('should select a valid item to be added as the second item in the sales list', async() => {
let searchValue = 'Melee weapon heavy shield 1x0.5m'; let searchValue = 'Melee weapon heavy shield 1x0.5m';
await page.waitToClick(`${selectors.ticketSales.secondSaleIdAutocomplete} input`); await page.autocompleteSearch(selectors.ticketSales.secondSaleIdAutocomplete, searchValue);
await page.waitForSelector(selector => {
document
.querySelector(`${selector} vn-drop-down`).$ctrl.content
.querySelectorAll('li');
}, selectors.ticketSales.secondSaleIdAutocomplete);
await page.write(`.vn-drop-down.shown`, searchValue);
await page.waitForFunction((selector, searchValue) => {
let element = document
.querySelector(`${selector} vn-drop-down`).$ctrl.content
.querySelector('li.active');
if (element)
return element.innerText.includes(searchValue);
}, {}, selectors.ticketSales.secondSaleIdAutocomplete, searchValue);
await page.keyboard.press('Enter');
await page.waitToClick(selectors.ticketSales.secondSaleQuantityCell); await page.waitToClick(selectors.ticketSales.secondSaleQuantityCell);
await page.type(selectors.ticketSales.secondSaleQuantity, '1'); await page.type(selectors.ticketSales.secondSaleQuantity, '1');
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should update the description of the new sale', async() => { it('should update the description of the new sale', async() => {
@ -86,25 +70,25 @@ describe('Ticket List sale path', () => {
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should add a third empty item to the sale list', async() => { it('should add a third empty item to the sale list', async() => {
await page.waitToClick(selectors.ticketSales.newItemButton); await page.waitToClick(selectors.ticketSales.newItemButton);
await page.waitForNumberOfElements(selectors.ticketSales.saleLine, 3);
const sales = await page.countElement(selectors.ticketSales.saleLine); const sales = await page.countElement(selectors.ticketSales.saleLine);
expect(sales).toEqual(3); expect(sales).toEqual(3);
}); });
it('should select the 2nd and 3th item and delete both', async() => { it('should select the 2nd and 3th item and delete both', async() => {
await page.waitFor(2000);
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox); await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox); await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
await page.waitToClick(selectors.ticketSales.deleteSaleButton); await page.waitToClick(selectors.ticketSales.deleteSaleButton);
await page.waitToClick(selectors.globalItems.acceptButton); await page.waitToClick(selectors.globalItems.acceptButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should verify there's only 1 single line remaining`, async() => { it(`should verify there's only 1 single line remaining`, async() => {

View File

@ -41,7 +41,7 @@ describe('Ticket Edit sale path', () => {
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should check it's state is libre now`, async() => { it(`should check it's state is libre now`, async() => {
@ -55,7 +55,7 @@ describe('Ticket Edit sale path', () => {
await page.waitToClick(selectors.ticketSales.setOk); await page.waitToClick(selectors.ticketSales.setOk);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should check it's state is OK now`, async() => { it(`should check it's state is OK now`, async() => {
@ -125,7 +125,7 @@ describe('Ticket Edit sale path', () => {
await page.type(selectors.ticketSales.firstSaleQuantity, '11\u000d'); await page.type(selectors.ticketSales.firstSaleQuantity, '11\u000d');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('The new quantity should be smaller than the old one'); expect(message.text).toContain('The new quantity should be smaller than the old one');
}); });
it('should remove 1 from the first sale quantity', async() => { it('should remove 1 from the first sale quantity', async() => {
@ -135,7 +135,7 @@ describe('Ticket Edit sale path', () => {
await page.type(selectors.ticketSales.firstSaleQuantity, '9\u000d'); await page.type(selectors.ticketSales.firstSaleQuantity, '9\u000d');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should update the price', async() => { it('should update the price', async() => {
@ -144,7 +144,7 @@ describe('Ticket Edit sale path', () => {
await page.type(selectors.ticketSales.firstSalePriceInput, '5\u000d'); await page.type(selectors.ticketSales.firstSalePriceInput, '5\u000d');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the price have been updated', async() => { it('should confirm the price have been updated', async() => {
@ -165,7 +165,7 @@ describe('Ticket Edit sale path', () => {
await page.type(selectors.ticketSales.firstSaleDiscountInput, '50\u000d'); await page.type(selectors.ticketSales.firstSaleDiscountInput, '50\u000d');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the discount have been updated', async() => { it('should confirm the discount have been updated', async() => {
@ -224,7 +224,7 @@ describe('Ticket Edit sale path', () => {
await page.waitForSpinnerLoad(); await page.waitForSpinnerLoad();
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the third sale was deleted`, async() => { it(`should confirm the third sale was deleted`, async() => {
@ -307,7 +307,7 @@ describe('Ticket Edit sale path', () => {
await page.waitToClick(selectors.ticketSales.moveToNewTicketButton); await page.waitToClick(selectors.ticketSales.moveToNewTicketButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe(`You can't create a ticket for a inactive client`); expect(message.text).toContain(`You can't create a ticket for a inactive client`);
await page.closePopup(); await page.closePopup();
}); });

View File

@ -24,7 +24,7 @@ describe('Ticket Create notes path', () => {
await page.waitToClick(selectors.ticketNotes.submitNotesButton); await page.waitToClick(selectors.ticketNotes.submitNotesButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the note is the expected one', async() => { it('should confirm the note is the expected one', async() => {
@ -45,6 +45,6 @@ describe('Ticket Create notes path', () => {
await page.waitToClick(selectors.ticketNotes.submitNotesButton); await page.waitToClick(selectors.ticketNotes.submitNotesButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
}); });

View File

@ -24,7 +24,7 @@ describe('Ticket Create packages path', () => {
await page.waitToClick(selectors.ticketPackages.savePackagesButton); await page.waitToClick(selectors.ticketPackages.savePackagesButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Package cannot be blank'); expect(message.text).toContain('Package cannot be blank');
}); });
it(`should delete the first package and receive and error to save a new one with blank quantity`, async() => { it(`should delete the first package and receive and error to save a new one with blank quantity`, async() => {
@ -33,7 +33,7 @@ describe('Ticket Create packages path', () => {
await page.waitToClick(selectors.ticketPackages.savePackagesButton); await page.waitToClick(selectors.ticketPackages.savePackagesButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Some fields are invalid'); expect(message.text).toContain('Some fields are invalid');
}); });
it(`should confirm the quantity input isn't invalid yet`, async() => { it(`should confirm the quantity input isn't invalid yet`, async() => {
@ -51,7 +51,7 @@ describe('Ticket Create packages path', () => {
await page.waitToClick(selectors.ticketPackages.savePackagesButton); await page.waitToClick(selectors.ticketPackages.savePackagesButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the first select is the expected one`, async() => { it(`should confirm the first select is the expected one`, async() => {

View File

@ -28,7 +28,7 @@ describe('Ticket Create new tracking state path', () => {
await page.waitToClick(selectors.createStateView.saveStateButton); await page.waitToClick(selectors.createStateView.saveStateButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('State cannot be blank'); expect(message.text).toContain('State cannot be blank');
}); });
it(`should create a new state`, async() => { it(`should create a new state`, async() => {
@ -36,7 +36,7 @@ describe('Ticket Create new tracking state path', () => {
await page.waitToClick(selectors.createStateView.saveStateButton); await page.waitToClick(selectors.createStateView.saveStateButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
}); });
@ -48,7 +48,7 @@ describe('Ticket Create new tracking state path', () => {
}); });
it('should now access to the create state view by clicking the create floating button', async() => { it('should now access to the create state view by clicking the create floating button', async() => {
await page.waitFor('.vn-popup', {hidden: true}), await page.waitFor('.vn-popup', {hidden: true});
await page.waitToClick(selectors.ticketTracking.createStateButton); await page.waitToClick(selectors.ticketTracking.createStateButton);
await page.waitForState('ticket.card.tracking.edit'); await page.waitForState('ticket.card.tracking.edit');
}); });
@ -59,7 +59,7 @@ describe('Ticket Create new tracking state path', () => {
await page.waitToClick(selectors.createStateView.saveStateButton); await page.waitToClick(selectors.createStateView.saveStateButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe(`You don't have enough privileges`); expect(message.text).toContain(`You don't have enough privileges`);
}); });
it(`should make sure the worker gets autocomplete uppon selecting the assigned state`, async() => { it(`should make sure the worker gets autocomplete uppon selecting the assigned state`, async() => {
@ -74,7 +74,7 @@ describe('Ticket Create new tracking state path', () => {
await page.waitToClick(selectors.createStateView.saveStateButton); await page.waitToClick(selectors.createStateView.saveStateButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
}); });
}); });

View File

@ -33,7 +33,7 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.thursdayButton); await page.waitToClick(selectors.ticketDescriptor.thursdayButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should again click on the Tickets button of the top bar menu', async() => { it('should again click on the Tickets button of the top bar menu', async() => {
@ -68,7 +68,7 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.saturdayButton); await page.waitToClick(selectors.ticketDescriptor.saturdayButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should click on the Tickets button of the top bar menu once again', async() => { it('should click on the Tickets button of the top bar menu once again', async() => {
@ -97,7 +97,7 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketsIndex.acceptDeleteTurn); await page.waitToClick(selectors.ticketsIndex.acceptDeleteTurn);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the sixth weekly ticket was deleted', async() => { it('should confirm the sixth weekly ticket was deleted', async() => {
@ -111,11 +111,11 @@ describe('Ticket descriptor path', () => {
await page.autocompleteSearch(selectors.ticketsIndex.firstWeeklyTicketAgency, 'Silla247'); await page.autocompleteSearch(selectors.ticketsIndex.firstWeeklyTicketAgency, 'Silla247');
let message = await page.waitForSnackbar(); let message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
await page.clearInput(selectors.ticketsIndex.firstWeeklyTicketAgency); await page.clearInput(selectors.ticketsIndex.firstWeeklyTicketAgency);
message = await page.waitForSnackbar(); message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
}); });

View File

@ -27,7 +27,7 @@ describe('Ticket purchase request path', () => {
await page.waitToClick(selectors.ticketRequests.saveButton); await page.waitToClick(selectors.ticketRequests.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should have been redirected to the request index', async() => { it('should have been redirected to the request index', async() => {
@ -39,7 +39,7 @@ describe('Ticket purchase request path', () => {
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should check the new request was added', async() => { it('should check the new request was added', async() => {
@ -67,7 +67,7 @@ describe('Ticket purchase request path', () => {
await page.waitToClick(selectors.ticketRequests.thirdRemoveRequestButton); await page.waitToClick(selectors.ticketRequests.thirdRemoveRequestButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should check the request was deleted', async() => { it('should check the request was deleted', async() => {

View File

@ -28,10 +28,11 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.acceptChangeHourButton); await page.waitToClick(selectors.ticketDescriptor.acceptChangeHourButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Shipped hour updated'); expect(message.text).toContain('Shipped hour updated');
}); });
it(`should confirm the ticket descriptor shows the correct shipping hour`, async() => { it(`should confirm the ticket descriptor shows the correct shipping hour`, async() => {
await page.waitForState('ticket.card.summary');
const result = await page const result = await page
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryDate, 'innerText'); .waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryDate, 'innerText');
@ -44,7 +45,7 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.acceptDialog); await page.waitToClick(selectors.ticketDescriptor.acceptDialog);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Ticket deleted. You can undo this action within the first hour'); expect(message.text).toContain('Ticket deleted. You can undo this action within the first hour');
}); });
it('should have been relocated to the ticket index', async() => { it('should have been relocated to the ticket index', async() => {
@ -67,9 +68,10 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuRestoreTicket); await page.waitToClick(selectors.ticketDescriptor.moreMenuRestoreTicket);
await page.waitToClick(selectors.ticketDescriptor.acceptDialog); await page.waitToClick(selectors.ticketDescriptor.acceptDialog);
await page.waitForState('ticket.card.summary');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should make sure the ticketDeleted icon is no longer bright', async() => { it('should make sure the ticketDeleted icon is no longer bright', async() => {
@ -77,7 +79,7 @@ describe('Ticket descriptor path', () => {
}); });
}); });
describe('add stowaway', () => { describe('Add stowaway', () => {
it('should search for a ticket', async() => { it('should search for a ticket', async() => {
await page.accessToSearchResult('16'); await page.accessToSearchResult('16');
await page.waitForState('ticket.card.summary'); await page.waitForState('ticket.card.summary');
@ -85,7 +87,7 @@ describe('Ticket descriptor path', () => {
it('should open the add stowaway dialog', async() => { it('should open the add stowaway dialog', async() => {
await page.waitForFunction(() => { await page.waitForFunction(() => {
let element = document.querySelector('vn-ticket-descriptor'); let element = document.querySelector('vn-ticket-descriptor-menu');
return element.$ctrl.canShowStowaway === true; return element.$ctrl.canShowStowaway === true;
}); });
await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenu);
@ -100,11 +102,11 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket); await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
xit(`should check the state of the stowaway ticket is embarked`, async() => { it(`should check the state of the stowaway ticket is embarked`, async() => {
await page.wait(500); await page.waitForState('ticket.card.summary');
const state = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText'); const state = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
expect(state).toEqual('State Embarcando'); expect(state).toEqual('State Embarcando');
@ -122,7 +124,7 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton); await page.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the ship buton doesn't exisist any more`, async() => { it(`should confirm the ship buton doesn't exisist any more`, async() => {
@ -153,7 +155,7 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.acceptInvoiceOutButton); await page.waitToClick(selectors.ticketDescriptor.acceptInvoiceOutButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Ticket invoiced'); expect(message.text).toContain('Ticket invoiced');
}); });
it(`should make sure the ticket summary have an invoiceOutFk`, async() => { it(`should make sure the ticket summary have an invoiceOutFk`, async() => {

View File

@ -34,7 +34,7 @@ describe('Ticket services path', () => {
await page.waitToClick(selectors.ticketService.saveServiceButton); await page.waitToClick(selectors.ticketService.saveServiceButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe(`The current ticket can't be modified`); expect(message.text).toContain(`The current ticket can't be modified`);
}); });
}); });
@ -58,7 +58,7 @@ describe('Ticket services path', () => {
await page.waitToClick(selectors.ticketService.saveServiceButton); await page.waitToClick(selectors.ticketService.saveServiceButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe(`can't be blank`); expect(message.text).toContain(`can't be blank`);
}); });
it('should click on the add new service type to open the dialog', async() => { it('should click on the add new service type to open the dialog', async() => {
@ -73,7 +73,7 @@ describe('Ticket services path', () => {
await page.waitToClick(selectors.ticketService.saveServiceTypeButton); await page.waitToClick(selectors.ticketService.saveServiceTypeButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe(`Name can't be empty`); expect(message.text).toContain(`Name can't be empty`);
}); });
it('should create a new service type then add price then create the service', async() => { it('should create a new service type then add price then create the service', async() => {
@ -83,7 +83,7 @@ describe('Ticket services path', () => {
await page.waitToClick(selectors.ticketService.saveServiceButton); await page.waitToClick(selectors.ticketService.saveServiceButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the service description was created correctly', async() => { it('should confirm the service description was created correctly', async() => {
@ -114,7 +114,7 @@ describe('Ticket services path', () => {
await page.waitToClick(selectors.ticketService.saveServiceButton); await page.waitToClick(selectors.ticketService.saveServiceButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the service was removed`, async() => { it(`should confirm the service was removed`, async() => {

View File

@ -31,7 +31,7 @@ describe('Ticket create path', () => {
await page.waitToClick(selectors.createTicketView.createButton); await page.waitToClick(selectors.createTicketView.createButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should check the url is now the summary of the ticket', async() => { it('should check the url is now the summary of the ticket', async() => {
@ -55,7 +55,7 @@ describe('Ticket create path', () => {
await page.waitToClick(selectors.createTicketView.createButton); await page.waitToClick(selectors.createTicketView.createButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should check the url is now the summary of the created ticket', async() => { it('should check the url is now the summary of the created ticket', async() => {
@ -68,7 +68,7 @@ describe('Ticket create path', () => {
await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket); await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should delete the current ticket', async() => { it('should delete the current ticket', async() => {
@ -77,7 +77,7 @@ describe('Ticket create path', () => {
await page.waitToClick(selectors.ticketDescriptor.acceptDialog); await page.waitToClick(selectors.ticketDescriptor.acceptDialog);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Ticket deleted. You can undo this action within the first hour'); expect(message.text).toContain('Ticket deleted. You can undo this action within the first hour');
}); });
it('should search for the stowaway ticket of the previously deleted ticket', async() => { it('should search for the stowaway ticket of the previously deleted ticket', async() => {

View File

@ -80,7 +80,7 @@ describe('Ticket Summary path', () => {
await page.waitToClick(selectors.ticketSummary.setOk); await page.waitToClick(selectors.ticketSummary.setOk);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the ticket state was updated', async() => { it('should confirm the ticket state was updated', async() => {

View File

@ -29,7 +29,7 @@ describe('Ticket log path', () => {
await page.waitToClick(selectors.ticketNotes.submitNotesButton); await page.waitToClick(selectors.ticketNotes.submitNotesButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should navigate to the log section', async() => { it('should navigate to the log section', async() => {

View File

@ -26,7 +26,7 @@ describe('Ticket index payout path', () => {
await page.waitToClick(selectors.ticketsIndex.payoutButton); await page.waitToClick(selectors.ticketsIndex.payoutButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('You cannot make a payment on account from multiple clients'); expect(message.text).toContain('You cannot make a payment on account from multiple clients');
}); });
it('should uncheck the sixth ticket result and check the third which is from the same client then open the payout form', async() => { it('should uncheck the sixth ticket result and check the third which is from the same client then open the payout form', async() => {
@ -42,7 +42,7 @@ describe('Ticket index payout path', () => {
await page.waitToClick(selectors.ticketsIndex.submitPayout); await page.waitToClick(selectors.ticketsIndex.submitPayout);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should navigate to the client balance section and check a new balance line was entered', async() => { it('should navigate to the client balance section and check a new balance line was entered', async() => {

View File

@ -27,7 +27,7 @@ describe('Claim edit basic data path', () => {
await page.waitToClick(selectors.claimBasicData.saveButton); await page.waitToClick(selectors.claimBasicData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should have been redirected to the next section of claims as the role is claimManager`, async() => { it(`should have been redirected to the next section of claims as the role is claimManager`, async() => {
@ -40,7 +40,7 @@ describe('Claim edit basic data path', () => {
await page.waitToClick(selectors.claimBasicData.saveButton); await page.waitToClick(selectors.claimBasicData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the claim state was edited', async() => { it('should confirm the claim state was edited', async() => {
@ -71,6 +71,6 @@ describe('Claim edit basic data path', () => {
await page.waitToClick(selectors.claimBasicData.saveButton); await page.waitToClick(selectors.claimBasicData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
}); });

View File

@ -28,7 +28,7 @@ describe('Claim development', () => {
await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton); await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should redirect to the next section of claims as the role is claimManager`, async() => { it(`should redirect to the next section of claims as the role is claimManager`, async() => {
@ -45,7 +45,7 @@ describe('Claim development', () => {
await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton); await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the first development is the expected one', async() => { it('should confirm the first development is the expected one', async() => {

View File

@ -23,7 +23,7 @@ xdescribe('Claim detail', () => {
await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket); await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the claim contains now two items', async() => { it('should confirm the claim contains now two items', async() => {
@ -38,7 +38,7 @@ xdescribe('Claim detail', () => {
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the first item quantity, and the claimed total were correctly edited', async() => { it('should confirm the first item quantity, and the claimed total were correctly edited', async() => {
@ -67,7 +67,7 @@ xdescribe('Claim detail', () => {
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should check the mana is the expected one', async() => { it('should check the mana is the expected one', async() => {
@ -81,7 +81,7 @@ xdescribe('Claim detail', () => {
await page.waitToClick(selectors.claimDetail.secondItemDeleteButton); await page.waitToClick(selectors.claimDetail.secondItemDeleteButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the claim contains now one item', async() => { it('should confirm the claim contains now one item', async() => {
@ -95,7 +95,7 @@ xdescribe('Claim detail', () => {
await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket); await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should have been redirected to the next section in claims`, async() => { it(`should have been redirected to the next section in claims`, async() => {

View File

@ -21,7 +21,7 @@ describe('Claim action path', () => {
await page.waitToClick(selectors.claimAction.importClaimButton); await page.waitToClick(selectors.claimAction.importClaimButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should import the second importable ticket', async() => { it('should import the second importable ticket', async() => {
@ -33,7 +33,7 @@ describe('Claim action path', () => {
await page.waitToClick(selectors.claimAction.secondImportableTicket); await page.waitToClick(selectors.claimAction.secondImportableTicket);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should edit the second line destination field', async() => { it('should edit the second line destination field', async() => {
@ -41,14 +41,14 @@ describe('Claim action path', () => {
await page.autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno'); await page.autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should delete the first line', async() => { it('should delete the first line', async() => {
await page.waitToClick(selectors.claimAction.firstDeleteLine); await page.waitToClick(selectors.claimAction.firstDeleteLine);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should refresh the view to check the remaining line is the expected one', async() => { it('should refresh the view to check the remaining line is the expected one', async() => {
@ -62,14 +62,14 @@ describe('Claim action path', () => {
await page.waitToClick(selectors.claimAction.firstDeleteLine); await page.waitToClick(selectors.claimAction.firstDeleteLine);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should check the "is paid with mana" checkbox', async() => { it('should check the "is paid with mana" checkbox', async() => {
await page.waitToClick(selectors.claimAction.isPaidWithManaCheckbox); await page.waitToClick(selectors.claimAction.isPaidWithManaCheckbox);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the "is paid with mana" is checked', async() => { it('should confirm the "is paid with mana" is checked', async() => {

View File

@ -42,7 +42,7 @@ describe('claim Descriptor path', () => {
await page.waitToClick(selectors.claimDescriptor.acceptDeleteClaim); await page.waitToClick(selectors.claimDescriptor.acceptDeleteClaim);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Claim deleted!'); expect(message.text).toContain('Claim deleted!');
}); });
it(`should have been relocated to the claim index`, async() => { it(`should have been relocated to the claim index`, async() => {

View File

@ -25,7 +25,7 @@ describe('Order edit basic data path', () => {
await page.waitToClick(selectors.orderBasicData.saveButton); await page.waitToClick(selectors.orderBasicData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe(`You can't make changes on the basic data of an confirmed order or with rows`); expect(message.text).toContain(`You can't make changes on the basic data of an confirmed order or with rows`);
}); });
}); });
@ -47,7 +47,7 @@ describe('Order edit basic data path', () => {
await page.waitToClick(selectors.orderBasicData.saveButton); await page.waitToClick(selectors.orderBasicData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe(`You can't make changes on the basic data of an confirmed order or with rows`); expect(message.text).toContain(`You can't make changes on the basic data of an confirmed order or with rows`);
}); });
}); });
@ -81,7 +81,7 @@ describe('Order edit basic data path', () => {
await page.waitToClick(selectors.orderBasicData.saveButton); await page.waitToClick(selectors.orderBasicData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should now confirm the client have been edited', async() => { it('should now confirm the client have been edited', async() => {

View File

@ -28,7 +28,7 @@ describe('Order lines', () => {
await page.waitToClick(selectors.orderLine.confirmButton); await page.waitToClick(selectors.orderLine.confirmButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the order subtotal has changed', async() => { it('should confirm the order subtotal has changed', async() => {

View File

@ -33,7 +33,7 @@ describe('Route basic Data path', () => {
await page.waitToClick(selectors.routeBasicData.saveButton); await page.waitToClick(selectors.routeBasicData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the worker was edited', async() => { it('should confirm the worker was edited', async() => {

View File

@ -27,7 +27,7 @@ describe('Route create path', () => {
await page.waitToClick(selectors.createRouteView.submitButton); await page.waitToClick(selectors.createRouteView.submitButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Access denied'); expect(message.text).toContain('Access denied');
}); });
}); });
@ -51,7 +51,7 @@ describe('Route create path', () => {
await page.waitToClick(selectors.createRouteView.submitButton); await page.waitToClick(selectors.createRouteView.submitButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the redirection to the created route summary`, async() => { it(`should confirm the redirection to the created route summary`, async() => {

View File

@ -23,7 +23,7 @@ xdescribe('Route basic Data path', () => {
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the buscamanButton is disabled', async() => { it('should confirm the buscamanButton is disabled', async() => {
@ -60,7 +60,7 @@ xdescribe('Route basic Data path', () => {
await page.waitToClick(selectors.routeTickets.confirmButton); await page.waitToClick(selectors.routeTickets.confirmButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Ticket removed from route'); expect(message.text).toContain('Ticket removed from route');
}); });
it('should again delete the first ticket in route', async() => { it('should again delete the first ticket in route', async() => {
@ -68,7 +68,7 @@ xdescribe('Route basic Data path', () => {
await page.waitToClick(selectors.routeTickets.confirmButton); await page.waitToClick(selectors.routeTickets.confirmButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Ticket removed from route'); expect(message.text).toContain('Ticket removed from route');
}); });
it('should now count how many tickets are in route to find one less', async() => { it('should now count how many tickets are in route to find one less', async() => {

View File

@ -43,7 +43,7 @@ describe('InvoiceOut descriptor path', () => {
await page.waitToClick(selectors.invoiceOutDescriptor.acceptDeleteButton); await page.waitToClick(selectors.invoiceOutDescriptor.acceptDeleteButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('InvoiceOut deleted'); expect(message.text).toContain('InvoiceOut deleted');
}); });
it('should have been relocated to the invoiceOut index', async() => { it('should have been relocated to the invoiceOut index', async() => {
@ -96,7 +96,7 @@ describe('InvoiceOut descriptor path', () => {
await page.waitToClick(selectors.invoiceOutDescriptor.acceptBookingButton); await page.waitToClick(selectors.invoiceOutDescriptor.acceptBookingButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('InvoiceOut booked'); expect(message.text).toContain('InvoiceOut booked');
}); });
it(`should check the invoiceOut booked in the summary data`, async() => { it(`should check the invoiceOut booked in the summary data`, async() => {

View File

@ -51,7 +51,7 @@ describe('Travel thermograph path', () => {
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
const state = await page.getState(); const state = await page.getState();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
expect(state).toBe('travel.card.thermograph.index'); expect(state).toBe('travel.card.thermograph.index');
}); });

View File

@ -29,7 +29,7 @@ describe('Travel basic data path', () => {
await page.waitToClick(selectors.travelBasicDada.save); await page.waitToClick(selectors.travelBasicDada.save);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Landing cannot be lesser than shipment'); expect(message.text).toContain('Landing cannot be lesser than shipment');
}); });
it('should undo the changes', async() => { it('should undo the changes', async() => {
@ -37,7 +37,7 @@ describe('Travel basic data path', () => {
await page.waitToClick(selectors.travelBasicDada.save); await page.waitToClick(selectors.travelBasicDada.save);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('No changes to save'); expect(message.text).toContain('No changes to save');
}); });
it('should now edit the whole form then save', async() => { it('should now edit the whole form then save', async() => {
@ -52,7 +52,7 @@ describe('Travel basic data path', () => {
await page.waitToClick(selectors.travelBasicDada.save); await page.waitToClick(selectors.travelBasicDada.save);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should reload the section and check the reference was saved', async() => { it('should reload the section and check the reference was saved', async() => {

View File

@ -40,7 +40,7 @@ describe('Zone basic data path', () => {
await page.waitToClick(selectors.zoneBasicData.saveButton); await page.waitToClick(selectors.zoneBasicData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should now reload the section', async() => { it('should now reload the section', async() => {

View File

@ -35,7 +35,7 @@ describe('Entry basic data path', () => {
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the reference was edited', async() => { it('should confirm the reference was edited', async() => {

View File

@ -79,6 +79,6 @@ describe('Supplier summary & descriptor path', () => {
}); });
it(`should check the client button isn't present since this supplier should not be a client`, async() => { it(`should check the client button isn't present since this supplier should not be a client`, async() => {
await page.waitForSelector(selectors.supplierDescriptor.clientButton, {hidden: true}); await page.waitForSelector(selectors.supplierDescriptor.clientButton, {visible: false});
}); });
}); });

View File

@ -0,0 +1,70 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Supplier basic data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('administrative', 'supplier');
await page.accessToSearchResult('1');
await page.accessToSection('supplier.card.basicData');
});
afterAll(async() => {
await browser.close();
});
it('should edit the basic data', async() => {
await page.clearInput(selectors.supplierBasicData.alias);
await page.write(selectors.supplierBasicData.alias, 'Plants Nick SL');
await page.waitToClick(selectors.supplierBasicData.isOfficial);
await page.waitToClick(selectors.supplierBasicData.isActive);
await page.write(selectors.supplierBasicData.notes, 'Some notes');
await page.waitToClick(selectors.supplierBasicData.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should reload the section', async() => {
await page.reloadSection('supplier.card.basicData');
});
it('should check the alias was edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierBasicData.alias, 'value');
expect(result).toEqual('Plants Nick SL');
});
it('should check the isOffical checkbox is now unchecked', async() => {
const result = await page.checkboxState(selectors.supplierBasicData.isOfficial);
expect(result).toBe('unchecked');
});
it('should check the isActive checkbox is now unchecked', async() => {
const result = await page.checkboxState(selectors.supplierBasicData.isActive);
expect(result).toBe('unchecked');
});
it('should check the notes were edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierBasicData.notes, 'value');
expect(result).toEqual('Some notes');
});
it('should navigate to the log section', async() => {
await page.accessToSection('supplier.card.log');
});
it('should check the changes have been recorded', async() => {
const result = await page.waitToGetProperty('#newInstance:nth-child(3)', 'innerText');
expect(result).toEqual('note: Some notes');
});
});

View File

@ -0,0 +1,108 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Supplier fiscal data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('administrative', 'supplier');
await page.accessToSearchResult('2');
await page.accessToSection('supplier.card.fiscalData');
});
afterAll(async() => {
await browser.close();
});
it('should attempt to edit the fiscal data but fail as the tax number is invalid', async() => {
await page.clearInput(selectors.supplierFiscalData.city);
await page.clearInput(selectors.supplierFiscalData.province);
await page.clearInput(selectors.supplierFiscalData.country);
await page.clearInput(selectors.supplierFiscalData.postCode);
await page.write(selectors.supplierFiscalData.city, 'Valencia');
await page.clearInput(selectors.supplierFiscalData.socialName);
await page.write(selectors.supplierFiscalData.socialName, 'Farmer King SL');
await page.clearInput(selectors.supplierFiscalData.taxNumber);
await page.write(selectors.supplierFiscalData.taxNumber, 'invalid tax number');
await page.clearInput(selectors.supplierFiscalData.account);
await page.write(selectors.supplierFiscalData.account, 'edited account number');
await page.autocompleteSearch(selectors.supplierFiscalData.sageWihholding, 'retencion estimacion objetiva');
await page.autocompleteSearch(selectors.supplierFiscalData.sageTaxType, 'operaciones no sujetas');
await page.waitToClick(selectors.supplierFiscalData.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Invalid Tax number');
});
it('should save the changes as the tax number is valid this time', async() => {
await page.clearInput(selectors.supplierFiscalData.taxNumber);
await page.write(selectors.supplierFiscalData.taxNumber, '12345678Z');
await page.waitToClick(selectors.supplierFiscalData.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should reload the section', async() => {
await page.reloadSection('supplier.card.fiscalData');
});
it('should check the socialName was edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierFiscalData.socialName, 'value');
expect(result).toEqual('Farmer King SL');
});
it('should check the taxNumber was edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierFiscalData.taxNumber, 'value');
expect(result).toEqual('12345678Z');
});
it('should check the account was edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierFiscalData.account, 'value');
expect(result).toEqual('edited account number');
});
it('should check the sageWihholding was edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierFiscalData.sageWihholding, 'value');
expect(result).toEqual('RETENCION ESTIMACION OBJETIVA');
});
it('should check the sageTaxType was edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierFiscalData.sageTaxType, 'value');
expect(result).toEqual('Operaciones no sujetas');
});
it('should check the postCode was edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierFiscalData.postCode, 'value');
expect(result).toEqual('46000');
});
it('should check the city was edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierFiscalData.city, 'value');
expect(result).toEqual('Valencia');
});
it('should check the province was edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierFiscalData.province, 'value');
expect(result).toEqual('Province one (España)');
});
it('should check the country was edited', async() => {
const result = await page.waitToGetProperty(selectors.supplierFiscalData.country, 'value');
expect(result).toEqual('España');
});
});

View File

@ -27,7 +27,7 @@ describe('Supplier contact path', () => {
await page.waitToClick(selectors.supplierContact.saveButton); await page.waitToClick(selectors.supplierContact.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should reload the section and count the contacts`, async() => { it(`should reload the section and count the contacts`, async() => {
@ -62,6 +62,7 @@ describe('Supplier contact path', () => {
}); });
it(`should check the new contact note was saved correctly`, async() => { it(`should check the new contact note was saved correctly`, async() => {
await page.waitForTextInField(selectors.supplierContact.thirdContactNotes, 'the end to end integration tester');
const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactNotes, 'value'); const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactNotes, 'value');
expect(result).toContain('the end to end integration tester'); expect(result).toContain('the end to end integration tester');
@ -69,10 +70,14 @@ describe('Supplier contact path', () => {
it(`should remove the created contact`, async() => { it(`should remove the created contact`, async() => {
await page.waitToClick(selectors.supplierContact.thirdContactDeleteButton, 'value'); await page.waitToClick(selectors.supplierContact.thirdContactDeleteButton, 'value');
const result = await page.countElement(selectors.supplierContact.anyContact);
expect(result).toEqual(2);
await page.waitToClick(selectors.supplierContact.saveButton); await page.waitToClick(selectors.supplierContact.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toBe('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should reload the section and count the amount of contacts went back to 2`, async() => { it(`should reload the section and count the amount of contacts went back to 2`, async() => {

View File

@ -1,7 +1,6 @@
@import "variables"; @import "variables";
.vn-radio { .vn-radio {
& > .btn { & > .btn {
border-radius: 50%; border-radius: 50%;
@ -26,8 +25,4 @@
&.disabled.checked > .btn > .mark { &.disabled.checked > .btn > .mark {
background-color: $color-font-secondary; background-color: $color-font-secondary;
} }
> div {
text-overflow: ellipsis;
overflow: hidden;
}
} }

5148
front/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -17,11 +17,14 @@
ui-sref="{{::$ctrl.summaryState}}({id: $ctrl.descriptor.id})"> ui-sref="{{::$ctrl.summaryState}}({id: $ctrl.descriptor.id})">
<vn-icon icon="desktop_windows"></vn-icon> <vn-icon icon="desktop_windows"></vn-icon>
</a> </a>
<vn-icon-button <vn-icon-button ng-if="$ctrl.$transclude.isSlotFilled('menu')"
ng-class="::{invisible: !$ctrl.$transclude.isSlotFilled('menu')}" ng-class="::{invisible: !$ctrl.$transclude.isSlotFilled('menu')}"
icon="more_vert" icon="more_vert"
vn-popover="menu"> vn-popover="menu">
</vn-icon-button> </vn-icon-button>
<div ng-if="$ctrl.$transclude.isSlotFilled('dotMenu')"
ng-transclude="dotMenu">
</div>
</div> </div>
<vn-menu vn-id="menu"> <vn-menu vn-id="menu">
<vn-list ng-transclude="menu"></vn-list> <vn-list ng-transclude="menu"></vn-list>

View File

@ -130,6 +130,7 @@ ngModule.vnComponent('vnDescriptorContent', {
body: 'slotBody', body: 'slotBody',
before: '?slotBefore', before: '?slotBefore',
after: '?slotAfter', after: '?slotAfter',
menu: '?slotMenu' menu: '?slotMenu',
dotMenu: '?slotDotMenu'
} }
}); });

View File

@ -21,7 +21,8 @@ vn-descriptor-content {
align-items: stretch; align-items: stretch;
color: $color-font-dark; color: $color-font-dark;
& > * { & > a,
& > vn-icon-button {
display: flex; display: flex;
min-width: 45px; min-width: 45px;
height: 45px; height: 45px;

View File

@ -21,6 +21,7 @@ let buildDir = 'dist';
let backSources = [ let backSources = [
'!node_modules', '!node_modules',
'!loopback/locale/*.json',
'loopback', 'loopback',
'modules/*/back/**', 'modules/*/back/**',
'modules/*/back/*', 'modules/*/back/*',
@ -186,9 +187,25 @@ function e2eSingleRun() {
displaySpecDuration: true, displaySpecDuration: true,
}, },
summary: { summary: {
displayStacktrace: 'pretty', displayStacktrace: 'raw',
displayPending: false displayPending: false
} },
colors: {
enabled: true,
successful: 'brightGreen',
failed: 'brightRed'
},
// stacktrace: {
// filter: stacktrace => {
// const lines = stacktrace.split('\n');
// const filtered = [];
// for (let i = 1; i < lines.length; i++) {
// if (/e2e\/paths/.test(lines[i]))
// filtered.push(lines[i]);
// }
// return filtered.join('\n');
// }
// }
}) })
] ]
})); }));

View File

@ -81,5 +81,8 @@
"shipped": "Shipped", "shipped": "Shipped",
"landed": "Landed", "landed": "Landed",
"addressFk": "Address", "addressFk": "Address",
"companyFk": "Company" "companyFk": "Company",
"You need to fill sage information before you check verified data": "You need to fill sage information before you check verified data",
"The social name cannot be empty": "The social name cannot be empty",
"The nif cannot be empty": "The nif cannot be empty"
} }

View File

@ -156,5 +156,9 @@
"shipped": "F. envío", "shipped": "F. envío",
"landed": "F. entrega", "landed": "F. entrega",
"addressFk": "Consignatario", "addressFk": "Consignatario",
"companyFk": "Empresa" "companyFk": "Empresa",
"The social name cannot be empty": "La razón social no puede quedar en blanco",
"The nif cannot be empty": "El NIF no puede quedar en blanco",
"You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados",
"ASSIGN_ZONE_FIRST": "Asigna una zona primero"
} }

View File

@ -226,7 +226,7 @@ class SyncLdap extends SyncConnector {
// Recreate roles // Recreate roles
let roles = await $.Role.find({ let roles = await $.Role.find({
fields: ['id', 'name'] fields: ['id', 'name', 'description']
}); });
let roleRoles = await $.RoleRole.find({ let roleRoles = await $.RoleRole.find({
fields: ['role', 'inheritsFrom'] fields: ['role', 'inheritsFrom']
@ -251,13 +251,12 @@ class SyncLdap extends SyncConnector {
return {key: user.roleFk, val: user.name}; return {key: user.roleFk, val: user.name};
}); });
console.log;
reqs = []; reqs = [];
for (let role of roles) { for (let role of roles) {
let newEntry = { let newEntry = {
objectClass: ['top', 'posixGroup'], objectClass: ['top', 'posixGroup'],
cn: role.name, cn: role.name,
description: role.description,
gidNumber: accountConfig.idBase + role.id gidNumber: accountConfig.idBase + role.id
}; };

View File

@ -28,6 +28,7 @@ class SyncSamba extends SyncConnector {
url: `ldaps://${sambaConfig.host}:636`, url: `ldaps://${sambaConfig.host}:636`,
tlsOptions: {rejectUnauthorized: false} tlsOptions: {rejectUnauthorized: false}
}); });
await adClient.bind(sambaConfig.adUser, sambaConfig.adPassword);
Object.assign(this, { Object.assign(this, {
sambaConfig, sambaConfig,
@ -98,8 +99,6 @@ class SyncSamba extends SyncConnector {
adClient adClient
} = this; } = this;
await adClient.bind(sambaConfig.adUser, sambaConfig.adPassword);
let opts = { let opts = {
scope: 'sub', scope: 'sub',
attributes: ['sAMAccountName'], attributes: ['sAMAccountName'],

View File

@ -143,13 +143,15 @@
ng-if="$ctrl.askOldPass" ng-if="$ctrl.askOldPass"
label="Old password" label="Old password"
ng-model="$ctrl.oldPassword" ng-model="$ctrl.oldPassword"
type="password"> type="password"
vn-focus>
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield
label="New password" label="New password"
ng-model="$ctrl.newPassword" ng-model="$ctrl.newPassword"
type="password" type="password"
info="{{'Password requirements' | translate:$ctrl.passRequirements}}"> info="{{'Password requirements' | translate:$ctrl.passRequirements}}"
vn-focus>
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield
label="Repeat password" label="Repeat password"

View File

@ -9,7 +9,7 @@
name="form" name="form"
ng-submit="watcher.submit()" ng-submit="watcher.submit()"
class="vn-w-md"> class="vn-w-md">
<vn-card class="vn-pa-lg"> <vn-card class="vn-pa-lg" vn-focus>
<vn-vertical> <vn-vertical>
<vn-check <vn-check
label="Enable synchronization" label="Enable synchronization"
@ -22,8 +22,7 @@
<vn-textfield <vn-textfield
label="Server" label="Server"
ng-model="$ctrl.config.server" ng-model="$ctrl.config.server"
rule="LdapConfig" rule="LdapConfig">
vn-focus>
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield
label="RDN" label="RDN"
@ -79,7 +78,8 @@
<tpl-body> <tpl-body>
<vn-textfield <vn-textfield
label="Username" label="Username"
ng-model="$ctrl.syncUser"> ng-model="$ctrl.syncUser"
vn-focus>
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield
label="Password" label="Password"

View File

@ -9,13 +9,12 @@
name="form" name="form"
ng-submit="watcher.submit()" ng-submit="watcher.submit()"
class="vn-w-md"> class="vn-w-md">
<vn-card class="vn-pa-lg"> <vn-card class="vn-pa-lg" vn-focus>
<vn-vertical> <vn-vertical>
<vn-textfield <vn-textfield
label="Homedir" label="Homedir"
ng-model="$ctrl.config.homedir" ng-model="$ctrl.config.homedir"
rule="AccountConfig" rule="AccountConfig">
vn-focus>
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield
label="Shell" label="Shell"

View File

@ -9,7 +9,7 @@
name="form" name="form"
ng-submit="watcher.submit()" ng-submit="watcher.submit()"
class="vn-w-md"> class="vn-w-md">
<vn-card class="vn-pa-lg"> <vn-card class="vn-pa-lg" vn-focus>
<vn-vertical> <vn-vertical>
<vn-check <vn-check
label="Enable synchronization" label="Enable synchronization"
@ -22,8 +22,7 @@
<vn-textfield <vn-textfield
label="Host" label="Host"
ng-model="$ctrl.config.host" ng-model="$ctrl.config.host"
rule="SambaConfig" rule="SambaConfig">
vn-focus>
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield
label="SSH user" label="SSH user"

View File

@ -57,7 +57,7 @@
<vn-th number>Id</vn-th> <vn-th number>Id</vn-th>
<vn-th number>Ticket</vn-th> <vn-th number>Ticket</vn-th>
<vn-th>Destination</vn-th> <vn-th>Destination</vn-th>
<vn-th>Landed</vn-th> <vn-th expand>Landed</vn-th>
<vn-th number>Quantity</vn-th> <vn-th number>Quantity</vn-th>
<vn-th>Description</vn-th> <vn-th>Description</vn-th>
<vn-th number>Price</vn-th> <vn-th number>Price</vn-th>
@ -92,7 +92,7 @@
show-field="description"> show-field="description">
</vn-autocomplete> </vn-autocomplete>
</vn-td> </vn-td>
<vn-td>{{::saleClaimed.sale.ticket.landed | date: 'dd/MM/yyyy'}}</vn-td> <vn-td expand>{{::saleClaimed.sale.ticket.landed | date: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{::saleClaimed.sale.quantity}}</vn-td> <vn-td number>{{::saleClaimed.sale.quantity}}</vn-td>
<vn-td expand>{{::saleClaimed.sale.concept}}</vn-td> <vn-td expand>{{::saleClaimed.sale.concept}}</vn-td>
<vn-td number>{{::saleClaimed.sale.price | currency: 'EUR':2}}</vn-td> <vn-td number>{{::saleClaimed.sale.price | currency: 'EUR':2}}</vn-td>

View File

@ -22,7 +22,7 @@
<vn-table model="model"> <vn-table model="model">
<vn-thead> <vn-thead>
<vn-tr> <vn-tr>
<vn-th center>Landed</vn-th> <vn-th center expand>Landed</vn-th>
<vn-th number>Quantity</vn-th> <vn-th number>Quantity</vn-th>
<vn-th>Claimed</vn-th> <vn-th>Claimed</vn-th>
<vn-th>Description</vn-th> <vn-th>Description</vn-th>
@ -34,7 +34,7 @@
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="saleClaimed in $ctrl.salesClaimed" vn-repeat-last> <vn-tr ng-repeat="saleClaimed in $ctrl.salesClaimed" vn-repeat-last>
<vn-td center>{{::saleClaimed.sale.ticket.landed | date:'dd/MM/yyyy'}}</vn-td> <vn-td center expand>{{::saleClaimed.sale.ticket.landed | date:'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{::saleClaimed.sale.quantity}}</vn-td> <vn-td number>{{::saleClaimed.sale.quantity}}</vn-td>
<vn-td> <vn-td>
<vn-input-number <vn-input-number

View File

@ -10,7 +10,7 @@
<vn-tr> <vn-tr>
<vn-th field="id" number>Id</vn-th> <vn-th field="id" number>Id</vn-th>
<vn-th field="clientFk">Client</vn-th> <vn-th field="clientFk">Client</vn-th>
<vn-th field="created" center>Created</vn-th> <vn-th field="created" center expand>Created</vn-th>
<vn-th field="workerFk">Worker</vn-th> <vn-th field="workerFk">Worker</vn-th>
<vn-th field="claimStateFk">State</vn-th> <vn-th field="claimStateFk">State</vn-th>
<vn-th></vn-th> <vn-th></vn-th>
@ -29,7 +29,7 @@
{{::claim.name}} {{::claim.name}}
</span> </span>
</vn-td> </vn-td>
<vn-td center>{{::claim.created | date:'dd/MM/yyyy'}}</vn-td> <vn-td center expand>{{::claim.created | date:'dd/MM/yyyy'}}</vn-td>
<vn-td expand> <vn-td expand>
<span <span
vn-click-stop="workerDescriptor.show($event, claim.workerFk)" vn-click-stop="workerDescriptor.show($event, claim.workerFk)"

View File

@ -52,7 +52,7 @@
<vn-thead> <vn-thead>
<vn-tr> <vn-tr>
<vn-th number>Item</vn-th> <vn-th number>Item</vn-th>
<vn-th>Landed</vn-th> <vn-th expand>Landed</vn-th>
<vn-th number>Quantity</vn-th> <vn-th number>Quantity</vn-th>
<vn-th number>Claimed</vn-th> <vn-th number>Claimed</vn-th>
<vn-th>Description</vn-th> <vn-th>Description</vn-th>
@ -70,7 +70,7 @@
{{::saleClaimed.sale.itemFk | zeroFill:6}} {{::saleClaimed.sale.itemFk | zeroFill:6}}
</span> </span>
</vn-td> </vn-td>
<vn-td>{{::saleClaimed.sale.ticket.landed | date: 'dd/MM/yyyy'}}</vn-td> <vn-td expand>{{::saleClaimed.sale.ticket.landed | date: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{::saleClaimed.sale.quantity}}</vn-td> <vn-td number>{{::saleClaimed.sale.quantity}}</vn-td>
<vn-td number>{{::saleClaimed.quantity}}</vn-td> <vn-td number>{{::saleClaimed.quantity}}</vn-td>
<vn-td expand>{{::saleClaimed.sale.concept}}</vn-td> <vn-td expand>{{::saleClaimed.sale.concept}}</vn-td>

View File

@ -2,9 +2,11 @@ const app = require('vn-loopback/server/server');
describe('Client updateFiscalData', () => { describe('Client updateFiscalData', () => {
const clientId = 101; const clientId = 101;
const employeeId = 1;
const salesAssistantId = 21;
const administrativeId = 5;
afterAll(async done => { afterAll(async done => {
const clientId = 101; const ctx = {req: {accessToken: {userId: administrativeId}}};
const ctx = {req: {accessToken: {userId: 5}}};
ctx.args = {postcode: 46460}; ctx.args = {postcode: 46460};
await app.models.Client.updateFiscalData(ctx, clientId); await app.models.Client.updateFiscalData(ctx, clientId);
@ -12,8 +14,8 @@ describe('Client updateFiscalData', () => {
done(); done();
}); });
it('should return an error if the user is not administrative and the isTaxDataChecked value is true', async() => { it('should return an error if the user is not salesAssistant and the isTaxDataChecked value is true', async() => {
const ctx = {req: {accessToken: {userId: 1}}}; const ctx = {req: {accessToken: {userId: employeeId}}};
ctx.args = {}; ctx.args = {};
let error; let error;
@ -22,11 +24,30 @@ describe('Client updateFiscalData', () => {
error = e; error = e;
}); });
expect(error.message).toBeDefined(); expect(error.message).toEqual(`You can't make changes on a client with verified data`);
});
it('should return an error if the salesAssistant did not fill the sage data before checking verified data', async() => {
const client = await app.models.Client.findById(clientId);
await client.updateAttribute('isTaxDataChecked', false);
const ctx = {req: {accessToken: {userId: salesAssistantId}}};
ctx.args = {isTaxDataChecked: true};
let error;
await app.models.Client.updateFiscalData(ctx, clientId)
.catch(e => {
error = e;
});
expect(error.message).toEqual('You need to fill sage information before you check verified data');
// Restores
await client.updateAttribute('isTaxDataChecked', true);
}); });
it('should update the client fiscal data and return the count if changes made', async() => { it('should update the client fiscal data and return the count if changes made', async() => {
const ctx = {req: {accessToken: {userId: 5}}}; const ctx = {req: {accessToken: {userId: administrativeId}}};
ctx.args = {postcode: 46680}; ctx.args = {postcode: 46680};
const client = await app.models.Client.findById(clientId); const client = await app.models.Client.findById(clientId);

View File

@ -45,15 +45,15 @@ module.exports = Self => {
}, },
{ {
arg: 'sageTaxTypeFk', arg: 'sageTaxTypeFk',
type: 'number' type: 'any'
}, },
{ {
arg: 'sageTransactionTypeFk', arg: 'sageTransactionTypeFk',
type: 'number' type: 'any'
}, },
{ {
arg: 'transferorFk', arg: 'transferorFk',
type: 'number' type: 'any'
}, },
{ {
arg: 'hasToInvoiceByAddress', arg: 'hasToInvoiceByAddress',
@ -118,6 +118,15 @@ module.exports = Self => {
if (!isSalesAssistant && client.isTaxDataChecked) if (!isSalesAssistant && client.isTaxDataChecked)
throw new UserError(`You can't make changes on a client with verified data`); throw new UserError(`You can't make changes on a client with verified data`);
// Sage data validation
const taxDataChecked = args.isTaxDataChecked;
const sageTaxChecked = client.sageTaxTypeFk || args.sageTaxTypeFk;
const sageTransactionChecked = client.sageTransactionTypeFk || args.sageTransactionTypeFk;
const hasSageData = sageTaxChecked && sageTransactionChecked;
if (taxDataChecked && !hasSageData)
throw new UserError(`You need to fill sage information before you check verified data`);
if (args.despiteOfClient) { if (args.despiteOfClient) {
const logRecord = { const logRecord = {
originFk: clientId, originFk: clientId,

Some files were not shown because too many files have changed in this diff Show More