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

This commit is contained in:
Carlos Satorres 2023-05-23 14:56:24 +02:00
commit aa524aa14d
228 changed files with 9587 additions and 7968 deletions

View File

@ -5,17 +5,49 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2316.01] - 2023-05-04 ## [2322.01] - 2023-06-08
### Added
- (Tickets -> Crear Factura) Al facturar se envia automáticamente el pdf al cliente
### Changed
- (Trabajadores -> Nuevo trabajador) Los clientes se crean sin 'TR' pero se añade tipo de negocio 'Trabajador'
### Fixed
-
## [2320.01] - 2023-05-25
### Added
- (Tickets -> Crear Factura) Al facturar se envia automáticamente el pdf al cliente
### Changed
- (Trabajadores -> Nuevo trabajador) Los clientes se crean sin 'TR' pero se añade tipo de negocio 'Trabajador'
### Fixed
-
## [2318.01] - 2023-05-08
### Added ### Added
- (Usuarios -> Histórico) Nueva sección - (Usuarios -> Histórico) Nueva sección
- (Roles -> Histórico) Nueva sección - (Roles -> Histórico) Nueva sección
- (General -> Traducciones) Correo de bienvenida a clientes al portugués y al francés
### Changed ### Changed
- (Artículo -> Precio fijado) Modificado el buscador superior por uno lateral - (Artículo -> Precio fijado) Modificado el buscador superior por uno lateral
### Fixed ### Fixed
- - (Ticket -> Boxing) Arreglado selección de horas
- (Cesta -> Índice) Optimizada búsqueda
## [2314.01] - 2023-04-20 ## [2314.01] - 2023-04-20

View File

@ -4,25 +4,25 @@ module.exports = Self => {
Self.remoteMethodCtx('deliveryNoteEmail', { Self.remoteMethodCtx('deliveryNoteEmail', {
description: 'Sends the delivery note email with an docuware attached PDF', description: 'Sends the delivery note email with an docuware attached PDF',
accessType: 'WRITE', accessType: 'WRITE',
accessScopes: ['docuwareDeliveryNoteEmail'],
accepts: [ accepts: [
{ {
arg: 'id', arg: 'id',
type: 'string', type: 'number',
required: true, required: true,
description: 'The ticket id', description: 'The ticket id',
http: {source: 'path'}
},
{
arg: 'recipient',
type: 'string',
description: 'The recipient email',
required: true,
}, },
{ {
arg: 'recipientId', arg: 'recipientId',
type: 'number', type: 'number',
description: 'The client id', description: 'The client id',
required: false required: true
},
{
arg: 'recipient',
type: 'string',
description: 'The recipient email',
required: false,
} }
], ],
returns: [ returns: [
@ -41,12 +41,13 @@ module.exports = Self => {
} }
], ],
http: { http: {
path: '/:id/delivery-note-email', path: '/delivery-note-email',
verb: 'POST' verb: 'POST'
} }
}); });
Self.deliveryNoteEmail = async(ctx, id) => { Self.deliveryNoteEmail = async(ctx, id, recipientId, recipient) => {
const models = Self.app.models;
const args = Object.assign({}, ctx.args); const args = Object.assign({}, ctx.args);
const params = { const params = {
recipient: args.recipient, recipient: args.recipient,
@ -57,9 +58,11 @@ module.exports = Self => {
for (const param in args) for (const param in args)
params[param] = args[param]; params[param] = args[param];
if (!recipient) params.recipient = models.Client.findById(recipientId, {fields: ['email']});
const email = new Email('delivery-note', params); const email = new Email('delivery-note', params);
const docuwareFile = await Self.app.models.Docuware.download(ctx, id, 'deliveryNote'); const docuwareFile = await models.Docuware.download(ctx, id, 'deliveryNote');
return email.send({ return email.send({
overrideAttachments: true, overrideAttachments: true,

View File

@ -23,13 +23,7 @@ module.exports = Self => {
let models = Self.app.models; let models = Self.app.models;
let user = await Self.findById(userId, { let user = await Self.findById(userId, {
fields: ['id', 'name', 'nickname', 'email', 'lang'], fields: ['id', 'name', 'nickname', 'email', 'lang']
include: {
relation: 'userConfig',
scope: {
fields: ['darkMode']
}
}
}); });
let roles = await models.RoleMapping.find({ let roles = await models.RoleMapping.find({

View File

@ -34,6 +34,8 @@ async function test() {
app.boot(bootOptions, app.boot(bootOptions,
err => err ? reject(err) : resolve()); err => err ? reject(err) : resolve());
}); });
// FIXME: Workaround to wait for loopback to be ready
await app.models.Application.status();
const Jasmine = require('jasmine'); const Jasmine = require('jasmine');
const jasmine = new Jasmine(); const jasmine = new Jasmine();

View File

@ -1,9 +1,10 @@
FROM mariadb:10.7.3 FROM mariadb:10.7.5
ENV MYSQL_ROOT_PASSWORD root ENV MYSQL_ROOT_PASSWORD root
ENV TZ Europe/Madrid ENV TZ Europe/Madrid
ARG MOCKDATE=2001-01-01 11:00:00
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates \ && apt-get install -y --no-install-recommends curl ca-certificates \
&& curl -sL https://apt.verdnatura.es/conf/verdnatura.gpg | apt-key add - \ && curl -sL https://apt.verdnatura.es/conf/verdnatura.gpg | apt-key add - \
@ -31,14 +32,15 @@ COPY \
import-changes.sh \ import-changes.sh \
config.ini \ config.ini \
dump/mysqlPlugins.sql \ dump/mysqlPlugins.sql \
dump/mockDate.sql \
dump/structure.sql \ dump/structure.sql \
dump/mockDate.sql \
dump/dumpedFixtures.sql \ dump/dumpedFixtures.sql \
./ ./
RUN gosu mysql docker-init.sh \ RUN gosu mysql docker-init.sh \
&& docker-dump.sh mysqlPlugins \ && docker-dump.sh mysqlPlugins \
&& docker-dump.sh mockDate \
&& docker-dump.sh structure \ && docker-dump.sh structure \
&& sed -i -e 's/@mockDate/'"$MOCKDATE"'/g' mockDate.sql \
&& docker-dump.sh mockDate \
&& docker-dump.sh dumpedFixtures \ && docker-dump.sh dumpedFixtures \
&& gosu mysql docker-temp-stop.sh && gosu mysql docker-temp-stop.sh

View File

@ -1,5 +0,0 @@
UPDATE vn.supplier s
JOIN vn.country c ON c.id = s.countryFk
SET s.nif = MID(REPLACE(s.nif, ' ', ''), 3, LENGTH(REPLACE(s.nif, ' ', '')) - 1)
WHERE s.isVies = TRUE
AND c.code = LEFT(REPLACE(s.nif, ' ', ''), 2);

View File

@ -1,5 +0,0 @@
UPDATE IGNORE vn.client c
JOIN vn.country co ON co.id = c.countryFk
SET c.fi = MID(REPLACE(c.fi, ' ', ''), 3, LENGTH(REPLACE(c.fi, ' ', '')) - 1)
WHERE c.isVies = TRUE
AND co.code = LEFT(REPLACE(c.fi, ' ', ''), 2);

View File

@ -0,0 +1,77 @@
CREATE OR REPLACE
ALGORITHM = UNDEFINED VIEW `vn`.`zoneEstimatedDelivery` AS
select
`t`.`zoneFk` AS `zoneFk`,
cast(`util`.`VN_CURDATE`() + interval hour(ifnull(`zc`.`hour`, `z`.`hour`)) * 60 + minute(ifnull(`zc`.`hour`, `z`.`hour`)) minute as time) AS `hourTheoretical`,
cast(sum(`sv`.`volume`) as decimal(5, 1)) AS `totalVolume`,
cast(sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) as decimal(5, 1)) AS `remainingVolume`,
greatest(
ifnull(`lhp`.`m3`, 0),
ifnull(`dl`.`minSpeed`, 0)
) AS `speed`,
cast(`zc`.`hour` + interval -sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) * 60 / greatest(ifnull(`lhp`.`m3`, 0), ifnull(`dl`.`minSpeed`, 0)) minute as time) AS `hourEffective`,
floor(-sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) * 60 / greatest(ifnull(`lhp`.`m3`, 0), ifnull(`dl`.`minSpeed`, 0))) AS `minutesLess`,
cast(`zc`.`hour` + interval -sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) * 60 / greatest(ifnull(`lhp`.`m3`, 0), ifnull(`dl`.`minSpeed`, 0)) minute as time) AS `etc`
from
(
(
(
(
(
(
(
(
(
`vn`.`ticket` `t`
join `vn`.`ticketStateToday` `tst` on
(
`tst`.`ticket` = `t`.`id`
)
)
join `vn`.`state` `s` on
(
`s`.`id` = `tst`.`state`
)
)
join `vn`.`saleVolume` `sv` on
(
`sv`.`ticketFk` = `t`.`id`
)
)
left join `vn`.`lastHourProduction` `lhp` on
(
`lhp`.`warehouseFk` = `t`.`warehouseFk`
)
)
join `vn`.`warehouse` `w` on
(
`w`.`id` = `t`.`warehouseFk`
)
)
join `vn`.`warehouseAlias` `wa` on
(
`wa`.`id` = `w`.`aliasFk`
)
)
straight_join `vn`.`zone` `z` on
(
`z`.`id` = `t`.`zoneFk`
)
)
left join `vn`.`zoneClosure` `zc` on
(
`zc`.`zoneFk` = `t`.`zoneFk`
and `zc`.`dated` = `util`.`VN_CURDATE`()
)
)
left join `cache`.`departure_limit` `dl` on
(
`dl`.`warehouse_id` = `t`.`warehouseFk`
and `dl`.`fecha` = `util`.`VN_CURDATE`()
)
)
where
`w`.`hasProduction` <> 0
and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`()
group by
`t`.`zoneFk`;

View File

@ -1 +1 @@
ALTER TABLE `vn`.`ticketConfig` ADD daysForWarningClaim INT DEFAULT 2 NOT NULL COMMENT 'dias restantes hasta que salte el aviso de reclamación fuerade plazo'; ALTER TABLE `vn`.`ticketConfig` ADD daysForWarningClaim INT DEFAULT 2 NOT NULL COMMENT 'dias restantes hasta que salte el aviso de reclamación fuera de plazo';

View File

@ -0,0 +1,5 @@
UPDATE `vn`.`supplier` s
JOIN `vn`.`country` c ON c.id = s.countryFk
SET s.nif = MID(REPLACE(s.nif, ' ', ''), 3, LENGTH(REPLACE(s.nif, ' ', '')) - 1)
WHERE s.isVies = TRUE
AND c.code = LEFT(REPLACE(s.nif, ' ', ''), 2);

View File

@ -0,0 +1,5 @@
UPDATE IGNORE `vn`.`client` c
JOIN `vn`.`country` co ON co.id = c.countryFk
SET c.fi = MID(REPLACE(c.fi, ' ', ''), 3, LENGTH(REPLACE(c.fi, ' ', '')) - 1)
WHERE c.isVies = TRUE
AND co.code = LEFT(REPLACE(c.fi, ' ', ''), 2);

View File

@ -0,0 +1,12 @@
-- vn.companyL10n source
CREATE OR REPLACE
ALGORITHM = UNDEFINED VIEW `vn`.`companyL10n` AS
select
`c`.`id` AS `id`,
ifnull(`ci`.`footnotes`, `c`.`footnotes`) AS `footnotes`
from
(`vn`.`company` `c`
left join `vn`.`companyI18n` `ci` on
(`ci`.`companyFk` = `c`.`id`
and `ci`.`lang` = `util`.`LANG`()));

View File

@ -0,0 +1,73 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clientCreate`(
vFirstname VARCHAR(50),
vSurnames VARCHAR(50),
vFi VARCHAR(9),
vAddress TEXT,
vPostcode CHAR(5),
vCity VARCHAR(25),
vProvinceFk SMALLINT(5),
vCompanyFk SMALLINT(5),
vPhone VARCHAR(11),
vEmail VARCHAR(255),
vUserFk INT)
BEGIN
/**
* Create new client
*
*/
DECLARE vPayMethodFk INT DEFAULT 4;
DECLARE vDueDay INT DEFAULT 5;
DECLARE vDefaultCredit DECIMAL(10, 2) DEFAULT 300.00;
DECLARE vIsTaxDataChecked TINYINT(1) DEFAULT 1;
DECLARE vHasCoreVnl BOOLEAN DEFAULT TRUE;
DECLARE vMandateTypeFk INT DEFAULT 2;
INSERT INTO `client` (
id,
name,
street,
fi,
phone,
email,
provinceFk,
city,
postcode,
socialName,
payMethodFk,
dueDay,
credit,
isTaxDataChecked,
hasCoreVnl,
isEqualizated)
VALUES (
vUserFk,
CONCAT(vFirstname, ' ', vSurnames),
vAddress,
TRIM(vFi),
vPhone,
vEmail,
vProvinceFk,
vCity,
vPostcode,
CONCAT(vSurnames, ' ', vFirstname),
vPayMethodFk,
vDueDay,
vDefaultCredit,
vIsTaxDataChecked,
vHasCoreVnl,
FALSE
) ON duplicate key update
payMethodFk = vPayMethodFk,
dueDay = vDueDay,
credit = vDefaultCredit,
isTaxDataChecked = vIsTaxDataChecked,
hasCoreVnl = vHasCoreVnl,
isActive = TRUE;
IF (SELECT COUNT(*) FROM mandate WHERE clientFk = vUserFk AND companyFk = vCompanyFk AND mandateTypeFk = vMandateTypeFk) = 0 THEN
INSERT INTO mandate (clientFk, companyFk, mandateTypeFk)
VALUES (vUserFk, vCompanyFk, vMandateTypeFk);
END IF;
END$$
DELIMITER ;

View File

@ -0,0 +1,14 @@
INSERT INTO `vn`.`businessType` (`code`, `description`)
VALUES ('worker','Trabajador');
ALTER TABLE `vn`.`workerConfig` ADD businessTypeFk varchar(100) NULL
COMMENT 'Tipo de negocio por defecto al dar de alta un trabajador nuevo';
UPDATE `vn`.`workerConfig`
SET businessTypeFk = 'worker'
WHERE id = 1;
UPDATE `vn`.`client` c
JOIN `vn`.`worker` w ON w.id = c.id
SET c.name = REPLACE(c.name, 'TR ', ''),
c.businessTypeFk = 'worker';

View File

@ -0,0 +1,254 @@
DROP PROCEDURE IF EXISTS `vn`.`invoiceOut_new`;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOut_new`(
vSerial VARCHAR(255),
vInvoiceDate DATE,
vTaxArea VARCHAR(25),
OUT vNewInvoiceId INT)
BEGIN
/**
* Creación de facturas emitidas.
* requiere previamente tabla tmp.ticketToInvoice(id).
*
* @param vSerial serie a la cual se hace la factura
* @param vInvoiceDate fecha de la factura
* @param vTaxArea tipo de iva en relacion a la empresa y al cliente
* @param vNewInvoiceId id de la factura que se acaba de generar
* @return vNewInvoiceId
*/
DECLARE vIsAnySaleToInvoice BOOL;
DECLARE vIsAnyServiceToInvoice BOOL;
DECLARE vNewRef VARCHAR(255);
DECLARE vWorker INT DEFAULT account.myUser_getId();
DECLARE vCompanyFk INT;
DECLARE vInterCompanyFk INT;
DECLARE vClientFk INT;
DECLARE vCplusStandardInvoiceTypeFk INT DEFAULT 1;
DECLARE vCplusCorrectingInvoiceTypeFk INT DEFAULT 6;
DECLARE vCplusSimplifiedInvoiceTypeFk INT DEFAULT 2;
DECLARE vCorrectingSerial VARCHAR(1) DEFAULT 'R';
DECLARE vSimplifiedSerial VARCHAR(1) DEFAULT 'S';
DECLARE vNewInvoiceInFk INT;
DECLARE vIsInterCompany BOOL DEFAULT FALSE;
DECLARE vIsCEESerial BOOL DEFAULT FALSE;
DECLARE vIsCorrectInvoiceDate BOOL;
DECLARE vMaxShipped DATE;
SET vInvoiceDate = IFNULL(vInvoiceDate, util.VN_CURDATE());
SELECT t.clientFk,
t.companyFk,
MAX(DATE(t.shipped)),
DATE(vInvoiceDate) >= invoiceOut_getMaxIssued(
vSerial,
t.companyFk,
YEAR(vInvoiceDate))
INTO vClientFk,
vCompanyFk,
vMaxShipped,
vIsCorrectInvoiceDate
FROM tmp.ticketToInvoice tt
JOIN ticket t ON t.id = tt.id;
IF(vMaxShipped > vInvoiceDate) THEN
CALL util.throw("Invoice date can't be less than max date");
END IF;
IF NOT vIsCorrectInvoiceDate THEN
CALL util.throw('Exists an invoice with a previous date');
END IF;
-- Eliminem de tmp.ticketToInvoice els tickets que no han de ser facturats
DELETE ti.*
FROM tmp.ticketToInvoice ti
JOIN ticket t ON t.id = ti.id
JOIN sale s ON s.ticketFk = t.id
JOIN item i ON i.id = s.itemFk
JOIN supplier su ON su.id = t.companyFk
JOIN client c ON c.id = t.clientFk
LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = su.countryFk
WHERE (YEAR(t.shipped) < 2001 AND t.isDeleted)
OR c.isTaxDataChecked = FALSE
OR t.isDeleted
OR c.hasToInvoice = FALSE
OR itc.id IS NULL;
SELECT SUM(s.quantity * s.price * (100 - s.discount)/100) <> 0
INTO vIsAnySaleToInvoice
FROM tmp.ticketToInvoice t
JOIN sale s ON s.ticketFk = t.id;
SELECT COUNT(*) > 0 INTO vIsAnyServiceToInvoice
FROM tmp.ticketToInvoice t
JOIN ticketService ts ON ts.ticketFk = t.id;
IF (vIsAnySaleToInvoice OR vIsAnyServiceToInvoice)
AND (vCorrectingSerial = vSerial OR NOT hasAnyNegativeBase())
THEN
-- el trigger añade el siguiente Id_Factura correspondiente a la vSerial
INSERT INTO invoiceOut(
ref,
serial,
issued,
clientFk,
dued,
companyFk,
cplusInvoiceType477Fk
)
SELECT
1,
vSerial,
vInvoiceDate,
vClientFk,
getDueDate(vInvoiceDate, dueDay),
vCompanyFk,
IF(vSerial = vCorrectingSerial,
vCplusCorrectingInvoiceTypeFk,
IF(vSerial = vSimplifiedSerial,
vCplusSimplifiedInvoiceTypeFk,
vCplusStandardInvoiceTypeFk))
FROM client
WHERE id = vClientFk;
SET vNewInvoiceId = LAST_INSERT_ID();
SELECT `ref`
INTO vNewRef
FROM invoiceOut
WHERE id = vNewInvoiceId;
UPDATE ticket t
JOIN tmp.ticketToInvoice ti ON ti.id = t.id
SET t.refFk = vNewRef;
DROP TEMPORARY TABLE IF EXISTS tmp.updateInter;
CREATE TEMPORARY TABLE tmp.updateInter ENGINE = MEMORY
SELECT s.id,ti.id ticket_id,vWorker Id_Trabajador
FROM tmp.ticketToInvoice ti
LEFT JOIN ticketState ts ON ti.id = ts.ticket
JOIN state s
WHERE IFNULL(ts.alertLevel,0) < 3 and s.`code` = getAlert3State(ti.id);
INSERT INTO ticketTracking(stateFk,ticketFk,workerFk)
SELECT * FROM tmp.updateInter;
CALL invoiceExpenceMake(vNewInvoiceId);
CALL invoiceTaxMake(vNewInvoiceId,vTaxArea);
UPDATE invoiceOut io
JOIN (
SELECT SUM(amount) total
FROM invoiceOutExpence
WHERE invoiceOutFk = vNewInvoiceId
) base
JOIN (
SELECT SUM(vat) total
FROM invoiceOutTax
WHERE invoiceOutFk = vNewInvoiceId
) vat
SET io.amount = base.total + vat.total
WHERE io.id = vNewInvoiceId;
DROP TEMPORARY TABLE tmp.updateInter;
SELECT COUNT(*), id
INTO vIsInterCompany, vInterCompanyFk
FROM company
WHERE clientFk = vClientFk;
IF (vIsInterCompany) THEN
INSERT INTO invoiceIn(supplierFk, supplierRef, issued, companyFk)
SELECT vCompanyFk, vNewRef, vInvoiceDate, vInterCompanyFk;
SET vNewInvoiceInFk = LAST_INSERT_ID();
DROP TEMPORARY TABLE IF EXISTS tmp.ticket;
CREATE TEMPORARY TABLE tmp.ticket
(KEY (ticketFk))
ENGINE = MEMORY
SELECT id ticketFk
FROM tmp.ticketToInvoice;
CALL `ticket_getTax`('NATIONAL');
SET @vTaxableBaseServices := 0.00;
SET @vTaxCodeGeneral := NULL;
INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk)
SELECT vNewInvoiceInFk,
@vTaxableBaseServices,
sub.expenceFk,
sub.taxTypeSageFk,
sub.transactionTypeSageFk
FROM (
SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase,
i.expenceFk,
i.taxTypeSageFk,
i.transactionTypeSageFk,
@vTaxCodeGeneral := i.taxClassCodeFk
FROM tmp.ticketServiceTax tst
JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tst.code
WHERE i.isService
HAVING taxableBase
) sub;
INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk)
SELECT vNewInvoiceInFk,
SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral,
@vTaxableBaseServices, 0) taxableBase,
i.expenceFk,
i.taxTypeSageFk ,
i.transactionTypeSageFk
FROM tmp.ticketTax tt
JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tt.code
WHERE !i.isService
GROUP BY tt.pgcFk
HAVING taxableBase
ORDER BY tt.priority;
CALL invoiceInDueDay_calculate(vNewInvoiceInFk);
SELECT COUNT(*) INTO vIsCEESerial
FROM invoiceOutSerial
WHERE code = vSerial;
IF vIsCEESerial THEN
INSERT INTO invoiceInIntrastat (
invoiceInFk,
intrastatFk,
amount,
stems,
countryFk,
net)
SELECT
vNewInvoiceInFk,
i.intrastatFk,
SUM(CAST((s.quantity * s.price * (100 - s.discount) / 100 ) AS DECIMAL(10, 2))),
SUM(CAST(IFNULL(i.stems, 1) * s.quantity AS DECIMAL(10, 2))),
su.countryFk,
CAST(SUM(IFNULL(i.stems, 1)
* s.quantity
* IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000) AS DECIMAL(10, 2))
FROM sale s
JOIN ticket t ON s.ticketFk = t.id
JOIN supplier su ON su.id = t.companyFk
JOIN item i ON i.id = s.itemFk
LEFT JOIN itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk
WHERE t.refFk = vNewRef
GROUP BY i.intrastatFk;
END IF;
DROP TEMPORARY TABLE tmp.ticket;
DROP TEMPORARY TABLE tmp.ticketAmount;
DROP TEMPORARY TABLE tmp.ticketTax;
DROP TEMPORARY TABLE tmp.ticketServiceTax;
END IF;
END IF;
DROP TEMPORARY TABLE `tmp`.`ticketToInvoice`;
END$$
DELIMITER ;

View File

@ -0,0 +1,127 @@
DELIMITER $$
$$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT)
BEGIN
/**
* Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar.
*
* @param vDateFuture Fecha de los tickets que se quieren adelantar.
* @param vDateToAdvance Fecha a cuando se quiere adelantar.
* @param vWarehouseFk Almacén
*/
DECLARE vDateInventory DATE;
SELECT inventoried INTO vDateInventory FROM config;
DROP TEMPORARY TABLE IF EXISTS tmp.stock;
CREATE TEMPORARY TABLE tmp.stock
(itemFk INT PRIMARY KEY,
amount INT)
ENGINE = MEMORY;
INSERT INTO tmp.stock(itemFk, amount)
SELECT itemFk, SUM(quantity) amount FROM
(
SELECT itemFk, quantity
FROM itemTicketOut
WHERE shipped >= vDateInventory
AND shipped < vDateFuture
AND warehouseFk = vWarehouseFk
UNION ALL
SELECT itemFk, quantity
FROM itemEntryIn
WHERE landed >= vDateInventory
AND landed < vDateFuture
AND isVirtualStock = FALSE
AND warehouseInFk = vWarehouseFk
UNION ALL
SELECT itemFk, quantity
FROM itemEntryOut
WHERE shipped >= vDateInventory
AND shipped < vDateFuture
AND warehouseOutFk = vWarehouseFk
) t
GROUP BY itemFk HAVING amount != 0;
DROP TEMPORARY TABLE IF EXISTS tmp.filter;
CREATE TEMPORARY TABLE tmp.filter
(INDEX (id))
SELECT
origin.ticketFk futureId,
dest.ticketFk id,
dest.state,
origin.futureState,
origin.futureIpt,
dest.ipt,
origin.workerFk,
origin.futureLiters,
origin.futureLines,
dest.shipped,
origin.shipped futureShipped,
dest.totalWithVat,
origin.totalWithVat futureTotalWithVat,
dest.agency,
origin.futureAgency,
dest.lines,
dest.liters,
origin.futureLines - origin.hasStock AS notMovableLines,
(origin.futureLines = origin.hasStock) AS isFullMovable,
origin.classColor,
dest.classColor futureClassColor
FROM (
SELECT
s.ticketFk,
t.workerFk,
t.shipped,
t.totalWithVat,
st.name futureState,
t.addressFk,
am.name futureAgency,
count(s.id) futureLines,
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
SUM((s.quantity <= IFNULL(st.amount,0))) hasStock,
st.classColor
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN state st ON st.id = ts.stateFk
JOIN agencyMode am ON t.agencyModeFk = am.id
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
LEFT JOIN tmp.stock st ON st.itemFk = i.id
WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
AND t.warehouseFk = vWarehouseFk
GROUP BY t.id
) origin
JOIN (
SELECT
t.id ticketFk,
t.addressFk,
st.name state,
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt,
t.shipped,
t.totalWithVat,
am.name agency,
CAST(SUM(litros) AS DECIMAL(10,0)) liters,
CAST(COUNT(*) AS DECIMAL(10,0)) `lines`,
st.classColor
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN state st ON st.id = ts.stateFk
JOIN agencyMode am ON t.agencyModeFk = am.id
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
WHERE t.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance)
AND t.warehouseFk = vWarehouseFk
AND st.order <= 5
GROUP BY t.id
) dest ON dest.addressFk = origin.addressFk
WHERE origin.hasStock != 0;
DROP TEMPORARY TABLE tmp.stock;
END$$
DELIMITER ;

View File

@ -0,0 +1,72 @@
DELIMITER $$
$$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vWarehouseFk INT)
BEGIN
/**
* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro
*
* @param vOriginDated Fecha en cuestión
* @param vFutureDated Fecha en el futuro a sondear
* @param vWarehouseFk Identificador de vn.warehouse
*/
DROP TEMPORARY TABLE IF EXISTS tmp.filter;
CREATE TEMPORARY TABLE tmp.filter
(INDEX (id))
SELECT sv.ticketFk id,
sub2.id futureId,
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt,
CAST(sum(litros) AS DECIMAL(10,0)) liters,
CAST(count(*) AS DECIMAL(10,0)) `lines`,
st.name state,
sub2.iptd futureIpt,
sub2.state futureState,
t.clientFk,
t.warehouseFk,
ts.alertLevel,
t.shipped,
sub2.shipped futureShipped,
t.workerFk,
st.code stateCode,
sub2.code futureStateCode,
st.classColor
FROM vn.saleVolume sv
JOIN vn.sale s ON s.id = sv.saleFk
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.ticket t ON t.id = sv.ticketFk
JOIN vn.address a ON a.id = t.addressFk
JOIN vn.province p ON p.id = a.provinceFk
JOIN vn.country c ON c.id = p.countryFk
JOIN vn.ticketState ts ON ts.ticketFk = t.id
JOIN vn.state st ON st.id = ts.stateFk
JOIN vn.alertLevel al ON al.id = ts.alertLevel
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
LEFT JOIN (
SELECT *
FROM (
SELECT
t.addressFk,
t.id,
t.shipped,
st.name state,
st.code code,
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd
FROM vn.ticket t
JOIN vn.ticketState ts ON ts.ticketFk = t.id
JOIN vn.state st ON st.id = ts.stateFk
JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
WHERE t.shipped BETWEEN vFutureDated
AND util.dayend(vFutureDated)
AND t.warehouseFk = vWarehouseFk
GROUP BY t.id
) sub
GROUP BY sub.addressFk
) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id
WHERE t.shipped BETWEEN vOriginDated AND util.dayend(vOriginDated)
AND t.warehouseFk = vWarehouseFk
AND al.code = 'FREE'
AND tp.ticketFk IS NULL
GROUP BY sv.ticketFk
HAVING futureId;
END$$
DELIMITER ;

View File

File diff suppressed because one or more lines are too long

View File

@ -349,20 +349,20 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
(4, 'GCN Channel'), (4, 'GCN Channel'),
(5, 'The Newspaper'); (5, 'The Newspaper');
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`) INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`)
VALUES VALUES
(1101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), (1101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'),
(1102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street, Queens, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), (1102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street, Queens, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'),
(1103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street, Apartament 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), (1103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street, Apartament 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'),
(1104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), (1104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'),
(1105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'), (1105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'),
(1106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'City of New York, New York, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'), (1106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'City of New York, New York, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'),
(1107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill, San Francisco, California', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'), (1107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill, San Francisco, California', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'),
(1108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist'), (1108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist'),
(1109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist'), (1109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist'),
(1110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist'), (1110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist'),
(1111, 'Missing', NULL, 'Missing man', 'Anton', 'The space, Universe far away', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'), (1111, 'Missing', NULL, 'Missing man', 'Anton', 'The space, Universe far away', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'),
(1112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city, Underground', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'); (1112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city, Underground', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others');
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`) INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1 SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1
@ -707,7 +707,7 @@ INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeF
(15, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE()), (15, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE()),
(16, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE()), (16, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE()),
(17, 1, 7, 2, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE()), (17, 1, 7, 2, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE()),
(18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, util.VN_CURDATE()), (18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +12 HOUR)),
(19, 1, 5, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, util.VN_CURDATE()), (19, 1, 5, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, util.VN_CURDATE()),
(20, 1, 5, 5, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), (20, 1, 5, 5, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)),
(21, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), (21, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)),
@ -1940,6 +1940,16 @@ INSERT INTO `pbx`.`sip`(`user_id`, `extension`)
(5, 1102), (5, 1102),
(9, 1201); (9, 1201);
INSERT INTO `vn`.`professionalCategory` (`id`, `name`, `level`, `dayBreak`)
VALUES
(1, 'employee', NULL, NULL),
(2, 'florist', NULL, NULL);
INSERT INTO `vn`.`calendarType` (`id`, `description`, `hoursWeek`, `isPartial`)
VALUES
(1, 'General schedule', 40, 0);
DROP TEMPORARY TABLE IF EXISTS tmp.worker; DROP TEMPORARY TABLE IF EXISTS tmp.worker;
CREATE TEMPORARY TABLE tmp.worker CREATE TEMPORARY TABLE tmp.worker
(PRIMARY KEY (id)) (PRIMARY KEY (id))
@ -1968,7 +1978,7 @@ UPDATE `vn`.`business`
WHERE `id`= 1106; WHERE `id`= 1106;
UPDATE `vn`.`business` b UPDATE `vn`.`business` b
SET b.`workerBusinessProfessionalCategoryFk` = 31 SET b.`workerBusinessProfessionalCategoryFk` = 2
WHERE b.`workerFk` = 1110; WHERE b.`workerFk` = 1110;
UPDATE `vn`.`business` b UPDATE `vn`.`business` b
@ -2775,6 +2785,19 @@ INSERT INTO `vn`.`ticketLog` (`originFk`, userFk, `action`, changedModel, oldIns
(7, 18, 'update', 'Sale', '{"price":3}', '{"price":5}', 1, NULL), (7, 18, 'update', 'Sale', '{"price":3}', '{"price":5}', 1, NULL),
(7, 18, 'update', NULL, NULL, NULL, NULL, "Cambio cantidad Melee weapon heavy shield 1x0.5m de '5' a '10'"); (7, 18, 'update', NULL, NULL, NULL, NULL, "Cambio cantidad Melee weapon heavy shield 1x0.5m de '5' a '10'");
INSERT INTO `vn`.`ticketLog` (originFk, userFk, `action`, creationDate, changedModel, changedModelId, changedModelValue, oldInstance, newInstance, description)
VALUES
(1, NULL, 'delete', '2001-06-09 11:00:04', 'Ticket', 45, 'Spider Man' , NULL, NULL, NULL),
(1, 18, 'select', '2001-06-09 11:00:03', 'Ticket', 45, 'Spider Man' , NULL, NULL, NULL),
(1, NULL, 'update', '2001-05-09 10:00:02', 'Sale', 69854, 'Armor' , '{"isPicked": false}','{"isPicked": true}', NULL),
(1, 18, 'update', '2001-01-01 10:05:01', 'Sale', 69854, 'Armor' , NULL, NULL, 'Armor quantity changed from ''15'' to ''10'''),
(1, NULL, 'delete', '2001-01-01 10:00:10', 'Sale', 5689, 'Shield' , '{"quantity":10,"concept":"Shield"}', NULL, NULL),
(1, 18, 'insert', '2000-12-31 15:00:05', 'Sale', 69854, 'Armor' , NULL,'{"quantity":15,"concept":"Armor", "price": 345.99, "itemFk": 2}', NULL),
(1, 18, 'update', '2000-12-28 08:40:45', 'Ticket', 45, 'Spider Man' , '{"warehouseFk":60,"shipped":"2023-05-16T22:00:00.000Z","nickname":"Super Man","isSigned":true,"isLabeled":true,"isPrinted":true,"packages":0,"hour":0,"isBlocked":false,"hasPriority":false,"companyFk":442,"landed":"2023-05-17T22:00:00.000Z","isBoxed":true,"isDeleted":true,"zoneFk":713,"zonePrice":13,"zoneBonus":0}','{"warehouseFk":61,"shipped":"2023-05-17T22:00:00.000Z","nickname":"Spider Man","isSigned":false,"isLabeled":false,"isPrinted":false,"packages":1,"hour":0,"isBlocked":true,"hasPriority":true,"companyFk":443,"landed":"2023-05-18T22:00:00.000Z","isBoxed":false,"isDeleted":false,"zoneFk":713,"zonePrice":13,"zoneBonus":1}', NULL),
(1, 18, 'select', '2000-12-27 03:40:30', 'Ticket', 45, NULL , NULL, NULL, NULL),
(1, 18, 'insert', '2000-04-10 09:40:15', 'Sale', 5689, 'Shield' , NULL, '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', NULL),
(1, 18, 'insert', '1999-05-09 10:00:00', 'Ticket', 45, 'Super Man' , NULL, '{"id":45,"clientFk":8608,"warehouseFk":60,"shipped":"2023-05-16T22:00:00.000Z","nickname":"Super Man","addressFk":48637,"isSigned":true,"isLabeled":true,"isPrinted":true,"packages":0,"hour":0,"created":"2023-05-16T11:42:56.000Z","isBlocked":false,"hasPriority":false,"companyFk":442,"agencyModeFk":639,"landed":"2023-05-17T22:00:00.000Z","isBoxed":true,"isDeleted":true,"zoneFk":713,"zonePrice":13,"zoneBonus":0}', NULL);
INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`) INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`)
VALUES VALUES
(0, 'http://localhost:56596/scp', 'ostadmin', 'Admin1', '1,6', 3, 60, 'Este CAU se ha cerrado automáticamente. Si el problema persiste responda a este mensaje.', 'localhost', 'osticket', 'osticket', 40003, 'reply', 1, 'all'); (0, 'http://localhost:56596/scp', 'ostadmin', 'Admin1', '1,6', 3, 60, 'Este CAU se ha cerrado automáticamente. Si el problema persiste responda a este mensaje.', 'localhost', 'osticket', 'osticket', 40003, 'reply', 1, 'all');
@ -2801,9 +2824,9 @@ INSERT INTO `vn`.`payDemDetail` (`id`, `detail`)
VALUES VALUES
(1, 1); (1, 1);
INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`) INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`, `businessTypeFk`)
VALUES VALUES
(1, NULL, 1); (1, NULL, 1, 'worker');
INSERT INTO `vn`.`ticketRefund`(`refundTicketFk`, `originalTicketFk`) INSERT INTO `vn`.`ticketRefund`(`refundTicketFk`, `originalTicketFk`)
VALUES VALUES

View File

@ -1,42 +1,33 @@
CREATE SCHEMA IF NOT EXISTS `util`; DROP FUNCTION IF EXISTS `util`.`mockTime`;
USE `util`;
DELIMITER ;; DELIMITER $$
DROP FUNCTION IF EXISTS `util`.`mockedDate`; $$
CREATE FUNCTION `util`.`mockedDate`() CREATE DEFINER=`root`@`localhost` FUNCTION `util`.`mockTime`() RETURNS datetime
RETURNS DATETIME DETERMINISTIC
DETERMINISTIC
BEGIN BEGIN
RETURN CONVERT_TZ('2001-01-01 11:00:00', 'utc', 'Europe/Madrid'); RETURN CONVERT_TZ('@mockDate', 'utc', 'Europe/Madrid');
END ;; END$$
DELIMITER ; DELIMITER ;
DELIMITER ;; DROP FUNCTION IF EXISTS `util`.`mockUtcTime`;
DROP FUNCTION IF EXISTS `util`.`VN_CURDATE`;
CREATE FUNCTION `util`.`VN_CURDATE`() DELIMITER $$
RETURNS DATE $$
DETERMINISTIC CREATE DEFINER=`root`@`localhost` FUNCTION `util`.`mockUtcTime`() RETURNS datetime
DETERMINISTIC
BEGIN BEGIN
RETURN DATE(mockedDate()); RETURN CONVERT_TZ('@mockDate', 'utc', 'Europe/Madrid');
END ;; END$$
DELIMITER ; DELIMITER ;
DELIMITER ;; DROP FUNCTION IF EXISTS `util`.`mockTimeBase`;
DROP FUNCTION IF EXISTS `util`.`VN_CURTIME`;
CREATE FUNCTION `util`.`VN_CURTIME`() DELIMITER $$
RETURNS TIME $$
DETERMINISTIC CREATE DEFINER=`root`@`localhost` FUNCTION `util`.`mockTimeBase`(vIsUtc BOOL) RETURNS datetime
DETERMINISTIC
BEGIN BEGIN
RETURN TIME(mockedDate()); RETURN CONVERT_TZ('@mockDate', 'utc', 'Europe/Madrid');
END ;; END$$
DELIMITER ; DELIMITER ;
DELIMITER ;;
DROP FUNCTION IF EXISTS `util`.`VN_NOW`;
CREATE FUNCTION `util`.`VN_NOW`()
RETURNS DATETIME
DETERMINISTIC
BEGIN
RETURN mockedDate();
END ;;
DELIMITER ;

File diff suppressed because it is too large Load Diff

View File

@ -100,11 +100,8 @@ dump_tables ${TABLES[@]}
TABLES=( TABLES=(
postgresql postgresql
calendar_labour_type
labour_agreement labour_agreement
media_type media_type
professional_category
profile_type
) )
dump_tables ${TABLES[@]} dump_tables ${TABLES[@]}

View File

@ -93,12 +93,5 @@ mysqldump \
--databases \ --databases \
${SCHEMAS[@]} \ ${SCHEMAS[@]} \
${IGNORETABLES[@]} \ ${IGNORETABLES[@]} \
| sed 's/\bCURDATE\b/util.VN_CURDATE/ig'\
| sed 's/\bCURTIME\b/util.VN_CURTIME/ig' \
| sed 's/\bNOW\b/util.VN_NOW/ig' \
| sed 's/\bCURRENT_DATE\b/util.VN_CURDATE/ig' \
| sed 's/\bCURRENT_TIME\b/util.VN_CURTIME/ig' \
| sed 's/\bLOCALTIME\b/util.VN_NOW/ig' \
| sed 's/\bLOCALTIMESTAMP\b/util.VN_NOW/ig' \
| sed 's/ AUTO_INCREMENT=[0-9]* //g' \ | sed 's/ AUTO_INCREMENT=[0-9]* //g' \
> dump/structure.sql > dump/structure.sql

View File

@ -218,23 +218,6 @@ let actions = {
return handle.jsonValue(); return handle.jsonValue();
}, },
getValue: async function(selector) {
return await this.waitToGetProperty(selector, 'value');
},
getValues: async function(selectorMap) {
const values = {};
for (const key in selectorMap)
values[key] = await this.waitToGetProperty(selectorMap[key], 'value');
return values;
},
innerText: async function(selector) {
const element = await this.$(selector);
const handle = await element.getProperty('innerText');
return handle.jsonValue();
},
waitPropertyLength: async function(selector, property, minLength) { waitPropertyLength: async function(selector, property, minLength) {
await this.waitForFunction((selector, property, minLength) => { await this.waitForFunction((selector, property, minLength) => {
const element = document.querySelector(selector); const element = document.querySelector(selector);
@ -431,7 +414,7 @@ let actions = {
const selector = 'vn-snackbar .shape.shown'; const selector = 'vn-snackbar .shape.shown';
await this.waitForSelector(selector); await this.waitForSelector(selector);
let message = await this.evaluate(selector => { const message = await this.evaluate(selector => {
const shape = document.querySelector(selector); const shape = document.querySelector(selector);
const message = { const message = {
text: shape.querySelector('.text').innerText text: shape.querySelector('.text').innerText
@ -448,6 +431,8 @@ let actions = {
return message; return message;
}, selector); }, selector);
message.isSuccess = message.type == 'success';
await this.hideSnackbar(); await this.hideSnackbar();
return message; return message;
}, },
@ -483,28 +468,6 @@ let actions = {
}, selector); }, selector);
}, },
clearInput: async function(selector) {
await this.waitForSelector(selector);
let field = await this.evaluate(selector => {
return document.querySelector(`${selector} input`).closest('.vn-field').$ctrl.field;
}, selector);
if ((field != null && field != '') || field == '0') {
let coords = await this.evaluate(selector => {
let rect = document.querySelector(selector).getBoundingClientRect();
return {x: rect.x + (rect.width / 2), y: rect.y + (rect.height / 2), width: rect.width};
}, selector);
await this.mouse.move(coords.x, coords.y);
await this.waitForSelector(`${selector} [icon="clear"]`, {visible: true});
await this.waitToClick(`${selector} [icon="clear"]`);
}
await this.evaluate(selector => {
return document.querySelector(`${selector} input`).closest('.vn-field').$ctrl.field == '';
}, selector);
},
autocompleteSearch: async function(selector, searchValue) { autocompleteSearch: async function(selector, searchValue) {
let builtSelector = await this.selectorFormater(selector); let builtSelector = await this.selectorFormater(selector);
@ -536,9 +499,8 @@ let actions = {
checkboxState: async function(selector) { checkboxState: async function(selector) {
await this.waitForSelector(selector); await this.waitForSelector(selector);
return this.evaluate(selector => { const value = await this.getInputValue(selector);
let checkbox = document.querySelector(selector); switch (value) {
switch (checkbox.$ctrl.field) {
case null: case null:
return 'intermediate'; return 'intermediate';
case true: case true:
@ -546,7 +508,6 @@ let actions = {
default: default:
return 'unchecked'; return 'unchecked';
} }
}, selector);
}, },
isDisabled: async function(selector) { isDisabled: async function(selector) {
@ -639,6 +600,138 @@ let actions = {
waitForContentLoaded: async function() { waitForContentLoaded: async function() {
await this.waitForSpinnerLoad(); await this.waitForSpinnerLoad();
},
async getInputValue(selector) {
return this.evaluate(selector => {
const input = document.querySelector(selector);
return input.$ctrl.field;
}, selector);
},
async getValue(selector) {
return await this.waitToGetProperty(selector, 'value');
},
async innerText(selector) {
const element = await this.$(selector);
const handle = await element.getProperty('innerText');
return handle.jsonValue();
},
async setInput(selector, value) {
const input = await this.$(selector);
const tagName = (await input.evaluate(e => e.tagName)).toLowerCase();
switch (tagName) {
case 'vn-textfield':
case 'vn-datalist':
case 'vn-input-number':
await this.clearInput(selector);
if (value)
await this.write(selector, value.toString());
break;
case 'vn-autocomplete':
if (value)
await this.autocompleteSearch(selector, value.toString());
else
await this.clearInput(selector);
break;
case 'vn-date-picker':
if (value)
await this.pickDate(selector, value);
else
await this.clearInput(selector);
break;
case 'vn-input-time':
if (value)
await this.pickTime(selector, value);
else
await this.clearInput(selector);
break;
case 'vn-check':
for (let i = 0; i < 3; i++) {
if (await this.getInput(selector) == value) break;
await this.click(selector);
}
break;
}
},
async getInput(selector) {
const input = await this.$(selector);
const tagName = (await input.evaluate(e => e.tagName)).toLowerCase();
let el;
let value;
switch (tagName) {
case 'vn-textfield':
case 'vn-autocomplete':
case 'vn-input-time':
case 'vn-datalist':
el = await input.$('input');
value = await el.getProperty('value');
return value.jsonValue();
case 'vn-check':
case 'vn-input-number':
return await this.getInputValue(selector);
case 'vn-textarea':
el = await input.$('textarea');
value = await el.getProperty('value');
return value.jsonValue();
case 'vn-date-picker':
el = await input.$('input');
value = await el.getProperty('value');
if (value) {
const date = new Date(await value.jsonValue());
date.setUTCHours(0, 0, 0, 0);
return date;
} else
return null;
default:
value = await this.innerText(selector);
return value.jsonValue();
}
},
async clearInput(selector) {
await this.waitForSelector(selector);
let field = await this.evaluate(selector => {
return document.querySelector(`${selector} input`).closest('.vn-field').$ctrl.field;
}, selector);
if ((field != null && field != '') || field == '0') {
let coords = await this.evaluate(selector => {
let rect = document.querySelector(selector).getBoundingClientRect();
return {x: rect.x + (rect.width / 2), y: rect.y + (rect.height / 2), width: rect.width};
}, selector);
await this.mouse.move(coords.x, coords.y);
await this.waitForSelector(`${selector} [icon="clear"]`, {visible: true});
await this.waitToClick(`${selector} [icon="clear"]`);
}
await this.evaluate(selector => {
return document.querySelector(`${selector} input`).closest('.vn-field').$ctrl.field == '';
}, selector);
},
async fetchForm(selector, inputNames) {
const values = {};
for (const inputName of inputNames)
values[inputName] = await this.getInput(`${selector} [vn-name="${inputName}"]`);
return values;
},
async fillForm(selector, values) {
for (const inputName in values)
await this.setInput(`${selector} [vn-name="${inputName}"]`, values[inputName]);
},
async sendForm(selector, values) {
if (values) await this.fillForm(selector, values);
await this.click(`${selector} button[type=submit]`);
return await this.waitForSnackbar();
} }
}; };
@ -646,12 +739,14 @@ export function extendPage(page) {
for (let name in actions) { for (let name in actions) {
page[name] = async(...args) => { page[name] = async(...args) => {
try { try {
return actions[name].apply(page, args); return await actions[name].apply(page, args);
} catch (err) { } catch (err) {
let stringArgs = args let stringArgs = args
.map(i => typeof i == 'function' ? 'Function' : i) .map(i => typeof i == 'function' ? 'Function' : `'${i}'`)
.join(', '); .join(', ');
throw new Error(`.${name}(${stringArgs}): ${err.message}`); const myErr = new Error(`${err.message}\n at Page.${name}(${stringArgs})`);
myErr.stack = err.stack;
throw myErr;
} }
}; };
} }

View File

@ -193,10 +193,6 @@ export default {
saveNewPoscode: '#savePostcode', saveNewPoscode: '#savePostcode',
createButton: 'vn-client-create button[type=submit]' createButton: 'vn-client-create button[type=submit]'
}, },
clientDescriptor: {
moreMenu: 'vn-client-descriptor vn-icon-button[icon=more_vert]',
simpleTicketButton: '.vn-menu [name="simpleTicket"]'
},
clientBasicData: { clientBasicData: {
name: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.name"]', name: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.name"]',
contact: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.contact"]', contact: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.contact"]',
@ -231,23 +227,6 @@ export default {
saveButton: 'button[type=submit]', saveButton: 'button[type=submit]',
watcher: 'vn-client-fiscal-data vn-watcher' watcher: 'vn-client-fiscal-data vn-watcher'
}, },
clientBillingData: {
payMethod: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.payMethodFk"]',
IBAN: 'vn-client-billing-data vn-textfield[ng-model="$ctrl.client.iban"]',
dueDay: 'vn-client-billing-data vn-input-number[ng-model="$ctrl.client.dueDay"]',
receivedCoreLCRCheckbox: 'vn-client-billing-data vn-check[label="Received LCR"]',
receivedCoreVNLCheckbox: 'vn-client-billing-data vn-check[label="Received core VNL"]',
receivedB2BVNLCheckbox: 'vn-client-billing-data vn-check[label="Received B2B VNL"]',
swiftBic: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.bankEntityFk"]',
newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button',
newBankEntityName: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.data.name"]',
newBankEntityBIC: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.data.bic"]',
newBankEntityCountry: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.data.countryFk"]',
newBankEntityCode: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.data.id"]',
acceptBankEntityButton: '.vn-dialog.shown button[response="accept"]',
saveButton: 'vn-client-billing-data button[type=submit]',
watcher: 'vn-client-billing-data vn-watcher'
},
clientAddresses: { clientAddresses: {
addressesButton: 'vn-left-menu a[ui-sref="client.card.address.index"]', addressesButton: 'vn-left-menu a[ui-sref="client.card.address.index"]',
createAddress: 'vn-client-address-index vn-float-button', createAddress: 'vn-client-address-index vn-float-button',
@ -306,21 +285,6 @@ export default {
clientMandate: { clientMandate: {
firstMandateText: 'vn-client-mandate vn-card vn-table vn-tbody > vn-tr' firstMandateText: 'vn-client-mandate vn-card vn-table vn-tbody > vn-tr'
}, },
clientBalance: {
company: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]',
newPaymentButton: `vn-float-button`,
newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.bankFk"]',
newPaymentAmount: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.amountPaid"]',
newDescription: 'vn-textfield[ng-model="$ctrl.receipt.description"]',
deliveredAmount: '.vn-dialog vn-input-number[ng-model="$ctrl.deliveredAmount"]',
refundAmount: '.vn-dialog vn-input-number[ng-model="$ctrl.amountToReturn"]',
saveButton: '.vn-dialog.shown [response="accept"]',
anyBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr',
firstLineBalance: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)',
firstLineReference: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable',
firstLineReferenceInput: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable > div > field > vn-textfield',
compensationButton: 'vn-client-balance-index vn-icon-button[vn-dialog="send_compensation"]'
},
webPayment: { webPayment: {
confirmFirstPaymentButton: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon-button[icon="done_all"]', confirmFirstPaymentButton: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon-button[icon="done_all"]',
firstPaymentConfirmed: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon[icon="check"]' firstPaymentConfirmed: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon[icon="check"]'
@ -466,10 +430,6 @@ export default {
packingOut: 'vn-input-number[ng-model="$ctrl.item.packingOut"]', packingOut: 'vn-input-number[ng-model="$ctrl.item.packingOut"]',
isActiveCheckbox: 'vn-check[label="Active"]', isActiveCheckbox: 'vn-check[label="Active"]',
priceInKgCheckbox: 'vn-check[label="Price in kg"]', priceInKgCheckbox: 'vn-check[label="Price in kg"]',
newIntrastatButton: 'vn-item-basic-data vn-icon-button[vn-tooltip="New intrastat"] > button',
newIntrastatId: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.newIntrastat.intrastatId"]',
newIntrastatDescription: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newIntrastat.description"]',
acceptIntrastatButton: '.vn-dialog.shown button[response="accept"]',
submitBasicDataButton: `button[type=submit]` submitBasicDataButton: `button[type=submit]`
}, },
itemTags: { itemTags: {
@ -622,13 +582,6 @@ export default {
saveButton: '.vn-dialog.shown [response="accept"]', saveButton: '.vn-dialog.shown [response="accept"]',
expeditionRow: 'vn-ticket-expedition vn-table vn-tbody > vn-tr' expeditionRow: 'vn-ticket-expedition vn-table vn-tbody > vn-tr'
}, },
ticketPackages: {
firstPackage: 'vn-autocomplete[label="Package"]',
firstQuantity: 'vn-ticket-package vn-horizontal:nth-child(1) vn-input-number[ng-model="package.quantity"]',
firstRemovePackageButton: 'vn-icon-button[vn-tooltip="Remove package"]',
addPackageButton: 'vn-icon-button[vn-tooltip="Add package"]',
savePackagesButton: `button[type=submit]`
},
ticketSales: { ticketSales: {
setOk: 'vn-ticket-sale vn-tool-bar > vn-button[label="Ok"] > button', setOk: 'vn-ticket-sale vn-tool-bar > vn-button[label="Ok"] > button',
saleLine: 'vn-table div > vn-tbody > vn-tr vn-check', saleLine: 'vn-table div > vn-tbody > vn-tr vn-check',
@ -873,15 +826,6 @@ export default {
landedDatePicker: 'vn-date-picker[label="Landed"]', landedDatePicker: 'vn-date-picker[label="Landed"]',
createButton: 'button[type=submit]' createButton: 'button[type=submit]'
}, },
orderSummary: {
id: 'vn-order-summary vn-one:nth-child(1) > vn-label-value:nth-child(1) span',
alias: 'vn-order-summary vn-one:nth-child(1) > vn-label-value:nth-child(2) span',
consignee: 'vn-order-summary vn-one:nth-child(2) > vn-label-value:nth-child(6) span',
subtotal: 'vn-order-summary vn-one.taxes > p:nth-child(1)',
vat: 'vn-order-summary vn-one.taxes > p:nth-child(2)',
total: 'vn-order-summary vn-one.taxes > p:nth-child(3)',
sale: 'vn-order-summary vn-tbody > vn-tr',
},
orderCatalog: { orderCatalog: {
plantRealmButton: 'vn-order-catalog > vn-side-menu vn-icon[icon="icon-plant"]', plantRealmButton: 'vn-order-catalog > vn-side-menu vn-icon[icon="icon-plant"]',
type: 'vn-order-catalog vn-autocomplete[data="$ctrl.itemTypes"]', type: 'vn-order-catalog vn-autocomplete[data="$ctrl.itemTypes"]',
@ -899,14 +843,6 @@ export default {
fifthFilterRemoveButton: 'vn-order-catalog > vn-side-menu .chips > vn-chip:nth-child(5) vn-icon[icon=cancel]', fifthFilterRemoveButton: 'vn-order-catalog > vn-side-menu .chips > vn-chip:nth-child(5) vn-icon[icon=cancel]',
sixthFilterRemoveButton: 'vn-order-catalog > vn-side-menu .chips > vn-chip:nth-child(6) vn-icon[icon=cancel]', sixthFilterRemoveButton: 'vn-order-catalog > vn-side-menu .chips > vn-chip:nth-child(6) vn-icon[icon=cancel]',
}, },
orderBasicData: {
client: 'vn-autocomplete[label="Client"]',
address: 'vn-autocomplete[label="Address"]',
agency: 'vn-autocomplete[label="Agency"]',
observation: 'vn-textarea[label="Notes"]',
saveButton: `button[type=submit]`,
acceptButton: '.vn-confirm.shown button[response="accept"]'
},
orderLine: { orderLine: {
orderSubtotal: 'vn-order-line .header :first-child', orderSubtotal: 'vn-order-line .header :first-child',
firstLineDeleteButton: 'vn-order-line vn-tbody > vn-tr:nth-child(1) vn-icon[icon="delete"]', firstLineDeleteButton: 'vn-order-line vn-tbody > vn-tr:nth-child(1) vn-icon[icon="delete"]',
@ -946,16 +882,6 @@ export default {
goToRouteSummaryButton: 'vn-route-summary > vn-card > h5 > a', goToRouteSummaryButton: 'vn-route-summary > vn-card > h5 > a',
}, },
routeBasicData: {
worker: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.workerFk"]',
vehicle: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]',
kmStart: 'vn-route-basic-data vn-input-number[ng-model="$ctrl.route.kmStart"]',
kmEnd: 'vn-route-basic-data vn-input-number[ng-model="$ctrl.route.kmEnd"]',
createdDate: 'vn-route-basic-data vn-date-picker[ng-model="$ctrl.route.created"]',
startedHour: 'vn-route-basic-data vn-input-time[ng-model="$ctrl.route.started"]',
finishedHour: 'vn-route-basic-data vn-input-time[ng-model="$ctrl.route.finished"]',
saveButton: 'vn-route-basic-data button[type=submit]'
},
routeTickets: { routeTickets: {
firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-input-number[ng-model="ticket.priority"]', firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-input-number[ng-model="ticket.priority"]',
firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check', firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check',
@ -1240,22 +1166,6 @@ export default {
confirmed: 'vn-entry-summary vn-check[label="Confirmed"]', confirmed: 'vn-entry-summary vn-check[label="Confirmed"]',
anyBuyLine: 'vn-entry-summary tr.dark-row' anyBuyLine: 'vn-entry-summary tr.dark-row'
}, },
entryBasicData: {
reference: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.reference"]',
invoiceNumber: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.invoiceNumber"]',
notes: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.notes"]',
observations: 'vn-entry-basic-data vn-textarea[ng-model="$ctrl.entry.observation"]',
supplier: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.supplierFk"]',
currency: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.currencyFk"]',
commission: 'vn-entry-basic-data vn-input-number[ng-model="$ctrl.entry.commission"]',
company: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.companyFk"]',
ordered: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isOrdered"]',
confirmed: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isConfirmed"]',
inventory: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isExcludedFromAvailable"]',
raid: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isRaid"]',
booked: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isBooked"]',
save: 'vn-entry-basic-data button[type=submit]',
},
entryDescriptor: { entryDescriptor: {
agency: 'vn-entry-descriptor div.body vn-label-value:nth-child(1) span', agency: 'vn-entry-descriptor div.body vn-label-value:nth-child(1) span',
travelsQuicklink: 'vn-entry-descriptor vn-quick-link[icon="local_airport"] > a', travelsQuicklink: 'vn-entry-descriptor vn-quick-link[icon="local_airport"] > a',

View File

@ -15,81 +15,55 @@ describe('SmartTable SearchBar integration', () => {
await browser.close(); await browser.close();
}); });
describe('as filters in smart-table section', () => { it('should search by type in searchBar, reload page and have same results', async() => {
it('should search by type in searchBar', async() => {
await page.waitToClick(selectors.itemsIndex.openAdvancedSearchButton); await page.waitToClick(selectors.itemsIndex.openAdvancedSearchButton);
await page.autocompleteSearch(selectors.itemsIndex.advancedSearchItemType, 'Anthurium'); await page.autocompleteSearch(selectors.itemsIndex.advancedSearchItemType, 'Anthurium');
await page.waitToClick(selectors.itemsIndex.advancedSearchButton); await page.waitToClick(selectors.itemsIndex.advancedSearchButton);
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 3); await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 3);
});
it('should reload page and have same results', async() => {
await page.reload({ await page.reload({
waitUntil: 'networkidle2' waitUntil: 'networkidle2'
}); });
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 3); await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 3);
});
it('should search by grouping in smartTable', async() => {
await page.waitToClick(selectors.itemsIndex.advancedSmartTableButton); await page.waitToClick(selectors.itemsIndex.advancedSmartTableButton);
await page.write(selectors.itemsIndex.advancedSmartTableGrouping, '1'); await page.write(selectors.itemsIndex.advancedSmartTableGrouping, '1');
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2); await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2);
});
it('should now reload page and have same results', async() => {
await page.reload({ await page.reload({
waitUntil: 'networkidle2' waitUntil: 'networkidle2'
}); });
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2); await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2);
}); });
});
describe('as filters in section without smart-table', () => { it('should filter in section without smart-table and search in searchBar go to zone section', async() => {
it('go to zone section', async() => {
await page.loginAndModule('salesPerson', 'zone'); await page.loginAndModule('salesPerson', 'zone');
await page.waitToClick(selectors.globalItems.searchButton); await page.waitToClick(selectors.globalItems.searchButton);
});
it('should search in searchBar first time', async() => {
await page.doSearch('A'); await page.doSearch('A');
const count = await page.countElement(selectors.zoneIndex.searchResult); const firstCount = await page.countElement(selectors.zoneIndex.searchResult);
expect(count).toEqual(7);
});
it('should search in searchBar second time', async() => {
await page.doSearch('A'); await page.doSearch('A');
const count = await page.countElement(selectors.zoneIndex.searchResult); const secondCount = await page.countElement(selectors.zoneIndex.searchResult);
expect(count).toEqual(7); expect(firstCount).toEqual(7);
expect(secondCount).toEqual(7);
}); });
it('should search in searchBar third time', async() => { it('should order orders by first id and order by last id, reload page and have same order', async() => {
await page.doSearch('A');
const count = await page.countElement(selectors.zoneIndex.searchResult);
expect(count).toEqual(7);
});
});
describe('as orders', () => {
it('should order by first id', async() => {
await page.loginAndModule('developer', 'item'); await page.loginAndModule('developer', 'item');
await page.accessToSection('item.fixedPrice'); await page.accessToSection('item.fixedPrice');
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
await page.waitForTextInField(selectors.itemFixedPrice.firstItemID, '1'); await page.waitForTextInField(selectors.itemFixedPrice.firstItemID, '1');
});
it('should order by last id, reload page and have same order', async() => {
await page.waitToClick(selectors.itemFixedPrice.orderColumnId); await page.waitToClick(selectors.itemFixedPrice.orderColumnId);
await page.reload({ await page.reload({
waitUntil: 'networkidle2' waitUntil: 'networkidle2'
}); });
await page.waitForTextInField(selectors.itemFixedPrice.firstItemID, '13'); await page.waitForTextInField(selectors.itemFixedPrice.firstItemID, '13');
}); });
});
}); });

View File

@ -171,100 +171,40 @@ describe('Client Edit fiscalData path', () => {
expect(result).toEqual('SMASH'); expect(result).toEqual('SMASH');
}); });
it('should confirm the fiscal id have been edited', async() => { it('should confirm the fiscal data have been edited', async() => {
const result = await page.waitToGetProperty(selectors.clientFiscalData.fiscalId, 'value'); const fiscalId = await page.waitToGetProperty(selectors.clientFiscalData.fiscalId, 'value');
const address = await page.waitToGetProperty(selectors.clientFiscalData.address, 'value');
const postcode = await page.waitToGetProperty(selectors.clientFiscalData.postcode, 'value');
const sageTax = await page.waitToGetProperty(selectors.clientFiscalData.sageTax, 'value');
const sageTransaction = await page.waitToGetProperty(selectors.clientFiscalData.sageTransaction, 'value');
const city = await page.waitToGetProperty(selectors.clientFiscalData.city, 'value');
const province = await page.waitToGetProperty(selectors.clientFiscalData.province, 'value');
const country = await page.waitToGetProperty(selectors.clientFiscalData.country, 'value');
const active = await page.checkboxState(selectors.clientFiscalData.activeCheckbox);
const frozen = await page.checkboxState(selectors.clientFiscalData.frozenCheckbox);
const hasToInvoice = await page.checkboxState(selectors.clientFiscalData.hasToInvoiceCheckbox);
const vies = await page.checkboxState(selectors.clientFiscalData.viesCheckbox);
const notifyByMail = await page.checkboxState(selectors.clientFiscalData.notifyByMailCheckbox);
const invoiceByAddress = await page.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
const equalizationTax = await page.checkboxState(selectors.clientFiscalData.equalizationTaxCheckbox);
const verifiedData = await page.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
expect(result).toEqual('94980061C'); expect(fiscalId).toEqual('94980061C');
}); expect(address).toEqual('Somewhere edited');
expect(postcode).toContain('46000');
it('should confirm the address have been edited', async() => { expect(sageTax).toEqual('Operaciones no sujetas');
const result = await page.waitToGetProperty(selectors.clientFiscalData.address, 'value'); expect(sageTransaction).toEqual('Regularización de inversiones');
expect(city).toEqual('Valencia');
expect(result).toEqual('Somewhere edited'); expect(province).toContain('Province one');
}); expect(country).toEqual('España');
expect(active).toBe('unchecked');
it('should confirm the postcode have been edited', async() => { expect(frozen).toBe('checked');
const result = await page.waitToGetProperty(selectors.clientFiscalData.postcode, 'value'); expect(hasToInvoice).toBe('unchecked');
expect(vies).toBe('checked');
expect(result).toContain('46000'); expect(notifyByMail).toBe('unchecked');
}); expect(invoiceByAddress).toBe('checked');
expect(equalizationTax).toBe('unchecked');
it('should confirm the sageTax have been edited', async() => { expect(verifiedData).toBe('checked');
const result = await page.waitToGetProperty(selectors.clientFiscalData.sageTax, 'value');
expect(result).toEqual('Operaciones no sujetas');
});
it('should confirm the sageTransaction have been edited', async() => {
const result = await page.waitToGetProperty(selectors.clientFiscalData.sageTransaction, 'value');
expect(result).toEqual('36: Regularización de inversiones');
});
it('should confirm the city have been autocompleted', async() => {
const result = await page.waitToGetProperty(selectors.clientFiscalData.city, 'value');
expect(result).toEqual('Valencia');
});
it(`should confirm the province have been autocompleted`, async() => {
const result = await page.waitToGetProperty(selectors.clientFiscalData.province, 'value');
expect(result).toContain('Province one');
});
it('should confirm the country have been autocompleted', async() => {
const result = await page.waitToGetProperty(selectors.clientFiscalData.country, 'value');
expect(result).toEqual('España');
});
it('should confirm active checkbox is unchecked', async() => {
const result = await page.checkboxState(selectors.clientFiscalData.activeCheckbox);
expect(result).toBe('unchecked');
});
it('should confirm frozen checkbox is checked', async() => {
const result = await page.checkboxState(selectors.clientFiscalData.frozenCheckbox);
expect(result).toBe('checked');
});
it('should confirm Has to invoice checkbox is unchecked', async() => {
const result = await page.checkboxState(selectors.clientFiscalData.hasToInvoiceCheckbox);
expect(result).toBe('unchecked');
});
it('should confirm Vies checkbox is checked', async() => {
const result = await page.checkboxState(selectors.clientFiscalData.viesCheckbox);
expect(result).toBe('checked');
});
it('should confirm Notify by email checkbox is unchecked', async() => {
const result = await page.checkboxState(selectors.clientFiscalData.notifyByMailCheckbox);
expect(result).toBe('unchecked');
});
it('should confirm invoice by address checkbox is checked', async() => {
const result = await page.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
expect(result).toBe('checked');
});
it('should confirm Equalization tax checkbox is unchecked', async() => {
const result = await page.checkboxState(selectors.clientFiscalData.equalizationTaxCheckbox);
expect(result).toBe('unchecked');
});
it('should confirm Verified data checkbox is checked', async() => {
const result = await page.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
expect(result).toBe('checked');
}); });
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 1 // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 1

View File

@ -1,6 +1,23 @@
import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
const $ = {
payMethod: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.payMethodFk"]',
IBAN: 'vn-client-billing-data vn-textfield[ng-model="$ctrl.client.iban"]',
dueDay: 'vn-client-billing-data vn-input-number[ng-model="$ctrl.client.dueDay"]',
receivedCoreLCRCheckbox: 'vn-client-billing-data vn-check[label="Received LCR"]',
receivedCoreVNLCheckbox: 'vn-client-billing-data vn-check[label="Received core VNL"]',
receivedB2BVNLCheckbox: 'vn-client-billing-data vn-check[label="Received B2B VNL"]',
swiftBic: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.bankEntityFk"]',
newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button',
newBankEntityName: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.data.name"]',
newBankEntityBIC: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.data.bic"]',
newBankEntityCountry: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.data.countryFk"]',
newBankEntityCode: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.data.id"]',
acceptBankEntityButton: '.vn-dialog.shown button[response="accept"]',
saveButton: 'vn-client-billing-data button[type=submit]',
watcher: 'vn-client-billing-data vn-watcher'
};
describe('Client Edit billing data path', () => { describe('Client Edit billing data path', () => {
let browser; let browser;
let page; let page;
@ -17,93 +34,72 @@ describe('Client Edit billing data path', () => {
}); });
it(`should attempt to edit the billing data without an IBAN but fail`, async() => { it(`should attempt to edit the billing data without an IBAN but fail`, async() => {
await page.autocompleteSearch(selectors.clientBillingData.payMethod, 'PayMethod with IBAN'); await page.autocompleteSearch($.payMethod, 'PayMethod with IBAN');
await page.autocompleteSearch(selectors.clientBillingData.swiftBic, 'BBKKESMMMMM'); await page.autocompleteSearch($.swiftBic, 'BBKKESMMMMM');
await page.clearInput(selectors.clientBillingData.dueDay); await page.clearInput($.dueDay);
await page.write(selectors.clientBillingData.dueDay, '60'); await page.write($.dueDay, '60');
await page.waitForTextInField(selectors.clientBillingData.dueDay, '60'); await page.waitForTextInField($.dueDay, '60');
await page.waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox); await page.waitToClick($.receivedCoreLCRCheckbox);
await page.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox); await page.waitToClick($.receivedCoreVNLCheckbox);
await page.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox); await page.waitToClick($.receivedB2BVNLCheckbox);
await page.waitToClick(selectors.clientBillingData.saveButton); await page.waitToClick($.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('That payment method requires an IBAN'); expect(message.text).toContain('That payment method requires an IBAN');
}); });
it(`should create a new BIC code`, async() => { it(`should create a new BIC code`, async() => {
await page.waitToClick(selectors.clientBillingData.newBankEntityButton); await page.waitToClick($.newBankEntityButton);
await page.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank'); await page.write($.newBankEntityName, 'Gotham City Bank');
await page.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT'); await page.write($.newBankEntityBIC, 'GTHMCT');
await page.autocompleteSearch(selectors.clientBillingData.newBankEntityCountry, 'España'); await page.autocompleteSearch($.newBankEntityCountry, 'España');
await page.write(selectors.clientBillingData.newBankEntityCode, '9999'); await page.write($.newBankEntityCode, '9999');
await page.waitToClick(selectors.clientBillingData.acceptBankEntityButton); await page.waitToClick($.acceptBankEntityButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
await page.waitForTextInField(selectors.clientBillingData.swiftBic, 'Gotham City Bank'); await page.waitForTextInField($.swiftBic, 'GTHMCT');
const newcode = await page.waitToGetProperty(selectors.clientBillingData.swiftBic, 'value'); const newcode = await page.waitToGetProperty($.swiftBic, 'value');
expect(newcode).toEqual('GTHMCT Gotham City Bank');
expect(newcode).toEqual('GTHMCT');
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the IBAN pay method was sucessfully saved`, async() => { it(`should confirm the IBAN pay method was sucessfully saved`, async() => {
const payMethod = await page.waitToGetProperty(selectors.clientBillingData.payMethod, 'value'); const payMethod = await page.waitToGetProperty($.payMethod, 'value');
expect(payMethod).toEqual('PayMethod with IBAN'); expect(payMethod).toEqual('PayMethod with IBAN');
}); });
it(`should clear the BIC code field, update the IBAN to see how he BIC code autocompletes`, async() => { it(`should clear the BIC code field, update the IBAN to see how he BIC code autocompletes`, async() => {
await page.write(selectors.clientBillingData.IBAN, 'ES9121000418450200051332'); await page.write($.IBAN, 'ES9121000418450200051332');
await page.keyboard.press('Tab'); await page.keyboard.press('Tab');
await page.keyboard.press('Tab'); await page.keyboard.press('Tab');
await page.waitForTextInField(selectors.clientBillingData.swiftBic, 'caixesbb'); await page.waitForTextInField($.swiftBic, 'caixesbb');
let automaticCode = await page.waitToGetProperty(selectors.clientBillingData.swiftBic, 'value'); let automaticCode = await page.waitToGetProperty($.swiftBic, 'value');
expect(automaticCode).toEqual('CAIXESBB Caixa Bank'); expect(automaticCode).toEqual('CAIXESBB');
}); });
it(`should save the form with all its new data`, async() => { it(`should save the form with all its new data`, async() => {
await page.waitForWatcherData(selectors.clientBillingData.watcher); await page.waitForWatcherData($.watcher);
await page.waitToClick(selectors.clientBillingData.saveButton); await page.waitToClick($.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('Notification sent!'); expect(message.text).toContain('Notification sent!');
}); });
it('should confirm the due day have been edited', async() => { it('should confirm the billing data have been edited', async() => {
const dueDate = await page.waitToGetProperty(selectors.clientBillingData.dueDay, 'value'); const dueDate = await page.waitToGetProperty($.dueDay, 'value');
const IBAN = await page.waitToGetProperty($.IBAN, 'value');
const swiftBic = await page.waitToGetProperty($.swiftBic, 'value');
const receivedCoreLCR = await page.checkboxState($.receivedCoreLCRCheckbox);
const receivedCoreVNL = await page.checkboxState($.receivedCoreVNLCheckbox);
const receivedB2BVNL = await page.checkboxState($.receivedB2BVNLCheckbox);
expect(dueDate).toEqual('60'); expect(dueDate).toEqual('60');
});
it('should confirm the IBAN was saved', async() => {
const IBAN = await page.waitToGetProperty(selectors.clientBillingData.IBAN, 'value');
expect(IBAN).toEqual('ES9121000418450200051332'); expect(IBAN).toEqual('ES9121000418450200051332');
}); expect(swiftBic).toEqual('CAIXESBB');
expect(receivedCoreLCR).toBe('checked');
it('should confirm the swift / BIC code was saved', async() => { expect(receivedCoreVNL).toBe('unchecked');
const code = await page.waitToGetProperty(selectors.clientBillingData.swiftBic, 'value'); expect(receivedB2BVNL).toBe('unchecked');
expect(code).toEqual('CAIXESBB Caixa Bank');
});
it('should confirm Received LCR checkbox is checked', async() => {
const result = await page.checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox);
expect(result).toBe('checked');
});
it('should confirm Received core VNL checkbox is unchecked', async() => {
const result = await page.checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox);
expect(result).toBe('unchecked');
});
it('should confirm Received B2B VNL checkbox is unchecked', async() => {
const result = await page.checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox);
expect(result).toBe('unchecked');
}); });
}); });

View File

@ -5,8 +5,8 @@ const $ = {
userName: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.name"]', userName: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.name"]',
email: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.email"]', email: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.email"]',
saveButton: 'vn-client-web-access button[type=submit]', saveButton: 'vn-client-web-access button[type=submit]',
nameValue: 'vn-client-log .change:nth-child(1) .basic-json:nth-child(1) vn-json-value', nameValue: 'vn-client-log .change:nth-child(1) .basic-json:nth-child(2) vn-json-value',
activeValue: 'vn-client-log .change:nth-child(2) .basic-json:nth-child(2) vn-json-value' activeValue: 'vn-client-log .change:nth-child(2) .basic-json:nth-child(1) vn-json-value'
}; };
describe('Client web access path', () => { describe('Client web access path', () => {

View File

@ -29,19 +29,16 @@ describe('Client Add greuge path', () => {
expect(message.text).toContain('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 and confirm the greuge was added to the list`, async() => {
await page.write(selectors.clientGreuge.amount, '999'); await page.write(selectors.clientGreuge.amount, '999');
await page.waitForTextInField(selectors.clientGreuge.amount, '999'); await page.waitForTextInField(selectors.clientGreuge.amount, '999');
await page.write(selectors.clientGreuge.description, 'new armor for Batman!'); await page.write(selectors.clientGreuge.description, 'new armor for Batman!');
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).toContain('Data saved!');
});
it('should confirm the greuge was added to the list', async() => {
const result = await page.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText'); const result = await page.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText');
expect(message.text).toContain('Data saved!');
expect(result).toContain(999); expect(result).toContain(999);
expect(result).toContain('new armor for Batman!'); expect(result).toContain('new armor for Batman!');
expect(result).toContain('Diff'); expect(result).toContain('Diff');

View File

@ -1,6 +1,17 @@
import selectors from '../../helpers/selectors'; import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
const $ = {
company: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]',
newPaymentButton: `vn-float-button`,
newPayment: '.vn-dialog.shown',
refundAmount: '.vn-dialog.shown [vn-name="amountToReturn"]',
saveButton: '.vn-dialog.shown [response="accept"]',
firstLineBalance: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)',
firstLineReference: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable',
firstLineReferenceInput: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable vn-textfield',
};
describe('Client balance path', () => { describe('Client balance path', () => {
let browser; let browser;
let page; let page;
@ -18,125 +29,100 @@ describe('Client balance path', () => {
it('should now edit the local user config data', async() => { it('should now edit the local user config data', async() => {
await page.waitToClick(selectors.globalItems.userMenuButton); await page.waitToClick(selectors.globalItems.userMenuButton);
await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs'); await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs');
const message = await page.waitForSnackbar(); const companyMessage = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should access to the balance section to check the data shown matches the local settings', async() => {
await page.accessToSection('client.card.balance.index'); await page.accessToSection('client.card.balance.index');
let result = await page.waitToGetProperty(selectors.clientBalance.company, 'value'); const company = await page.getValue($.company);
expect(result).toEqual('CCs');
});
it('should now clear the user local settings', async() => {
await page.waitToClick(selectors.globalItems.userMenuButton); await page.waitToClick(selectors.globalItems.userMenuButton);
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).toContain('Data saved!');
});
it('should reload the section', async() => {
await page.closePopup(); await page.closePopup();
await page.reloadSection('client.card.balance.index'); await page.reloadSection('client.card.balance.index');
expect(companyMessage.isSuccess).toBeTrue();
expect(company).toEqual('CCs');
expect(message.isSuccess).toBeTrue();
}); });
it('should create a new payment that clears the debt', async() => { it('should create a new payment that clears the debt', async() => {
await page.closePopup(); await page.waitToClick($.newPaymentButton);
await page.waitToClick(selectors.clientBalance.newPaymentButton); await page.fillForm($.newPayment, {
await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Cash'); bank: 'Cash',
await page.clearInput(selectors.clientBalance.newDescription); description: 'Description',
await page.write(selectors.clientBalance.newDescription, 'Description'); viewReceipt: false
await page.waitToClick(selectors.clientBalance.saveButton); });
await page.respondToDialog('accept');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!'); expect(message.isSuccess).toBeTrue();
}); });
it('should edit the 1st line reference', async() => { it('should edit the 1st line reference and check data', async() => {
await page.waitToClick(selectors.clientBalance.firstLineReference); await page.waitToClick($.firstLineReference);
await page.write(selectors.clientBalance.firstLineReferenceInput, 'Miscellaneous payment'); await page.write($.firstLineReferenceInput, 'Miscellaneous payment');
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
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() => {
await page.waitForSpinnerLoad(); await page.waitForSpinnerLoad();
let company = await page let company = await page.getValue($.company);
.waitToGetProperty(selectors.clientBalance.company, 'value'); let reference = await page.innerText($.firstLineReference);
let firstBalanceLine = await page.innerText($.firstLineBalance);
let reference = await page
.waitToGetProperty(selectors.clientBalance.firstLineReference, 'innerText');
let firstBalanceLine = await page
.waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText');
expect(message.isSuccess).toBeTrue();
expect(company).toEqual('VNL'); expect(company).toEqual('VNL');
expect(reference).toEqual('Miscellaneous payment'); expect(reference).toEqual('Miscellaneous payment');
expect(firstBalanceLine).toContain('0.00'); expect(firstBalanceLine).toContain('0.00');
}); });
it('should create a new payment and check the cash comparison works correctly', async() => { it('should create a new payment, check the cash comparison works correctly and balance value is -100', async() => {
const amountPaid = '100'; await page.waitToClick($.newPaymentButton);
const cashHanded = '500'; await page.fillForm($.newPayment, {
const expectedRefund = '400'; amountPaid: 100,
description: 'Payment',
await page.waitToClick(selectors.clientBalance.newPaymentButton); deliveredAmount: 500,
await page.write(selectors.clientBalance.newPaymentAmount, amountPaid); viewReceipt: false
await page.clearInput(selectors.clientBalance.newDescription); });
await page.write(selectors.clientBalance.newDescription, 'Payment'); const refund = await page.getValue($.refundAmount);
await page.write(selectors.clientBalance.deliveredAmount, cashHanded); await page.respondToDialog('accept');
const refund = await page.waitToGetProperty(selectors.clientBalance.refundAmount, 'value');
await page.waitToClick(selectors.clientBalance.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(refund).toEqual(expectedRefund); const result = await page.innerText($.firstLineBalance);
expect(message.text).toContain('Data saved!');
});
it('should check the balance value is now -100', async() => {
let result = await page
.waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText');
expect(refund).toEqual('400');
expect(message.isSuccess).toBeTrue();
expect(result).toContain('-€100.00'); expect(result).toContain('-€100.00');
}); });
it('should create a new payment and check the cash exceeded the maximum', async() => { it('should create a new payment and check the cash exceeded the maximum', async() => {
const amountPaid = '1001'; await page.waitToClick($.newPaymentButton);
await page.fillForm($.newPayment, {
await page.closePopup(); bank: 'Cash',
await page.waitToClick(selectors.clientBalance.newPaymentButton); amountPaid: 1001,
await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Cash'); description: 'Payment'
await page.write(selectors.clientBalance.newPaymentAmount, amountPaid); });
await page.clearInput(selectors.clientBalance.newDescription); await page.waitToClick($.saveButton);
await page.write(selectors.clientBalance.newDescription, 'Payment');
await page.waitToClick(selectors.clientBalance.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('Amount exceeded'); expect(message.text).toContain('Amount exceeded');
}); });
it('should create a new payment that sets the balance back to the original negative value', async() => { it('should create a new payment that sets the balance back to negative value and check it', async() => {
await page.closePopup(); await page.closePopup();
await page.waitToClick(selectors.clientBalance.newPaymentButton); await page.waitToClick($.newPaymentButton);
await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt');
await page.overwrite(selectors.clientBalance.newPaymentAmount, '-150'); await page.fillForm($.newPayment, {
await page.clearInput(selectors.clientBalance.newDescription); bank: 'Pay on receipt',
await page.write(selectors.clientBalance.newDescription, 'Description'); amountPaid: -150,
await page.waitToClick(selectors.clientBalance.saveButton); description: 'Description'
});
await page.respondToDialog('accept');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!'); const result = await page.innerText($.firstLineBalance);
});
it('should check balance is now 50', async() => {
let result = await page
.waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText');
expect(message.isSuccess).toBeTrue();
expect(result).toEqual('€50.00'); expect(result).toEqual('€50.00');
}); });
@ -149,12 +135,9 @@ describe('Client balance path', () => {
await page.waitForState('client.index'); await page.waitForState('client.index');
}); });
it('should now search for the user Petter Parker', async() => { it('should now search for the user Petter Parker not check the payment button is not present', async() => {
await page.accessToSearchResult('Petter Parker'); await page.accessToSearchResult('Petter Parker');
await page.accessToSection('client.card.balance.index'); await page.accessToSection('client.card.balance.index');
}); await page.waitForSelector($.newPaymentButton, {hidden: true});
it('should not be able to click the new payment button as it isnt present', async() => {
await page.waitForSelector(selectors.clientBalance.newPaymentButton, {hidden: true});
}); });
}); });

View File

@ -1,6 +1,11 @@
import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
const $ = {
company: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]',
compensationButton: 'vn-client-balance-index vn-icon-button[vn-dialog="send_compensation"]',
saveButton: '.vn-dialog.shown [response="accept"]'
};
describe('Client Send balance compensation', () => { describe('Client Send balance compensation', () => {
let browser; let browser;
let page; let page;
@ -17,9 +22,9 @@ describe('Client Send balance compensation', () => {
}); });
it(`should click on send compensation button`, async() => { it(`should click on send compensation button`, async() => {
await page.autocompleteSearch(selectors.clientBalance.company, 'VNL'); await page.autocompleteSearch($.company, 'VNL');
await page.waitToClick(selectors.clientBalance.compensationButton); await page.waitToClick($.compensationButton);
await page.waitToClick(selectors.clientBalance.saveButton); await page.waitToClick($.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('Notification sent!'); expect(message.text).toContain('Notification sent!');

View File

@ -1,14 +1,23 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
const $ = {
form: 'vn-item-basic-data form',
intrastatForm: '.vn-dialog.shown form',
newIntrastatButton: 'vn-item-basic-data vn-icon-button[vn-tooltip="New intrastat"] > button'
};
describe('Item Edit basic data path', () => { describe('Item Edit basic data path', () => {
let browser; let browser;
let page; let page;
beforeAll(async() => { beforeAll(async() => {
browser = await getBrowser(); browser = await getBrowser();
page = browser.page; page = browser.page;
await page.loginAndModule('buyer', 'item'); await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Melee weapon combat fist 15cm'); await page.accessToSearchResult('Melee weapon combat fist 15cm');
});
beforeEach(async() => {
await page.accessToSection('item.card.basicData'); await page.accessToSection('item.card.basicData');
}); });
@ -16,124 +25,43 @@ describe('Item Edit basic data path', () => {
await browser.close(); await browser.close();
}); });
it(`should check the descritor edit button is visible for buyer`, async() => { it(`should edit the item basic data and confirm the item data was edited`, async() => {
await page.waitForSelector(selectors.itemDescriptor.editButton, {visible: true}); const values = {
}); name: 'Rose of Purity',
longName: 'RS Rose of Purity',
type: 'Anthurium',
intrastat: 'Coral y materiales similares',
origin: 'Spain',
relevancy: 1,
generic: 'Pallet',
isActive: false,
priceInKg: true,
isFragile: true,
packingOut: 5
};
it(`should edit the item basic data`, async() => { const message = await page.sendForm($.form, values);
await page.clearInput(selectors.itemBasicData.name);
await page.write(selectors.itemBasicData.name, 'Rose of Purity');
await page.clearInput(selectors.itemBasicData.longName);
await page.write(selectors.itemBasicData.longName, 'RS Rose of Purity');
await page.autocompleteSearch(selectors.itemBasicData.type, 'Anthurium');
await page.autocompleteSearch(selectors.itemBasicData.intrastat, 'Coral y materiales similares');
await page.autocompleteSearch(selectors.itemBasicData.origin, 'Spain');
await page.clearInput(selectors.itemBasicData.relevancy);
await page.write(selectors.itemBasicData.relevancy, '1');
await page.clearInput(selectors.itemBasicData.generic);
await page.autocompleteSearch(selectors.itemBasicData.generic, '16');
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox);
await page.waitToClick(selectors.itemBasicData.isFragile);
await page.write(selectors.itemBasicData.packingOut, '5');
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should create a new intrastat`, async() => {
await page.waitToClick(selectors.itemBasicData.newIntrastatButton);
await page.write(selectors.itemBasicData.newIntrastatId, '588420239');
await page.write(selectors.itemBasicData.newIntrastatDescription, 'Tropical Flowers');
await page.waitToClick(selectors.itemBasicData.acceptIntrastatButton);
await page.waitForTextInField(selectors.itemBasicData.intrastat, 'Tropical Flowers');
let newcode = await page.waitToGetProperty(selectors.itemBasicData.intrastat, 'value');
expect(newcode).toEqual('588420239 Tropical Flowers');
});
it('should save with the new intrastat', async() => {
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should confirm the item name was edited`, async() => {
await page.reloadSection('item.card.basicData'); await page.reloadSection('item.card.basicData');
const result = await page.waitToGetProperty(selectors.itemBasicData.name, 'value'); const formValues = await page.fetchForm($.form, Object.keys(values));
expect(result).toEqual('Rose of Purity'); expect(message.isSuccess).toBeTrue();
expect(formValues).toEqual(values);
}); });
it(`should confirm the item type was edited`, async() => { it(`should create a new intrastat and save it`, async() => {
const result = await page await page.click($.newIntrastatButton);
.waitToGetProperty(selectors.itemBasicData.type, 'value'); await page.waitForSelector($.intrastatForm);
await page.fillForm($.intrastatForm, {
expect(result).toEqual('Anthurium'); id: '588420239',
description: 'Tropical Flowers'
}); });
await page.respondToDialog('accept');
it(`should confirm the item intrastat was edited`, async() => { const message = await page.sendForm($.form);
const result = await page await page.reloadSection('item.card.basicData');
.waitToGetProperty(selectors.itemBasicData.intrastat, 'value'); const formValues = await page.fetchForm($.form, ['intrastat']);
expect(result).toEqual('588420239 Tropical Flowers'); expect(message.isSuccess).toBeTrue();
}); expect(formValues).toEqual({intrastat: 'Tropical Flowers'});
it(`should confirm the item relevancy was edited`, async() => {
const result = await page
.waitToGetProperty(selectors.itemBasicData.relevancy, 'value');
expect(result).toEqual('1');
});
it(`should confirm the item origin was edited`, async() => {
const result = await page
.waitToGetProperty(selectors.itemBasicData.origin, 'value');
expect(result).toEqual('Spain');
});
it(`should confirm the item generic was edited`, async() => {
const result = await page
.waitToGetProperty(selectors.itemBasicData.generic, 'value');
expect(result).toEqual('16 - Pallet');
});
it(`should confirm the item long name was edited`, async() => {
const result = await page
.waitToGetProperty(selectors.itemBasicData.longName, 'value');
expect(result).toEqual('RS Rose of Purity');
});
it('should confirm isFragile checkbox is unchecked', async() => {
const result = await page
.checkboxState(selectors.itemBasicData.isFragile);
expect(result).toBe('checked');
});
it('should confirm isActive checkbox is unchecked', async() => {
const result = await page
.checkboxState(selectors.itemBasicData.isActiveCheckbox);
expect(result).toBe('unchecked');
});
it('should confirm the priceInKg checkbox is checked', async() => {
const result = await page
.checkboxState(selectors.itemBasicData.priceInKgCheckbox);
expect(result).toBe('checked');
});
it(`should confirm the item packingOut was edited`, async() => {
const result = await page
.waitToGetProperty(selectors.itemBasicData.packingOut, 'value');
expect(result).toEqual('5');
}); });
}); });

View File

@ -53,12 +53,4 @@ describe('Item edit tax path', () => {
expect(firstVatType).toEqual('Reduced VAT'); expect(firstVatType).toEqual('Reduced VAT');
}); });
// # #2680 Undo changes button bugs
xit(`should now click the undo changes button and see the form is restored`, async() => {
await page.waitToClick(selectors.itemTax.undoChangesButton);
const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClass, 'value');
expect(firstVatType).toEqual('General VAT');
});
}); });

View File

@ -1,6 +1,10 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
const $ = {
form: 'vn-item-create form'
};
describe('Item Create', () => { describe('Item Create', () => {
let browser; let browser;
let page; let page;
@ -14,13 +18,6 @@ describe('Item Create', () => {
await browser.close(); await browser.close();
}); });
it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, async() => {
await page.doSearch('Infinity Gauntlet');
const resultsCount = await page.countElement(selectors.itemsIndex.searchResult);
expect(resultsCount).toEqual(0);
});
it('should access to the create item view by clicking the create floating button', async() => { it('should access to the create item view by clicking the create floating button', async() => {
await page.waitToClick(selectors.itemsIndex.createItemButton); await page.waitToClick(selectors.itemsIndex.createItemButton);
await page.waitForState('item.create'); await page.waitForState('item.create');
@ -37,44 +34,32 @@ describe('Item Create', () => {
}); });
it('should throw an error when insert an invalid priority', async() => { it('should throw an error when insert an invalid priority', async() => {
await page.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet'); const values = {
await page.autocompleteSearch(selectors.itemCreateView.type, 'Crisantemo'); name: 'Infinity Gauntlet',
await page.autocompleteSearch(selectors.itemCreateView.intrastat, 'Coral y materiales similares'); type: 'Crisantemo',
await page.autocompleteSearch(selectors.itemCreateView.origin, 'Holand'); intrastat: 'Coral y materiales similares',
await page.clearInput(selectors.itemCreateView.priority); origin: 'Holand',
await page.waitToClick(selectors.itemCreateView.createButton); priority: null
const message = await page.waitForSnackbar(); };
const message = await page.sendForm($.form, values);
expect(message.text).toContain('Valid priorities'); expect(message.text).toContain('Valid priorities');
}); });
it('should create the Infinity Gauntlet item', async() => { it('should create the Infinity Gauntlet item', async() => {
await page.autocompleteSearch(selectors.itemCreateView.priority, '2'); const values = {
await page.waitToClick(selectors.itemCreateView.createButton); name: 'Infinity Gauntlet',
const message = await page.waitForSnackbar(); type: 'Crisantemo',
intrastat: 'Coral y materiales similares',
origin: 'Holand',
priority: '2'
};
expect(message.text).toContain('Data saved!'); await page.fillForm($.form, values);
}); const formValues = await page.fetchForm($.form, Object.keys(values));
const message = await page.sendForm($.form);
it('should confirm Infinity Gauntlet item was created', async() => { expect(message.isSuccess).toBeTrue();
let result = await page expect(formValues).toEqual(values);
.waitToGetProperty(selectors.itemBasicData.name, 'value');
expect(result).toEqual('Infinity Gauntlet');
result = await page
.waitToGetProperty(selectors.itemBasicData.type, 'value');
expect(result).toEqual('Crisantemo');
result = await page
.waitToGetProperty(selectors.itemBasicData.intrastat, 'value');
expect(result).toEqual('5080000 Coral y materiales similares');
result = await page
.waitToGetProperty(selectors.itemBasicData.origin, 'value');
expect(result).toEqual('Holand');
}); });
}); });

View File

@ -1,6 +1,8 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
const $ = selectors.itemFixedPrice;
describe('Item fixed prices path', () => { describe('Item fixed prices path', () => {
let browser; let browser;
let page; let page;
@ -22,63 +24,63 @@ describe('Item fixed prices path', () => {
}); });
it('should filter using all the fields', async() => { it('should filter using all the fields', async() => {
await page.write(selectors.itemFixedPrice.generalSearchFilter, 'item'); await page.write($.generalSearchFilter, 'item');
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
expect(httpRequest).toContain('search=item'); expect(httpRequest).toContain('search=item');
await page.click(selectors.itemFixedPrice.chip); await page.click($.chip);
await page.click(selectors.itemFixedPrice.reignFilter); await page.click($.reignFilter);
expect(httpRequest).toContain('categoryFk'); expect(httpRequest).toContain('categoryFk');
await page.autocompleteSearch(selectors.itemFixedPrice.typeFilter, 'Alstroemeria'); await page.autocompleteSearch($.typeFilter, 'Alstroemeria');
expect(httpRequest).toContain('typeFk'); expect(httpRequest).toContain('typeFk');
await page.click(selectors.itemFixedPrice.chip); await page.click($.chip);
await page.autocompleteSearch(selectors.itemFixedPrice.buyerFilter, 'buyerNick'); await page.autocompleteSearch($.buyerFilter, 'buyerNick');
expect(httpRequest).toContain('buyerFk'); expect(httpRequest).toContain('buyerFk');
await page.click(selectors.itemFixedPrice.chip); await page.click($.chip);
await page.autocompleteSearch(selectors.itemFixedPrice.warehouseFilter, 'Algemesi'); await page.autocompleteSearch($.warehouseFilter, 'Algemesi');
expect(httpRequest).toContain('warehouseFk'); expect(httpRequest).toContain('warehouseFk');
await page.click(selectors.itemFixedPrice.chip); await page.click($.chip);
await page.click(selectors.itemFixedPrice.mineFilter); await page.click($.mineFilter);
expect(httpRequest).toContain('mine=true'); expect(httpRequest).toContain('mine=true');
await page.click(selectors.itemFixedPrice.chip); await page.click($.chip);
await page.click(selectors.itemFixedPrice.hasMinPriceFilter); await page.click($.hasMinPriceFilter);
expect(httpRequest).toContain('hasMinPrice=true'); expect(httpRequest).toContain('hasMinPrice=true');
await page.click(selectors.itemFixedPrice.chip); await page.click($.chip);
await page.click(selectors.itemFixedPrice.addTag); await page.click($.addTag);
await page.autocompleteSearch(selectors.itemFixedPrice.tagFilter, 'Color'); await page.autocompleteSearch($.tagFilter, 'Color');
await page.autocompleteSearch(selectors.itemFixedPrice.tagValueFilter, 'Brown'); await page.autocompleteSearch($.tagValueFilter, 'Brown');
expect(httpRequest).toContain('tags'); expect(httpRequest).toContain('tags');
await page.click(selectors.itemFixedPrice.chip); await page.click($.chip);
}); });
it('should click on the add new fixed price button', async() => { it('should click on the add new fixed price button', async() => {
await page.waitToClick(selectors.itemFixedPrice.add); await page.waitToClick($.add);
await page.waitForSelector(selectors.itemFixedPrice.fourthFixedPrice); await page.waitForSelector($.fourthFixedPrice);
}); });
it('should fill the fixed price data', async() => { it('should fill the fixed price data', async() => {
const now = Date.vnNew(); const now = Date.vnNew();
await page.autocompleteSearch(selectors.itemFixedPrice.fourthWarehouse, 'Warehouse one'); await page.autocompleteSearch($.fourthWarehouse, 'Warehouse one');
await page.writeOnEditableTD(selectors.itemFixedPrice.fourthGroupingPrice, '1'); await page.writeOnEditableTD($.fourthGroupingPrice, '1');
await page.writeOnEditableTD(selectors.itemFixedPrice.fourthPackingPrice, '1'); await page.writeOnEditableTD($.fourthPackingPrice, '1');
await page.write(selectors.itemFixedPrice.fourthMinPrice, '1'); await page.write($.fourthMinPrice, '1');
await page.pickDate(selectors.itemFixedPrice.fourthStarted, now); await page.pickDate($.fourthStarted, now);
await page.pickDate(selectors.itemFixedPrice.fourthEnded, now); await page.pickDate($.fourthEnded, now);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
@ -87,7 +89,7 @@ describe('Item fixed prices path', () => {
it('should reload the section and check the created price has the expected ID', async() => { it('should reload the section and check the created price has the expected ID', async() => {
await page.goto(`http://localhost:5000/#!/item/fixed-price`); await page.goto(`http://localhost:5000/#!/item/fixed-price`);
const result = await page.waitToGetProperty(selectors.itemFixedPrice.fourthItemID, 'value'); const result = await page.waitToGetProperty($.fourthItemID, 'value');
expect(result).toContain('13'); expect(result).toContain('13');
}); });

View File

@ -250,6 +250,7 @@ describe('Ticket Edit sale path', () => {
await page.waitToClick(selectors.ticketSales.moreMenu); await page.waitToClick(selectors.ticketSales.moreMenu);
await page.waitToClick(selectors.ticketSales.moreMenuCreateClaim); await page.waitToClick(selectors.ticketSales.moreMenuCreateClaim);
await page.waitToClick(selectors.globalItems.acceptButton); await page.waitToClick(selectors.globalItems.acceptButton);
await page.waitToClick(selectors.globalItems.acceptButton);
await page.waitForState('claim.card.basicData'); await page.waitForState('claim.card.basicData');
}); });
@ -315,7 +316,7 @@ describe('Ticket Edit sale path', () => {
it('should confirm the transfered quantity is the correct one', async() => { it('should confirm the transfered quantity is the correct one', async() => {
const result = await page.waitToGetProperty(selectors.ticketSales.secondSaleQuantityCell, 'innerText'); const result = await page.waitToGetProperty(selectors.ticketSales.secondSaleQuantityCell, 'innerText');
expect(result).toContain('20'); expect(result).toContain('10');
}); });
it('should go back to the original ticket sales section', async() => { it('should go back to the original ticket sales section', async() => {
@ -424,20 +425,6 @@ describe('Ticket Edit sale path', () => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); });
// tickets no longer update their totals instantly, a task performed ever 5-10 mins does it. disabled this test until it changes.
xit('should update all sales discount', async() => {
await page.closePopup();
await page.waitToClick(selectors.ticketSales.moreMenu);
await page.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount);
await page.waitForSelector(selectors.ticketSales.moreMenuUpdateDiscountInput);
await page.type(selectors.ticketSales.moreMenuUpdateDiscountInput, '100');
await page.keyboard.press('Enter');
await page.waitForTextInElement(selectors.ticketSales.totalImport, '0.00');
const result = await page.waitToGetProperty(selectors.ticketSales.totalImport, 'innerText');
expect(result).toContain('0.00');
});
it('should log in as Production role and go to a target ticket summary', async() => { it('should log in as Production role and go to a target ticket summary', async() => {
await page.loginAndModule('production', 'ticket'); await page.loginAndModule('production', 'ticket');
await page.accessToSearchResult('13'); await page.accessToSearchResult('13');

View File

@ -1,6 +1,13 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
const $ = {
firstPackage: 'vn-autocomplete[label="Package"]',
firstQuantity: 'vn-ticket-package vn-horizontal:nth-child(1) vn-input-number[ng-model="package.quantity"]',
firstRemovePackageButton: 'vn-icon-button[vn-tooltip="Remove package"]',
addPackageButton: 'vn-icon-button[vn-tooltip="Add package"]',
savePackagesButton: `button[type=submit]`
};
describe('Ticket Create packages path', () => { describe('Ticket Create packages path', () => {
let browser; let browser;
let page; let page;
@ -18,19 +25,19 @@ describe('Ticket Create packages path', () => {
}); });
it(`should attempt create a new package but receive an error if package is blank`, async() => { it(`should attempt create a new package but receive an error if package is blank`, async() => {
await page.waitToClick(selectors.ticketPackages.firstRemovePackageButton); await page.waitToClick($.firstRemovePackageButton);
await page.waitToClick(selectors.ticketPackages.addPackageButton); await page.waitToClick($.addPackageButton);
await page.write(selectors.ticketPackages.firstQuantity, '99'); await page.write($.firstQuantity, '99');
await page.waitToClick(selectors.ticketPackages.savePackagesButton); await page.waitToClick($.savePackagesButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('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() => {
await page.clearInput(selectors.ticketPackages.firstQuantity); await page.clearInput($.firstQuantity);
await page.autocompleteSearch(selectors.ticketPackages.firstPackage, 'Container medical box 1m'); await page.autocompleteSearch($.firstPackage, 'Container medical box 1m');
await page.waitToClick(selectors.ticketPackages.savePackagesButton); await page.waitToClick($.savePackagesButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('Some fields are invalid'); expect(message.text).toContain('Some fields are invalid');
@ -40,15 +47,15 @@ describe('Ticket Create packages path', () => {
const result = await page const result = await page
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(`${selector} input`).checkValidity(); return document.querySelector(`${selector} input`).checkValidity();
}, selectors.ticketPackages.firstQuantity); }, $.firstQuantity);
expect(result).toBeTruthy(); expect(result).toBeTruthy();
}); });
it(`should create a new package with correct data`, async() => { it(`should create a new package with correct data`, async() => {
await page.clearInput(selectors.ticketPackages.firstQuantity); await page.clearInput($.firstQuantity);
await page.write(selectors.ticketPackages.firstQuantity, '-99'); await page.write($.firstQuantity, '-99');
await page.waitToClick(selectors.ticketPackages.savePackagesButton); await page.waitToClick($.savePackagesButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
@ -56,15 +63,15 @@ describe('Ticket Create packages path', () => {
it(`should confirm the first select is the expected one`, async() => { it(`should confirm the first select is the expected one`, async() => {
await page.reloadSection('ticket.card.package'); await page.reloadSection('ticket.card.package');
await page.waitForTextInField(selectors.ticketPackages.firstPackage, 'Container medical box 1m'); await page.waitForTextInField($.firstPackage, 'Container medical box 1m');
const result = await page.waitToGetProperty(selectors.ticketPackages.firstPackage, 'value'); const result = await page.waitToGetProperty($.firstPackage, 'value');
expect(result).toEqual('7 : Container medical box 1m'); expect(result).toEqual('Container medical box 1m');
}); });
it(`should confirm quantity is just a number and the string part was ignored by the imput number`, async() => { it(`should confirm quantity is just a number and the string part was ignored by the imput number`, async() => {
await page.waitForTextInField(selectors.ticketPackages.firstQuantity, '-99'); await page.waitForTextInField($.firstQuantity, '-99');
const result = await page.waitToGetProperty(selectors.ticketPackages.firstQuantity, 'value'); const result = await page.waitToGetProperty($.firstQuantity, 'value');
expect(result).toEqual('-99'); expect(result).toEqual('-99');
}); });

View File

@ -1,6 +1,11 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
const $ = {
form: 'vn-ticket-create-card',
moreMenu: 'vn-client-descriptor vn-icon-button[icon=more_vert]',
simpleTicketButton: '.vn-menu [name="simpleTicket"]'
};
describe('Ticket create from client path', () => { describe('Ticket create from client path', () => {
let browser; let browser;
let page; let page;
@ -16,20 +21,17 @@ describe('Ticket create from client path', () => {
await browser.close(); await browser.close();
}); });
it('should click the create simple ticket on the descriptor menu', async() => { it('should create simple ticket and check if the client details are the expected ones', async() => {
await page.waitToClick(selectors.clientDescriptor.moreMenu); await page.waitToClick($.moreMenu);
await page.waitToClick(selectors.clientDescriptor.simpleTicketButton); await page.waitToClick($.simpleTicketButton);
await page.waitForState('ticket.create'); await page.waitForState('ticket.create');
});
it('should check if the client details are the expected ones', async() => { const values = {
const client = await page client: 'Petter Parker',
.waitToGetProperty(selectors.createTicketView.client, 'value'); address: 'Petter Parker'
};
const formValues = await page.fetchForm($.form, Object.keys(values));
const address = await page expect(formValues).toEqual(values);
.waitToGetProperty(selectors.createTicketView.address, 'value');
expect(client).toContain('Petter Parker');
expect(address).toContain('20 Ingram Street');
}); });
}); });

View File

@ -1,5 +1,10 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
const $ = {
newPayment: '.vn-dialog.shown',
anyBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr',
firstLineReference: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable'
};
describe('Ticket index payout path', () => { describe('Ticket index payout path', () => {
let browser; let browser;
@ -8,17 +13,14 @@ describe('Ticket index payout path', () => {
beforeAll(async() => { beforeAll(async() => {
browser = await getBrowser(); browser = await getBrowser();
page = browser.page; page = browser.page;
await page.loginAndModule('administrative', 'ticket');
await page.waitForState('ticket.index');
}); });
afterAll(async() => { afterAll(async() => {
await browser.close(); await browser.close();
}); });
it('should navigate to the ticket index', async() => {
await page.loginAndModule('administrative', 'ticket');
await page.waitForState('ticket.index');
});
it('should check the second ticket from a client and 1 of another', async() => { it('should check the second ticket from a client and 1 of another', async() => {
await page.waitToClick(selectors.globalItems.searchButton); await page.waitToClick(selectors.globalItems.searchButton);
await page.waitToClick(selectors.ticketsIndex.thirdTicketCheckbox); await page.waitToClick(selectors.ticketsIndex.thirdTicketCheckbox);
@ -42,27 +44,27 @@ describe('Ticket index payout path', () => {
await page.waitForSelector(selectors.ticketsIndex.payoutCompany); await page.waitForSelector(selectors.ticketsIndex.payoutCompany);
}); });
it('should fill the company and bank to perform a payout', async() => { it('should fill the company and bank to perform a payout and check a new balance line was entered', async() => {
await page.autocompleteSearch(selectors.ticketsIndex.payoutCompany, 'VNL'); await page.fillForm($.newPayment, {
await page.autocompleteSearch(selectors.ticketsIndex.payoutBank, 'cash'); company: 'VNL',
await page.write(selectors.clientBalance.newPaymentAmount, '100'); bank: 'cash',
await page.write(selectors.ticketsIndex.payoutDescription, 'Payment'); amountPaid: 100,
await page.waitToClick(selectors.ticketsIndex.submitPayout); description: 'Payment',
viewReceipt: false
});
await page.respondToDialog('accept');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should navigate to the client balance section and check a new balance line was entered', async() => {
await page.waitToClick(selectors.globalItems.homeButton); await page.waitToClick(selectors.globalItems.homeButton);
await page.selectModule('client'); await page.selectModule('client');
await page.accessToSearchResult('1101'); await page.accessToSearchResult('1101');
await page.accessToSection('client.card.balance.index'); await page.accessToSection('client.card.balance.index');
await page.waitForSelector(selectors.clientBalance.anyBalanceLine); await page.waitForSelector($.anyBalanceLine);
const count = await page.countElement(selectors.clientBalance.anyBalanceLine); const count = await page.countElement($.anyBalanceLine);
const reference = await page.waitToGetProperty(selectors.clientBalance.firstLineReference, 'innerText'); const reference = await page.innerText($.firstLineReference);
expect(message.isSuccess).toBeTrue();
expect(count).toEqual(4); expect(count).toEqual(4);
expect(reference).toContain('Cash, Albaran: 7, 8Payment'); expect(reference).toContain('Payment');
}); });
}); });

View File

@ -1,7 +1,8 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
describe('Ticket Future path', () => { // 'https:// redmine.verdnatura.es/issues/5642'
xdescribe('Ticket Future path', () => {
let browser; let browser;
let page; let page;
let httpRequest; let httpRequest;
@ -44,95 +45,67 @@ describe('Ticket Future path', () => {
expect(message.text).toContain('originDated is a required argument'); expect(message.text).toContain('originDated is a required argument');
}); });
it('should search with the required data', async() => { // it('should search with the required data', async() => {
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); // await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketFuture.submit); // await page.waitToClick(selectors.ticketFuture.submit);
expect(httpRequest).toBeDefined(); // expect(httpRequest).toBeDefined();
}); // });
it('should search with the origin IPT', async() => { // it('should search with the origin IPT', async() => {
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); // await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.autocompleteSearch(selectors.ticketFuture.ipt, 'H'); // await page.autocompleteSearch(selectors.ticketFuture.ipt, 'H');
await page.waitToClick(selectors.ticketFuture.submit); // await page.waitToClick(selectors.ticketFuture.submit);
expect(httpRequest).toContain('ipt=H'); // expect(httpRequest).toContain('ipt=H');
}); // });
it('should search with the destination IPT', async() => { // it('should search with the destination IPT', async() => {
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); // await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.clearInput(selectors.ticketFuture.ipt); // await page.clearInput(selectors.ticketFuture.ipt);
await page.autocompleteSearch(selectors.ticketFuture.futureIpt, 'H'); // await page.autocompleteSearch(selectors.ticketFuture.futureIpt, 'H');
await page.waitToClick(selectors.ticketFuture.submit); // await page.waitToClick(selectors.ticketFuture.submit);
expect(httpRequest).toContain('futureIpt=H'); // expect(httpRequest).toContain('futureIpt=H');
}); // });
it('should search with the origin grouped state', async() => { // it('should search with the origin grouped state', async() => {
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); // await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.clearInput(selectors.ticketFuture.futureIpt); // await page.clearInput(selectors.ticketFuture.futureIpt);
await page.autocompleteSearch(selectors.ticketFuture.state, 'Free'); // await page.autocompleteSearch(selectors.ticketFuture.state, 'Free');
await page.waitToClick(selectors.ticketFuture.submit); // await page.waitToClick(selectors.ticketFuture.submit);
expect(httpRequest).toContain('state=FREE'); // expect(httpRequest).toContain('state=FREE');
}); // });
it('should search with the destination grouped state', async() => { // it('should search with the destination grouped state', async() => {
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); // await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.clearInput(selectors.ticketFuture.state); // await page.clearInput(selectors.ticketFuture.state);
await page.autocompleteSearch(selectors.ticketFuture.futureState, 'Free'); // await page.autocompleteSearch(selectors.ticketFuture.futureState, 'Free');
await page.waitToClick(selectors.ticketFuture.submit); // await page.waitToClick(selectors.ticketFuture.submit);
expect(httpRequest).toContain('futureState=FREE'); // expect(httpRequest).toContain('futureState=FREE');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); // await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.clearInput(selectors.ticketFuture.futureState); // await page.clearInput(selectors.ticketFuture.futureState);
await page.waitToClick(selectors.ticketFuture.submit); // await page.waitToClick(selectors.ticketFuture.submit);
}); // });
it('should search in smart-table with an ID Origin', async() => { // it('should check the three last tickets and move to the future', async() => {
await page.waitToClick(selectors.ticketFuture.tableButtonSearch); // await page.waitForNumberOfElements(selectors.ticketFuture.searchResult, 4);
await page.write(selectors.ticketFuture.tableId, '1'); // await page.waitToClick(selectors.ticketFuture.multiCheck);
await page.keyboard.press('Enter'); // await page.waitToClick(selectors.ticketFuture.firstCheck);
// await page.waitToClick(selectors.ticketFuture.moveButton);
// await page.waitToClick(selectors.globalItems.acceptButton);
// const message = await page.waitForSnackbar();
expect(httpRequest).toContain('id'); // expect(message.text).toContain('Tickets moved successfully!');
await page.waitToClick(selectors.ticketFuture.tableButtonSearch); // });
});
it('should search in smart-table with an IPT Destination', async() => {
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
await page.autocompleteSearch(selectors.ticketFuture.tableFutureIpt, 'H');
expect(httpRequest).toContain('futureIpt');
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
});
it('should search in smart-table with an ID Destination', async() => {
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
await page.write(selectors.ticketFuture.tableFutureId, '1');
await page.keyboard.press('Enter');
expect(httpRequest).toContain('futureId');
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketFuture.submit);
});
it('should check the three last tickets and move to the future', async() => {
await page.waitForNumberOfElements(selectors.ticketFuture.searchResult, 4);
await page.waitToClick(selectors.ticketFuture.multiCheck);
await page.waitToClick(selectors.ticketFuture.firstCheck);
await page.waitToClick(selectors.ticketFuture.moveButton);
await page.waitToClick(selectors.globalItems.acceptButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Tickets moved successfully!');
});
}); });

View File

@ -1,7 +1,8 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
describe('Ticket Advance path', () => { // 'https:// redmine.verdnatura.es/issues/5642'
xdescribe('Ticket Advance path', () => {
let browser; let browser;
let page; let page;
let httpRequest; let httpRequest;
@ -45,65 +46,43 @@ describe('Ticket Advance path', () => {
expect(message.text).toContain('dateFuture is a required argument'); expect(message.text).toContain('dateFuture is a required argument');
}); });
it('should search with the required data', async() => { // it('should search with the required data', async() => {
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); // await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.submit); // await page.waitToClick(selectors.ticketAdvance.submit);
expect(httpRequest).toBeDefined(); // expect(httpRequest).toBeDefined();
}); // });
it('should search with the origin IPT', async() => { // it('should search with the origin IPT', async() => {
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); // await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'H'); // await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'H');
await page.waitToClick(selectors.ticketAdvance.submit); // await page.waitToClick(selectors.ticketAdvance.submit);
expect(httpRequest).toContain('futureIpt=H'); // expect(httpRequest).toContain('futureIpt=H');
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); // await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.clearInput(selectors.ticketAdvance.futureIpt); // await page.clearInput(selectors.ticketAdvance.futureIpt);
await page.waitToClick(selectors.ticketAdvance.submit); // await page.waitToClick(selectors.ticketAdvance.submit);
}); // });
it('should search with the destination IPT', async() => { // it('should search with the destination IPT', async() => {
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); // await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'H'); // await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'H');
await page.waitToClick(selectors.ticketAdvance.submit); // await page.waitToClick(selectors.ticketAdvance.submit);
expect(httpRequest).toContain('ipt=H'); // expect(httpRequest).toContain('ipt=H');
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); // await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.clearInput(selectors.ticketAdvance.ipt); // await page.clearInput(selectors.ticketAdvance.ipt);
await page.waitToClick(selectors.ticketAdvance.submit); // await page.waitToClick(selectors.ticketAdvance.submit);
}); // });
it('should search in smart-table with an IPT Origin', async() => { // it('should check the first ticket and move to the present', async() => {
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); // await page.waitToClick(selectors.ticketAdvance.firstCheck);
await page.autocompleteSearch(selectors.ticketAdvance.tableFutureIpt, 'V'); // await page.waitToClick(selectors.ticketAdvance.moveButton);
// await page.waitToClick(selectors.ticketAdvance.acceptButton);
// const message = await page.waitForSnackbar();
expect(httpRequest).toContain('futureIpt'); // expect(message.text).toContain('Tickets moved successfully!');
// });
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.submit);
});
it('should search in smart-table with an IPT Destination', async() => {
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
await page.autocompleteSearch(selectors.ticketAdvance.tableIpt, 'V');
expect(httpRequest).toContain('ipt');
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.submit);
});
it('should check the first ticket and move to the present', async() => {
await page.waitToClick(selectors.ticketAdvance.firstCheck);
await page.waitToClick(selectors.ticketAdvance.moveButton);
await page.waitToClick(selectors.ticketAdvance.acceptButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Tickets moved successfully!');
});
}); });

View File

@ -1,6 +1,15 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
const $ = {
id: 'vn-order-summary vn-one:nth-child(1) > vn-label-value:nth-child(1) span',
alias: 'vn-order-summary vn-one:nth-child(1) > vn-label-value:nth-child(2) span',
consignee: 'vn-order-summary vn-one:nth-child(2) > vn-label-value:nth-child(6) span',
subtotal: 'vn-order-summary vn-one.taxes > p:nth-child(1)',
vat: 'vn-order-summary vn-one.taxes > p:nth-child(2)',
total: 'vn-order-summary vn-one.taxes > p:nth-child(3)',
sale: 'vn-order-summary vn-tbody > vn-tr',
};
describe('Order summary path', () => { describe('Order summary path', () => {
let browser; let browser;
let page; let page;
@ -15,49 +24,23 @@ describe('Order summary path', () => {
await browser.close(); await browser.close();
}); });
it('should reach the order summary section', async() => { it('should reach the order summary section and check data', async() => {
await page.waitForState('order.card.summary'); await page.waitForState('order.card.summary');
});
it('should check the summary contains the order id', async() => { const id = await page.innerText($.id);
const result = await page.waitToGetProperty(selectors.orderSummary.id, 'innerText'); const alias = await page.innerText($.alias);
const consignee = await page.innerText($.consignee);
const subtotal = await page.innerText($.subtotal);
const vat = await page.innerText($.vat);
const total = await page.innerText($.total);
const sale = await page.countElement($.sale);
expect(result).toEqual('16'); expect(id).toEqual('16');
}); expect(alias).toEqual('Many places');
expect(consignee).toEqual('address 26 - Gotham (Province one)');
it('should check the summary contains the order alias', async() => { expect(subtotal.length).toBeGreaterThan(1);
const result = await page.waitToGetProperty(selectors.orderSummary.alias, 'innerText'); expect(vat.length).toBeGreaterThan(1);
expect(total.length).toBeGreaterThan(1);
expect(result).toEqual('Many places'); expect(sale).toBeGreaterThan(0);
});
it('should check the summary contains the order consignee', async() => {
const result = await page.waitToGetProperty(selectors.orderSummary.consignee, 'innerText');
expect(result).toEqual('address 26 - Gotham (Province one)');
});
it('should check the summary contains the order subtotal', async() => {
const result = await page.waitToGetProperty(selectors.orderSummary.subtotal, 'innerText');
expect(result.length).toBeGreaterThan(1);
});
it('should check the summary contains the order vat', async() => {
const result = await page.waitToGetProperty(selectors.orderSummary.vat, 'innerText');
expect(result.length).toBeGreaterThan(1);
});
it('should check the summary contains the order total', async() => {
const result = await page.waitToGetProperty(selectors.orderSummary.total, 'innerText');
expect(result.length).toBeGreaterThan(1);
});
it('should check the summary contains the order sales', async() => {
const result = await page.countElement(selectors.orderSummary.sale);
expect(result).toBeGreaterThan(0);
}); });
}); });

View File

@ -1,6 +1,13 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
const $ = {
form: 'vn-order-basic-data form',
observation: 'vn-order-basic-data form [vn-name="note"]',
saveButton: `vn-order-basic-data form button[type=submit]`,
acceptButton: '.vn-confirm.shown button[response="accept"]'
};
describe('Order edit basic data path', () => { describe('Order edit basic data path', () => {
let browser; let browser;
let page; let page;
@ -20,90 +27,43 @@ describe('Order edit basic data path', () => {
describe('when confirmed order', () => { describe('when confirmed order', () => {
it('should not be able to change the client', async() => { it('should not be able to change the client', async() => {
await page.autocompleteSearch(selectors.orderBasicData.client, 'Tony Stark'); const message = await page.sendForm($.form, {
await page.autocompleteSearch(selectors.orderBasicData.address, 'Tony Stark'); client: 'Tony Stark',
await page.waitToClick(selectors.orderBasicData.saveButton); address: 'Tony Stark',
const message = await page.waitForSnackbar();
expect(message.text).toContain(`You can't make changes on the basic data of an confirmed order or with rows`);
});
}); });
describe('when order with rows', () => { expect(message.text).toContain(`You can't make changes on the basic data`);
it('should now navigate to order index', async() => {
const orderId = '16';
await page.waitToClick(selectors.orderDescriptor.returnToModuleIndexButton);
await page.waitToClick(selectors.globalItems.acceptButton);
await page.waitForContentLoaded();
await page.accessToSearchResult(orderId);
await page.accessToSection('order.card.basicData');
await page.waitForSelector(selectors.orderBasicData.observation, {visible: true});
await page.waitForState('order.card.basicData');
});
it('should not be able to change anything', async() => {
await page.write(selectors.orderBasicData.observation, 'observation');
await page.waitToClick(selectors.orderBasicData.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain(`You can't make changes on the basic data of an confirmed order or with rows`);
}); });
}); });
describe('when new order', () => { describe('when new order', () => {
it('should navigate to the order index and click the new order button', async() => { it('should create an order and edit its basic data', async() => {
await page.waitToClick(selectors.globalItems.returnToModuleIndexButton); await page.waitToClick(selectors.globalItems.returnToModuleIndexButton);
await page.waitToClick(selectors.orderBasicData.acceptButton); await page.waitToClick($.acceptButton);
await page.waitForContentLoaded(); await page.waitForContentLoaded();
await page.waitToClick(selectors.ordersIndex.createOrderButton); await page.waitToClick(selectors.ordersIndex.createOrderButton);
await page.waitForState('order.create'); await page.waitForState('order.create');
});
it('should now create a new one', async() => {
await page.autocompleteSearch(selectors.createOrderView.client, 'Jessica Jones'); await page.autocompleteSearch(selectors.createOrderView.client, 'Jessica Jones');
await page.pickDate(selectors.createOrderView.landedDatePicker); await page.pickDate(selectors.createOrderView.landedDatePicker);
await page.autocompleteSearch(selectors.createOrderView.agency, 'Other agency'); await page.autocompleteSearch(selectors.createOrderView.agency, 'Other agency');
await page.waitToClick(selectors.createOrderView.createButton); await page.waitToClick(selectors.createOrderView.createButton);
await page.waitForState('order.card.catalog'); await page.waitForState('order.card.catalog');
});
it('should navigate to the basic data section of the new order', async() => {
await page.accessToSection('order.card.basicData'); await page.accessToSection('order.card.basicData');
await page.waitForState('order.card.basicData');
});
it('should be able to modify all the properties', async() => { const values = {
await page.autocompleteSearch(selectors.orderBasicData.client, 'Tony Stark'); client: 'Tony Stark',
await page.autocompleteSearch(selectors.orderBasicData.address, 'Tony Stark'); address: 'Tony Stark',
await page.autocompleteSearch(selectors.orderBasicData.agency, 'Other agency'); agencyMode: 'Other agency'
await page.write(selectors.orderBasicData.observation, 'my observation'); };
await page.waitToClick(selectors.orderBasicData.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!'); const message = await page.sendForm($.form, values);
});
it('should now confirm the client have been edited', async() => {
await page.reloadSection('order.card.basicData'); await page.reloadSection('order.card.basicData');
const result = await page const formValues = await page.fetchForm($.form, Object.keys(values));
.waitToGetProperty(selectors.orderBasicData.client, 'value');
expect(result).toEqual('1104: Tony Stark'); expect(message.isSuccess).toBeTrue();
}); expect(formValues).toEqual(values);
it('should now confirm the agency have been edited', async() => {
const result = await page
.waitToGetProperty(selectors.orderBasicData.agency, 'value');
expect(result).toEqual('Other agency');
});
it('should now confirm the observations have been edited', async() => {
const result = await page
.waitToGetProperty(selectors.orderBasicData.observation, 'value');
expect(result).toEqual('my observation');
}); });
}); });
}); });

View File

@ -1,4 +1,3 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
describe('Route basic Data path', () => { describe('Route basic Data path', () => {
@ -17,47 +16,27 @@ describe('Route basic Data path', () => {
await browser.close(); await browser.close();
}); });
it('should edit the route basic data', async() => { it('should edit the route basic data and confirm the route was edited', async() => {
const nextMonth = Date.vnNew(); const nextMonth = Date.vnNew();
nextMonth.setMonth(nextMonth.getMonth() + 1); nextMonth.setMonth(nextMonth.getMonth() + 1);
nextMonth.setUTCHours(0, 0, 0, 0);
await page.autocompleteSearch(selectors.routeBasicData.worker, 'adminBossNick'); const form = 'vn-route-basic-data form';
await page.autocompleteSearch(selectors.routeBasicData.vehicle, '1111-IMK'); const values = {
await page.pickDate(selectors.routeBasicData.createdDate, nextMonth); worker: 'adminBossNick',
await page.clearInput(selectors.routeBasicData.kmStart); vehicle: '1111-IMK',
await page.write(selectors.routeBasicData.kmStart, '1'); created: nextMonth,
await page.clearInput(selectors.routeBasicData.kmEnd); kmStart: 1,
await page.write(selectors.routeBasicData.kmEnd, '2'); kmEnd: 2,
await page.type(`${selectors.routeBasicData.startedHour} input`, '0800'); started: '08:00',
await page.type(`${selectors.routeBasicData.finishedHour} input`, '1230'); finished: '12:30',
await page.waitToClick(selectors.routeBasicData.saveButton); };
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!'); const message = await page.sendForm(form, values);
});
it('should confirm the worker was edited', async() => {
await page.reloadSection('route.card.basicData'); await page.reloadSection('route.card.basicData');
const worker = await page.waitToGetProperty(selectors.routeBasicData.worker, 'value'); const formValues = await page.fetchForm(form, Object.keys(values));
expect(worker).toEqual('adminBoss - adminBossNick'); expect(message.isSuccess).toBeTrue();
}); expect(formValues).toEqual(values);
it('should confirm the vehicle was edited', async() => {
const vehicle = await page.waitToGetProperty(selectors.routeBasicData.vehicle, 'value');
expect(vehicle).toEqual('1111-IMK');
});
it('should confirm the km start was edited', async() => {
const kmStart = await page.waitToGetProperty(selectors.routeBasicData.kmStart, 'value');
expect(kmStart).toEqual('1');
});
it('should confirm the km end was edited', async() => {
const kmEnd = await page.waitToGetProperty(selectors.routeBasicData.kmEnd, 'value');
expect(kmEnd).toEqual('2');
}); });
}); });

View File

@ -57,11 +57,4 @@ describe('Route tickets path', () => {
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() => {
await page.waitForNumberOfElements(selectors.routeTickets.anyTicket, 0); await page.waitForNumberOfElements(selectors.routeTickets.anyTicket, 0);
}); });
// #2862 updateVolume() route descriptor no actualiza volumen
xit('should confirm the route volume on the descriptor has been updated by the changes made', async() => {
const result = await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
expect(result).toEqual('0 / 50 m³');
});
}); });

View File

@ -17,55 +17,36 @@ describe('InvoiceIn tax path', () => {
await browser.close(); await browser.close();
}); });
it('should add a new tax', async() => { it('should add a new tax and check it', async() => {
await page.waitToClick(selectors.invoiceInTax.addTaxButton); await page.waitToClick(selectors.invoiceInTax.addTaxButton);
await page.autocompleteSearch(selectors.invoiceInTax.thirdExpense, '6210000567'); await page.autocompleteSearch(selectors.invoiceInTax.thirdExpense, '6210000567');
await page.write(selectors.invoiceInTax.thirdTaxableBase, '100'); await page.write(selectors.invoiceInTax.thirdTaxableBase, '100');
await page.autocompleteSearch(selectors.invoiceInTax.thirdTaxType, '6'); await page.autocompleteSearch(selectors.invoiceInTax.thirdTaxType, 'H.P. IVA');
await page.autocompleteSearch(selectors.invoiceInTax.thirdTransactionType, 'Operaciones exentas'); await page.autocompleteSearch(selectors.invoiceInTax.thirdTransactionType, 'Operaciones exentas');
await page.waitToClick(selectors.invoiceInTax.saveButton); await page.waitToClick(selectors.invoiceInTax.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should navigate to the summary and check the taxable base sum is correct', async() => {
await page.waitToClick(selectors.invoiceInDescriptor.summaryIcon); await page.waitToClick(selectors.invoiceInDescriptor.summaryIcon);
await page.waitForState('invoiceIn.card.summary'); await page.waitForState('invoiceIn.card.summary');
const result = await page.waitToGetProperty(selectors.invoiceInSummary.totalTaxableBase, 'innerText'); const total = await page.waitToGetProperty(selectors.invoiceInSummary.totalTaxableBase, 'innerText');
expect(result).toEqual('Taxable base €1,323.16');
});
it('should navigate back to tax section, check the reciently added line contains the expected expense', async() => {
await page.accessToSection('invoiceIn.card.tax'); await page.accessToSection('invoiceIn.card.tax');
const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdExpense, 'value');
expect(result).toEqual('6210000567: Alquiler VNH'); const thirdExpense = await page.waitToGetProperty(selectors.invoiceInTax.thirdExpense, 'value');
}); const thirdTaxableBase = await page.waitToGetProperty(selectors.invoiceInTax.thirdTaxableBase, 'value');
const thirdTaxType = await page.waitToGetProperty(selectors.invoiceInTax.thirdTaxType, 'value');
const thirdTransactionType = await page.waitToGetProperty(selectors.invoiceInTax.thirdTransactionType, 'value');
const thirdRate = await page.waitToGetProperty(selectors.invoiceInTax.thirdRate, 'value');
it('should check the reciently added line contains the expected taxable base', async() => { expect(message.text).toContain('Data saved!');
const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdTaxableBase, 'value');
expect(result).toEqual('100'); expect(total).toEqual('Taxable base €1,323.16');
});
it('should check the reciently added line contains the expected tax type', async() => { expect(thirdExpense).toEqual('6210000567');
const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdTaxType, 'value'); expect(thirdTaxableBase).toEqual('100');
expect(thirdTaxType).toEqual('H.P. IVA 4% CEE');
expect(result).toEqual('6: H.P. IVA 4% CEE'); expect(thirdTransactionType).toEqual('Operaciones exentas');
}); expect(thirdRate).toEqual('€4.00');
it('should check the reciently added line contains the expected transaction type', async() => {
const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdTransactionType, 'value');
expect(result).toEqual('37: Operaciones exentas');
});
it('should check the reciently added line contains the expected rate', async() => {
const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdRate, 'value');
expect(result).toEqual('€4.00');
}); });
it('should delete the added line', async() => { it('should delete the added line', async() => {

View File

@ -15,49 +15,39 @@ describe('InvoiceOut manual invoice path', () => {
await browser.close(); await browser.close();
}); });
it('should open the manual invoice form', async() => { it('should create an invoice from a ticket', async() => {
await page.waitToClick(selectors.invoiceOutIndex.createInvoice); await page.waitToClick(selectors.invoiceOutIndex.createInvoice);
await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm); await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm);
});
it('should create an invoice from a ticket', async() => {
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTicket, '15'); await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTicket, '15');
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional'); await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional');
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national'); await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national');
await page.waitToClick(selectors.invoiceOutIndex.saveInvoice); await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
await page.waitForState('invoiceOut.card.summary');
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should have been redirected to the created invoice summary`, async() => { it(`should create another invoice from a client`, async() => {
await page.waitForState('invoiceOut.card.summary');
});
it(`should navigate back to the invoiceOut index`, async() => {
await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await page.waitForSelector(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.invoiceOutButton); await page.waitToClick(selectors.globalItems.invoiceOutButton);
await page.waitForSelector(selectors.invoiceOutIndex.topbarSearch); await page.waitForSelector(selectors.invoiceOutIndex.topbarSearch);
await page.waitForState('invoiceOut.index'); await page.waitForState('invoiceOut.index');
});
it('should now open the manual invoice form', async() => {
await page.waitToClick(selectors.invoiceOutIndex.createInvoice); await page.waitToClick(selectors.invoiceOutIndex.createInvoice);
await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm); await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm);
});
it('should create an invoice from a client', async() => {
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceClient, 'Max Eisenhardt'); await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceClient, 'Max Eisenhardt');
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional'); await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional');
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national'); await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national');
await page.waitToClick(selectors.invoiceOutIndex.saveInvoice); await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
await page.waitForState('invoiceOut.card.summary');
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should have been redirected to the created invoice summary`, async() => {
await page.waitForState('invoiceOut.card.summary');
});
}); });

View File

@ -18,7 +18,6 @@ describe('InvoiceOut global invoice path', () => {
}); });
let invoicesBeforeOneClient; let invoicesBeforeOneClient;
let invoicesBeforeAllClients;
let now = Date.vnNew(); let now = Date.vnNew();
it('should count the amount of invoices listed before globla invoces are made', async() => { it('should count the amount of invoices listed before globla invoces are made', async() => {
@ -27,13 +26,10 @@ describe('InvoiceOut global invoice path', () => {
expect(invoicesBeforeOneClient).toBeGreaterThanOrEqual(4); expect(invoicesBeforeOneClient).toBeGreaterThanOrEqual(4);
}); });
it('should open the global invoice form', async() => {
await page.accessToSection('invoiceOut.global-invoicing');
});
it('should create a global invoice for charles xavier today', async() => { it('should create a global invoice for charles xavier today', async() => {
await page.accessToSection('invoiceOut.global-invoicing');
await page.waitToClick(selectors.invoiceOutGlobalInvoicing.oneClient); await page.waitToClick(selectors.invoiceOutGlobalInvoicing.oneClient);
await page.autocompleteSearch(selectors.invoiceOutGlobalInvoicing.clientId, '1108'); await page.autocompleteSearch(selectors.invoiceOutGlobalInvoicing.clientId, 'Charles Xavier');
await page.pickDate(selectors.invoiceOutGlobalInvoicing.invoiceDate, now); await page.pickDate(selectors.invoiceOutGlobalInvoicing.invoiceDate, now);
await page.pickDate(selectors.invoiceOutGlobalInvoicing.maxShipped, now); await page.pickDate(selectors.invoiceOutGlobalInvoicing.maxShipped, now);
await page.autocompleteSearch(selectors.invoiceOutGlobalInvoicing.printer, '1'); await page.autocompleteSearch(selectors.invoiceOutGlobalInvoicing.printer, '1');

View File

@ -4,9 +4,6 @@ import getBrowser from '../../helpers/puppeteer';
describe('Travel create path', () => { describe('Travel create path', () => {
let browser; let browser;
let page; let page;
const date = Date.vnNew();
const day = 15;
date.setDate(day);
beforeAll(async() => { beforeAll(async() => {
browser = await getBrowser(); browser = await getBrowser();
@ -18,60 +15,28 @@ describe('Travel create path', () => {
await browser.close(); await browser.close();
}); });
it('should open the create travel form by clicking on the "new" button', async() => { it('should create a new travel and check it was created with the correct data', async() => {
const date = Date.vnNew();
date.setDate(15);
date.setUTCHours(0, 0, 0, 0);
await page.waitToClick(selectors.travelIndex.newTravelButton); await page.waitToClick(selectors.travelIndex.newTravelButton);
await page.waitForState('travel.create'); await page.waitForState('travel.create');
});
it('should fill the reference, agency and ship date then save the form', async() => { const values = {
await page.write(selectors.travelIndex.reference, 'Testing reference'); reference: 'Testing reference',
await page.autocompleteSearch(selectors.travelIndex.agency, 'inhouse pickup'); agencyMode: 'inhouse pickup',
await page.pickDate(selectors.travelIndex.shipDate, date); // this line autocompletes another 3 fields shipped: date,
await page.waitForTimeout(1000); landed: date,
await page.waitToClick(selectors.travelIndex.save); warehouseOut: 'Warehouse One',
warehouseIn: 'Warehouse Five'
};
const message = await page.waitForSnackbar(); const message = await page.sendForm('vn-travel-create form', values);
expect(message.text).toContain('Data saved!');
});
it('should check the user was redirected to the travel basic data upon creation', async() => {
await page.waitForState('travel.card.basicData'); await page.waitForState('travel.card.basicData');
}); const formValues = await page.fetchForm('vn-travel-basic-data form', Object.keys(values));
it('should check the travel was created with the correct reference', async() => { expect(message.isSuccess).toBeTrue();
const reference = await page.waitToGetProperty(selectors.travelBasicData.reference, 'value'); expect(formValues).toEqual(values);
expect(reference).toContain('Testing reference');
});
it('should check the travel was created with the correct agency', async() => {
const agency = await page.waitToGetProperty(selectors.travelBasicData.agency, 'value');
expect(agency).toContain('inhouse pickup');
});
it('should check the travel was created with the correct shiping date', async() => {
const shipDate = await page.waitToGetProperty(selectors.travelBasicData.shippedDate, 'value');
expect(shipDate).toContain(day);
});
it('should check the travel was created with the correct landing date', async() => {
const landingDate = await page.waitToGetProperty(selectors.travelBasicData.deliveryDate, 'value');
expect(landingDate).toContain(day);
});
it('should check the travel was created with the correct warehouseOut', async() => {
const warehouseOut = await page.waitToGetProperty(selectors.travelBasicData.outputWarehouse, 'value');
expect(warehouseOut).toContain('Warehouse One');
});
it('should check the travel was created with the correct warehouseIn', async() => {
const warehouseIn = await page.waitToGetProperty(selectors.travelBasicData.inputWarehouse, 'value');
expect(warehouseIn).toContain('Warehouse Five');
}); });
}); });

View File

@ -42,20 +42,6 @@ describe('Entry lastest buys path', () => {
expect(httpRequests.find(req => req.includes(('typeFk')))).toBeDefined(); expect(httpRequests.find(req => req.includes(('typeFk')))).toBeDefined();
}); });
it('should filter by from date', async() => {
await page.pickDate(selectors.entryLatestBuys.fromInput, new Date());
await page.waitToClick(selectors.entryLatestBuys.chip);
expect(httpRequests.find(req => req.includes(('from')))).toBeDefined();
});
it('should filter by to date', async() => {
await page.pickDate(selectors.entryLatestBuys.toInput, new Date());
await page.waitToClick(selectors.entryLatestBuys.chip);
expect(httpRequests.find(req => req.includes(('to')))).toBeDefined();
});
it('should filter by sales person', async() => { it('should filter by sales person', async() => {
await page.autocompleteSearch(selectors.entryLatestBuys.salesPersonInput, 'buyerNick'); await page.autocompleteSearch(selectors.entryLatestBuys.salesPersonInput, 'buyerNick');
await page.waitToClick(selectors.entryLatestBuys.chip); await page.waitToClick(selectors.entryLatestBuys.chip);

View File

@ -21,8 +21,8 @@ describe('Entry create path', () => {
}); });
it('should fill the form to create a valid entry then redirect to basic Data', async() => { it('should fill the form to create a valid entry then redirect to basic Data', async() => {
await page.autocompleteSearch(selectors.entryIndex.newEntrySupplier, '2'); await page.autocompleteSearch(selectors.entryIndex.newEntrySupplier, 'The farmer');
await page.autocompleteSearch(selectors.entryIndex.newEntryTravel, 'Warehouse Three'); await page.autocompleteSearch(selectors.entryIndex.newEntryTravel, 'Warehouse');
await page.autocompleteSearch(selectors.entryIndex.newEntryCompany, 'ORN'); await page.autocompleteSearch(selectors.entryIndex.newEntryCompany, 'ORN');
await page.waitToClick(selectors.entryIndex.saveNewEntry); await page.waitToClick(selectors.entryIndex.saveNewEntry);

View File

@ -1,6 +1,22 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
const $ = {
reference: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.reference"]',
invoiceNumber: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.invoiceNumber"]',
notes: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.notes"]',
observations: 'vn-entry-basic-data vn-textarea[ng-model="$ctrl.entry.observation"]',
supplier: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.supplierFk"]',
currency: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.currencyFk"]',
commission: 'vn-entry-basic-data vn-input-number[ng-model="$ctrl.entry.commission"]',
company: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.companyFk"]',
ordered: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isOrdered"]',
confirmed: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isConfirmed"]',
inventory: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isExcludedFromAvailable"]',
raid: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isRaid"]',
booked: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isBooked"]',
save: 'vn-entry-basic-data button[type=submit]',
};
describe('Entry basic data path', () => { describe('Entry basic data path', () => {
let browser; let browser;
let page; let page;
@ -17,98 +33,49 @@ describe('Entry basic data path', () => {
await browser.close(); await browser.close();
}); });
it('should edit the basic data', async() => { it('should edit the basic data and confirm the reference was edited', async() => {
await page.write(selectors.entryBasicData.reference, 'new movement 8'); await page.write($.reference, 'new movement 8');
await page.write(selectors.entryBasicData.invoiceNumber, 'new movement 8'); await page.write($.invoiceNumber, 'new movement 8');
await page.write(selectors.entryBasicData.observations, ' edited'); await page.write($.observations, ' edited');
await page.autocompleteSearch(selectors.entryBasicData.supplier, 'Plants nick'); await page.autocompleteSearch($.supplier, 'Plants nick');
await page.autocompleteSearch(selectors.entryBasicData.currency, 'eur'); await page.autocompleteSearch($.currency, 'eur');
await page.clearInput(selectors.entryBasicData.commission); await page.clearInput($.commission);
await page.write(selectors.entryBasicData.commission, '100'); await page.write($.commission, '100');
await page.autocompleteSearch(selectors.entryBasicData.company, 'CCs'); await page.autocompleteSearch($.company, 'CCs');
await page.waitToClick(selectors.entryBasicData.ordered); await page.waitToClick($.ordered);
await page.waitToClick(selectors.entryBasicData.confirmed); await page.waitToClick($.confirmed);
await page.waitToClick(selectors.entryBasicData.inventory); await page.waitToClick($.inventory);
await page.waitToClick(selectors.entryBasicData.raid); await page.waitToClick($.raid);
await page.waitToClick(selectors.entryBasicData.booked); await page.waitToClick($.booked);
await page.waitToClick(selectors.entryBasicData.save); await page.waitToClick($.save);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
await page.reloadSection('entry.card.basicData');
const reference = await page.waitToGetProperty($.reference, 'value');
const supplier = await page.waitToGetProperty($.supplier, 'value');
const invoiceNumber = await page.waitToGetProperty($.invoiceNumber, 'value');
const observations = await page.waitToGetProperty($.observations, 'value');
const currency = await page.waitToGetProperty($.currency, 'value');
const commission = await page.waitToGetProperty($.commission, 'value');
const company = await page.waitToGetProperty($.company, 'value');
const ordered = await page.checkboxState($.ordered);
const confirmed = await page.checkboxState($.confirmed);
const inventory = await page.checkboxState($.inventory);
const raid = await page.checkboxState($.raid);
const booked = await page.checkboxState($.booked);
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
}); expect(reference).toEqual('new movement 8');
expect(supplier).toEqual('Plants nick');
it('should confirm the reference was edited', async() => { expect(invoiceNumber).toEqual('new movement 8');
await page.reloadSection('entry.card.basicData'); expect(observations).toEqual('observation two edited');
const result = await page.waitToGetProperty(selectors.entryBasicData.reference, 'value'); expect(currency).toEqual('EUR');
expect(commission).toEqual('100');
expect(result).toEqual('new movement 8'); expect(company).toEqual('CCs');
}); expect(ordered).toBe('checked');
expect(confirmed).toBe('checked');
it('should confirm the invoiceNumber was edited', async() => { expect(inventory).toBe('checked');
await page.reloadSection('entry.card.basicData'); expect(raid).toBe('checked');
const result = await page.waitToGetProperty(selectors.entryBasicData.invoiceNumber, 'value'); expect(booked).toBe('checked');
expect(result).toEqual('new movement 8');
});
it('should confirm the observation was edited', async() => {
const result = await page.waitToGetProperty(selectors.entryBasicData.observations, 'value');
expect(result).toEqual('observation two edited');
});
it('should confirm the supplier was edited', async() => {
const result = await page.waitToGetProperty(selectors.entryBasicData.supplier, 'value');
expect(result).toEqual('1 - Plants nick');
});
it('should confirm the currency was edited', async() => {
const result = await page.waitToGetProperty(selectors.entryBasicData.currency, 'value');
expect(result).toEqual('EUR');
});
it('should confirm the commission was edited', async() => {
const result = await page.waitToGetProperty(selectors.entryBasicData.commission, 'value');
expect(result).toEqual('100');
});
it('should confirm the company was edited', async() => {
const result = await page.waitToGetProperty(selectors.entryBasicData.company, 'value');
expect(result).toEqual('CCs');
});
it('should confirm ordered was edited', async() => {
const result = await page.checkboxState(selectors.entryBasicData.ordered);
expect(result).toBe('checked');
});
it('should confirm confirmed was edited', async() => {
const result = await page.checkboxState(selectors.entryBasicData.confirmed);
expect(result).toBe('checked');
});
it('should confirm inventory was edited', async() => {
const result = await page.checkboxState(selectors.entryBasicData.inventory);
expect(result).toBe('checked');
});
it('should confirm raid was edited', async() => {
const result = await page.checkboxState(selectors.entryBasicData.raid);
expect(result).toBe('checked');
});
it('should confirm booked was edited', async() => {
const result = await page.checkboxState(selectors.entryBasicData.booked);
expect(result).toBe('checked');
}); });
}); });

View File

@ -86,40 +86,47 @@ describe('Entry import, create and edit buys path', () => {
await page.waitForNumberOfElements(selectors.entryBuys.anyBuyLine, 2); await page.waitForNumberOfElements(selectors.entryBuys.anyBuyLine, 2);
}); });
it('should edit the newest buy', async() => { it('should edit the newest buy and check data', async() => {
await page.clearInput(selectors.entryBuys.secondBuyPackingPrice); await page.clearInput(selectors.entryBuys.secondBuyPackingPrice);
await page.waitForTimeout(250); await page.waitForTimeout(250);
await page.write(selectors.entryBuys.secondBuyPackingPrice, '100'); await page.write(selectors.entryBuys.secondBuyPackingPrice, '100');
await page.keyboard.press('Enter');
await page.waitForSnackbar(); await page.waitForSnackbar();
await page.clearInput(selectors.entryBuys.secondBuyGroupingPrice); await page.clearInput(selectors.entryBuys.secondBuyGroupingPrice);
await page.waitForTimeout(250); await page.waitForTimeout(250);
await page.write(selectors.entryBuys.secondBuyGroupingPrice, '200'); await page.write(selectors.entryBuys.secondBuyGroupingPrice, '200');
await page.keyboard.press('Enter');
await page.waitForSnackbar(); await page.waitForSnackbar();
await page.clearInput(selectors.entryBuys.secondBuyPrice); await page.clearInput(selectors.entryBuys.secondBuyPrice);
await page.waitForTimeout(250); await page.waitForTimeout(250);
await page.write(selectors.entryBuys.secondBuyPrice, '300'); await page.write(selectors.entryBuys.secondBuyPrice, '300');
await page.keyboard.press('Enter');
await page.waitForSnackbar(); await page.waitForSnackbar();
await page.clearInput(selectors.entryBuys.secondBuyGrouping); await page.clearInput(selectors.entryBuys.secondBuyGrouping);
await page.waitForTimeout(250); await page.waitForTimeout(250);
await page.write(selectors.entryBuys.secondBuyGrouping, '400'); await page.write(selectors.entryBuys.secondBuyGrouping, '400');
await page.keyboard.press('Enter');
await page.waitForSnackbar(); await page.waitForSnackbar();
await page.clearInput(selectors.entryBuys.secondBuyPacking); await page.clearInput(selectors.entryBuys.secondBuyPacking);
await page.waitForTimeout(250); await page.waitForTimeout(250);
await page.write(selectors.entryBuys.secondBuyPacking, '500'); await page.write(selectors.entryBuys.secondBuyPacking, '500');
await page.keyboard.press('Enter');
await page.waitForSnackbar(); await page.waitForSnackbar();
await page.clearInput(selectors.entryBuys.secondBuyWeight); await page.clearInput(selectors.entryBuys.secondBuyWeight);
await page.waitForTimeout(250); await page.waitForTimeout(250);
await page.write(selectors.entryBuys.secondBuyWeight, '600'); await page.write(selectors.entryBuys.secondBuyWeight, '600');
await page.keyboard.press('Enter');
await page.waitForSnackbar(); await page.waitForSnackbar();
await page.clearInput(selectors.entryBuys.secondBuyStickers); await page.clearInput(selectors.entryBuys.secondBuyStickers);
await page.waitForTimeout(250); await page.waitForTimeout(250);
await page.write(selectors.entryBuys.secondBuyStickers, '700'); await page.write(selectors.entryBuys.secondBuyStickers, '700');
await page.keyboard.press('Enter');
await page.waitForSnackbar(); await page.waitForSnackbar();
await page.autocompleteSearch(selectors.entryBuys.secondBuyPackage, '94'); await page.autocompleteSearch(selectors.entryBuys.secondBuyPackage, '94');
@ -128,60 +135,28 @@ describe('Entry import, create and edit buys path', () => {
await page.clearInput(selectors.entryBuys.secondBuyQuantity); await page.clearInput(selectors.entryBuys.secondBuyQuantity);
await page.waitForTimeout(250); await page.waitForTimeout(250);
await page.write(selectors.entryBuys.secondBuyQuantity, '800'); await page.write(selectors.entryBuys.secondBuyQuantity, '800');
}); await page.keyboard.press('Enter');
it('should reload the section and check the packing price is as expected', async() => {
await page.reloadSection('entry.card.buy.index'); await page.reloadSection('entry.card.buy.index');
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyPackingPrice, 'value');
expect(result).toEqual('100'); const secondBuyPackingPrice = await page.getValue(selectors.entryBuys.secondBuyPackingPrice);
}); const secondBuyGroupingPrice = await page.getValue(selectors.entryBuys.secondBuyGroupingPrice);
const secondBuyPrice = await page.getValue(selectors.entryBuys.secondBuyPrice);
const secondBuyGrouping = await page.getValue(selectors.entryBuys.secondBuyGrouping);
const secondBuyPacking = await page.getValue(selectors.entryBuys.secondBuyPacking);
const secondBuyWeight = await page.getValue(selectors.entryBuys.secondBuyWeight);
const secondBuyStickers = await page.getValue(selectors.entryBuys.secondBuyStickers);
const secondBuyPackage = await page.getValue(selectors.entryBuys.secondBuyPackage);
const secondBuyQuantity = await page.getValue(selectors.entryBuys.secondBuyQuantity);
it('should reload the section and check the grouping price is as expected', async() => { expect(secondBuyPackingPrice).toEqual('100');
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyGroupingPrice, 'value'); expect(secondBuyGroupingPrice).toEqual('200');
expect(secondBuyPrice).toEqual('300');
expect(result).toEqual('200'); expect(secondBuyGrouping).toEqual('400');
}); expect(secondBuyPacking).toEqual('500');
expect(secondBuyWeight).toEqual('600');
it('should reload the section and check the price is as expected', async() => { expect(secondBuyStickers).toEqual('700');
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyPrice, 'value'); expect(secondBuyPackage).toEqual('94');
expect(secondBuyQuantity).toEqual('800');
expect(result).toEqual('300');
});
it('should reload the section and check the grouping is as expected', async() => {
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyGrouping, 'value');
expect(result).toEqual('400');
});
it('should reload the section and check the packing is as expected', async() => {
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyPacking, 'value');
expect(result).toEqual('500');
});
it('should reload the section and check the weight is as expected', async() => {
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyWeight, 'value');
expect(result).toEqual('600');
});
it('should reload the section and check the stickers are as expected', async() => {
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyStickers, 'value');
expect(result).toEqual('700');
});
it('should reload the section and check the package is as expected', async() => {
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyPackage, 'value');
expect(result).toEqual('94');
});
it('should reload the section and check the quantity is as expected', async() => {
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyQuantity, 'value');
expect(result).toEqual('800');
}); });
}); });

View File

@ -1,20 +1,5 @@
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
const $ = {
saveButton: 'vn-supplier-fiscal-data button[type="submit"]',
};
const $inputs = {
province: 'vn-supplier-fiscal-data [name="province"]',
country: 'vn-supplier-fiscal-data [name="country"]',
postcode: 'vn-supplier-fiscal-data [name="postcode"]',
city: 'vn-supplier-fiscal-data [name="city"]',
socialName: 'vn-supplier-fiscal-data [name="socialName"]',
taxNumber: 'vn-supplier-fiscal-data [name="taxNumber"]',
account: 'vn-supplier-fiscal-data [name="account"]',
sageWithholding: 'vn-supplier-fiscal-data [ng-model="$ctrl.supplier.sageWithholdingFk"]',
sageTaxType: 'vn-supplier-fiscal-data [ng-model="$ctrl.supplier.sageTaxTypeFk"]'
};
describe('Supplier fiscal data path', () => { describe('Supplier fiscal data path', () => {
let browser; let browser;
let page; let page;
@ -32,28 +17,32 @@ describe('Supplier fiscal data path', () => {
it('should attempt to edit the fiscal data and check data is saved', async() => { it('should attempt to edit the fiscal data and check data is saved', async() => {
await page.accessToSection('supplier.card.fiscalData'); await page.accessToSection('supplier.card.fiscalData');
await page.clearInput($inputs.province);
await page.clearInput($inputs.country); const form = 'vn-supplier-fiscal-data form';
await page.clearInput($inputs.postcode); const values = {
await page.overwrite($inputs.city, 'Valencia'); province: null,
await page.overwrite($inputs.socialName, 'Farmer King SL'); country: null,
await page.overwrite($inputs.taxNumber, 'Wrong tax number'); postcode: null,
await page.overwrite($inputs.account, '0123456789'); city: 'Valencia',
await page.autocompleteSearch($inputs.sageWithholding, 'retencion estimacion objetiva'); socialName: 'Farmer King SL',
await page.autocompleteSearch($inputs.sageTaxType, 'operaciones no sujetas'); taxNumber: 'Wrong tax number',
await page.click($.saveButton); account: '0123456789',
const errorMessage = await page.waitForSnackbar(); sageWithholding: 'retencion estimacion objetiva',
await page.overwrite($inputs.taxNumber, '12345678Z'); sageTaxType: 'operaciones no sujetas'
await page.click($.saveButton); };
const successMessage = await page.waitForSnackbar();
const errorMessage = await page.sendForm(form, values);
const message = await page.sendForm(form, {
taxNumber: '12345678Z'
});
await page.reloadSection('supplier.card.fiscalData'); await page.reloadSection('supplier.card.fiscalData');
const values = await page.getValues($inputs); const formValues = await page.fetchForm(form, Object.keys(values));
expect(errorMessage.text).toContain('Invalid Tax number'); expect(errorMessage.text).toContain('Invalid Tax number');
expect(successMessage.type).toBe('success'); expect(message.isSuccess).toBeTrue();
expect(values).toEqual({ expect(formValues).toEqual({
province: 'Province one (España)', province: 'Province one',
country: 'España', country: 'España',
postcode: '46000', postcode: '46000',
city: 'Valencia', city: 'Valencia',

View File

@ -1,5 +1,6 @@
import ngModule from '../../module'; import ngModule from '../../module';
import Component from 'core/lib/component'; import Component from 'core/lib/component';
import {hashToColor} from '../../lib/string';
import './style.scss'; import './style.scss';
/** /**
@ -16,13 +17,8 @@ export default class Avatar extends Component {
this._val = value; this._val = value;
const val = value || ''; const val = value || '';
let hash = 0;
for (let i = 0; i < val.length; i++)
hash += val.charCodeAt(i);
const color = '#' + colors[hash % colors.length];
const el = this.element; const el = this.element;
el.style.backgroundColor = color; el.style.backgroundColor = hashToColor(val);
el.title = val; el.title = val;
} }
} }
@ -35,29 +31,3 @@ ngModule.vnComponent('vnAvatar', {
}, },
transclude: true transclude: true
}); });
const colors = [
'e2553d', // Coral
'FFA07A', // Salmon
'FFDAB9', // Peach
'a17077', // Pink
'bf0e99', // Pink light
'52a500', // Green chartreuse
'00aeae', // Cian
'b754cf', // Purple middle
'8a69cd', // Blue lavender
'1fa8a1', // Green ocean
'DC143C', // Red crimson
'5681cf', // Blue steel
'FF1493', // Ping intense
'02ba02', // Green lime
'1E90FF', // Blue sky
'8B008B', // Purple dark
'cc7000', // Orange bright
'00b5b8', // Turquoise
'8B0000', // Red dark
'008080', // Green bluish
'2F4F4F', // Gray board
'7e7e7e', // Gray
'5d5d5d', // Gray dark
];

View File

@ -7,11 +7,10 @@ export default class DataViewer {
} }
get status() { get status() {
if (this.model)
return this.model.status;
if (this.isLoading) if (this.isLoading)
return 'loading'; return 'loading';
if (this.model)
return this.model.status;
if (!this.data) if (!this.data)
return 'clear'; return 'clear';
if (this.data.length) if (this.data.length)

View File

@ -20,7 +20,7 @@ export default class Field extends FormInput {
super.$onInit(); super.$onInit();
if (this.info) this.classList.add('has-icons'); if (this.info) this.classList.add('has-icons');
this.input.addEventListener('change', event => this.element.addEventListener('change', event =>
this.onChange(event)); this.onChange(event));
} }

View File

@ -2,7 +2,7 @@ import ngModule from '../../module';
import Component from 'core/lib/component'; import Component from 'core/lib/component';
import './style.scss'; import './style.scss';
const maxStrLen = 50; const maxStrLen = 512;
/** /**
* Displays pretty JSON value. * Displays pretty JSON value.
@ -28,6 +28,12 @@ export default class Controller extends Component {
} else { } else {
cssClass = type; cssClass = type;
switch (type) { switch (type) {
case 'number':
if (Number.isInteger(value))
text = value;
else
text = Math.round((value + Number.EPSILON) * 1000) / 1000;
break;
case 'boolean': case 'boolean':
text = value ? '✓' : '✗'; text = value ? '✓' : '✗';
cssClass = value ? 'true' : 'false'; cssClass = value ? 'true' : 'false';

View File

@ -75,5 +75,19 @@ describe('Component vnJsonValue', () => {
expect(el.textContent).toEqual('2050'); expect(el.textContent).toEqual('2050');
expect(el.className).toContain('json-number'); expect(el.className).toContain('json-number');
}); });
it('should display number when value is decimal', () => {
controller.value = 10.1;
expect(el.textContent).toEqual('10.1');
expect(el.className).toContain('json-number');
});
it('should display rounded number when value is decimal with lot of decimals', () => {
controller.value = 10.124323234;
expect(el.textContent).toEqual('10.124');
expect(el.className).toContain('json-number');
});
}); });
}); });

View File

@ -1,3 +1,3 @@
SelectAllRows: Seleccionar las {{rows}} fila(s) SelectAllRows: Seleccionar las {{rows}} fila(s)
All: Se han seleccionado Have been selected: Se han seleccionado
row(s) have been selected.: fila(s). row(s) have been selected.: fila(s).

View File

@ -36,30 +36,6 @@ describe('Component vnPopover', () => {
expect(controller.emit).not.toHaveBeenCalledWith('open'); expect(controller.emit).not.toHaveBeenCalledWith('open');
}); });
// #1615 migrar karma a jest (this doesn't work anymore, needs fixing)
xit(`should check that popover is visible into the screen`, () => {
$parent.css({
backgroundColor: 'red',
position: 'absolute',
width: '50px',
height: '50px',
top: '0',
left: '100px'
});
controller.show($parent[0]);
let rect = controller.popover.getBoundingClientRect();
let style = controller.window.getComputedStyle(controller.element);
expect(style.visibility).toEqual('visible');
expect(style.display).not.toEqual('none');
expect(0).toBeLessThanOrEqual(rect.top);
expect(0).toBeLessThanOrEqual(rect.left);
expect(controller.window.innerHeight).toBeGreaterThan(rect.bottom);
expect(controller.window.innerWidth).toBeGreaterThan(rect.right);
});
}); });
describe('hide()', () => { describe('hide()', () => {

View File

@ -8,18 +8,8 @@ export default class Th {
$element.on('click', () => this.onToggleOrder()); $element.on('click', () => this.onToggleOrder());
} }
/**
* Changes the order if the cell has a field and defaultOrder property
*/
$onInit() { $onInit() {
if (!this.field) return; if (!this.field) return;
if (this.defaultOrder) {
this.order = this.defaultOrder;
this.table.applyOrder(this.field, this.order);
this.updateArrow();
}
this.updateArrow(); this.updateArrow();
} }
@ -82,9 +72,6 @@ ngModule.vnComponent('vnTh', {
template: require('./index.html'), template: require('./index.html'),
transclude: true, transclude: true,
controller: Th, controller: Th,
bindings: {
defaultOrder: '@?'
},
require: { require: {
table: '^^vnTable' table: '^^vnTable'
} }

View File

@ -17,17 +17,6 @@ describe('Component vnTh', () => {
controller.column.setAttribute('field', 'MyField'); controller.column.setAttribute('field', 'MyField');
})); }));
describe('onInit()', () => {
it(`should define controllers order as per defaultOrder then call setOrder()`, () => {
controller.defaultOrder = 'DESC';
jest.spyOn(controller.table, 'setOrder');
controller.$onInit();
expect(controller.order).toEqual('DESC');
expect(controller.table.setOrder).toHaveBeenCalledWith('MyField', 'DESC');
});
});
describe('toggleOrder()', () => { describe('toggleOrder()', () => {
it(`should change the ordenation to DESC (descendant) if it was ASC (ascendant)`, () => { it(`should change the ordenation to DESC (descendant) if it was ASC (ascendant)`, () => {
controller.order = 'ASC'; controller.order = 'ASC';

View File

@ -30,3 +30,39 @@ export function camelToKebab(str) {
export function firstUpper(str) { export function firstUpper(str) {
return str.charAt(0).toUpperCase() + str.substr(1); return str.charAt(0).toUpperCase() + str.substr(1);
} }
export function djb2a(string) {
let hash = 5381;
for (let i = 0; i < string.length; i++)
hash = ((hash << 5) + hash) ^ string.charCodeAt(i);
return hash >>> 0;
}
export function hashToColor(value) {
return '#' + colors[djb2a(value || '') % colors.length];
}
const colors = [
'b5b941', // Yellow
'ae9681', // Peach
'd78767', // Salmon
'cc7000', // Orange bright
'e2553d', // Coral
'8B0000', // Red dark
'de4362', // Red crimson
'FF1493', // Ping intense
'be39a2', // Pink light
'b754cf', // Purple middle
'a87ba8', // Pink
'8a69cd', // Blue lavender
'ab20ab', // Purple dark
'00b5b8', // Turquoise
'1fa8a1', // Green ocean
'5681cf', // Blue steel
'3399fe', // Blue sky
'6d9c3e', // Green chartreuse
'51bb51', // Green lime
'518b8b', // Gray board
'7e7e7e', // Gray
'5d5d5d', // Gray dark
];

View File

@ -38,6 +38,9 @@
.text-overline { .text-overline {
font-size: .8rem; font-size: .8rem;
} }
.text-capitalize {
text-transform: capitalize;
}
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
padding: 0; padding: 0;

View File

@ -10,16 +10,18 @@
</vn-crud-model> </vn-crud-model>
<vn-crud-model <vn-crud-model
url="{{$ctrl.url}}/{{$ctrl.originId}}/models" url="{{$ctrl.url}}/{{$ctrl.originId}}/models"
data="models" data="$ctrl.models"
order="changedModel" order="changedModel"
auto-load="true"> auto-load="true">
</vn-crud-model> </vn-crud-model>
<vn-data-viewer model="model" class="vn-w-md vn-px-sm"> <vn-data-viewer
model="model"
class="vn-w-sm vn-px-sm">
<div class="change vn-mb-sm" ng-repeat="log in $ctrl.logs"> <div class="change vn-mb-sm" ng-repeat="log in $ctrl.logs">
<div class="user-wrapper"> <div class="left">
<vn-avatar class="vn-mt-xs" <vn-avatar class="vn-mt-xs"
ng-class="::{system: !log.user}" ng-class="::{system: !log.user}"
val="{{::log.user ? log.user.nickname : 'System'}}" val="{{::log.user ? log.user.nickname : $ctrl.$t('System')}}"
ng-click="$ctrl.showWorkerDescriptor($event, log)"> ng-click="$ctrl.showWorkerDescriptor($event, log)">
<img <img
ng-if="::log.user.image" ng-if="::log.user.image"
@ -29,61 +31,55 @@
<div class="arrow bg-panel"></div> <div class="arrow bg-panel"></div>
<div class="line"></div> <div class="line"></div>
</div> </div>
<vn-card class="detail vn-pa-sm"> <vn-card class="detail">
<div class="header vn-mb-sm"> <div class="header vn-pa-sm">
<div <div
class="date text-secondary text-caption" class="action-date text-secondary text-caption vn-mr-sm"
title="{{::log.creationDate | date:'dd/MM/yyyy HH:mm'}}"> title="{{::log.creationDate | date:'dd/MM/yyyy HH:mm:ss'}}">
<vn-icon
class="action vn-mr-xs"
ng-class="::$ctrl.actionsClass[log.action]"
icon="{{::$ctrl.actionsIcon[log.action]}}"
translate-attr="::{title: $ctrl.actionsText[log.action]}">
</vn-icon>
{{::$ctrl.relativeDate(log.creationDate)}} {{::$ctrl.relativeDate(log.creationDate)}}
</div> </div>
<span class="chip" ng-class="::$ctrl.actionsClass[log.action]" translate> <div class="action-model">
{{::$ctrl.actionsText[log.action]}}
</span>
</div>
<div
class="model vn-mb-sm"
title="{{::log.changedModelValue}}"
ng-if="::log.changedModel || log.changedModelValue">
<span class="model-name" <span class="model-name"
ng-if="::$ctrl.showModelName" ng-if="::$ctrl.showModelName && log.changedModel"
ng-style="::{backgroundColor: $ctrl.hashToColor(log.changedModel)}"
title="{{::log.changedModel}}"> title="{{::log.changedModel}}">
{{::log.changedModelI18n}} {{::log.changedModelI18n}}
</span> </span>
<span class="model-id"
ng-if="::log.changedModelId">
#{{::log.changedModelId}}
</span>
<span class="model-value">
{{::log.changedModelValue}}
</span>
</div> </div>
<div class="changes" </div>
ng-class="::log.props.length ? 'props' : 'no-props'" <div
vn-id="changes"> class="model vn-pb-sm vn-px-sm"
<vn-icon icon="visibility" title="{{::log.changedModelValue}}"
class="expand-button" ng-if="::log.changedModelId || log.changedModelValue">
ng-click="$ctrl.toggleAttributes(log, changes, true)"> <span class="model-id" ng-if="::log.changedModelId">#{{::log.changedModelId}}</span>
<span class="model-value">{{::log.changedModelValue}}</span>
</div>
<div class="changes vn-pa-sm"
ng-class="{expanded: log.expand}"
ng-if="::log.props.length || log.description">
<vn-icon
icon="expand_more"
translate-attr="{title: 'Details'}"
ng-click="log.expand = !log.expand">
</vn-icon> </vn-icon>
<vn-icon icon="visibility_off"
class="shrink-button"
ng-click="$ctrl.toggleAttributes(log, changes, false)">
</vn-icon>
<div class="changes-wrapper">
<span ng-if="::log.props.length" <span ng-if="::log.props.length"
class="attributes"> class="attributes">
<span ng-if="!log.expand" ng-repeat="prop in ::log.props" <span ng-if="!log.expand" ng-repeat="prop in ::log.props"
class="basic-json"> class="basic-json">
<span class="json-field" <span class="json-field" title="{{::prop.name}}">
title="{{::prop.name}}">
{{::prop.nameI18n}}: {{::prop.nameI18n}}:
</span> </span>
<vn-json-value value="::$ctrl.mainVal(prop, log.action)"></vn-json-value><span ng-if="::!$last">,</span> <vn-json-value value="::$ctrl.mainVal(prop, log.action)"></vn-json-value><span ng-if="::!$last">,</span>
</span> </span>
<div ng-if="log.expand" <div ng-if="log.expand" class="expanded-json">
class="expanded-json">
<div ng-repeat="prop in ::log.props"> <div ng-repeat="prop in ::log.props">
<span class="json-field" <span class="json-field" title="{{::prop.name}}">
title="{{::prop.name}}">
{{::prop.nameI18n}}: {{::prop.nameI18n}}:
</span> </span>
<vn-json-value value="::$ctrl.mainVal(prop, log.action)"></vn-json-value> <vn-json-value value="::$ctrl.mainVal(prop, log.action)"></vn-json-value>
@ -93,16 +89,9 @@
</div> </div>
</div> </div>
</span> </span>
<span ng-if="::!log.props.length" <span ng-if="::!log.props.length" class="description">
class="description">
{{::log.description}} {{::log.description}}
</span> </span>
<span ng-if="::!log.description && !log.props.length"
class="no-changes"
translate>
No changes
</span>
</div>
</vn-card> </vn-card>
</div> </div>
</div> </div>
@ -111,10 +100,6 @@
<form vn-vertical <form vn-vertical
ng-model-options="{updateOn: 'change blur'}" ng-model-options="{updateOn: 'change blur'}"
class="vn-pa-md filter"> class="vn-pa-md filter">
<vn-textfield
label="Name"
ng-model="filter.changedModelValue">
</vn-textfield>
<vn-vertical> <vn-vertical>
<vn-radio <vn-radio
label="All" label="All"
@ -131,7 +116,7 @@
val="system" val="system"
ng-model="filter.who"> ng-model="filter.who">
</vn-radio> </vn-radio>
</div> </vn-vertical>
<vn-autocomplete <vn-autocomplete
ng-show="filter.who != 'system'" ng-show="filter.who != 'system'"
label="User" label="User"
@ -159,24 +144,38 @@
</div> </div>
</tpl-item> </tpl-item>
</vn-autocomplete> </vn-autocomplete>
<vn-textfield
label="Search"
ng-model="filter.search">
<append>
<vn-icon
icon="info_outline"
vn-tooltip="Search by id or concept"
pointer>
</vn-icon>
</append>
</vn-textfield>
<vn-autocomplete <vn-autocomplete
label="Model" label="Entity"
ng-model="filter.changedModel" ng-model="filter.changedModel"
value-field="changedModel" value-field="changedModel"
show-field="changedModel" show-field="changedModelI18n"
data="models"> data="$ctrl.models"
class="changed-model">
</vn-autocomplete> </vn-autocomplete>
<!-- FIXME: Cannot use LIKE with JSON columns
<vn-textfield <vn-textfield
label="Id" label="Changes"
ng-model="filter.changedModelId"> ng-model="filter.changes">
</vn-textfield> </vn-textfield>
-->
<vn-vertical> <vn-vertical>
<vn-check <vn-check
label="Creates" label="Creates"
ng-model="filter.actions.insert"> ng-model="filter.actions.insert">
</vn-check> </vn-check>
<vn-check <vn-check
label="Updates" label="Edits"
ng-model="filter.actions.update"> ng-model="filter.actions.update">
</vn-check> </vn-check>
<vn-check <vn-check
@ -184,10 +183,10 @@
ng-model="filter.actions.delete"> ng-model="filter.actions.delete">
</vn-check> </vn-check>
<vn-check <vn-check
label="Views" label="Accesses"
ng-model="filter.actions.select"> ng-model="filter.actions.select">
</vn-check> </vn-check>
</div> </vn-vertical>
<vn-date-picker <vn-date-picker
label="Date" label="Date"
ng-model="filter.from"> ng-model="filter.from">
@ -196,7 +195,7 @@
label="To" label="To"
ng-model="filter.to"> ng-model="filter.to">
</vn-date-picker> </vn-date-picker>
<vn-button-bar vn-vertical class="vn-mt-sm"> <vn-button-bar vn-vertical>
<vn-button <vn-button
label="Filter" label="Filter"
ng-click="$ctrl.applyFilter(filter)"> ng-click="$ctrl.applyFilter(filter)">

View File

@ -1,5 +1,6 @@
import ngModule from '../../module'; import ngModule from '../../module';
import Section from '../section'; import Section from '../section';
import {hashToColor} from 'core/lib/string';
import './style.scss'; import './style.scss';
const validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/; const validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/;
@ -7,11 +8,12 @@ const validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[
export default class Controller extends Section { export default class Controller extends Section {
constructor($element, $) { constructor($element, $) {
super($element, $); super($element, $);
this.hashToColor = hashToColor;
this.actionsText = { this.actionsText = {
insert: 'Creates', insert: 'Creates',
update: 'Updates', update: 'Edits',
delete: 'Deletes', delete: 'Deletes',
select: 'Views' select: 'Accesses'
}; };
this.actionsClass = { this.actionsClass = {
insert: 'success', insert: 'success',
@ -19,6 +21,12 @@ export default class Controller extends Section {
delete: 'alert', delete: 'alert',
select: 'notice' select: 'notice'
}; };
this.actionsIcon = {
insert: 'add',
update: 'edit',
delete: 'remove',
select: 'visibility'
};
this.filter = { this.filter = {
include: [{ include: [{
relation: 'user', relation: 'user',
@ -55,14 +63,14 @@ export default class Controller extends Section {
set logs(value) { set logs(value) {
this._logs = value; this._logs = value;
if (!this.logs) return; if (!value) return;
const empty = {}; const empty = {};
const validations = window.validations; const validations = window.validations;
for (const log of value) { for (const log of value) {
const oldValues = log.oldInstance || empty; const oldValues = log.oldInstance || empty;
const newValues = log.newInstance || empty; const newValues = log.newInstance || empty;
const locale = validations[log.changedModel]?.locale || empty; const locale = validations[log.changedModel]?.locale || empty;
log.changedModelI18n = locale.name || log.changedModel; log.changedModelI18n = firstUpper(locale.name) || log.changedModel;
let props = Object.keys(oldValues).concat(Object.keys(newValues)); let props = Object.keys(oldValues).concat(Object.keys(newValues));
props = [...new Set(props)]; props = [...new Set(props)];
@ -71,11 +79,27 @@ export default class Controller extends Section {
for (const prop of props) { for (const prop of props) {
log.props.push({ log.props.push({
name: prop, name: prop,
nameI18n: locale.columns?.[prop] || prop, nameI18n: firstUpper(locale.columns?.[prop]) || prop,
old: this.castJsonValue(oldValues[prop]), old: this.castJsonValue(oldValues[prop]),
new: this.castJsonValue(newValues[prop]) new: this.castJsonValue(newValues[prop])
}); });
} }
log.props.sort(
(a, b) => a.nameI18n.localeCompare(b.nameI18n));
}
}
get models() {
return this._models;
}
set models(value) {
this._models = value;
if (!value) return;
for (const model of value) {
const name = model.changedModel;
model.changedModelI18n =
firstUpper(window.validations[name]?.locale?.name) || name;
} }
} }
@ -93,11 +117,6 @@ export default class Controller extends Section {
return action == 'delete' ? prop.old : prop.new; return action == 'delete' ? prop.old : prop.new;
} }
toggleAttributes(log, changesEl, force) {
log.expand = force;
changesEl.classList.toggle('expanded', force);
}
relativeDate(dateVal) { relativeDate(dateVal) {
if (dateVal == null) return ''; if (dateVal == null) return '';
const date = new Date(dateVal); const date = new Date(dateVal);
@ -130,8 +149,17 @@ export default class Controller extends Section {
function getParam(prop, value) { function getParam(prop, value) {
if (value == null || value == '') return null; if (value == null || value == '') return null;
switch (prop) { switch (prop) {
case 'changedModelValue': case 'search':
return {[prop]: {like: `%${value}%`}}; const or = [{changedModelId: value}];
if (!/^[0-9]+$/.test(value))
or.push({changedModelValue: {like: `%${value}%`}});
return {or};
case 'changes':
return {or: [
{oldInstance: {like: `%${value}%`}},
{newInstance: {like: `%${value}%`}},
{description: {like: `%${value}%`}}
]};
case 'who': case 'who':
switch (value) { switch (value) {
case 'all': case 'all':
@ -160,6 +188,9 @@ export default class Controller extends Section {
const to = new Date(value); const to = new Date(value);
to.setHours(23, 59, 59, 999); to.setHours(23, 59, 59, 999);
return {creationDate: {lte: to}}; return {creationDate: {lte: to}};
case 'userFk':
return filter.who != 'system'
? {[prop]: value} : null;
default: default:
return {[prop]: value}; return {[prop]: value};
} }
@ -192,6 +223,10 @@ export default class Controller extends Section {
} }
} }
function firstUpper(str) {
return str && str.charAt(0).toUpperCase() + str.substr(1);
}
ngModule.vnComponent('vnLog', { ngModule.vnComponent('vnLog', {
controller: Controller, controller: Controller,
template: require('./index.html'), template: require('./index.html'),

View File

@ -1,5 +1,8 @@
Date: Fecha Date: Fecha
Model: Modelo Concept: Concepto
Search: Buscar
Search by id or concept: Buscar por identificador o concepto
Entity: Entidad
Action: Acción Action: Acción
Author: Autor Author: Autor
Before: Antes Before: Antes
@ -7,12 +10,12 @@ After: Despues
History: Historial History: Historial
Name: Nombre Name: Nombre
Creates: Crea Creates: Crea
Updates: Actualiza Edits: Modifica
Deletes: Elimina Deletes: Elimina
Views: Visualiza Accesses: Accede
System: Sistema System: Sistema
Details: Detalles
note: nota note: nota
Changes: Cambios Changes: Cambios
No changes: No hay cambios
today: hoy today: hoy
yesterday: ayer yesterday: ayer

View File

@ -1,10 +1,11 @@
@import "variables"; @import "variables";
@import "effects";
vn-log { vn-log {
.change { .change {
display: flex; display: flex;
& > .user-wrapper { & > .left {
position: relative; position: relative;
padding-right: 10px; padding-right: 10px;
@ -34,7 +35,7 @@ vn-log {
bottom: -8px; bottom: -8px;
} }
} }
&:last-child > .user-wrapper > .line { &:last-child > .left > .line {
display: none; display: none;
} }
.detail { .detail {
@ -45,18 +46,41 @@ vn-log {
overflow: hidden; overflow: hidden;
& > .header { & > .header {
display: flex;
justify-content: space-between;
align-items: center;
overflow: hidden;
& > .action-model {
display: inline-flex;
overflow: hidden;
& > .model-name {
display: inline-block;
padding: 2px 5px;
color: $color-font-dark;
border-radius: 8px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
}
}
& > .action-date {
white-space: nowrap;
& > .chip { & > .action {
padding: 2px 4px; display: inline-flex;
border-radius: 4px; align-items: center;
display: inline-block; justify-content: center;
color: $color-font-bg; color: $color-font-bg;
vertical-align: middle;
border-radius: 50%;
width: 24px;
height: 24px;
font-size: 1.4em;
&.notice { &.notice {
background-color: $color-notice-medium; background-color: $color-notice-medium
} }
&.success { &.success {
background-color: $color-success-medium; background-color: $color-success-medium;
@ -68,8 +92,6 @@ vn-log {
background-color: lighten($color-alert, 5%); background-color: lighten($color-alert, 5%);
} }
} }
.date {
float: right;
} }
} }
& > .model { & > .model {
@ -77,16 +99,12 @@ vn-log {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
& > .model-name {
text-transform: capitalize;
}
& > .model-value { & > .model-value {
font-style: italic; font-style: italic;
color: #c7bd2b;
} }
& > .model-id { & > .model-id {
color: $color-font-secondary; color: $color-font-secondary;
font-size: .9em; font-size: .9rem;
} }
} }
} }
@ -94,59 +112,35 @@ vn-log {
.changes { .changes {
overflow: hidden; overflow: hidden;
background-color: rgba(255, 255, 255, .05); background-color: rgba(255, 255, 255, .05);
border-radius: 4px; color: $color-font-light;
color: $color-font-secondary;
transition: max-height 150ms ease-in-out;
max-height: 28px;
position: relative; position: relative;
& > .expand-button,
& > .shrink-button {
display: none;
}
&.props {
padding-right: 24px;
& > .expand-button,
& > .shrink-button {
position: absolute;
top: 6px;
right: 8px;
font-size: inherit;
float: right;
cursor: pointer;
}
& > .expand-button {
display: block;
}
&.expanded {
max-height: 500px;
padding-right: 0;
& > .changes-wrapper {
text-overflow: initial;
white-space: initial;
}
& > .shrink-button {
display: block;
}
& > .expand-button {
display: none;
}
}
}
& > .changes-wrapper {
padding: 4px 6px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
min-height: 34px;
box-sizing: border-box;
& > vn-icon {
@extend %clickable;
float: right;
position: relative;
transition-property: transform, background-color;
transition-duration: 150ms;
margin: -5px;
margin-left: 4px;
padding: 1px;
border-radius: 50%;
}
&.expanded {
text-overflow: initial;
white-space: initial;
& > vn-icon {
transform: rotate(180deg);
}
}
& > .no-changes { & > .no-changes {
font-style: italic; font-style: italic;
} }
.json-field {
text-transform: capitalize;
}
}
} }
} }

View File

@ -33,7 +33,7 @@ export default class Controller {
const newPassword = this.newPassword; const newPassword = this.newPassword;
this.$http.post('users/reset-password', {newPassword}, {headers}) this.$http.post('VnUsers/reset-password', {newPassword}, {headers})
.then(() => { .then(() => {
this.vnApp.showSuccess(this.$translate.instant('Password changed!')); this.vnApp.showSuccess(this.$translate.instant('Password changed!'));
this.$state.go('login'); this.$state.go('login');

View File

@ -170,5 +170,6 @@
"comercialName": "Comercial", "comercialName": "Comercial",
"Added observation": "Added observation", "Added observation": "Added observation",
"Comment added to client": "Comment added to client", "Comment added to client": "Comment added to client",
"This ticket is already a refund": "This ticket is already a refund" "This ticket is already a refund": "This ticket is already a refund",
"A claim with that sale already exists": "A claim with that sale already exists"
} }

View File

@ -0,0 +1,4 @@
name: mail forward
columns:
account: account
forwardTo: forward to

View File

@ -0,0 +1,4 @@
name: reenvio de correo
columns:
account: cuenta
forwardTo: reenviar a

View File

@ -1,4 +1,4 @@
name: mail name: correo electrónico
columns: columns:
id: id id: id
receiver: receptor receiver: receptor

View File

@ -0,0 +1,4 @@
name: subrole
columns:
role: rol
inheritsFrom: inherits

View File

@ -0,0 +1,4 @@
name: subrol
columns:
role: rol
inheritsFrom: hereda

View File

@ -0,0 +1,5 @@
name: role
columns:
id: id
name: name
description: description

View File

@ -0,0 +1,5 @@
name: rol
columns:
id: id
name: nombre
description: descripción

View File

@ -1,4 +1,4 @@
name: account name: user
columns: columns:
id: id id: id
name: name name: name
@ -6,7 +6,7 @@ columns:
nickname: nickname nickname: nickname
lang: lang lang: lang
password: password password: password
bcryptPassword: bcrypt password bcryptPassword: BCRYPT password
active: active active: active
email: email email: email
emailVerified: email verified emailVerified: email verified

View File

@ -1,4 +1,4 @@
name: cuenta name: usuario
columns: columns:
id: id id: id
name: nombre name: nombre
@ -6,12 +6,12 @@ columns:
nickname: apodo nickname: apodo
lang: idioma lang: idioma
password: contraseña password: contraseña
bcryptPassword: contraseña bcrypt bcryptPassword: contraseña BCRYPT
active: activo active: activo
email: email email: correo electrónico
emailVerified: email verificado emailVerified: correo verificado
created: creado created: creado
updated: actualizado updated: actualizado
image: imagen image: imagen
hasGrant: tiene permiso hasGrant: puede delegar
userFk: usuario userFk: usuario

View File

@ -1,4 +1,4 @@
name: claim beginning name: beginning
columns: columns:
id: id id: id
quantity: quantity quantity: quantity

View File

@ -1,4 +1,4 @@
name: comienzo reclamación name: comienzo
columns: columns:
id: id id: id
quantity: cantidad quantity: cantidad

View File

@ -1,4 +1,4 @@
name: claim development name: development
columns: columns:
id: id id: id
claimFk: claim claimFk: claim

View File

@ -1,4 +1,4 @@
name: desarrollo reclamación name: desarrollo
columns: columns:
id: id id: id
claimFk: reclamación claimFk: reclamación

View File

@ -1,4 +1,4 @@
name: claim dms name: document
columns: columns:
dmsFk: dms dmsFk: dms
claimFk: claim claimFk: claim

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