Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2003-adress_validate_uee_members
This commit is contained in:
commit
35e443a112
|
@ -2,8 +2,6 @@
|
|||
{
|
||||
// Carácter predeterminado de final de línea.
|
||||
"files.eol": "\n",
|
||||
"vsicons.presets.angular": false,
|
||||
"eslint.autoFixOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": true
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ const app = require('vn-loopback/server/server');
|
|||
|
||||
describe('dms downloadFile()', () => {
|
||||
let dmsId = 1;
|
||||
|
||||
it('should return a response for an employee with text content-type', async() => {
|
||||
let workerId = 107;
|
||||
let ctx = {req: {accessToken: {userId: workerId}}};
|
||||
|
|
|
@ -109,10 +109,10 @@ proc: BEGIN
|
|||
GROUP BY tc.itemFk, warehouseFk;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, ROUND(tcb.base * LEAST(cr.recobro, 0.25), 3)
|
||||
SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, ROUND(tcb.base * LEAST(cr.priceIncreasing, 0.25), 3)
|
||||
FROM tmp.ticketComponentBase tcb
|
||||
JOIN bi.claims_ratio cr ON cr.Id_Cliente = vClientFk
|
||||
WHERE cr.recobro > 0.009;
|
||||
JOIN claimRatio cr ON cr.clientFk = vClientFk
|
||||
WHERE cr.priceIncreasing > 0.009;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcb.warehouseFk, tcb.itemFk, vManaAutoComponent, ROUND(base * (0.01 + wm.pricesModifierRate), 3) as manaAuto
|
||||
|
@ -147,7 +147,7 @@ proc: BEGIN
|
|||
vGeneralInflationCoefficient
|
||||
* ROUND((
|
||||
i.compression
|
||||
* r.cm3
|
||||
* ic.cm3
|
||||
* IF(am.deliveryMethodFk = 1, (GREATEST(i.density, vMinimumDensityWeight) / vMinimumDensityWeight), 1)
|
||||
* IFNULL((z.price - z.bonus)
|
||||
* 1/*amz.inflation*/ , 50)) / vBoxVolume, 4
|
||||
|
@ -156,8 +156,8 @@ proc: BEGIN
|
|||
JOIN item i ON i.id = tcc.itemFk
|
||||
JOIN zone z ON z.id = vZoneFk
|
||||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
||||
LEFT JOIN bi.rotacion r ON r.warehouse_id = tcc.warehouseFk
|
||||
AND r.Id_Article = tcc.itemFk
|
||||
LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk
|
||||
AND ic.itemFk = tcc.itemFk
|
||||
HAVING cost <> 0;
|
||||
|
||||
IF (SELECT COUNT(*) FROM vn.addressForPackaging WHERE addressFk = vAddressFk) THEN
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
|
||||
DROP procedure IF EXISTS `vn`.`buy_afterUpsert`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`buy_afterUpsert`(vSelf INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Triggered actions when a buy is updated or inserted.
|
||||
*
|
||||
* @param vSelf The buy reference
|
||||
*/
|
||||
DECLARE vEntryFk INT;
|
||||
DECLARE vItemFk INT;
|
||||
DECLARE vStickers INT;
|
||||
DECLARE vPacking INT;
|
||||
DECLARE vWarehouse INT;
|
||||
DECLARE vWarehouseOut INT;
|
||||
DECLARE vIsMerchandise BOOL;
|
||||
DECLARE vIsFeedStock BOOL;
|
||||
DECLARE vLanded DATE;
|
||||
DECLARE vBuyerFk INT;
|
||||
DECLARE vItemName VARCHAR(50);
|
||||
|
||||
SELECT entryFk, itemFk, stickers, packing
|
||||
INTO vEntryFk, vItemFk, vStickers, vPacking
|
||||
FROM buy
|
||||
WHERE id = vSelf;
|
||||
|
||||
SELECT t.warehouseInFk, t.warehouseOutFk, t.landed
|
||||
INTO vWarehouse, vWarehouseOut, vLanded
|
||||
FROM entry e
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
WHERE e.id = vEntryFk;
|
||||
|
||||
SELECT k.merchandise, it.workerFk, i.longName
|
||||
INTO vIsMerchandise, vBuyerFk, vItemName
|
||||
FROM itemCategory k
|
||||
JOIN itemType it ON it.categoryFk = k.id
|
||||
JOIN item i ON i.typeFk = it.id
|
||||
WHERE i.id = vItemFk;
|
||||
|
||||
IF vIsMerchandise THEN
|
||||
REPLACE itemCost SET
|
||||
itemFk = vItemFk,
|
||||
warehouseFk = vWarehouse,
|
||||
cm3 = buy_getUnitVolume(vSelf);
|
||||
END IF;
|
||||
|
||||
SELECT isFeedStock INTO vIsFeedStock
|
||||
FROM warehouse WHERE id = vWarehouseOut AND id <> 13;
|
||||
|
||||
IF vIsFeedStock THEN
|
||||
INSERT IGNORE INTO producer(`name`)
|
||||
SELECT es.company_name
|
||||
FROM buy b
|
||||
JOIN edi.ekt be ON be.id = b.ektFk
|
||||
JOIN edi.supplier es ON es.supplier_id = be.pro
|
||||
WHERE b.id = vSelf;
|
||||
|
||||
IF buy_hasNotifyPassport(vSelf, vItemFk) THEN
|
||||
CALL vn.buy_notifyPassport(vSelf, vItemFk, vStickers, vPacking);
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
-- Aviso al comprador de modificacion de entrada en Barajas
|
||||
IF (SELECT isBuyerToBeEmailed FROM warehouse WHERE id = vWarehouse)
|
||||
AND vLanded = CURDATE()
|
||||
AND vBuyerFk != account.myUserGetId()
|
||||
THEN
|
||||
|
||||
CALL vn.mail_insert(CONCAT(account.userGetNameFromId(vBuyerFk),'@verdnatura.es'),
|
||||
CONCAT(account.myUserGetName(),'@verdnatura.es'),
|
||||
CONCAT('E ',vEntryFk,' Se ha modificado item ', vItemFk, ' ',vItemName),
|
||||
'Este email se ha generado automáticamente');
|
||||
|
||||
END IF;
|
||||
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`clientRisk_update`(vClientId INT, vCompanyId INT, vAmount DECIMAL(10,2))
|
||||
BEGIN
|
||||
IF vAmount IS NOT NULL
|
||||
THEN
|
||||
INSERT INTO clientRisk
|
||||
SET
|
||||
clientFk = vClientId,
|
||||
companyFk = vCompanyId,
|
||||
amount = vAmount
|
||||
ON DUPLICATE KEY UPDATE
|
||||
amount = amount + VALUES(amount);
|
||||
END IF;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE `vn`.`componentType`
|
||||
CHANGE COLUMN `base` `isBase` TINYINT(4) NOT NULL DEFAULT '0' COMMENT 'Marca aquellas series que se utilizan para calcular el precio base de las ventas, a efectos estadisticos' ;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
DROP procedure IF EXISTS `bi`.`customer_risk_update`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `bi`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `bi`.`customer_risk_update`(v_customer INT, v_company INT, v_amount DECIMAL(10,2))
|
||||
BEGIN
|
||||
CALL vn.clientRisk_update(v_customer, v_company, v_amount);
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
|
||||
|
||||
DROP procedure IF EXISTS `vn`.`ticketComponentUpdateSale`;
|
||||
|
||||
DELIMITER $$
|
||||
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticketComponentUpdateSale`(vOption INT)
|
||||
BEGIN
|
||||
/**
|
||||
* A partir de la tabla tmp.sale, crea los Movimientos_componentes
|
||||
* y modifica el campo Preu de la tabla Movimientos
|
||||
*
|
||||
* @param i_option integer tipo de actualizacion
|
||||
* @param table tmp.sale tabla memory con el campo saleFk, warehouseFk
|
||||
**/
|
||||
DECLARE vComponentFk INT;
|
||||
DECLARE vRenewComponents BOOLEAN;
|
||||
DECLARE vKeepPrices BOOLEAN;
|
||||
|
||||
CASE vOption
|
||||
WHEN 1 THEN
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = FALSE;
|
||||
WHEN 2 THEN
|
||||
SET vComponentFk = 17;
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
WHEN 3 THEN
|
||||
SET vComponentFk = 37;
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
WHEN 4 THEN
|
||||
SET vComponentFk = 34;
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
WHEN 5 THEN
|
||||
SET vComponentFk = 35;
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
WHEN 6 THEN
|
||||
SET vComponentFk = 36;
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
WHEN 7 THEN
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.8, 3)
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
AND sc.componentFk NOT IN (28, 29)
|
||||
GROUP BY s.id;
|
||||
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, 29, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.2, 3)
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
AND sc.componentFk NOT IN (28, 29)
|
||||
GROUP BY s.id;
|
||||
|
||||
SET vRenewComponents = FALSE;
|
||||
SET vKeepPrices = FALSE;
|
||||
WHEN 8 THEN
|
||||
DELETE sc.*
|
||||
FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk;
|
||||
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100)), 3)
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id;
|
||||
|
||||
SET vRenewComponents = FALSE;
|
||||
SET vKeepPrices = FALSE;
|
||||
WHEN 9 THEN
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
END CASE;
|
||||
|
||||
IF vRenewComponents THEN
|
||||
DELETE sc.*
|
||||
FROM tmp.sale tmps
|
||||
JOIN saleComponent sc ON sc.saleFk = tmps.saleFk
|
||||
JOIN `component` c ON c.id = sc.componentFk
|
||||
WHERE c.isRenewable;
|
||||
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, tc.componentFk, tc.cost
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
AND sc.componentFk = tc.componentFk
|
||||
LEFT JOIN `component` c ON c.id = tc.componentFk
|
||||
WHERE IF(sc.componentFk IS NULL AND NOT c.isRenewable, FALSE, TRUE);
|
||||
END IF;
|
||||
|
||||
IF vKeepPrices THEN
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, vComponentFk, ROUND((s.price * (100 - s.discount) / 100) - SUM(sc.value), 3) dif
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
WHERE sc.saleFk <> vComponentFk
|
||||
GROUP BY s.id
|
||||
HAVING dif <> 0;
|
||||
ELSE
|
||||
UPDATE sale s
|
||||
JOIN item i on i.id = s.itemFk
|
||||
JOIN itemType it on it.id = i.typeFk
|
||||
JOIN (SELECT SUM(sc.value) sumValue, sc.saleFk
|
||||
FROM saleComponent sc
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
|
||||
GROUP BY sc.saleFk) sc ON sc.saleFk = s.id
|
||||
SET s.price = sumValue
|
||||
WHERE it.code != 'PRT' ;
|
||||
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, 21, ROUND((s.price * (100 - s.discount) / 100) - SUM(value), 3) saleValue
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
WHERE sc.componentFk != 21
|
||||
GROUP BY s.id
|
||||
HAVING ROUND(saleValue, 4) <> 0;
|
||||
END IF;
|
||||
|
||||
UPDATE sale s
|
||||
JOIN (
|
||||
SELECT SUM(sc.value) sumValue, sc.saleFk
|
||||
FROM saleComponent sc
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
|
||||
JOIN `component` c ON c.id = sc.componentFk
|
||||
JOIN componentType ct on ct.id = c.typeFk AND ct.isBase
|
||||
GROUP BY sc.saleFk) sc ON sc.saleFk = s.id
|
||||
SET s.priceFixed = sumValue, s.isPriceFixed = 1;
|
||||
|
||||
DELETE sc.*
|
||||
FROM saleComponent sc
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
|
||||
JOIN sale s on s.id = sc.saleFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
WHERE it.code = 'PRT';
|
||||
|
||||
INSERT INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, 15, s.price
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
JOIN item i ON i.id = s.itemFK
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
WHERE it.code = 'PRT' AND s.price > 0;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
DROP TRIGGER IF EXISTS `vn`.`invoiceOut_afterInsert`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`invoiceOut_afterInsert` AFTER INSERT ON `vn`.`invoiceOut` FOR EACH ROW BEGIN
|
||||
CALL clientRisk_update(NEW.clientFk, NEW.companyFk, NEW.amount);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
||||
DROP TRIGGER IF EXISTS `vn`.`invoiceOut_beforeUpdate`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`invoiceOut_beforeUpdate` BEFORE UPDATE ON `vn`.`invoiceOut` FOR EACH ROW
|
||||
BEGIN
|
||||
CALL clientRisk_update (OLD.clientFk, OLD.companyFk, -OLD.amount);
|
||||
CALL clientRisk_update (NEW.clientFk, NEW.companyFk, NEW.amount);
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
||||
|
||||
DROP TRIGGER IF EXISTS `vn`.`invoiceOut_beforeDelete`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`invoiceOut_beforeDelete` BEFORE DELETE ON `invoiceOut` FOR EACH ROW BEGIN
|
||||
CALL clientRisk_update (OLD.clientFk, OLD.companyFk, -OLD.amount);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,20 @@
|
|||
DROP TRIGGER IF EXISTS `vn`.`receipt_afterInsert`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`receipt_afterInsert` AFTER INSERT ON `receipt` FOR EACH ROW
|
||||
CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid)$$
|
||||
DELIMITER ;
|
||||
DROP TRIGGER IF EXISTS `vn`.`receipt_beforeUpdate`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`receipt_beforeUpdate` BEFORE UPDATE ON `receipt` FOR EACH ROW BEGIN
|
||||
CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid);
|
||||
CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
DROP TRIGGER IF EXISTS `vn`.`receipt_beforeDelete`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`receipt_beforeDelete` BEFORE DELETE ON `receipt` FOR EACH ROW
|
||||
CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid)$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,12 @@
|
|||
CREATE
|
||||
OR REPLACE ALGORITHM = UNDEFINED
|
||||
DEFINER = `root`@`%`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `bi`.`tarifa_componentes_series` AS
|
||||
SELECT
|
||||
`ct`.`id` AS `tarifa_componentes_series_id`,
|
||||
`ct`.`type` AS `Serie`,
|
||||
`ct`.`isBase` AS `base`,
|
||||
`ct`.`isMargin` AS `margen`
|
||||
FROM
|
||||
`vn`.`componentType` `ct`;
|
File diff suppressed because one or more lines are too long
|
@ -125,6 +125,13 @@ INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`,
|
|||
(1, 'Pay on receipt', '0000000000', 4, 0, 1, 1),
|
||||
(2, 'Cash', '1111111111', 1, 0, 1, 1);
|
||||
|
||||
INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
|
||||
VALUES
|
||||
(1, 'AGENCY', 'Agencia'),
|
||||
(2, 'DELIVERY', 'Reparto'),
|
||||
(3, 'PICKUP', 'Recogida'),
|
||||
(4, 'OTHER', 'Otros');
|
||||
|
||||
INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `isVolumetric`, `bankFk`, `warehouseAliasFk`)
|
||||
VALUES
|
||||
(1, 'inhouse pickup' , 1, 0, 1, 1),
|
||||
|
@ -460,21 +467,21 @@ INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaF
|
|||
('T', 'Española rapida', 1, 'NATIONAL', 0),
|
||||
('V', 'Intracomunitaria global', 0, 'CEE', 1);
|
||||
|
||||
INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, `price`, `bonus`)
|
||||
INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, `price`, `bonus`, `m3Max`)
|
||||
VALUES
|
||||
(1, 'Zone pickup A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0),
|
||||
(2, 'Zone pickup B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0),
|
||||
(3, 'Zone 247 A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 7, 1, 2, 0),
|
||||
(4, 'Zone 247 B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 7, 1, 2, 0),
|
||||
(5, 'Zone expensive A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 8, 1, 1000, 0),
|
||||
(6, 'Zone expensive B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 8, 1, 1000, 0),
|
||||
(7, 'Zone refund', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 23, 0, 0, 0),
|
||||
(8, 'Zone others', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 10, 0, 0, 0),
|
||||
(9, 'Zone superMan', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 0, 0, 0),
|
||||
(10, 'Zone teleportation', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 3, 0, 0, 0),
|
||||
(11, 'Zone pickup C', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0),
|
||||
(12, 'Zone entanglement', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 4, 0, 0, 0),
|
||||
(13, 'Zone quantum break', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 5, 0, 0, 0);
|
||||
(1, 'Zone pickup A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0, 30.50),
|
||||
(2, 'Zone pickup B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0, 30.50),
|
||||
(3, 'Zone 247 A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 7, 1, 2, 0, 40.50),
|
||||
(4, 'Zone 247 B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 7, 1, 2, 0, 40.50),
|
||||
(5, 'Zone expensive A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 8, 1, 1000, 0, 50.50),
|
||||
(6, 'Zone expensive B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 8, 1, 1000, 0, 50.50),
|
||||
(7, 'Zone refund', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 23, 0, 0, 0, 60.50),
|
||||
(8, 'Zone others', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 10, 0, 0, 0, 60.50),
|
||||
(9, 'Zone superMan', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 0, 0, 0, NULL),
|
||||
(10, 'Zone teleportation', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 3, 0, 0, 0, NULL),
|
||||
(11, 'Zone pickup C', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0, NULL),
|
||||
(12, 'Zone entanglement', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 4, 0, 0, 0, NULL),
|
||||
(13, 'Zone quantum break', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 5, 0, 0, 0, NULL);
|
||||
|
||||
INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`)
|
||||
VALUES
|
||||
|
@ -1166,13 +1173,6 @@ INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`package
|
|||
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 7.30, 7.00, 0.00, NULL, 0, 1, 0, CURDATE()),
|
||||
(15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, CURDATE());
|
||||
|
||||
INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
|
||||
VALUES
|
||||
(1, 'AGENCY', 'Agencia'),
|
||||
(2, 'DELIVERY', 'Reparto'),
|
||||
(3, 'PICKUP', 'Recogida'),
|
||||
(4, 'OTHER', 'Otros');
|
||||
|
||||
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`, `date_make`, `first_row_stamp`, `confirm_date`)
|
||||
VALUES
|
||||
(1, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 3, 1, 121, 442, NULL, 'TPV', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||
|
@ -1880,12 +1880,12 @@ INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `dated`)
|
|||
(8, 'day', DATE_ADD(CURDATE(), INTERVAL +5 DAY)),
|
||||
(8, 'day', DATE_ADD(CURDATE(), INTERVAL +6 DAY));
|
||||
|
||||
INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `order`, `manual`, `direction`)
|
||||
INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`)
|
||||
VALUES
|
||||
(106, CONCAT(CURDATE(), ' 07:00'), 1, TRUE, 'in'),
|
||||
(106, CONCAT(CURDATE(), ' 10:00'), 2, TRUE, 'middle'),
|
||||
(106, CONCAT(CURDATE(), ' 10:10'), 3, TRUE, 'middle'),
|
||||
(106, CONCAT(CURDATE(), ' 15:00'), 4, TRUE, 'out');
|
||||
(106, CONCAT(CURDATE(), ' 07:00'), TRUE, 'in'),
|
||||
(106, CONCAT(CURDATE(), ' 10:00'), TRUE, 'middle'),
|
||||
(106, CONCAT(CURDATE(), ' 10:10'), TRUE, 'middle'),
|
||||
(106, CONCAT(CURDATE(), ' 15:00'), TRUE, 'out');
|
||||
|
||||
INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `code`)
|
||||
VALUES
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -49,13 +49,8 @@ TABLES=(
|
|||
state
|
||||
sample
|
||||
department
|
||||
)
|
||||
dump_tables ${TABLES[@]}
|
||||
|
||||
TABLES=(
|
||||
bi
|
||||
tarifa_componentes
|
||||
tarifa_componentes_series
|
||||
component
|
||||
componentType
|
||||
)
|
||||
dump_tables ${TABLES[@]}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
SCHEMAS=(
|
||||
account
|
||||
bi
|
||||
bs
|
||||
cache
|
||||
edi
|
||||
|
|
|
@ -48,7 +48,7 @@ describe('buyUltimate()', () => {
|
|||
expect(buyUltimateTable[1].buyFk).toEqual(4);
|
||||
expect(buyUltimateTable[0].buyFk).toEqual(3);
|
||||
expect(buyUltimateTable[2].buyFk).toEqual(5);
|
||||
expect(buyUltimateTable[3].buyFk).toEqual(8);
|
||||
expect(buyUltimateTable[3].buyFk).toEqual(9);
|
||||
expect(buyUltimateTable[4].buyFk).toEqual(6);
|
||||
expect(buyUltimateTable[5].buyFk).toEqual(7);
|
||||
});
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/* eslint no-invalid-this: "off" */
|
||||
|
||||
import Nightmare from 'nightmare';
|
||||
import {URL} from 'url';
|
||||
import config from './config.js';
|
||||
|
||||
let currentUser;
|
||||
import {url as defaultURL} from './config';
|
||||
|
||||
let actions = {
|
||||
clickIfExists: async function(selector) {
|
||||
let exists = await this.exists(selector);
|
||||
if (exists) await this.click(selector);
|
||||
let exists;
|
||||
try {
|
||||
exists = await this.waitForSelector(selector, {timeout: 500});
|
||||
} catch (error) {
|
||||
exists = false;
|
||||
}
|
||||
if (exists) await this.waitToClick(selector);
|
||||
return exists;
|
||||
},
|
||||
|
||||
|
@ -26,54 +26,43 @@ let actions = {
|
|||
changeLanguageToEnglish: async function() {
|
||||
let langSelector = '.user-popover vn-autocomplete[ng-model="$ctrl.lang"]';
|
||||
|
||||
let lang = await this.waitToClick('#user')
|
||||
.wait(langSelector)
|
||||
.waitToGetProperty(`${langSelector} input`, 'value');
|
||||
await this.waitToClick('#user');
|
||||
await this.wait(langSelector);
|
||||
let lang = await this.waitToGetProperty(`${langSelector} input`, 'value');
|
||||
|
||||
if (lang !== 'English')
|
||||
await this.autocompleteSearch(langSelector, 'English');
|
||||
|
||||
await this.keyboard.press('Escape');
|
||||
await this.waitForSelector(langSelector, {hidden: true});
|
||||
},
|
||||
|
||||
doLogin: async function(userName, password) {
|
||||
if (password == null) password = 'nightmare';
|
||||
await this.wait(`vn-login [name=user]`)
|
||||
.clearInput(`vn-login [name=user]`)
|
||||
.write(`vn-login [name=user]`, userName)
|
||||
.write(`vn-login [name=password]`, password)
|
||||
.click(`vn-login button[type=submit]`);
|
||||
doLogin: async function(userName, password = 'nightmare') {
|
||||
await this.wait(`vn-login [ng-model="$ctrl.user"]`);
|
||||
await this.clearInput(`vn-login [ng-model="$ctrl.user"]`);
|
||||
await this.write(`vn-login [ng-model="$ctrl.user"]`, userName);
|
||||
await this.clearInput(`vn-login [ng-model="$ctrl.password"]`);
|
||||
await this.write(`vn-login [ng-model="$ctrl.password"]`, password);
|
||||
await this.click('vn-login button[type=submit]');
|
||||
},
|
||||
|
||||
login: async function(userName) {
|
||||
if (currentUser !== userName) {
|
||||
let accountClicked = await this.clickIfExists('#user');
|
||||
|
||||
if (accountClicked) {
|
||||
let buttonSelector = '.vn-dialog.shown button[response=accept]';
|
||||
await this.waitToClick('#logout')
|
||||
.wait(buttonSelector => {
|
||||
return document.querySelector(buttonSelector) != null
|
||||
|| location.hash == '#!/login';
|
||||
}, buttonSelector);
|
||||
await this.clickIfExists(buttonSelector);
|
||||
}
|
||||
|
||||
try {
|
||||
await this.waitForURL('#!/login');
|
||||
} catch (e) {
|
||||
await this.goto(`${config.url}/#!/login`);
|
||||
await this.goto(`${defaultURL}/#!/login`);
|
||||
let dialog = await this.evaluate(() => {
|
||||
return document.querySelector('button[response="accept"]');
|
||||
});
|
||||
if (dialog)
|
||||
await this.waitToClick('button[response="accept"]');
|
||||
}
|
||||
|
||||
await this.doLogin(userName, null)
|
||||
.waitForURL('#!/')
|
||||
.changeLanguageToEnglish();
|
||||
|
||||
currentUser = userName;
|
||||
} else
|
||||
await this.waitToClick('a[ui-sref=home]');
|
||||
},
|
||||
|
||||
waitForLogin: async function(userName) {
|
||||
await this.login(userName);
|
||||
await this.doLogin(userName);
|
||||
await this.wait(() => {
|
||||
return document.location.hash === '#!/';
|
||||
}, {});
|
||||
await this.changeLanguageToEnglish();
|
||||
},
|
||||
|
||||
selectModule: async function(moduleName) {
|
||||
|
@ -81,13 +70,14 @@ let actions = {
|
|||
return m[0] + '-' + m[1];
|
||||
}).toLowerCase();
|
||||
|
||||
await this.waitToClick(`vn-home a[ui-sref="${moduleName}.index"]`)
|
||||
.waitForURL(snakeName);
|
||||
let selector = `vn-home a[ui-sref="${moduleName}.index"]`;
|
||||
await this.waitToClick(selector);
|
||||
await this.waitForURL(snakeName);
|
||||
},
|
||||
|
||||
loginAndModule: async function(userName, moduleName) {
|
||||
await this.login(userName)
|
||||
.selectModule(moduleName);
|
||||
await this.login(userName);
|
||||
await this.selectModule(moduleName);
|
||||
},
|
||||
|
||||
datePicker: async function(selector, changeMonth, day) {
|
||||
|
@ -96,8 +86,8 @@ let actions = {
|
|||
date.setDate(day ? day : 16);
|
||||
date = date.toISOString().substr(0, 10);
|
||||
|
||||
await this.wait(selector)
|
||||
.evaluate((selector, date) => {
|
||||
await this.wait(selector);
|
||||
await this.evaluate((selector, date) => {
|
||||
let input = document.querySelector(selector).$ctrl.input;
|
||||
input.value = date;
|
||||
input.dispatchEvent(new Event('change'));
|
||||
|
@ -105,83 +95,97 @@ let actions = {
|
|||
},
|
||||
|
||||
pickTime: async function(selector, time) {
|
||||
await this.wait(selector)
|
||||
.evaluate((selector, time) => {
|
||||
await this.wait(selector);
|
||||
await this.evaluate((selector, time) => {
|
||||
let input = document.querySelector(selector).$ctrl.input;
|
||||
input.value = time;
|
||||
input.dispatchEvent(new Event('change'));
|
||||
}, selector, time);
|
||||
},
|
||||
|
||||
clearTextarea: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(inputSelector => {
|
||||
clearTextarea: async function(selector) {
|
||||
await this.wait(selector);
|
||||
await this.evaluate(inputSelector => {
|
||||
return document.querySelector(inputSelector).value = '';
|
||||
}, selector);
|
||||
},
|
||||
|
||||
clearInput: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(selector => {
|
||||
let $ctrl = document.querySelector(selector).closest('.vn-field').$ctrl;
|
||||
$ctrl.field = null;
|
||||
$ctrl.$.$apply();
|
||||
$ctrl.input.dispatchEvent(new Event('change'));
|
||||
clearInput: async function(selector) {
|
||||
await this.wait(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);
|
||||
},
|
||||
|
||||
getProperty: function(selector, property) {
|
||||
return this.evaluate((selector, property) => {
|
||||
getProperty: async function(selector, property) {
|
||||
return await this.evaluate((selector, property) => {
|
||||
return document.querySelector(selector)[property].replace(/\s+/g, ' ').trim();
|
||||
}, selector, property);
|
||||
},
|
||||
|
||||
waitPropertyLength: function(selector, property, minLength) {
|
||||
return this.wait((selector, property, minLength) => {
|
||||
waitPropertyLength: async function(selector, property, minLength) {
|
||||
await this.wait((selector, property, minLength) => {
|
||||
const element = document.querySelector(selector);
|
||||
return element && element[property] != null && element[property] !== '' && element[property].length >= minLength;
|
||||
}, selector, property, minLength)
|
||||
.getProperty(selector, property);
|
||||
}, {}, selector, property, minLength);
|
||||
return await this.getProperty(selector, property);
|
||||
},
|
||||
|
||||
waitPropertyValue: function(selector, property, status) {
|
||||
return this.wait(selector)
|
||||
.wait((selector, property, status) => {
|
||||
waitPropertyValue: async function(selector, property, status) {
|
||||
await this.waitForSelector(selector);
|
||||
return await this.waitForFunction((selector, property, status) => {
|
||||
const element = document.querySelector(selector);
|
||||
return element[property] === status;
|
||||
}, selector, property, status);
|
||||
}, {}, selector, property, status);
|
||||
},
|
||||
|
||||
waitToGetProperty: function(selector, property) {
|
||||
return this.wait((selector, property) => {
|
||||
waitToGetProperty: async function(selector, property) {
|
||||
try {
|
||||
await this.waitForFunction((selector, property) => {
|
||||
const element = document.querySelector(selector);
|
||||
|
||||
return element && element[property] != null && element[property] !== '';
|
||||
}, selector, property)
|
||||
.getProperty(selector, property);
|
||||
}, {}, selector, property);
|
||||
return await this.getProperty(selector, property);
|
||||
} catch (error) {
|
||||
throw new Error(`couldn't get property: ${property} of ${selector}`);
|
||||
}
|
||||
},
|
||||
|
||||
write: function(selector, text) {
|
||||
return this.wait(selector)
|
||||
.type(selector, text);
|
||||
write: async function(selector, text) {
|
||||
await this.waitForSelector(selector, {});
|
||||
await this.type(`${selector} input`, text);
|
||||
await this.waitForTextInInput(selector, text);
|
||||
},
|
||||
|
||||
waitToClick: function(selector) {
|
||||
return this.wait(selector)
|
||||
.click(selector);
|
||||
waitToClick: async function(selector) {
|
||||
await this.waitForSelector(selector, {});
|
||||
await this.click(selector, {waitUntil: 'domcontentloaded'});
|
||||
},
|
||||
|
||||
focusElement: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(selector => {
|
||||
focusElement: async function(selector) {
|
||||
await this.wait(selector);
|
||||
return await this.evaluate(selector => {
|
||||
let element = document.querySelector(selector);
|
||||
element.focus();
|
||||
}, selector);
|
||||
},
|
||||
|
||||
isVisible: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(elementSelector => {
|
||||
isVisible: async function(selector) {
|
||||
await this.wait(selector);
|
||||
return await this.evaluate(elementSelector => {
|
||||
let selectorMatches = document.querySelectorAll(elementSelector);
|
||||
let element = selectorMatches[0];
|
||||
|
||||
|
@ -223,183 +227,192 @@ let actions = {
|
|||
}, selector);
|
||||
},
|
||||
|
||||
waitImgLoad: function(selector) {
|
||||
return this.wait(selector)
|
||||
.wait(selector => {
|
||||
waitImgLoad: async function(selector) {
|
||||
await this.wait(selector);
|
||||
return await this.wait(selector => {
|
||||
const imageReady = document.querySelector(selector).complete;
|
||||
return imageReady;
|
||||
}, selector);
|
||||
}, {}, selector);
|
||||
},
|
||||
|
||||
clickIfVisible: function(selector) {
|
||||
return this.wait(selector)
|
||||
.isVisible(selector)
|
||||
.then(visible => {
|
||||
if (visible)
|
||||
return this.click(selector);
|
||||
clickIfVisible: async function(selector) {
|
||||
await this.wait(selector);
|
||||
let isVisible = await this.isVisible(selector);
|
||||
|
||||
if (isVisible)
|
||||
return await this.click(selector);
|
||||
|
||||
throw new Error(`invisible selector: ${selector}`);
|
||||
});
|
||||
},
|
||||
|
||||
countElement: function(selector) {
|
||||
return this.evaluate(selector => {
|
||||
countElement: async function(selector) {
|
||||
return await this.evaluate(selector => {
|
||||
return document.querySelectorAll(selector).length;
|
||||
}, selector);
|
||||
},
|
||||
|
||||
waitForNumberOfElements: function(selector, count) {
|
||||
return this.wait((selector, count) => {
|
||||
waitForNumberOfElements: async function(selector, count) {
|
||||
return await this.waitForFunction((selector, count) => {
|
||||
return document.querySelectorAll(selector).length === count;
|
||||
}, selector, count);
|
||||
}, {}, selector, count);
|
||||
},
|
||||
|
||||
waitForClassNotPresent: function(selector, className) {
|
||||
return this.wait(selector)
|
||||
.wait((selector, className) => {
|
||||
waitForClassNotPresent: async function(selector, className) {
|
||||
await this.wait(selector);
|
||||
return await this.wait((selector, className) => {
|
||||
if (!document.querySelector(selector).classList.contains(className))
|
||||
return true;
|
||||
}, selector, className);
|
||||
}, {}, selector, className);
|
||||
},
|
||||
|
||||
waitForClassPresent: function(selector, className) {
|
||||
return this.wait(selector)
|
||||
.wait((elementSelector, targetClass) => {
|
||||
waitForClassPresent: async function(selector, className) {
|
||||
await this.wait(selector);
|
||||
return await this.wait((elementSelector, targetClass) => {
|
||||
if (document.querySelector(elementSelector).classList.contains(targetClass))
|
||||
return true;
|
||||
}, selector, className);
|
||||
}, {}, selector, className);
|
||||
},
|
||||
|
||||
waitForTextInElement: function(selector, text) {
|
||||
return this.wait(selector)
|
||||
.wait((selector, text) => {
|
||||
waitForTextInElement: async function(selector, text) {
|
||||
await this.wait(selector);
|
||||
return await this.wait((selector, text) => {
|
||||
return document.querySelector(selector).innerText.toLowerCase().includes(text.toLowerCase());
|
||||
}, selector, text);
|
||||
}, {}, selector, text);
|
||||
},
|
||||
|
||||
waitForTextInInput: function(selector, text) {
|
||||
return this.wait(selector)
|
||||
.wait((selector, text) => {
|
||||
return document.querySelector(selector).value.toLowerCase().includes(text.toLowerCase());
|
||||
}, selector, text);
|
||||
waitForTextInInput: async function(selector, text) {
|
||||
await this.wait(selector);
|
||||
return await this.wait((selector, text) => {
|
||||
return document.querySelector(`${selector} input`).value.toLowerCase().includes(text.toLowerCase());
|
||||
}, {}, selector, text);
|
||||
},
|
||||
|
||||
waitForInnerText: function(selector) {
|
||||
return this.wait(selector)
|
||||
.wait(selector => {
|
||||
waitForInnerText: async function(selector) {
|
||||
await this.waitForSelector(selector, {});
|
||||
await this.waitForFunction(selector => {
|
||||
const innerText = document.querySelector(selector).innerText;
|
||||
return innerText != null && innerText != '';
|
||||
}, selector)
|
||||
.evaluate(selector => {
|
||||
}, {}, selector);
|
||||
return await this.evaluate(selector => {
|
||||
return document.querySelector(selector).innerText;
|
||||
}, selector);
|
||||
},
|
||||
|
||||
waitForEmptyInnerText: function(selector) {
|
||||
return this.wait(selector => {
|
||||
waitForEmptyInnerText: async function(selector) {
|
||||
return await this.wait(selector => {
|
||||
return document.querySelector(selector).innerText == '';
|
||||
}, selector);
|
||||
},
|
||||
|
||||
waitForURL: function(hashURL) {
|
||||
return this.wait(hash => {
|
||||
return document.location.hash.includes(hash);
|
||||
}, hashURL);
|
||||
waitForURL: async function(hashURL) {
|
||||
await this.waitForFunction(expectedHash => {
|
||||
return document.location.hash.includes(expectedHash);
|
||||
}, {}, hashURL);
|
||||
},
|
||||
|
||||
waitForShapes: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(selector => {
|
||||
const shapes = document.querySelectorAll(selector);
|
||||
const shapesList = [];
|
||||
|
||||
for (const shape of shapes)
|
||||
shapesList.push(shape.innerText);
|
||||
|
||||
|
||||
return shapesList;
|
||||
}, selector);
|
||||
},
|
||||
waitForSnackbar: function() {
|
||||
return this.wait(500)
|
||||
.waitForShapes('vn-snackbar .shape .text');
|
||||
hideSnackbar: async function() {
|
||||
await this.waitToClick('#shapes .shown button');
|
||||
},
|
||||
|
||||
waitForLastShape: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(selector => {
|
||||
waitForLastShape: async function(selector) {
|
||||
await this.wait(selector);
|
||||
let snackBarText = await this.evaluate(selector => {
|
||||
const shape = document.querySelector(selector);
|
||||
|
||||
return shape.innerText;
|
||||
}, selector);
|
||||
await this.hideSnackbar();
|
||||
return snackBarText;
|
||||
},
|
||||
|
||||
waitForLastSnackbar: function() {
|
||||
return this.wait(500)
|
||||
.waitForSpinnerLoad()
|
||||
.waitForLastShape('vn-snackbar .shape .text');
|
||||
waitForLastSnackbar: async function() {
|
||||
await this.wait(2000); // this needs a refactor to be somehow dynamic ie: page.waitForResponse(urlOrPredicate[, options]) or something to fire waitForLastShape once the request is completed
|
||||
await this.waitForSpinnerLoad();
|
||||
return await this.waitForLastShape('vn-snackbar .shown .text');
|
||||
},
|
||||
|
||||
accessToSearchResult: function(searchValue) {
|
||||
return this.clearInput('vn-searchbar input')
|
||||
.write('vn-searchbar input', searchValue)
|
||||
.click('vn-searchbar vn-icon[icon="search"]')
|
||||
.wait(100)
|
||||
.waitForNumberOfElements('.search-result', 1)
|
||||
.evaluate(() => {
|
||||
return document.querySelector('ui-view vn-card vn-table') != null;
|
||||
})
|
||||
.then(result => {
|
||||
if (result)
|
||||
return this.waitToClick('ui-view vn-card vn-td');
|
||||
|
||||
return this.waitToClick('ui-view vn-card a');
|
||||
accessToSearchResult: async function(searchValue) {
|
||||
await this.clearInput('vn-searchbar');
|
||||
await this.write('vn-searchbar', searchValue);
|
||||
await this.waitToClick('vn-searchbar vn-icon[icon="search"]');
|
||||
await this.waitForNumberOfElements('.search-result', 1);
|
||||
await this.waitFor(1000);
|
||||
await this.evaluate(() => {
|
||||
return document.querySelector('.search-result').click();
|
||||
});
|
||||
},
|
||||
|
||||
accessToSection: function(sectionRoute) {
|
||||
return this.wait(`vn-left-menu`)
|
||||
.evaluate(sectionRoute => {
|
||||
accessToSection: async function(sectionRoute) {
|
||||
await this.waitForSelector(`vn-left-menu`, {visible: true});
|
||||
let nested = await this.evaluate(sectionRoute => {
|
||||
return document.querySelector(`vn-left-menu li li > a[ui-sref="${sectionRoute}"]`) != null;
|
||||
}, sectionRoute)
|
||||
.then(nested => {
|
||||
}, sectionRoute);
|
||||
|
||||
if (nested) {
|
||||
this.waitToClick('vn-left-menu vn-item-section > vn-icon[icon=keyboard_arrow_down]')
|
||||
.wait('vn-left-menu .expanded');
|
||||
await this.waitToClick('vn-left-menu vn-item-section > vn-icon[icon=keyboard_arrow_down]');
|
||||
await this.wait('vn-left-menu .expanded');
|
||||
}
|
||||
|
||||
return this.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`)
|
||||
.waitForSpinnerLoad();
|
||||
});
|
||||
await this.evaluate(sectionRoute => {
|
||||
let navButton = document.querySelector(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
||||
navButton.scrollIntoViewIfNeeded();
|
||||
return navButton.click();
|
||||
}, sectionRoute);
|
||||
await this.waitForNavigation({waitUntil: ['networkidle0']});
|
||||
},
|
||||
|
||||
autocompleteSearch: function(autocompleteSelector, searchValue) {
|
||||
return this.waitToClick(`${autocompleteSelector} input`)
|
||||
.write(`.vn-drop-down.shown input`, searchValue)
|
||||
.waitToClick(`.vn-drop-down.shown li.active`)
|
||||
.wait((autocompleteSelector, searchValue) => {
|
||||
return document.querySelector(`${autocompleteSelector} input`).value
|
||||
.toLowerCase()
|
||||
autocompleteSearch: async function(selector, searchValue) {
|
||||
try {
|
||||
await this.waitToClick(`${selector} input`);
|
||||
await this.waitForSelector(selector => {
|
||||
document
|
||||
.querySelector(`${selector} vn-drop-down`).$ctrl.content
|
||||
.querySelectorAll('li');
|
||||
}, selector);
|
||||
|
||||
await this.write(`.vn-drop-down.shown`, searchValue);
|
||||
await this.waitForFunction((selector, searchValue) => {
|
||||
let element = document
|
||||
.querySelector(`${selector} vn-drop-down`).$ctrl.content
|
||||
.querySelector('li.active');
|
||||
if (element)
|
||||
return element.innerText.toLowerCase().includes(searchValue.toLowerCase());
|
||||
}, {}, selector, searchValue);
|
||||
|
||||
await this.keyboard.press('Enter');
|
||||
await this.waitForFunction((selector, searchValue) => {
|
||||
return document.querySelector(`${selector} input`).value.toLowerCase()
|
||||
.includes(searchValue.toLowerCase());
|
||||
}, autocompleteSelector, searchValue);
|
||||
}, {}, selector, searchValue);
|
||||
} catch (error) {
|
||||
throw new Error(`${selector} failed to autocomplete ${searchValue}! ${error}`);
|
||||
}
|
||||
await this.waitForMutation(`.vn-drop-down`, 'childList');
|
||||
},
|
||||
|
||||
reloadSection: function(sectionRoute) {
|
||||
return this.waitToClick('vn-icon[icon="desktop_windows"]')
|
||||
.wait('vn-card.summary')
|
||||
.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
||||
reloadSection: async function(sectionRoute) {
|
||||
await this.waitFor(1000);
|
||||
await Promise.all([
|
||||
this.waitForNavigation({waitUntil: 'networkidle0'}),
|
||||
this.click('vn-icon[icon="desktop_windows"]', {}),
|
||||
]);
|
||||
|
||||
await Promise.all([
|
||||
this.waitForNavigation({waitUntil: 'networkidle0'}),
|
||||
this.click(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`, {}),
|
||||
]);
|
||||
},
|
||||
|
||||
forceReloadSection: function(sectionRoute) {
|
||||
return this.waitToClick('vn-icon[icon="desktop_windows"]')
|
||||
.waitToClick('button[response="accept"]')
|
||||
.wait('vn-card.summary')
|
||||
.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
||||
forceReloadSection: async function(sectionRoute) {
|
||||
await this.waitToClick('vn-icon[icon="desktop_windows"]');
|
||||
await this.waitToClick('button[response="accept"]');
|
||||
await this.wait('vn-card.summary');
|
||||
await this.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
||||
},
|
||||
|
||||
checkboxState: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(selector => {
|
||||
checkboxState: async function(selector) {
|
||||
await this.wait(selector);
|
||||
return await this.evaluate(selector => {
|
||||
let checkbox = document.querySelector(selector);
|
||||
switch (checkbox.$ctrl.field) {
|
||||
case null:
|
||||
|
@ -412,53 +425,95 @@ let actions = {
|
|||
}, selector);
|
||||
},
|
||||
|
||||
isDisabled: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(selector => {
|
||||
isDisabled: async function(selector) {
|
||||
await this.wait(selector);
|
||||
return await this.evaluate(selector => {
|
||||
let element = document.querySelector(selector);
|
||||
return element.$ctrl.disabled;
|
||||
}, selector);
|
||||
},
|
||||
|
||||
waitForStylePresent: function(selector, property, value) {
|
||||
return this.wait((selector, property, value) => {
|
||||
waitForStylePresent: async function(selector, property, value) {
|
||||
return await this.wait((selector, property, value) => {
|
||||
const element = document.querySelector(selector);
|
||||
return element.style[property] == value;
|
||||
}, selector, property, value);
|
||||
}, {}, selector, property, value);
|
||||
},
|
||||
|
||||
waitForSpinnerLoad: function() {
|
||||
return this.waitUntilNotPresent('vn-topbar vn-spinner');
|
||||
waitForSpinnerLoad: async function() {
|
||||
await this.waitUntilNotPresent('vn-topbar vn-spinner');
|
||||
},
|
||||
|
||||
waitForWatcherData: function(selector) {
|
||||
return this.wait(selector)
|
||||
.wait(selector => {
|
||||
const watcher = document.querySelector(selector);
|
||||
waitForWatcherData: async function(selector) {
|
||||
await this.wait(selector);
|
||||
await this.wait(selector => {
|
||||
let watcher = document.querySelector(selector);
|
||||
let orgData = watcher.$ctrl.orgData;
|
||||
return !angular.equals({}, orgData) && orgData != null;
|
||||
}, selector)
|
||||
.waitForSpinnerLoad();
|
||||
}, {}, selector);
|
||||
await this.waitForSpinnerLoad();
|
||||
},
|
||||
|
||||
waitForMutation: async function(selector, type) {
|
||||
try {
|
||||
await this.evaluate((selector, type) => {
|
||||
return new Promise(resolve => {
|
||||
const config = {attributes: true, childList: true, subtree: true};
|
||||
const target = document.querySelector(selector);
|
||||
|
||||
const onEnd = function(mutationsList, observer) {
|
||||
resolve();
|
||||
|
||||
observer.disconnect();
|
||||
};
|
||||
const observer = new MutationObserver(onEnd);
|
||||
observer.expectedType = type;
|
||||
|
||||
observer.observe(target, config);
|
||||
});
|
||||
}, selector, type);
|
||||
} catch (error) {
|
||||
throw new Error(`failed to wait for mutation type: ${type}`);
|
||||
}
|
||||
},
|
||||
|
||||
waitForTransitionEnd: async function(selector) {
|
||||
await this.evaluate(selector => {
|
||||
return new Promise(resolve => {
|
||||
const transition = document.querySelector(selector);
|
||||
const onEnd = function() {
|
||||
transition.removeEventListener('transitionend', onEnd);
|
||||
resolve();
|
||||
};
|
||||
transition.addEventListener('transitionend', onEnd);
|
||||
});
|
||||
}, selector);
|
||||
},
|
||||
|
||||
waitForContentLoaded: async function() {
|
||||
await this.waitFor(1000);
|
||||
// to be implemented in base of a directive loaded once al modules are done loading, further investigation required.
|
||||
// await this.waitForFunction(() => {
|
||||
// return new Promise(resolve => {
|
||||
// angular.element(document).ready(() => resolve());
|
||||
// const $rootScope = angular.element(document).find('ui-view').injector().get('$rootScope');
|
||||
// $rootScope.$$postDigest(resolve());
|
||||
// $rootScope.$on('$viewContentLoaded', resolve());
|
||||
// });
|
||||
// });
|
||||
}
|
||||
};
|
||||
|
||||
for (let name in actions) {
|
||||
Nightmare.action(name, function(...args) {
|
||||
let fnArgs = args.slice(0, args.length - 1);
|
||||
let done = args[args.length - 1];
|
||||
export function extendPage(page) {
|
||||
for (let name in actions) {
|
||||
page[name] = async(...args) => {
|
||||
return await actions[name].call(page, ...args);
|
||||
};
|
||||
}
|
||||
|
||||
actions[name].apply(this, fnArgs)
|
||||
.then(res => done(null, res))
|
||||
.catch(err => {
|
||||
let stringArgs = fnArgs
|
||||
.map(i => typeof i == 'function' ? 'Function' : i)
|
||||
.join(', ');
|
||||
page.wait = page.waitFor;
|
||||
|
||||
let orgMessage = err.message.startsWith('.wait()')
|
||||
? '.wait() timed out'
|
||||
: err.message;
|
||||
|
||||
done(new Error(`.${name}(${stringArgs}) failed: ${orgMessage}`));
|
||||
});
|
||||
});
|
||||
return page;
|
||||
}
|
||||
|
||||
export default actions;
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
const Nightmare = require('nightmare');
|
||||
const config = require('./config.js');
|
||||
|
||||
let nightmare;
|
||||
|
||||
module.exports = function createNightmare(width = 1280, height = 800) {
|
||||
if (nightmare)
|
||||
return nightmare;
|
||||
|
||||
nightmare = new Nightmare({
|
||||
show: process.env.E2E_SHOW,
|
||||
typeInterval: 10,
|
||||
x: 0,
|
||||
y: 0,
|
||||
waitTimeout: 2000,
|
||||
// openDevTools: {mode: 'detach'}
|
||||
}).viewport(width, height);
|
||||
|
||||
nightmare.on('console', (type, message, ...args) => {
|
||||
if (type === 'error') {
|
||||
console[type](message, ...args);
|
||||
throw new Error(message);
|
||||
} else
|
||||
console[type](message, ...args);
|
||||
});
|
||||
|
||||
nightmare.header('Accept-Language', 'en');
|
||||
return nightmare.goto(config.url);
|
||||
};
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
import Puppeteer from 'puppeteer';
|
||||
import {extendPage} from './extensions';
|
||||
import {url as defaultURL} from './config';
|
||||
|
||||
export async function getBrowser() {
|
||||
const browser = await Puppeteer.launch({
|
||||
args: [
|
||||
`--window-size=${ 1920 },${ 1080 }`
|
||||
],
|
||||
defaultViewport: null,
|
||||
headless: false,
|
||||
slowMo: 0, // slow down by ms
|
||||
});
|
||||
let page = (await browser.pages())[0];
|
||||
page = extendPage(page);
|
||||
page.setDefaultTimeout(5000);
|
||||
await page.goto(defaultURL, {waitUntil: 'networkidle0'});
|
||||
return {page, close: browser.close.bind(browser)};
|
||||
}
|
||||
|
||||
export default getBrowser;
|
|
@ -15,29 +15,29 @@ export default {
|
|||
userLocalCompany: '.user-popover vn-autocomplete[ng-model="$ctrl.localCompanyFk"]',
|
||||
userWarehouse: '.user-popover vn-autocomplete[ng-model="$ctrl.warehouseFk"]',
|
||||
userCompany: '.user-popover vn-autocomplete[ng-model="$ctrl.companyFk"]',
|
||||
userConfigFirstAutocompleteClear: '#localWarehouse .icons > vn-icon[icon=clear]',
|
||||
userConfigSecondAutocompleteClear: '#localBank .icons > vn-icon[icon=clear]',
|
||||
userConfigThirdAutocompleteClear: '#localCompany .icons > vn-icon[icon=clear]',
|
||||
userConfigFirstAutocomplete: '#localWarehouse',
|
||||
userConfigSecondAutocomplete: '#localBank',
|
||||
userConfigThirdAutocomplete: '#localCompany',
|
||||
acceptButton: '.vn-confirm.shown button[response=accept]'
|
||||
},
|
||||
clientsIndex: {
|
||||
searchClientInput: `vn-textfield input`,
|
||||
searchClientInput: 'vn-topbar',
|
||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||
searchResult: 'vn-client-index .vn-item',
|
||||
createClientButton: `vn-float-button`,
|
||||
othersButton: 'vn-left-menu li[name="Others"] > a'
|
||||
},
|
||||
createClientView: {
|
||||
name: `vn-textfield input[name="name"]`,
|
||||
taxNumber: `vn-textfield input[name="fi"]`,
|
||||
socialName: `vn-textfield input[name="socialName"]`,
|
||||
street: `vn-textfield input[name="street"]`,
|
||||
postcode: `vn-textfield input[name="postcode"]`,
|
||||
city: `vn-textfield input[name="city"]`,
|
||||
name: `vn-client-create [ng-model="$ctrl.client.name"]`,
|
||||
taxNumber: 'vn-client-create [ng-model="$ctrl.client.fi"]',
|
||||
socialName: 'vn-client-create [ng-model="$ctrl.client.socialName"]',
|
||||
street: 'vn-client-create [ng-model="$ctrl.client.street"]',
|
||||
postcode: 'vn-client-create [ng-model="$ctrl.client.postcode"]',
|
||||
city: 'vn-client-create [ng-model="$ctrl.client.city"]',
|
||||
province: `vn-autocomplete[ng-model="$ctrl.client.provinceFk"]`,
|
||||
country: `vn-autocomplete[ng-model="$ctrl.client.countryFk"]`,
|
||||
userName: `vn-textfield input[name="userName"]`,
|
||||
email: `vn-textfield input[name="email"]`,
|
||||
userName: 'vn-client-create [ng-model="$ctrl.client.userName"]',
|
||||
email: 'vn-client-create [ng-model="$ctrl.client.email"]',
|
||||
salesPersonAutocomplete: `vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]`,
|
||||
createButton: `button[type=submit]`,
|
||||
cancelButton: 'vn-button[href="#!/client/index"]'
|
||||
|
@ -48,22 +48,24 @@ export default {
|
|||
},
|
||||
clientBasicData: {
|
||||
basicDataButton: 'vn-left-menu a[ui-sref="client.card.basicData"]',
|
||||
nameInput: 'vn-textfield[ng-model="$ctrl.client.name"] input',
|
||||
contactInput: 'vn-textfield[ng-model="$ctrl.client.contact"] input',
|
||||
emailInput: 'vn-textfield[ng-model="$ctrl.client.email"] input',
|
||||
nameInput: 'vn-client-basic-data [ng-model="$ctrl.client.name"]',
|
||||
contactInput: 'vn-client-basic-data [ng-model="$ctrl.client.contact"]',
|
||||
phoneInput: 'vn-client-basic-data [ng-model="$ctrl.client.phone"]',
|
||||
mobileInput: 'vn-client-basic-data [ng-model="$ctrl.client.mobile"]',
|
||||
emailInput: 'vn-client-basic-data [ng-model="$ctrl.client.email"]',
|
||||
salesPersonAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]',
|
||||
channelAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.contactChannelFk"]',
|
||||
saveButton: `button[type=submit]`
|
||||
},
|
||||
clientFiscalData: {
|
||||
fiscalDataButton: 'vn-left-menu a[ui-sref="client.card.fiscalData"]',
|
||||
socialNameInput: `vn-textfield input[name="socialName"]`,
|
||||
fiscalIdInput: `vn-textfield input[name="fi"]`,
|
||||
socialNameInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.socialName"]',
|
||||
fiscalIdInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.fi"]',
|
||||
equalizationTaxCheckbox: 'vn-check[ng-model="$ctrl.client.isEqualizated"]',
|
||||
acceptPropagationButton: '.vn-confirm.shown button[response=accept]',
|
||||
addressInput: `vn-textfield input[name="street"]`,
|
||||
postcodeInput: `vn-textfield input[name="postcode"]`,
|
||||
cityInput: `vn-textfield input[name="city"]`,
|
||||
addressInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.street"]',
|
||||
postcodeInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.postcode"]',
|
||||
cityInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.city"]',
|
||||
provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.provinceFk"]',
|
||||
countryAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.countryFk"]',
|
||||
activeCheckbox: 'vn-check[label="Active"]',
|
||||
|
@ -78,17 +80,17 @@ export default {
|
|||
},
|
||||
clientBillingData: {
|
||||
payMethodAutocomplete: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.payMethodFk"]',
|
||||
IBANInput: `vn-client-billing-data vn-textfield input[name="iban"]`,
|
||||
dueDayInput: `vn-client-billing-data vn-input-number input[name="dueDay"]`,
|
||||
IBANInput: 'vn-client-billing-data [ng-model="$ctrl.client.iban"]',
|
||||
dueDayInput: 'vn-client-billing-data [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"]',
|
||||
swiftBicAutocomplete: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.bankEntityFk"]',
|
||||
clearswiftBicButton: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.bankEntityFk"] .icons > vn-icon[icon=clear]',
|
||||
newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button',
|
||||
newBankEntityName: '.vn-dialog.shown vn-textfield[label="Name"] input',
|
||||
newBankEntityBIC: '.vn-dialog.shown vn-textfield[label="Swift / BIC"] input',
|
||||
newBankEntityCode: '.vn-dialog.shown vn-textfield[label="Entity Code"] input',
|
||||
newBankEntityName: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.name"]',
|
||||
newBankEntityBIC: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.bic"]',
|
||||
newBankEntityCode: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.id"]',
|
||||
acceptBankEntityButton: '.vn-dialog.shown button[response="accept"]',
|
||||
saveButton: `button[type=submit]`,
|
||||
watcher: 'vn-client-billing-data vn-watcher'
|
||||
|
@ -97,26 +99,26 @@ export default {
|
|||
addressesButton: 'vn-left-menu a[ui-sref="client.card.address.index"]',
|
||||
createAddress: `vn-client-address-index vn-float-button`,
|
||||
defaultCheckboxInput: 'vn-check[label="Default"]',
|
||||
consigneeInput: `vn-textfield input[name="nickname"]`,
|
||||
streetAddressInput: `vn-textfield input[name="street"]`,
|
||||
postcodeInput: `vn-textfield input[name="postalCode"]`,
|
||||
cityInput: `vn-textfield input[name="city"]`,
|
||||
consigneeInput: '[ng-model="$ctrl.address.nickname"]',
|
||||
streetAddressInput: '[ng-model="$ctrl.address.street"]',
|
||||
postcodeInput: '[ng-model="$ctrl.address.postalCode"]',
|
||||
cityInput: '[ng-model="$ctrl.address.city"]',
|
||||
provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.provinceFk"]',
|
||||
agencyAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.agencyModeFk"]',
|
||||
phoneInput: `vn-textfield input[name="phone"]`,
|
||||
mobileInput: `vn-textfield input[name="mobile"]`,
|
||||
phoneInput: '[ng-model="$ctrl.address.phone"]',
|
||||
mobileInput: '[ng-model="$ctrl.address.mobile"]',
|
||||
defaultAddress: 'vn-client-address-index div:nth-child(1) div[name="street"]',
|
||||
secondMakeDefaultStar: 'vn-client-address-index vn-card div:nth-child(2) vn-icon-button[icon="star_border"]',
|
||||
firstEditAddress: 'vn-client-address-index div:nth-child(1) > a',
|
||||
secondEditAddress: 'vn-client-address-index div:nth-child(2) > a',
|
||||
activeCheckbox: 'vn-check[label="Enabled"]',
|
||||
equalizationTaxCheckbox: 'vn-client-address-edit vn-check[label="Is equalizated"]',
|
||||
firstObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] :nth-child(1) [ng-model="observation.observationTypeFk"]',
|
||||
firstObservationDescriptionInput: 'vn-client-address-edit [name=observations] :nth-child(1) [ng-model="observation.description"] input',
|
||||
secondObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] :nth-child(2) [ng-model="observation.observationTypeFk"]',
|
||||
secondObservationDescriptionInput: 'vn-client-address-edit [name=observations] :nth-child(2) [ng-model="observation.description"] input',
|
||||
firstObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(1) [ng-model="observation.observationTypeFk"]',
|
||||
firstObservationDescriptionInput: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(1) [ng-model="observation.description"]',
|
||||
secondObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(2) [ng-model="observation.observationTypeFk"]',
|
||||
secondObservationDescriptionInput: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(2) [ng-model="observation.description"]',
|
||||
addObservationButton: 'vn-client-address-edit div[name="observations"] vn-icon-button[icon="add_circle"]',
|
||||
saveButton: `button[type=submit]`,
|
||||
saveButton: 'button[type=submit]',
|
||||
cancelCreateAddressButton: 'button[ui-sref="client.card.address.index"]',
|
||||
cancelEditAddressButton: 'vn-client-address-edit > form > vn-button-bar > vn-button > button',
|
||||
watcher: 'vn-client-address-edit vn-watcher'
|
||||
|
@ -124,27 +126,27 @@ export default {
|
|||
clientWebAccess: {
|
||||
webAccessButton: 'vn-left-menu a[ui-sref="client.card.webAccess"]',
|
||||
enableWebAccessCheckbox: 'vn-check[label="Enable web access"]',
|
||||
userNameInput: `vn-textfield input[name="name"]`,
|
||||
saveButton: `button[type=submit]`
|
||||
userNameInput: 'vn-client-web-access [ng-model="$ctrl.account.name"]',
|
||||
saveButton: 'button[type=submit]'
|
||||
},
|
||||
clientNotes: {
|
||||
addNoteFloatButton: `vn-float-button`,
|
||||
noteInput: 'vn-textarea[label="Note"]',
|
||||
saveButton: `button[type=submit]`,
|
||||
addNoteFloatButton: 'vn-float-button',
|
||||
noteInput: '[ng-model="$ctrl.note.text"]',
|
||||
saveButton: 'button[type=submit]',
|
||||
firstNoteText: 'vn-client-note .text'
|
||||
},
|
||||
clientCredit: {
|
||||
addCreditFloatButton: `vn-float-button`,
|
||||
creditInput: `vn-input-number input[name="credit"]`,
|
||||
saveButton: `button[type=submit]`,
|
||||
addCreditFloatButton: 'vn-float-button',
|
||||
creditInput: 'vn-client-credit-create [ng-model="$ctrl.client.credit"]',
|
||||
saveButton: 'button[type=submit]',
|
||||
firstCreditText: 'vn-client-credit-index vn-card vn-table vn-tbody > vn-tr'
|
||||
},
|
||||
clientGreuge: {
|
||||
addGreugeFloatButton: `vn-float-button`,
|
||||
amountInput: `vn-input-number input[name="amount"]`,
|
||||
descriptionInput: `vn-textfield input[name="description"]`,
|
||||
addGreugeFloatButton: 'vn-float-button',
|
||||
amountInput: 'vn-client-greuge-create [ng-model="$ctrl.greuge.amount"]',
|
||||
descriptionInput: 'vn-client-greuge-create [ng-model="$ctrl.greuge.description"]',
|
||||
typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.greuge.greugeTypeFk"]',
|
||||
saveButton: `button[type=submit]`,
|
||||
saveButton: 'button[type=submit]',
|
||||
firstGreugeText: 'vn-client-greuge-index vn-card vn-table vn-tbody > vn-tr'
|
||||
},
|
||||
clientMandate: {
|
||||
|
@ -165,7 +167,7 @@ export default {
|
|||
companyAutocomplete: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]',
|
||||
newPaymentButton: `vn-float-button`,
|
||||
newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]',
|
||||
newPaymentAmountInput: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.receipt.amountPaid"] input',
|
||||
newPaymentAmountInput: '.vn-dialog.shown [ng-model="$ctrl.receipt.amountPaid"]',
|
||||
saveButton: '.vn-dialog.shown vn-button[label="Save"]',
|
||||
firstBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)'
|
||||
|
||||
|
@ -187,7 +189,7 @@ export default {
|
|||
searchResultPreviewButton: 'vn-item-index .buttons > [icon="desktop_windows"]',
|
||||
searchResultCloneButton: 'vn-item-index .buttons > [icon="icon-clone"]',
|
||||
acceptClonationAlertButton: '.vn-confirm.shown [response="accept"]',
|
||||
searchItemInput: 'vn-searchbar vn-textfield input',
|
||||
searchItemInput: 'vn-searchbar',
|
||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||
closeItemSummaryPreview: '.vn-popup.shown',
|
||||
fieldsToShowButton: 'vn-item-index vn-table > div > div > vn-icon-button[icon="menu"]',
|
||||
|
@ -209,18 +211,18 @@ export default {
|
|||
saveFieldsButton: '.vn-dialog.shown vn-horizontal:nth-child(16) > vn-button > button'
|
||||
},
|
||||
itemCreateView: {
|
||||
temporalName: `vn-textfield input[name="provisionalName"]`,
|
||||
temporalName: 'vn-item-create [ng-model="$ctrl.item.provisionalName"]',
|
||||
typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]',
|
||||
intrastatAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]',
|
||||
originAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]',
|
||||
createButton: `button[type=submit]`,
|
||||
createButton: 'button[type=submit]',
|
||||
cancelButton: 'vn-button[ui-sref="item.index"]'
|
||||
},
|
||||
itemDescriptor: {
|
||||
goBackToModuleIndexButton: 'vn-item-descriptor a[href="#!/item/index"]',
|
||||
moreMenu: 'vn-item-descriptor vn-icon-menu[icon=more_vert]',
|
||||
moreMenuRegularizeButton: '.vn-drop-down.shown li[name="Regularize stock"]',
|
||||
regularizeQuantityInput: '.vn-dialog.shown tpl-body > div > vn-textfield input',
|
||||
regularizeQuantityInput: '.vn-dialog.shown [ng-model="$ctrl.quantity"]',
|
||||
regularizeWarehouseAutocomplete: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.warehouseFk"]',
|
||||
editButton: 'vn-item-descriptor vn-float-button[icon="edit"]',
|
||||
regularizeSaveButton: '.vn-dialog.shown tpl-buttons > button',
|
||||
|
@ -232,11 +234,11 @@ export default {
|
|||
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
|
||||
typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]',
|
||||
intrastatAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]',
|
||||
nameInput: 'vn-textfield[label="Name"] input',
|
||||
relevancyInput: 'vn-input-number[ng-model="$ctrl.item.relevancy"] input',
|
||||
nameInput: 'vn-item-basic-data [ng-model="$ctrl.item.name"]',
|
||||
relevancyInput: 'vn-item-basic-data [ng-model="$ctrl.item.relevancy"]',
|
||||
originAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]',
|
||||
expenseAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.expenseFk"]',
|
||||
longNameInput: 'vn-textfield[ng-model="$ctrl.item.longName"] input',
|
||||
longNameInput: 'vn-textfield[ng-model="$ctrl.item.longName"]',
|
||||
isActiveCheckbox: 'vn-check[label="Active"]',
|
||||
priceInKgCheckbox: 'vn-check[label="Price in kg"]',
|
||||
submitBasicDataButton: `button[type=submit]`
|
||||
|
@ -245,47 +247,47 @@ export default {
|
|||
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
|
||||
tagsButton: 'vn-left-menu a[ui-sref="item.card.tags"]',
|
||||
fourthTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(4) > vn-autocomplete[ng-model="itemTag.tagFk"]',
|
||||
fourthValueInput: 'vn-item-tags vn-horizontal:nth-child(4) > vn-textfield[label="Value"] input',
|
||||
fourthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(4) > vn-textfield[label="Relevancy"] input',
|
||||
fourthValueInput: 'vn-item-tags vn-horizontal:nth-child(4) [ng-model="itemTag.value"]',
|
||||
fourthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(4) [ng-model="itemTag.priority"]',
|
||||
fourthRemoveTagButton: 'vn-item-tags vn-horizontal:nth-child(4) vn-icon-button[icon="delete"]',
|
||||
fifthTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(5) > vn-autocomplete[ng-model="itemTag.tagFk"]',
|
||||
fifthValueInput: 'vn-item-tags vn-horizontal:nth-child(5) > vn-textfield[label="Value"] input',
|
||||
fifthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(5) > vn-textfield[label="Relevancy"] input',
|
||||
fifthValueInput: 'vn-item-tags vn-horizontal:nth-child(5) [ng-model="itemTag.value"]',
|
||||
fifthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(5) [ng-model="itemTag.priority"]',
|
||||
sixthTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(6) > vn-autocomplete[ng-model="itemTag.tagFk"]',
|
||||
sixthValueInput: 'vn-item-tags vn-horizontal:nth-child(6) > vn-textfield[label="Value"] input',
|
||||
sixthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(6) > vn-textfield[label="Relevancy"] input',
|
||||
sixthValueInput: 'vn-item-tags vn-horizontal:nth-child(6) [ng-model="itemTag.value"]',
|
||||
sixthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(6) [ng-model="itemTag.priority"]',
|
||||
seventhTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(7) > vn-autocomplete[ng-model="itemTag.tagFk"]',
|
||||
seventhValueInput: 'vn-item-tags vn-horizontal:nth-child(7) > vn-textfield[label="Value"] input',
|
||||
seventhRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(7) > vn-textfield[label="Relevancy"] input',
|
||||
seventhValueInput: 'vn-item-tags vn-horizontal:nth-child(7) [ng-model="itemTag.value"]',
|
||||
seventhRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(7) [ng-model="itemTag.priority"]',
|
||||
addItemTagButton: 'vn-item-tags vn-icon-button[icon="add_circle"]',
|
||||
submitItemTagsButton: `vn-item-tags button[type=submit]`
|
||||
submitItemTagsButton: 'vn-item-tags button[type=submit]'
|
||||
},
|
||||
itemTax: {
|
||||
undoChangesButton: 'vn-item-tax vn-button-bar > vn-button[label="Undo changes"]',
|
||||
firstClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(1) > vn-autocomplete[ng-model="tax.taxClassFk"]',
|
||||
secondClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(2) > vn-autocomplete[ng-model="tax.taxClassFk"]',
|
||||
thirdClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="tax.taxClassFk"]',
|
||||
submitTaxButton: `vn-item-tax button[type=submit]`
|
||||
submitTaxButton: 'vn-item-tax button[type=submit]'
|
||||
},
|
||||
itemBarcodes: {
|
||||
addBarcodeButton: 'vn-item-barcode vn-icon[icon="add_circle"]',
|
||||
thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(3) > vn-textfield input`,
|
||||
submitBarcodesButton: `vn-item-barcode button[type=submit]`,
|
||||
thirdCodeInput: 'vn-item-barcode vn-horizontal:nth-child(3) [ng-model="barcode.code"]',
|
||||
submitBarcodesButton: 'vn-item-barcode button[type=submit]',
|
||||
firstCodeRemoveButton: 'vn-item-barcode vn-horizontal vn-none vn-icon[icon="delete"]'
|
||||
},
|
||||
itemNiches: {
|
||||
addNicheButton: 'vn-item-niche vn-icon[icon="add_circle"]',
|
||||
firstWarehouseAutocomplete: 'vn-item-niche vn-autocomplete[ng-model="niche.warehouseFk"]',
|
||||
firstCodeInput: 'vn-item-niche vn-horizontal:nth-child(1) > vn-textfield[label="Code"] input',
|
||||
firstCodeInput: 'vn-item-niche vn-horizontal:nth-child(1) [ng-model="niche.code"]',
|
||||
secondWarehouseAutocomplete: 'vn-item-niche vn-horizontal:nth-child(2) > vn-autocomplete[ng-model="niche.warehouseFk"]',
|
||||
secondCodeInput: 'vn-item-niche vn-horizontal:nth-child(2) > vn-textfield[label="Code"] input',
|
||||
secondCodeInput: 'vn-item-niche vn-horizontal:nth-child(2) [ng-model="niche.code"]',
|
||||
secondNicheRemoveButton: 'vn-item-niche vn-horizontal:nth-child(2) > vn-none > vn-icon-button[icon="delete"]',
|
||||
thirdWarehouseAutocomplete: 'vn-item-niche vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="niche.warehouseFk"]',
|
||||
thirdCodeInput: 'vn-item-niche vn-horizontal:nth-child(3) > vn-textfield[label="Code"] input',
|
||||
submitNichesButton: `vn-item-niche button[type=submit]`
|
||||
thirdCodeInput: 'vn-item-niche vn-horizontal:nth-child(3) [ng-model="niche.code"]',
|
||||
submitNichesButton: 'vn-item-niche button[type=submit]'
|
||||
},
|
||||
itemBotanical: {
|
||||
botanicalInput: `vn-item-botanical vn-horizontal:nth-child(1) > vn-textfield input`,
|
||||
botanicalInput: 'vn-item-botanical vn-horizontal:nth-child(1) [ng-model="$ctrl.botanical.botanical"]',
|
||||
genusAutocomplete: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.genusFk"]',
|
||||
speciesAutocomplete: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.specieFk"]',
|
||||
submitBotanicalButton: `vn-item-botanical button[type=submit]`
|
||||
|
@ -326,20 +328,19 @@ export default {
|
|||
},
|
||||
ticketsIndex: {
|
||||
openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]',
|
||||
advancedSearchInvoiceOut: 'vn-ticket-search-panel vn-textfield[ng-model="filter.refFk"] input',
|
||||
advancedSearchInvoiceOut: 'vn-ticket-search-panel [ng-model="filter.refFk"]',
|
||||
newTicketButton: 'vn-ticket-index > a',
|
||||
searchResult: 'vn-ticket-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
||||
searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr',
|
||||
searchResultDate: 'vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(5)',
|
||||
searchTicketInput: `vn-searchbar input`,
|
||||
searchWeeklyTicketInput: `vn-searchbar input`,
|
||||
searchTicketInput: 'vn-searchbar',
|
||||
searchWeeklyClearInput: 'vn-searchbar vn-icon[icon=clear]',
|
||||
advancedSearchButton: 'vn-ticket-search-panel button[type=submit]',
|
||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||
searchWeeklyButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||
moreMenu: 'vn-ticket-index vn-icon-menu[icon=more_vert]',
|
||||
menuWeeklyTickets: 'vn-left-menu [ui-sref="ticket.weekly.index"]',
|
||||
sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6) vn-autocomplete[ng-model="weekly.weekDay"] input',
|
||||
sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6)',
|
||||
weeklyTicket: 'vn-ticket-weekly-index vn-table > div > vn-tbody > vn-tr',
|
||||
firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
|
||||
acceptDeleteTurn: '.vn-confirm.shown button[response="accept"]'
|
||||
|
@ -379,8 +380,8 @@ export default {
|
|||
firstNoteRemoveButton: 'vn-icon[icon="delete"]',
|
||||
addNoteButton: 'vn-icon[icon="add_circle"]',
|
||||
firstNoteTypeAutocomplete: 'vn-autocomplete[ng-model="observation.observationTypeFk"]',
|
||||
firstDescriptionInput: 'vn-textfield[label="Description"] input',
|
||||
submitNotesButton: `button[type=submit]`
|
||||
firstDescriptionInput: 'vn-ticket-observation [ng-model="observation.description"]',
|
||||
submitNotesButton: 'button[type=submit]'
|
||||
},
|
||||
ticketExpedition: {
|
||||
expeditionButton: 'vn-left-menu a[ui-sref="ticket.card.expedition"]',
|
||||
|
@ -391,7 +392,7 @@ export default {
|
|||
ticketPackages: {
|
||||
packagesButton: 'vn-left-menu a[ui-sref="ticket.card.package"]',
|
||||
firstPackageAutocomplete: 'vn-autocomplete[label="Package"]',
|
||||
firstQuantityInput: 'vn-input-number[ng-model="package.quantity"] input',
|
||||
firstQuantityInput: 'vn-ticket-package vn-horizontal:nth-child(1) [ng-model="package.quantity"]',
|
||||
firstRemovePackageButton: 'vn-icon-button[vn-tooltip="Remove package"]',
|
||||
addPackageButton: 'vn-icon-button[vn-tooltip="Add package"]',
|
||||
clearPackageAutocompleteButton: 'vn-autocomplete[label="Package"] .icons > vn-icon[icon=clear]',
|
||||
|
@ -410,7 +411,6 @@ export default {
|
|||
moreMenuReserve: '.vn-drop-down.shown li[name="Mark as reserved"]',
|
||||
moreMenuUnmarkReseved: '.vn-drop-down.shown li[name="Unmark as reserved"]',
|
||||
moreMenuUpdateDiscount: '.vn-drop-down.shown li[name="Update discount"]',
|
||||
moreMenuUpdateDiscountInput: '.vn-dialog.shown form vn-ticket-sale-edit-discount vn-input-number[ng-model="$ctrl.newDiscount"] input',
|
||||
transferQuantityInput: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable > span > text',
|
||||
transferQuantityCell: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable',
|
||||
firstSaleClaimIcon: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) vn-icon[icon="icon-claims"]',
|
||||
|
@ -418,15 +418,14 @@ export default {
|
|||
firstSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(1)',
|
||||
firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) vn-td:nth-child(3) > img',
|
||||
firstSaleZoomedImage: 'body > div > div > img',
|
||||
firstSaleQuantity: 'vn-input-number[ng-model="sale.quantity"]:nth-child(1) input',
|
||||
firstSaleQuantity: 'vn-ticket-sale [ng-model="sale.quantity"]',
|
||||
firstSaleQuantityCell: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td-editable:nth-child(5)',
|
||||
firstSaleQuantityClearInput: 'vn-textfield[ng-model="sale.quantity"] div.suffix > i',
|
||||
firstSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > vn-autocomplete',
|
||||
idAutocompleteFirstResult: '.vn-drop-down.shown li',
|
||||
firstSalePrice: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(7) > span',
|
||||
firstSalePriceInput: '.vn-popover.shown vn-input-number input',
|
||||
firstSalePriceInput: '.vn-popover.shown [ng-model="$ctrl.editedPrice"]',
|
||||
firstSaleDiscount: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(8) > span',
|
||||
firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount vn-input-number input',
|
||||
firstSaleDiscountInput: '.vn-popover.shown [ng-model="$ctrl.newDiscount"]',
|
||||
firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(9)',
|
||||
firstSaleReservedIcon: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td:nth-child(2) > vn-icon:nth-child(3)',
|
||||
firstSaleColour: 'vn-ticket-sale vn-tr:nth-child(1) vn-fetched-tags section',
|
||||
|
@ -439,18 +438,18 @@ export default {
|
|||
secondSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(2)',
|
||||
secondSaleId: 'vn-ticket-sale:nth-child(2) vn-td-editable:nth-child(4) text > span',
|
||||
secondSaleIdCell: 'vn-ticket-sale vn-tr:nth-child(2) > vn-td-editable:nth-child(4)',
|
||||
secondSaleIdInput: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete input',
|
||||
secondSaleIdInput: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete',
|
||||
secondSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete',
|
||||
secondSaleQuantity: 'vn-ticket-sale vn-table vn-tr:nth-child(2) vn-input-number input',
|
||||
secondSaleQuantity: 'vn-ticket-sale vn-table vn-tr:nth-child(2) vn-input-number',
|
||||
secondSaleConceptCell: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td-editable:nth-child(6) > div',
|
||||
secondSaleConceptInput: 'vn-ticket-sale vn-table vn-tr:nth-child(2) > vn-td-editable.ng-isolate-scope.selected vn-textfield input',
|
||||
secondSaleConceptInput: 'vn-ticket-sale vn-table vn-tr:nth-child(2) > vn-td-editable.ng-isolate-scope.selected vn-textfield',
|
||||
totalImport: 'vn-ticket-sale > vn-vertical > vn-card > vn-vertical > vn-horizontal > vn-one > p:nth-child(3) > strong',
|
||||
selectAllSalesCheckbox: 'vn-ticket-sale vn-thead vn-check',
|
||||
secondSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(2) vn-check[ng-model="sale.checked"]',
|
||||
thirdSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(3) vn-check[ng-model="sale.checked"]',
|
||||
deleteSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="delete"]',
|
||||
transferSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="call_split"]',
|
||||
moveToTicketInput: '.vn-popover.shown vn-textfield[ng-model="$ctrl.transfer.ticketId"] input',
|
||||
moveToTicketInput: '.vn-popover.shown vn-textfield[ng-model="$ctrl.transfer.ticketId"]',
|
||||
moveToTicketInputClearButton: '.vn-popover.shown i[title="Clear"]',
|
||||
moveToTicketButton: '.vn-popover.shown vn-icon[icon="arrow_forward_ios"]',
|
||||
moveToNewTicketButton: '.vn-popover.shown vn-button[label="New ticket"]',
|
||||
|
@ -482,10 +481,10 @@ export default {
|
|||
ticketRequests: {
|
||||
addRequestButton: 'vn-ticket-request-index > a > vn-float-button > button',
|
||||
request: 'vn-ticket-request-index vn-table vn-tr',
|
||||
descriptionInput: 'vn-ticket-request-create > form > div > vn-card > vn-horizontal:nth-child(1) > vn-textfield input',
|
||||
descriptionInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.description"]',
|
||||
atenderAutocomplete: 'vn-ticket-request-create vn-autocomplete[ng-model="$ctrl.ticketRequest.attenderFk"]',
|
||||
quantityInput: 'vn-ticket-request-create vn-input-number input[name=quantity]',
|
||||
priceInput: 'vn-ticket-request-create vn-input-number input[name=price]',
|
||||
quantityInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.quantity"]',
|
||||
priceInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.price"]',
|
||||
firstRemoveRequestButton: 'vn-ticket-request-index vn-icon[icon="delete"]:nth-child(1)',
|
||||
saveButton: 'vn-ticket-request-create button[type=submit]',
|
||||
firstDescription: 'vn-ticket-request-index vn-table vn-tr:nth-child(1) > vn-td:nth-child(2)',
|
||||
|
@ -501,11 +500,11 @@ export default {
|
|||
addServiceButton: 'vn-ticket-service vn-icon-button[vn-tooltip="Add service"] > button',
|
||||
firstAddServiceTypeButton: 'vn-ticket-service vn-icon-button[vn-tooltip="New service type"]',
|
||||
firstServiceTypeAutocomplete: 'vn-ticket-service vn-autocomplete[ng-model="service.ticketServiceTypeFk"]',
|
||||
firstQuantityInput: 'vn-ticket-service vn-input-number[label="Quantity"] input',
|
||||
firstPriceInput: 'vn-ticket-service vn-input-number[label="Price"] input',
|
||||
firstQuantityInput: 'vn-ticket-service [ng-model="service.quantity"]',
|
||||
firstPriceInput: 'vn-ticket-service [ng-model="service.price"]',
|
||||
firstVatTypeAutocomplete: 'vn-ticket-service vn-autocomplete[label="Tax class"]',
|
||||
fistDeleteServiceButton: 'vn-ticket-service form vn-horizontal:nth-child(1) vn-icon-button[icon="delete"]',
|
||||
newServiceTypeNameInput: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newServiceType.name"] input',
|
||||
newServiceTypeNameInput: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newServiceType.name"]',
|
||||
newServiceTypeExpenseAutocomplete: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.newServiceType.expenseFk"]',
|
||||
serviceLine: 'vn-ticket-service > form > vn-card > vn-one:nth-child(2) > vn-horizontal',
|
||||
saveServiceButton: `button[type=submit]`,
|
||||
|
@ -518,7 +517,7 @@ export default {
|
|||
saveStateButton: `button[type=submit]`
|
||||
},
|
||||
claimsIndex: {
|
||||
searchClaimInput: `vn-searchbar input`,
|
||||
searchClaimInput: 'vn-searchbar',
|
||||
searchResult: 'vn-claim-index vn-card > vn-table > div > vn-tbody > a',
|
||||
searchButton: 'vn-searchbar vn-icon[icon="search"]'
|
||||
},
|
||||
|
@ -548,12 +547,11 @@ export default {
|
|||
},
|
||||
claimDetail: {
|
||||
secondItemDiscount: 'vn-claim-detail > vn-vertical > vn-card > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(6) > span',
|
||||
discountInput: '.vn-popover.shown vn-input-number[ng-model="$ctrl.newDiscount"] input',
|
||||
discountInput: '.vn-popover.shown [ng-model="$ctrl.newDiscount"]',
|
||||
discoutPopoverMana: '.vn-popover.shown .content > div > vn-horizontal > h5',
|
||||
addItemButton: 'vn-claim-detail a vn-float-button',
|
||||
firstClaimableSaleFromTicket: '.vn-dialog.shown vn-tbody > vn-tr',
|
||||
claimDetailLine: 'vn-claim-detail > vn-vertical > vn-card > vn-vertical > vn-table > div > vn-tbody > vn-tr',
|
||||
firstItemQuantityInput: 'vn-claim-detail vn-tr:nth-child(1) vn-input-number[ng-model="saleClaimed.quantity"] input',
|
||||
totalClaimed: 'vn-claim-detail > vn-vertical > vn-card > vn-vertical > vn-horizontal > div > vn-label-value:nth-child(2) > section > span',
|
||||
secondItemDeleteButton: 'vn-claim-detail > vn-vertical > vn-card > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(8) > vn-icon-button > button > vn-icon > i'
|
||||
},
|
||||
|
@ -570,7 +568,7 @@ export default {
|
|||
secondClaimResponsibleAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimResponsibleFk"]',
|
||||
secondClaimWorkerAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.workerFk"]',
|
||||
secondClaimRedeliveryAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]',
|
||||
saveDevelopmentButton: `button[type=submit]`
|
||||
saveDevelopmentButton: 'button[type=submit]'
|
||||
},
|
||||
claimAction: {
|
||||
importClaimButton: 'vn-claim-action vn-button[label="Import claim"]',
|
||||
|
@ -585,9 +583,8 @@ export default {
|
|||
searchResult: 'vn-order-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
||||
searchResultDate: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)',
|
||||
searchResultAddress: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)',
|
||||
searchOrderInput: `vn-order-index vn-textfield input`,
|
||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||
createOrderButton: `vn-float-button`,
|
||||
createOrderButton: 'vn-float-button',
|
||||
},
|
||||
orderDescriptor: {
|
||||
returnToModuleIndexButton: 'vn-order-descriptor a[ui-sref="order.index"]',
|
||||
|
@ -598,18 +595,18 @@ export default {
|
|||
addressAutocomplete: 'vn-autocomplete[label="Address"]',
|
||||
agencyAutocomplete: 'vn-autocomplete[label="Agency"]',
|
||||
landedDatePicker: 'vn-date-picker[label="Landed"]',
|
||||
createButton: `button[type=submit]`,
|
||||
createButton: 'button[type=submit]',
|
||||
cancelButton: 'vn-button[href="#!/client/index"]'
|
||||
},
|
||||
orderCatalog: {
|
||||
orderByAutocomplete: 'vn-autocomplete[label="Order by"]',
|
||||
plantRealmButton: 'vn-order-catalog > vn-side-menu vn-icon[icon="icon-plant"]',
|
||||
typeAutocomplete: 'vn-autocomplete[data="$ctrl.itemTypes"]',
|
||||
itemIdInput: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.itemId"] input',
|
||||
itemTagValueInput: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.value"] input',
|
||||
itemIdInput: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.itemId"]',
|
||||
itemTagValueInput: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.value"]',
|
||||
openTagSearch: 'vn-catalog-filter > div > vn-vertical > vn-textfield[ng-model="$ctrl.value"] .append i',
|
||||
tagAutocomplete: 'vn-order-catalog-search-panel vn-autocomplete[ng-model="filter.tagFk"]',
|
||||
tagValueInput: 'vn-order-catalog-search-panel vn-textfield[ng-model="filter.value"] input',
|
||||
tagValueInput: 'vn-order-catalog-search-panel [ng-model="filter.value"]',
|
||||
searchTagButton: 'vn-order-catalog-search-panel button[type=submit]',
|
||||
thirdFilterRemoveButton: 'vn-catalog-filter .chips > vn-chip:nth-child(3) vn-icon[icon=cancel]',
|
||||
fourthFilterRemoveButton: 'vn-catalog-filter .chips > vn-chip:nth-child(4) vn-icon[icon=cancel]',
|
||||
|
@ -636,7 +633,7 @@ export default {
|
|||
createdDatePicker: 'vn-route-create vn-date-picker[ng-model="$ctrl.route.created"]',
|
||||
vehicleAutoComplete: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]',
|
||||
agencyAutoComplete: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]',
|
||||
descriptionInput: 'vn-route-create vn-textfield[ng-model="$ctrl.route.description"] input',
|
||||
descriptionInput: 'vn-route-create [ng-model="$ctrl.route.description"]',
|
||||
submitButton: 'vn-route-create button[type=submit]'
|
||||
},
|
||||
routeDescriptor: {
|
||||
|
@ -649,26 +646,26 @@ export default {
|
|||
workerAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.workerFk"]',
|
||||
vehicleAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]',
|
||||
agencyAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]',
|
||||
kmStartInput: 'vn-route-basic-data vn-input-number[ng-model="$ctrl.route.kmStart"] input',
|
||||
kmEndInput: 'vn-route-basic-data vn-input-number[ng-model="$ctrl.route.kmEnd"] input',
|
||||
kmStartInput: 'vn-route-basic-data [ng-model="$ctrl.route.kmStart"]',
|
||||
kmEndInput: 'vn-route-basic-data [ng-model="$ctrl.route.kmEnd"]',
|
||||
createdDateInput: 'vn-route-basic-data vn-date-picker[ng-model="$ctrl.route.created"]',
|
||||
startedHourInput: 'vn-route-basic-data vn-input-time[ng-model="$ctrl.route.started"] input',
|
||||
finishedHourInput: 'vn-route-basic-data vn-input-time[ng-model="$ctrl.route.finished"] input',
|
||||
startedHourInput: 'vn-route-basic-data [ng-model="$ctrl.route.started"]',
|
||||
finishedHourInput: 'vn-route-basic-data [ng-model="$ctrl.route.finished"]',
|
||||
saveButton: 'vn-route-basic-data button[type=submit]'
|
||||
},
|
||||
routeTickets: {
|
||||
firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-textfield[ng-model="ticket.priority"] input',
|
||||
secondTicketPriority: 'vn-route-tickets vn-tr:nth-child(2) vn-textfield[ng-model="ticket.priority"] input',
|
||||
thirdTicketPriority: 'vn-route-tickets vn-tr:nth-child(3) vn-textfield[ng-model="ticket.priority"] input',
|
||||
fourthTicketPriority: 'vn-route-tickets vn-tr:nth-child(4) vn-textfield[ng-model="ticket.priority"] input',
|
||||
eleventhTicketPriority: 'vn-route-tickets vn-tr:nth-child(11) vn-textfield[ng-model="ticket.priority"] input',
|
||||
firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-textfield[ng-model="ticket.priority"]',
|
||||
secondTicketPriority: 'vn-route-tickets vn-tr:nth-child(2) vn-textfield[ng-model="ticket.priority"]',
|
||||
thirdTicketPriority: 'vn-route-tickets vn-tr:nth-child(3) vn-textfield[ng-model="ticket.priority"]',
|
||||
fourthTicketPriority: 'vn-route-tickets vn-tr:nth-child(4) vn-textfield[ng-model="ticket.priority"]',
|
||||
eleventhTicketPriority: 'vn-route-tickets vn-tr:nth-child(11) vn-textfield[ng-model="ticket.priority"]',
|
||||
firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check',
|
||||
buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]',
|
||||
firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]',
|
||||
confirmButton: '.vn-confirm.shown button[response="accept"]'
|
||||
},
|
||||
workerPbx: {
|
||||
extensionInput: 'vn-worker-pbx vn-textfield[ng-model="$ctrl.worker.sip.extension"] input',
|
||||
extensionInput: 'vn-worker-pbx [ng-model="$ctrl.worker.sip.extension"]',
|
||||
saveButton: 'vn-worker-pbx button[type=submit]'
|
||||
},
|
||||
workerTimeControl: {
|
||||
|
@ -724,7 +721,7 @@ export default {
|
|||
acceptDeleteDialog: '.vn-confirm.shown button[response="accept"]'
|
||||
},
|
||||
invoiceOutIndex: {
|
||||
searchInvoiceOutInput: `vn-searchbar input`,
|
||||
searchInvoiceOutInput: 'vn-searchbar',
|
||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||
searchResult: 'vn-invoice-out-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
||||
},
|
||||
|
|
|
@ -1,37 +1,42 @@
|
|||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Login path', () => {
|
||||
const nightmare = createNightmare();
|
||||
describe('Login path', async() => {
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should receive an error when the username is incorrect', async() => {
|
||||
const result = await nightmare
|
||||
.doLogin('badUser', null)
|
||||
.waitForLastSnackbar();
|
||||
await page.doLogin('badUser', '');
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should receive an error when the username is blank', async() => {
|
||||
const result = await nightmare
|
||||
.doLogin('', null)
|
||||
.waitForLastSnackbar();
|
||||
await page.doLogin('', '');
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should receive an error when the password is incorrect', async() => {
|
||||
const result = await nightmare
|
||||
.doLogin('employee', 'badPassword')
|
||||
.waitForLastSnackbar();
|
||||
await page.doLogin('employee', 'badPassword');
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should log in', async() => {
|
||||
const url = await nightmare
|
||||
.doLogin('employee', null)
|
||||
.wait('#user')
|
||||
.parsedUrl();
|
||||
await page.doLogin('employee', 'nightmare');
|
||||
await page.waitForNavigation();
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/');
|
||||
});
|
||||
|
|
|
@ -1,90 +1,90 @@
|
|||
import selectors from '../../helpers/selectors';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client create path', () => {
|
||||
const nightmare = createNightmare();
|
||||
describe('Client create path', async() => {
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should search for the user Carol Danvers to confirm it isn't created yet`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
|
||||
.waitToClick(selectors.clientsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0)
|
||||
.countElement(selectors.clientsIndex.searchResult);
|
||||
await page.write(selectors.clientsIndex.searchClientInput, 'Carol Danvers');
|
||||
await page.waitToClick(selectors.clientsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0);
|
||||
const result = await page.countElement(selectors.clientsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(0);
|
||||
});
|
||||
|
||||
it('should now access to the create client view by clicking the create-client floating button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientsIndex.createClientButton)
|
||||
.wait(selectors.createClientView.createButton)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientsIndex.createClientButton);
|
||||
await page.wait(selectors.createClientView.createButton);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/create');
|
||||
});
|
||||
|
||||
it('should receive an error when clicking the create button having all the form fields empty', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.createClientView.createButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it('should receive an error when clicking the create button having name and Business name fields empty', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.createClientView.taxNumber, '74451390E')
|
||||
.write(selectors.createClientView.userName, 'CaptainMarvel')
|
||||
.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es')
|
||||
.autocompleteSearch(selectors.createClientView.salesPersonAutocomplete, 'replenisher')
|
||||
.waitToClick(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.createClientView.taxNumber, '74451390E');
|
||||
await page.write(selectors.createClientView.userName, 'CaptainMarvel');
|
||||
await page.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es');
|
||||
await page.autocompleteSearch(selectors.createClientView.salesPersonAutocomplete, 'replenisher');
|
||||
await page.waitToClick(selectors.createClientView.createButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it(`should attempt to create a new user with all it's data but wrong email`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.createClientView.name, 'Carol Danvers')
|
||||
.write(selectors.createClientView.socialName, 'AVG tax')
|
||||
.write(selectors.createClientView.street, 'Many places')
|
||||
.autocompleteSearch(selectors.createClientView.country, 'España')
|
||||
.autocompleteSearch(selectors.createClientView.province, 'Province one')
|
||||
.write(selectors.createClientView.city, 'Valencia')
|
||||
.write(selectors.createClientView.postcode, '46000')
|
||||
.clearInput(selectors.createClientView.email)
|
||||
.write(selectors.createClientView.email, 'incorrect email format')
|
||||
.waitToClick(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.createClientView.name, 'Carol Danvers');
|
||||
await page.write(selectors.createClientView.socialName, 'AVG tax');
|
||||
await page.write(selectors.createClientView.street, 'Many places');
|
||||
await page.waitForContentLoaded();
|
||||
await page.autocompleteSearch(selectors.createClientView.country, 'España');
|
||||
await page.autocompleteSearch(selectors.createClientView.province, 'Province one');
|
||||
await page.write(selectors.createClientView.city, 'Valencia');
|
||||
await page.write(selectors.createClientView.postcode, '46000');
|
||||
await page.clearInput(selectors.createClientView.email);
|
||||
await page.write(selectors.createClientView.email, 'incorrect email format');
|
||||
await page.waitToClick(selectors.createClientView.createButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it(`should attempt to create a new user with all it's data but wrong postal code`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.createClientView.email)
|
||||
.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es')
|
||||
.clearInput(selectors.createClientView.postcode)
|
||||
.write(selectors.createClientView.postcode, '479999')
|
||||
.waitToClick(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.createClientView.email);
|
||||
await page.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es');
|
||||
await page.clearInput(selectors.createClientView.postcode);
|
||||
await page.write(selectors.createClientView.postcode, '479999');
|
||||
await page.waitToClick(selectors.createClientView.createButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(`The postcode doesn't exists. Ensure you put the correct format`);
|
||||
});
|
||||
|
||||
it(`should check for autocompleted city, province and country`, async() => {
|
||||
const clientCity = await nightmare
|
||||
.waitToGetProperty(`${selectors.createClientView.city}`, 'value');
|
||||
const clientCity = await page
|
||||
.waitToGetProperty(`${selectors.createClientView.city} input`, 'value');
|
||||
|
||||
const clientProvince = await nightmare
|
||||
const clientProvince = await page
|
||||
.waitToGetProperty(`${selectors.createClientView.province} input`, 'value');
|
||||
|
||||
const clientCountry = await nightmare
|
||||
const clientCountry = await page
|
||||
.waitToGetProperty(`${selectors.createClientView.country} input`, 'value');
|
||||
|
||||
expect(clientCity).toEqual('Valencia');
|
||||
|
@ -93,33 +93,31 @@ describe('Client create path', () => {
|
|||
});
|
||||
|
||||
it(`should create a new user with all correct data`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.createClientView.postcode)
|
||||
.write(selectors.createClientView.postcode, '46000')
|
||||
.waitToClick(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.createClientView.postcode);
|
||||
await page.write(selectors.createClientView.postcode, '46000');
|
||||
await page.waitToClick(selectors.createClientView.createButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should click on the Clients button of the top bar menu', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.clientsButton)
|
||||
.wait(selectors.clientsIndex.createClientButton)
|
||||
.parsedUrl();
|
||||
await page.waitFor(500);
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.clientsButton);
|
||||
await page.wait(selectors.clientsIndex.createClientButton);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/index');
|
||||
});
|
||||
|
||||
it(`should search for the user Carol Danvers to confirm it exists`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
|
||||
.waitToClick(selectors.clientsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||
.countElement(selectors.clientsIndex.searchResult);
|
||||
await page.waitForContentLoaded();
|
||||
await page.accessToSearchResult('Carol Danvers');
|
||||
await page.waitForURL('#!/client/114/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(result).toEqual(1);
|
||||
expect(url.hash).toEqual('#!/client/114/summary');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,20 +1,25 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Edit basicData path', () => {
|
||||
const nightmare = createNightmare();
|
||||
describe('as employee', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Bruce Wayne')
|
||||
.accessToSection('client.card.basicData');
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Bruce Wayne');
|
||||
await page.accessToSection('client.card.basicData');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as employee', () => {
|
||||
it('should not be able to change the salesPerson', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientBasicData.nameInput)
|
||||
.evaluate(selector => {
|
||||
await page.wait(selectors.clientBasicData.nameInput);
|
||||
const result = await page.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.clientBasicData.salesPersonAutocomplete} input`);
|
||||
|
||||
|
@ -22,44 +27,42 @@ describe('Client Edit basicData path', () => {
|
|||
});
|
||||
|
||||
it('should edit the client basic data but leave salesPerson untainted', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientBasicData.nameInput)
|
||||
.write(selectors.clientBasicData.nameInput, 'Ptonomy Wallace')
|
||||
.clearInput(selectors.clientBasicData.contactInput)
|
||||
.write(selectors.clientBasicData.contactInput, 'David Haller')
|
||||
.clearInput(selectors.clientBasicData.emailInput)
|
||||
.write(selectors.clientBasicData.emailInput, 'PWallace@verdnatura.es')
|
||||
.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Rumors on the streets')
|
||||
.waitToClick(selectors.clientBasicData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientBasicData.nameInput);
|
||||
await page.write(selectors.clientBasicData.nameInput, 'Ptonomy Wallace');
|
||||
await page.clearInput(selectors.clientBasicData.contactInput);
|
||||
await page.write(selectors.clientBasicData.contactInput, 'David Haller');
|
||||
await page.clearInput(selectors.clientBasicData.emailInput);
|
||||
await page.write(selectors.clientBasicData.emailInput, 'PWallace@verdnatura.es');
|
||||
await page.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Rumors on the streets');
|
||||
await page.waitToClick(selectors.clientBasicData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('client.card.basicData')
|
||||
.waitToGetProperty(selectors.clientBasicData.nameInput, 'value');
|
||||
await page.reloadSection('client.card.basicData');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientBasicData.nameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Ptonomy Wallace');
|
||||
});
|
||||
|
||||
it('should confirm the contact name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientBasicData.contactInput, 'value');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.contactInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('David Haller');
|
||||
});
|
||||
|
||||
it('should confirm the email have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientBasicData.emailInput, 'value');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.emailInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('PWallace@verdnatura.es');
|
||||
});
|
||||
|
||||
it('should confirm the channel have been selected', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.channelAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Rumors on the streets');
|
||||
|
@ -67,17 +70,15 @@ describe('Client Edit basicData path', () => {
|
|||
});
|
||||
|
||||
describe('as salesAssistant', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesASsistant', 'client')
|
||||
.accessToSearchResult('Ptonomy Wallace')
|
||||
.accessToSection('client.card.basicData');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('salesASsistant', 'client');
|
||||
await page.accessToSearchResult('Ptonomy Wallace');
|
||||
await page.accessToSection('client.card.basicData');
|
||||
});
|
||||
|
||||
it('should be able to change the salesPerson', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientBasicData.nameInput)
|
||||
.evaluate(selector => {
|
||||
await page.wait(selectors.clientBasicData.nameInput);
|
||||
const result = await page.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.clientBasicData.salesPersonAutocomplete} input`);
|
||||
|
||||
|
@ -85,52 +86,50 @@ describe('Client Edit basicData path', () => {
|
|||
});
|
||||
|
||||
it('should edit the client basic data including salesPerson', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientBasicData.nameInput)
|
||||
.write(selectors.clientBasicData.nameInput, 'Ororo Munroe')
|
||||
.clearInput(selectors.clientBasicData.contactInput)
|
||||
.write(selectors.clientBasicData.contactInput, 'Black Panther')
|
||||
.clearInput(selectors.clientBasicData.emailInput)
|
||||
.write(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es')
|
||||
.autocompleteSearch(selectors.clientBasicData.salesPersonAutocomplete, 'replenisherNick')
|
||||
.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Metropolis newspaper')
|
||||
.waitToClick(selectors.clientBasicData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientBasicData.nameInput);
|
||||
await page.write(selectors.clientBasicData.nameInput, 'Ororo Munroe');
|
||||
await page.clearInput(selectors.clientBasicData.contactInput);
|
||||
await page.write(selectors.clientBasicData.contactInput, 'Black Panther');
|
||||
await page.clearInput(selectors.clientBasicData.emailInput);
|
||||
await page.write(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es');
|
||||
await page.autocompleteSearch(selectors.clientBasicData.salesPersonAutocomplete, 'replenisherNick');
|
||||
await page.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Metropolis newspaper');
|
||||
await page.waitToClick(selectors.clientBasicData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should now confirm the name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('client.card.basicData')
|
||||
.waitToGetProperty(selectors.clientBasicData.nameInput, 'value');
|
||||
await page.reloadSection('client.card.basicData');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientBasicData.nameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Ororo Munroe');
|
||||
});
|
||||
|
||||
it('should now confirm the contact name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientBasicData.contactInput, 'value');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.contactInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Black Panther');
|
||||
});
|
||||
|
||||
it('should now confirm the email have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientBasicData.emailInput, 'value');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.emailInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Storm@verdnatura.es');
|
||||
});
|
||||
|
||||
it('should confirm the sales person have been selected', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.salesPersonAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('replenisherNick');
|
||||
});
|
||||
|
||||
it('should now confirm the channel have been selected', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.channelAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Metropolis newspaper');
|
||||
|
|
|
@ -1,314 +1,287 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Edit fiscalData path', () => {
|
||||
const nightmare = createNightmare();
|
||||
describe('as employee', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.address.index');
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.address.index');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as employee', () => {
|
||||
// Confirms all addresses have EQtax false for future propagation test step 1
|
||||
it(`should click on the 1st edit icon to check EQtax isnt checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
// Confirms all addresses have EQtax false for future propagation test step 2
|
||||
it(`should go back to addresses then select the second one and confirm the EQtax isnt checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitToClick(selectors.clientAddresses.secondEditAddress)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||
await page.waitToClick(selectors.clientAddresses.secondEditAddress);
|
||||
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it(`should click on the fiscal data button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.waitForURL('fiscal-data')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||
await page.waitForURL('fiscal-data');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('fiscal-data');
|
||||
});
|
||||
|
||||
it('should not be able to edit the verified data checkbox', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.verifiedDataCheckbox)
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
await page.wait(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('as administrative', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it(`should edit the fiscal data but fail as the fiscal id ain't valid`, async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'SMASH')
|
||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
||||
.write(selectors.clientFiscalData.fiscalIdInput, 'INVALID!')
|
||||
.clearInput(selectors.clientFiscalData.addressInput)
|
||||
.write(selectors.clientFiscalData.addressInput, 'Somewhere edited')
|
||||
.autocompleteSearch(selectors.clientFiscalData.countryAutocomplete, 'España')
|
||||
.autocompleteSearch(selectors.clientFiscalData.provinceAutocomplete, 'Province one')
|
||||
.clearInput(selectors.clientFiscalData.cityInput)
|
||||
.write(selectors.clientFiscalData.cityInput, 'Valencia')
|
||||
.clearInput(selectors.clientFiscalData.postcodeInput)
|
||||
.write(selectors.clientFiscalData.postcodeInput, '46000')
|
||||
.waitToClick(selectors.clientFiscalData.activeCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.frozenCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.viesCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.invoiceByMailCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||
await page.write(selectors.clientFiscalData.socialNameInput, 'SMASH');
|
||||
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||
await page.write(selectors.clientFiscalData.fiscalIdInput, 'INVALID!');
|
||||
await page.clearInput(selectors.clientFiscalData.addressInput);
|
||||
await page.write(selectors.clientFiscalData.addressInput, 'Somewhere edited');
|
||||
await page.autocompleteSearch(selectors.clientFiscalData.countryAutocomplete, 'España');
|
||||
await page.autocompleteSearch(selectors.clientFiscalData.provinceAutocomplete, 'Province one');
|
||||
await page.clearInput(selectors.clientFiscalData.cityInput);
|
||||
await page.write(selectors.clientFiscalData.cityInput, 'Valencia');
|
||||
await page.clearInput(selectors.clientFiscalData.postcodeInput);
|
||||
await page.write(selectors.clientFiscalData.postcodeInput, '46000');
|
||||
await page.waitToClick(selectors.clientFiscalData.activeCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.frozenCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.viesCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.invoiceByMailCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Invalid Tax number');
|
||||
});
|
||||
}, 15000);
|
||||
|
||||
it(`should edit the fiscal this time with a valid fiscal id`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
||||
.write(selectors.clientFiscalData.fiscalIdInput, '94980061C')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||
await page.write(selectors.clientFiscalData.fiscalIdInput, '94980061C');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should propagate the Equalization tax', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.acceptPropagationButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientFiscalData.acceptPropagationButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Equivalent tax spreaded');
|
||||
});
|
||||
|
||||
it('should receive an error if the fiscal id contains A or B at the beginning', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.viesCheckbox)
|
||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
||||
.write(selectors.clientFiscalData.fiscalIdInput, 'A94980061C')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientFiscalData.viesCheckbox);
|
||||
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||
await page.write(selectors.clientFiscalData.fiscalIdInput, 'A94980061C');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Cannot check Equalization Tax in this NIF/CIF');
|
||||
});
|
||||
|
||||
it('should finally edit the fixcal data correctly as VIES isnt checked and fiscal id is valid for EQtax', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
||||
.write(selectors.clientFiscalData.fiscalIdInput, '94980061C')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||
await page.write(selectors.clientFiscalData.fiscalIdInput, '94980061C');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
// confirm all addresses have now EQtax checked step 1
|
||||
it(`should click on the addresses button to access to the client's addresses`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitForURL('/address/index')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||
await page.waitForURL('/address/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/address/index');
|
||||
});
|
||||
|
||||
// confirm all addresses have now EQtax checked step 2
|
||||
it(`should click on the 1st edit icon to confirm EQtax is checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.waitForWatcherData(selectors.clientAddresses.watcher)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||
await page.waitForWatcherData(selectors.clientAddresses.watcher);
|
||||
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
// confirm all addresses have now EQtax checked step 3
|
||||
it(`should go back to addresses then select the second one and confirm the EQtax is checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitToClick(selectors.clientAddresses.secondEditAddress)
|
||||
.waitForWatcherData(selectors.clientAddresses.watcher)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||
await page.waitToClick(selectors.clientAddresses.secondEditAddress);
|
||||
await page.waitForWatcherData(selectors.clientAddresses.watcher);
|
||||
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
it('should navigate back to fiscal data and uncheck EQtax then check VIES', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.waitToClick(selectors.clientFiscalData.viesCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||
await page.waitToClick(selectors.clientFiscalData.viesCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should propagate the Equalization tax changes', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.acceptPropagationButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientFiscalData.acceptPropagationButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Equivalent tax spreaded');
|
||||
});
|
||||
|
||||
it('should confirm its name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('SMASH');
|
||||
});
|
||||
|
||||
it('should confirm the fiscal id have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientFiscalData.fiscalIdInput, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.fiscalIdInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('94980061C');
|
||||
});
|
||||
|
||||
it('should confirm the address have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientFiscalData.addressInput, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.addressInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Somewhere edited');
|
||||
});
|
||||
|
||||
it('should confirm the postcode have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientFiscalData.postcodeInput}`, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.postcodeInput} input`, 'value');
|
||||
|
||||
expect(result).toContain('46000');
|
||||
});
|
||||
|
||||
it('should confirm the city have been autocompleted', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientFiscalData.cityInput}`, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.cityInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Valencia');
|
||||
});
|
||||
|
||||
|
||||
it(`should confirm the province have been autocompleted`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientFiscalData.provinceAutocomplete} input`, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.provinceAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Province one');
|
||||
});
|
||||
|
||||
it('should confirm the country have been autocompleted', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientFiscalData.countryAutocomplete} input`, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.countryAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('España');
|
||||
});
|
||||
|
||||
it('should confirm active checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.activeCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.activeCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm frozen checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.frozenCheckbox);
|
||||
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 nightmare
|
||||
.checkboxState(selectors.clientFiscalData.hasToInvoiceCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.hasToInvoiceCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm Vies checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.viesCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.viesCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
it('should confirm Invoice by mail checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.invoiceByMailCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.invoiceByMailCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm invoice by address checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm Equalization tax checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.equalizationTaxCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm Verified data checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
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
|
||||
it(`should click on the addresses button to access to the client's addresses`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitForURL('/address/index')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||
await page.waitForURL('/address/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/address/index');
|
||||
});
|
||||
|
||||
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2
|
||||
it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.waitForTextInInput(selectors.clientAddresses.cityInput, 'Silla')
|
||||
.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox)
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||
await page.waitForTextInInput(selectors.clientAddresses.cityInput, 'Silla');
|
||||
await page.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 3
|
||||
it('should navigate back to fiscal data to confirm invoice by address is now checked', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.waitForWatcherData(selectors.clientFiscalData.watcher)
|
||||
.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||
await page.waitForWatcherData(selectors.clientFiscalData.watcher);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
|
|
@ -1,121 +1,105 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Edit billing data path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.billingData');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.billingData');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should attempt to edit the billing data without an IBAN but fail`, async() => {
|
||||
const snackbarMessage = await nightmare
|
||||
.autocompleteSearch(selectors.clientBillingData.payMethodAutocomplete, 'PayMethod with IBAN')
|
||||
.autocompleteSearch(selectors.clientBillingData.swiftBicAutocomplete, 'BBKKESMMMMM')
|
||||
.clearInput(selectors.clientBillingData.dueDayInput)
|
||||
.write(selectors.clientBillingData.dueDayInput, '60')
|
||||
.waitForTextInInput(selectors.clientBillingData.dueDayInput, '60')
|
||||
.waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox)
|
||||
.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox)
|
||||
.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox)
|
||||
.waitToClick(selectors.clientBillingData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.clientBillingData.payMethodAutocomplete, 'PayMethod with IBAN');
|
||||
await page.autocompleteSearch(selectors.clientBillingData.swiftBicAutocomplete, 'BBKKESMMMMM');
|
||||
await page.clearInput(selectors.clientBillingData.dueDayInput);
|
||||
await page.write(selectors.clientBillingData.dueDayInput, '60');
|
||||
await page.waitForTextInInput(selectors.clientBillingData.dueDayInput, '60');
|
||||
await page.waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox);
|
||||
await page.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox);
|
||||
await page.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox);
|
||||
await page.waitToClick(selectors.clientBillingData.saveButton);
|
||||
let snackbarMessage = await page.waitForLastSnackbar();
|
||||
|
||||
expect(snackbarMessage).toEqual('That payment method requires an IBAN');
|
||||
});
|
||||
|
||||
it(`should add the IBAN but fail as it requires a BIC code`, async() => {
|
||||
const snackbarMessage = await nightmare
|
||||
.waitToClick(selectors.clientBillingData.clearswiftBicButton)
|
||||
.clearInput(selectors.clientBillingData.IBANInput)
|
||||
.write(selectors.clientBillingData.IBANInput, 'FR9121000418450200051332')
|
||||
.waitForTextInInput(selectors.clientBillingData.IBANInput, 'FR9121000418450200051332')
|
||||
.wait(1000)
|
||||
.waitToClick(selectors.clientBillingData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(snackbarMessage).toEqual('That payment method requires a BIC');
|
||||
});
|
||||
|
||||
it(`should create a new BIC code`, async() => {
|
||||
const newcode = await nightmare
|
||||
.waitToClick(selectors.clientBillingData.newBankEntityButton)
|
||||
.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank')
|
||||
.write(selectors.clientBillingData.newBankEntityCode, 9999)
|
||||
.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT')
|
||||
.waitToClick(selectors.clientBillingData.acceptBankEntityButton)
|
||||
.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
await page.waitToClick(selectors.clientBillingData.newBankEntityButton);
|
||||
await page.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank');
|
||||
await page.write(selectors.clientBillingData.newBankEntityCode, '9999');
|
||||
await page.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT');
|
||||
await page.waitToClick(selectors.clientBillingData.acceptBankEntityButton);
|
||||
await page.waitForTextInInput(selectors.clientBillingData.swiftBicAutocomplete, 'Gotham City Bank');
|
||||
let newcode = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
|
||||
expect(newcode).toEqual('GTHMCT Gotham City Bank');
|
||||
});
|
||||
|
||||
it(`should confirm the IBAN pay method is sucessfully saved`, async() => {
|
||||
const payMethod = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientBillingData.payMethodAutocomplete} input`, 'value');
|
||||
it(`should confirm the IBAN pay method was sucessfully saved`, async() => {
|
||||
let payMethod = await page.waitToGetProperty(`${selectors.clientBillingData.payMethodAutocomplete} input`, 'value');
|
||||
|
||||
expect(payMethod).toEqual('PayMethod with IBAN');
|
||||
});
|
||||
|
||||
it(`should clear the BIC code field, update the IBAN to see how he BIC code autocompletes`, async() => {
|
||||
const AutomaticCode = await nightmare
|
||||
.clearInput(selectors.clientBillingData.IBANInput)
|
||||
.write(selectors.clientBillingData.IBANInput, 'ES9121000418450200051332')
|
||||
.waitForTextInInput(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'caixesbb')
|
||||
.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
await page.write(selectors.clientBillingData.IBANInput, 'ES9121000418450200051332');
|
||||
await page.keyboard.press('Tab');
|
||||
await page.keyboard.press('Tab');
|
||||
await page.waitForTextInInput(selectors.clientBillingData.swiftBicAutocomplete, 'caixesbb');
|
||||
let automaticCode = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
|
||||
expect(AutomaticCode).toEqual('CAIXESBB Caixa Bank');
|
||||
expect(automaticCode).toEqual('CAIXESBB Caixa Bank');
|
||||
});
|
||||
|
||||
it(`should save the form with all its new data`, async() => {
|
||||
const snackbarMessages = await nightmare
|
||||
.waitForWatcherData(selectors.clientBillingData.watcher)
|
||||
.waitToClick(selectors.clientBillingData.saveButton)
|
||||
.waitForSnackbar();
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitForWatcherData(selectors.clientBillingData.watcher);
|
||||
await page.waitToClick(selectors.clientBillingData.saveButton);
|
||||
let snackbarMessage = await page.waitForLastSnackbar();
|
||||
|
||||
expect(snackbarMessages).toEqual(jasmine.arrayContaining(['Data saved!']));
|
||||
expect(snackbarMessage).toEqual('Notification sent!');
|
||||
});
|
||||
|
||||
it('should confirm the due day have been edited', async() => {
|
||||
const dueDate = await nightmare
|
||||
.waitToGetProperty(selectors.clientBillingData.dueDayInput, 'value');
|
||||
let dueDate = await page.waitToGetProperty(`${selectors.clientBillingData.dueDayInput} input`, 'value');
|
||||
|
||||
expect(dueDate).toEqual('60');
|
||||
});
|
||||
|
||||
it('should confirm the IBAN was saved', async() => {
|
||||
const IBAN = await nightmare
|
||||
.waitToGetProperty(selectors.clientBillingData.IBANInput, 'value');
|
||||
let IBAN = await page.waitToGetProperty(`${selectors.clientBillingData.IBANInput} input`, 'value');
|
||||
|
||||
expect(IBAN).toEqual('ES9121000418450200051332');
|
||||
});
|
||||
|
||||
it('should confirm the swift / BIC code was saved', async() => {
|
||||
const code = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
let code = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
|
||||
expect(code).toEqual('CAIXESBB Caixa Bank');
|
||||
});
|
||||
|
||||
it('should confirm Received LCR checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox);
|
||||
let result = await page.checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
it('should confirm Received core VNL checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox);
|
||||
let result = await page.checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm Received B2B VNL checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox);
|
||||
let result = await page.checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
|
|
@ -1,119 +1,95 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Add address path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.address.index');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.address.index');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click on the add new address button to access to the new address form`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.createAddress)
|
||||
.waitForURL('address/create')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientAddresses.createAddress);
|
||||
await page.waitForURL('address/create');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('address/create');
|
||||
});
|
||||
|
||||
it('should receive an error after clicking save button as consignee, street and town fields are empty', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.defaultCheckboxInput)
|
||||
.clearInput(selectors.clientAddresses.streetAddressInput)
|
||||
.autocompleteSearch(selectors.clientAddresses.provinceAutocomplete, 'Province one')
|
||||
.clearInput(selectors.clientAddresses.cityInput)
|
||||
.write(selectors.clientAddresses.cityInput, 'Valencia')
|
||||
.clearInput(selectors.clientAddresses.postcodeInput)
|
||||
.write(selectors.clientAddresses.postcodeInput, '46000')
|
||||
.autocompleteSearch(selectors.clientAddresses.agencyAutocomplete, 'Entanglement')
|
||||
.write(selectors.clientAddresses.phoneInput, '999887744')
|
||||
.write(selectors.clientAddresses.mobileInput, '999887744')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientAddresses.defaultCheckboxInput);
|
||||
await page.autocompleteSearch(selectors.clientAddresses.provinceAutocomplete, 'Province one');
|
||||
await page.write(selectors.clientAddresses.cityInput, 'Valencia');
|
||||
await page.write(selectors.clientAddresses.postcodeInput, '46000');
|
||||
await page.autocompleteSearch(selectors.clientAddresses.agencyAutocomplete, 'Entanglement');
|
||||
await page.write(selectors.clientAddresses.phoneInput, '999887744');
|
||||
await page.write(selectors.clientAddresses.mobileInput, '999887744');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it('should confirm the postcode have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientAddresses.postcodeInput}`, 'value');
|
||||
|
||||
expect(result).toContain('46000');
|
||||
});
|
||||
|
||||
it('should confirm the city have been autocompleted', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientAddresses.cityInput}`, 'value');
|
||||
|
||||
expect(result).toEqual('Valencia');
|
||||
});
|
||||
|
||||
|
||||
it(`should confirm the province have been autocompleted`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientAddresses.provinceAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Province one');
|
||||
});
|
||||
|
||||
it(`should create a new address with all it's data`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientAddresses.consigneeInput, 'Bruce Bunner')
|
||||
.write(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York')
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.clientAddresses.consigneeInput, 'Bruce Bunner');
|
||||
await page.write(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York');
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should click on the addresses button confirm the new address exists and it's the default one`, async() => {
|
||||
const result = await nightmare
|
||||
// .waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
||||
it(`should click on the first address button to confirm the new address exists and it's the default one`, async() => {
|
||||
const result = await page.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
||||
|
||||
expect(result).toContain('320 Park Avenue New York');
|
||||
});
|
||||
|
||||
it(`should click on the make default icon of the second address then confirm it is the default one now`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.secondMakeDefaultStar)
|
||||
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
|
||||
.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
||||
it(`should click on the make default icon of the second address`, async() => {
|
||||
await page.waitToClick(selectors.clientAddresses.secondMakeDefaultStar);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the default address is the expected one`, async() => {
|
||||
await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand');
|
||||
const result = await page.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
||||
|
||||
expect(result).toContain('Somewhere in Thailand');
|
||||
});
|
||||
|
||||
it(`should click on the edit icon of the default address`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.waitForURL('/edit')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand');
|
||||
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||
await page.waitForURL('/edit');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/edit');
|
||||
});
|
||||
|
||||
it(`should click on the active checkbox and receive an error to save it because it is the default address`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForWatcherData(selectors.clientAddresses.watcher)
|
||||
.waitToClick(selectors.clientAddresses.activeCheckbox)
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForWatcherData(selectors.clientAddresses.watcher);
|
||||
await page.waitToClick(selectors.clientAddresses.activeCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('The default consignee can not be unchecked');
|
||||
});
|
||||
|
||||
// this "it" should be removed if the watcher doesn't prevent the navigation upon state changes
|
||||
it(`should go back to the addreses section by clicking the cancel button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.cancelEditAddressButton)
|
||||
.waitToClick('.vn-confirm.shown button[response="accept"]')
|
||||
.waitForURL('address/index')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientAddresses.cancelEditAddressButton);
|
||||
await page.waitToClick('.vn-confirm.shown button[response="accept"]');
|
||||
await page.waitForURL('address/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('address/index');
|
||||
});
|
||||
|
|
|
@ -1,54 +1,55 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client add address notes path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Petter Parker');
|
||||
await page.accessToSection('client.card.address.index');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Petter Parker')
|
||||
.accessToSection('client.card.address.index');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click on the edit icon of the default address`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street')
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.waitForURL('/edit')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street');
|
||||
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||
await page.waitForURL('/edit');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/edit');
|
||||
});
|
||||
|
||||
it('should not save a description without observation type', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addObservationButton)
|
||||
.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientAddresses.addObservationButton);
|
||||
await page.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description');
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it('should not save an observation type without description', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientAddresses.firstObservationDescriptionInput)
|
||||
.autocompleteSearch(selectors.clientAddresses.firstObservationTypeAutocomplete, 'comercial')
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientAddresses.firstObservationDescriptionInput);
|
||||
await page.autocompleteSearch(selectors.clientAddresses.firstObservationTypeAutocomplete, 'comercial');
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it('should create two new observations', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
|
||||
.waitToClick(selectors.clientAddresses.addObservationButton)
|
||||
.autocompleteSearch(selectors.clientAddresses.secondObservationTypeAutocomplete, 'observation one')
|
||||
.write(selectors.clientAddresses.secondObservationDescriptionInput, 'second description')
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description');
|
||||
await page.waitToClick(selectors.clientAddresses.addObservationButton);
|
||||
await page.autocompleteSearch(selectors.clientAddresses.secondObservationTypeAutocomplete, 'observation one');
|
||||
await page.write(selectors.clientAddresses.secondObservationDescriptionInput, 'second description');
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
|
|
@ -1,41 +1,43 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Edit web access path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.webAccess');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.webAccess');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should uncheck the Enable web access checkbox and update the name`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox)
|
||||
.clearInput(selectors.clientWebAccess.userNameInput)
|
||||
.write(selectors.clientWebAccess.userNameInput, 'Hulk')
|
||||
.waitToClick(selectors.clientWebAccess.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox);
|
||||
await page.clearInput(selectors.clientWebAccess.userNameInput);
|
||||
await page.write(selectors.clientWebAccess.userNameInput, 'Hulk');
|
||||
await page.waitToClick(selectors.clientWebAccess.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm web access is now unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientBasicData.basicDataButton)
|
||||
.wait(selectors.clientBasicData.nameInput)
|
||||
.waitToClick(selectors.clientsIndex.othersButton)
|
||||
.waitToClick(selectors.clientWebAccess.webAccessButton)
|
||||
.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox);
|
||||
await page.waitToClick(selectors.clientBasicData.basicDataButton);
|
||||
await page.wait(selectors.clientBasicData.nameInput);
|
||||
await page.waitToClick(selectors.clientsIndex.othersButton);
|
||||
await page.waitToClick(selectors.clientWebAccess.webAccessButton);
|
||||
const result = await page.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm web access name have been updated', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientWebAccess.userNameInput, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientWebAccess.userNameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Hulk');
|
||||
});
|
||||
|
|
|
@ -1,37 +1,40 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Add notes path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.note.index');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.note.index');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click on the add note button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientNotes.addNoteFloatButton)
|
||||
.waitForURL('/note/create')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientNotes.addNoteFloatButton);
|
||||
await page.waitForURL('/note/create');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/note/create');
|
||||
});
|
||||
|
||||
it(`should create a note`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientNotes.noteInput, 'Meeting with Black Widow 21st 9am')
|
||||
.waitToClick(selectors.clientNotes.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitFor(selectors.clientNotes.noteInput);
|
||||
await page.type(`${selectors.clientNotes.noteInput} textarea`, 'Meeting with Black Widow 21st 9am');
|
||||
await page.waitToClick(selectors.clientNotes.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the note was created', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText');
|
||||
|
||||
expect(result).toEqual('Meeting with Black Widow 21st 9am');
|
||||
});
|
||||
|
|
|
@ -1,38 +1,42 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Add credit path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesAssistant', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.credit.index');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesAssistant', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.credit.index');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click on the add credit button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientCredit.addCreditFloatButton)
|
||||
.waitForURL('/credit/create')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientCredit.addCreditFloatButton);
|
||||
await page.waitForURL('/credit/create');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/credit/create');
|
||||
});
|
||||
|
||||
it(`should edit the credit`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientCredit.creditInput)
|
||||
.write(selectors.clientCredit.creditInput, 999)
|
||||
.waitToClick(selectors.clientCredit.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForContentLoaded();
|
||||
await page.clearInput(selectors.clientCredit.creditInput);
|
||||
await page.write(selectors.clientCredit.creditInput, '999');
|
||||
await page.waitToClick(selectors.clientCredit.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the credit was updated', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText');
|
||||
await page.waitForContentLoaded();
|
||||
const result = await page.waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText');
|
||||
|
||||
expect(result).toContain(999);
|
||||
expect(result).toContain('salesAssistant');
|
||||
|
|
|
@ -1,48 +1,49 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Add greuge path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesAssistant', 'client');
|
||||
await page.accessToSearchResult('Petter Parker');
|
||||
await page.accessToSection('client.card.greuge.index');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesAssistant', 'client')
|
||||
.accessToSearchResult('Petter Parker')
|
||||
.accessToSection('client.card.greuge.index');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click on the add greuge button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientGreuge.addGreugeFloatButton)
|
||||
.waitForURL('greuge/create')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientGreuge.addGreugeFloatButton);
|
||||
await page.waitForURL('greuge/create');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('greuge/create');
|
||||
});
|
||||
|
||||
it(`should receive an error if all fields are empty but date and type on submit`, async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.clientGreuge.typeAutocomplete, 'Diff')
|
||||
.waitToClick(selectors.clientGreuge.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.clientGreuge.typeAutocomplete, 'Diff');
|
||||
await page.waitToClick(selectors.clientGreuge.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it(`should create a new greuge with all its data`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientGreuge.amountInput, 999)
|
||||
.waitForTextInInput(selectors.clientGreuge.amountInput, '999')
|
||||
.write(selectors.clientGreuge.descriptionInput, 'new armor for Batman!')
|
||||
.waitToClick(selectors.clientGreuge.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.clientGreuge.amountInput, '999');
|
||||
await page.waitForTextInInput(selectors.clientGreuge.amountInput, '999');
|
||||
await page.write(selectors.clientGreuge.descriptionInput, 'new armor for Batman!');
|
||||
await page.waitToClick(selectors.clientGreuge.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the greuge was added to the list', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText');
|
||||
|
||||
expect(result).toContain(999);
|
||||
expect(result).toContain('new armor for Batman!');
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client mandate path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesPerson', 'client');
|
||||
await page.accessToSearchResult('Petter Parker');
|
||||
await page.accessToSection('client.card.mandate');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Petter Parker')
|
||||
.accessToSection('client.card.mandate');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should confirm the client has a mandate of the CORE type', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.clientMandate.firstMandateText, 'innerText');
|
||||
|
||||
expect(result).toContain('1');
|
||||
|
|
|
@ -1,178 +1,165 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client lock verified data path', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
describe('as salesPerson', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesPerson', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as salesPerson', () => {
|
||||
it('should confirm verified data button is disabled for salesPerson', async() => {
|
||||
const result = await nightmare
|
||||
.wait(200)
|
||||
.wait(selectors.clientFiscalData.verifiedDataCheckbox)
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
await page.wait(200);
|
||||
await page.wait(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should edit the social name', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'Captain America Civil War')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||
await page.write(selectors.clientFiscalData.socialNameInput, 'Captain America Civil War');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the social name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('client.card.fiscalData')
|
||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
await page.reloadSection('client.card.fiscalData');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Captain America Civil War');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as administrative', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it('should confirm verified data button is enabled for administrative', async() => {
|
||||
const result = await nightmare
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should check the Verified data checkbox', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm Verified data checkbox is checked', async() => {
|
||||
const isChecked = await nightmare
|
||||
.reloadSection('client.card.fiscalData')
|
||||
.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
await page.reloadSection('client.card.fiscalData');
|
||||
const isChecked = await page.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(isChecked).toEqual('checked');
|
||||
});
|
||||
|
||||
it('should again edit the social name', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'Ant man and the Wasp')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||
await page.write(selectors.clientFiscalData.socialNameInput, 'Ant man and the Wasp');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should again confirm the social name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('client.card.fiscalData')
|
||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
await page.reloadSection('client.card.fiscalData');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Ant man and the Wasp');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as salesPerson second run', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('salesPerson', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it('should confirm verified data button is disabled once again for salesPerson', async() => {
|
||||
const isDisabled = await nightmare
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(isDisabled).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not be able to save change throwing a verified data error', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'This wont happen')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForSnackbar();
|
||||
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||
await page.write(selectors.clientFiscalData.socialNameInput, 'This wont happen');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(jasmine.arrayContaining([`You can't make changes on a client with verified data`]));
|
||||
});
|
||||
});
|
||||
|
||||
describe('as salesAssistant', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.forceReloadSection('client.card.fiscalData')
|
||||
.loginAndModule('salesAssistant', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
beforeAll(async() => {
|
||||
await page.forceReloadSection('client.card.fiscalData');
|
||||
await page.loginAndModule('salesAssistant', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it('should confirm verified data button is enabled for salesAssistant', async() => {
|
||||
const isDisabled = await nightmare
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(isDisabled).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should now edit the social name', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'new social name edition')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||
await page.write(selectors.clientFiscalData.socialNameInput, 'new social name edition');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should now confirm the social name have been edited once and for all', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('client.card.fiscalData')
|
||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
await page.reloadSection('client.card.fiscalData');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('new social name edition');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as salesPerson third run', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('salesPerson', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it('should confirm verified data button is enabled once again', async() => {
|
||||
const isDisabled = await nightmare
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const isDisabled = await page;
|
||||
await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(isDisabled).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should confirm the form is enabled for salesPerson', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.evaluate(selector => {
|
||||
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||
const result = await page.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, 'vn-textfield[ng-model="$ctrl.client.socialName"] > div');
|
||||
|
||||
|
|
|
@ -1,48 +1,51 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client log path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('DavidCharlesHaller');
|
||||
await page.accessToSection('client.card.basicData');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('DavidCharlesHaller')
|
||||
.accessToSection('client.card.basicData');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should update the clients name', async() => {
|
||||
let result = await nightmare
|
||||
.clearInput(selectors.clientBasicData.nameInput)
|
||||
.write(selectors.clientBasicData.nameInput, 'this is a test')
|
||||
.waitToClick(selectors.clientBasicData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientBasicData.nameInput);
|
||||
await page.write(selectors.clientBasicData.nameInput, 'this is a test');
|
||||
await page.waitToClick(selectors.clientBasicData.saveButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should navigate to the log section', async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.clientLog.logButton)
|
||||
.waitForURL('log')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientLog.logButton);
|
||||
await page.waitForURL('log');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('log');
|
||||
});
|
||||
|
||||
it('should check the previous value of the last logged change', async() => {
|
||||
let lastModificationPreviousValue = await nightmare
|
||||
let lastModificationPreviousValue = await page
|
||||
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
|
||||
|
||||
expect(lastModificationPreviousValue).toContain('DavidCharlesHaller');
|
||||
});
|
||||
|
||||
it('should check the current value of the last logged change', async() => {
|
||||
let lastModificationPreviousValue = await nightmare
|
||||
let lastModificationPreviousValue = await page
|
||||
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
|
||||
|
||||
let lastModificationCurrentValue = await nightmare
|
||||
.waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
|
||||
let lastModificationCurrentValue = await page.
|
||||
waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
|
||||
|
||||
|
||||
expect(lastModificationPreviousValue).toEqual('name: DavidCharlesHaller');
|
||||
|
|
|
@ -1,66 +1,71 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client balance path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Petter Parker');
|
||||
}, 30000);
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'client')
|
||||
.accessToSearchResult('Petter Parker');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should now edit the local user config data', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs')
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs');
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should access to the balance section to check the data shown matches the local settings', async() => {
|
||||
let result = await nightmare
|
||||
.accessToSection('client.card.balance.index')
|
||||
.waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value');
|
||||
await page.accessToSection('client.card.balance.index');
|
||||
let result = await page.waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('CCs');
|
||||
});
|
||||
|
||||
it('should now clear the user local settings', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
.waitToClick(selectors.globalItems.userConfigThirdAutocompleteClear)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should click the new payment button', async() => {
|
||||
let url = await nightmare
|
||||
.reloadSection('client.card.balance.index')
|
||||
.waitToClick(selectors.clientBalance.newPaymentButton)
|
||||
.waitForURL('/balance')
|
||||
.parsedUrl();
|
||||
await page.keyboard.press('Escape');
|
||||
await page.reloadSection('client.card.balance.index');
|
||||
await page.waitForURL('/balance');
|
||||
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/balance');
|
||||
});
|
||||
|
||||
it('should create a new payment that clears the debt', async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt')
|
||||
.waitToClick(selectors.clientBalance.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await Promise.all([
|
||||
page.waitToClick(selectors.clientBalance.newPaymentButton),
|
||||
page.waitForSelector('.vn-dialog.vn-popup.shown', {visible: true})
|
||||
]);
|
||||
await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt');
|
||||
await page.waitToClick(selectors.clientBalance.saveButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should check balance is now 0 and the company is now VNL becouse the user local settings were removed', async() => {
|
||||
let company = await nightmare
|
||||
.waitForSpinnerLoad()
|
||||
await page.waitForSpinnerLoad();
|
||||
let company = await page
|
||||
.waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value');
|
||||
|
||||
let firstBalanceLine = await nightmare
|
||||
let firstBalanceLine = await page
|
||||
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
||||
|
||||
|
||||
|
@ -68,95 +73,75 @@ describe('Client balance path', () => {
|
|||
expect(firstBalanceLine).toContain('0.00');
|
||||
});
|
||||
|
||||
it('should now click the new payment button', async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.clientBalance.newPaymentButton)
|
||||
.waitForURL('/balance')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/balance');
|
||||
});
|
||||
|
||||
it('should create a new payment that sets the balance to positive value', async() => {
|
||||
let result = await nightmare
|
||||
.clearInput(selectors.clientBalance.newPaymentAmountInput)
|
||||
.write(selectors.clientBalance.newPaymentAmountInput, '100')
|
||||
.waitToClick(selectors.clientBalance.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientBalance.newPaymentButton);
|
||||
await page.waitFor(3000); // didn't manage to make this dynamic to allow clearInput to find the icon clear... :(
|
||||
await page.clearInput(selectors.clientBalance.newPaymentAmountInput);
|
||||
await page.write(selectors.clientBalance.newPaymentAmountInput, '100');
|
||||
await page.waitToClick(selectors.clientBalance.saveButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should check balance is now -100', async() => {
|
||||
let result = await nightmare
|
||||
let result = await page
|
||||
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
||||
|
||||
expect(result).toContain('-€100.00');
|
||||
});
|
||||
|
||||
it('should again click the new payment button', async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.clientBalance.newPaymentButton)
|
||||
.waitForURL('/balance')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/balance');
|
||||
});
|
||||
|
||||
it('should create a new payment that sets the balance back to the original negative value', async() => {
|
||||
let result = await nightmare
|
||||
.clearInput(selectors.clientBalance.newPaymentAmountInput)
|
||||
.write(selectors.clientBalance.newPaymentAmountInput, '-150')
|
||||
.waitToClick(selectors.clientBalance.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientBalance.newPaymentButton);
|
||||
await page.waitFor(3000); // didn't manage to make this dynamic to allow clearInput to find the icon clear... :(
|
||||
await page.waitForSelector('.vn-dialog.vn-popup.shown', {visible: true});
|
||||
await page.clearInput(selectors.clientBalance.newPaymentAmountInput);
|
||||
await page.write(selectors.clientBalance.newPaymentAmountInput, '-150');
|
||||
await page.waitToClick(selectors.clientBalance.saveButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should check balance is now 50', async() => {
|
||||
let result = await nightmare
|
||||
let result = await page
|
||||
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
||||
|
||||
expect(result).toEqual('€50.00');
|
||||
});
|
||||
|
||||
it('should now click on the Clients button of the top bar menu', async() => {
|
||||
let url = await nightmare
|
||||
.waitForLogin('employee')
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.clientsButton)
|
||||
.wait(selectors.clientsIndex.createClientButton)
|
||||
.parsedUrl();
|
||||
await page.login('employee');
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.clientsButton);
|
||||
await page.wait(selectors.clientsIndex.createClientButton);
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/index');
|
||||
});
|
||||
|
||||
it('should now search for the user Petter Parker', async() => {
|
||||
let resultCount = await nightmare
|
||||
.write(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||
.waitToClick(selectors.clientsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||
.countElement(selectors.clientsIndex.searchResult);
|
||||
await page.write(selectors.clientsIndex.searchClientInput, 'Petter Parker');
|
||||
await page.waitToClick(selectors.clientsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1);
|
||||
let resultCount = await page.countElement(selectors.clientsIndex.searchResult);
|
||||
|
||||
expect(resultCount).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the client's balance`, async() => {
|
||||
let url = await nightmare
|
||||
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
||||
.waitToClick(selectors.clientsIndex.searchResult)
|
||||
.waitToClick(selectors.clientBalance.balanceButton)
|
||||
.waitForURL('/balance')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker');
|
||||
await page.waitToClick(selectors.clientsIndex.searchResult);
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.clientBalance.balanceButton);
|
||||
await page.waitForURL('/balance');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/balance');
|
||||
});
|
||||
|
||||
it('should not be able to click the new payment button as it isnt present', async() => {
|
||||
let result = await nightmare
|
||||
.exists(selectors.clientBalance.newPaymentButton);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
await page.waitFor(selectors.clientBalance.newPaymentButton, {hidden: true});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,30 +1,40 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('User config', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as salesPerson', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.waitForLogin('salesPerson');
|
||||
it('should login', async() => {
|
||||
await page.login('salesPerson');
|
||||
});
|
||||
|
||||
it('should now open the user config form to check the settings', async() => {
|
||||
let userLocalWarehouse = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
|
||||
let userLocalWarehouse = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
||||
|
||||
let userLocalBank = await nightmare
|
||||
|
||||
let userLocalBank = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalBank} input`, 'value');
|
||||
|
||||
let userLocalCompany = await nightmare
|
||||
let userLocalCompany = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalCompany} input`, 'value');
|
||||
|
||||
let userWarehouse = await nightmare
|
||||
let userWarehouse = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value');
|
||||
|
||||
let userCompany = await nightmare
|
||||
let userCompany = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value');
|
||||
|
||||
expect(userLocalWarehouse).toEqual('');
|
||||
|
@ -36,26 +46,25 @@ describe('User config', () => {
|
|||
});
|
||||
|
||||
describe('as employee', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.waitForLogin('employee');
|
||||
it('should log in', async() => {
|
||||
await page.login('employee');
|
||||
});
|
||||
|
||||
it('should open the user config form to check the settings', async() => {
|
||||
let userLocalWarehouse = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
let userLocalWarehouse = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
||||
|
||||
let userLocalBank = await nightmare
|
||||
let userLocalBank = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalBank} input`, 'value');
|
||||
|
||||
let userLocalCompany = await nightmare
|
||||
let userLocalCompany = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalCompany} input`, 'value');
|
||||
|
||||
let userWarehouse = await nightmare
|
||||
let userWarehouse = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value');
|
||||
|
||||
let userCompany = await nightmare
|
||||
let userCompany = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value');
|
||||
|
||||
expect(userLocalWarehouse).toEqual('');
|
||||
|
@ -66,37 +75,35 @@ describe('User config', () => {
|
|||
});
|
||||
|
||||
it('should now edit the user config data', async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four')
|
||||
.autocompleteSearch(selectors.globalItems.userLocalBank, 'Pay on receipt')
|
||||
.autocompleteSearch(selectors.globalItems.userLocalCompany, 'VNL')
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four');
|
||||
await page.autocompleteSearch(selectors.globalItems.userLocalBank, 'Pay on receipt');
|
||||
await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'VNL');
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as salesPerson 2nd run', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.waitForLogin('salesPerson');
|
||||
it('should log in once more', async() => {
|
||||
await page.login('salesPerson');
|
||||
});
|
||||
|
||||
it('should again open the user config form to check the local settings', async() => {
|
||||
let userLocalWarehouse = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
let userLocalWarehouse = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
||||
|
||||
let userLocalBank = await nightmare
|
||||
let userLocalBank = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userLocalBank} input`, 'value');
|
||||
|
||||
let userLocalCompany = await nightmare
|
||||
let userLocalCompany = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userLocalCompany} input`, 'value');
|
||||
|
||||
let userWarehouse = await nightmare
|
||||
let userWarehouse = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value');
|
||||
|
||||
let userCompany = await nightmare
|
||||
let userCompany = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value');
|
||||
|
||||
expect(userLocalWarehouse).toContain('Warehouse Four');
|
||||
|
@ -107,12 +114,10 @@ describe('User config', () => {
|
|||
});
|
||||
|
||||
it('should now clear the local settings', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
.waitToClick(selectors.globalItems.userConfigFirstAutocompleteClear)
|
||||
.waitToClick(selectors.globalItems.userConfigSecondAutocompleteClear)
|
||||
.waitToClick(selectors.globalItems.userConfigThirdAutocompleteClear)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete);
|
||||
await page.clearInput(selectors.globalItems.userConfigSecondAutocomplete);
|
||||
await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
|
|
@ -1,40 +1,37 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client web Payment', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
describe('as employee', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Tony Stark')
|
||||
.accessToSection('client.card.webPayment');
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Tony Stark');
|
||||
await page.accessToSection('client.card.webPayment');
|
||||
});
|
||||
|
||||
it('should not be able to confirm payments', async() => {
|
||||
let exists = await nightmare
|
||||
.exists(selectors.webPayment.confirmFirstPaymentButton);
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
expect(exists).toBeFalsy();
|
||||
describe('as employee', () => {
|
||||
it('should not be able to confirm payments', async() => {
|
||||
await page.waitFor(selectors.webPayment.confirmFirstPaymentButton, {hidden: true});
|
||||
});
|
||||
});
|
||||
|
||||
describe('as administrative', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'client')
|
||||
.accessToSearchResult('Tony Stark')
|
||||
.accessToSection('client.card.webPayment');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Tony Stark');
|
||||
await page.accessToSection('client.card.webPayment');
|
||||
});
|
||||
|
||||
it('should be able to confirm payments', async() => {
|
||||
let exists = await nightmare
|
||||
.waitToClick(selectors.webPayment.confirmFirstPaymentButton)
|
||||
.wait(selectors.webPayment.firstPaymentConfirmed)
|
||||
.exists(selectors.webPayment.firstPaymentConfirmed);
|
||||
|
||||
expect(exists).toBeTruthy();
|
||||
await page.waitToClick(selectors.webPayment.confirmFirstPaymentButton);
|
||||
await page.waitFor(selectors.webPayment.firstPaymentConfirmed, {hidden: true});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,31 +1,34 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client DMS', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
describe('as salesPerson', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Tony Stark')
|
||||
.accessToSection('client.card.dms.index');
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesPerson', 'client');
|
||||
await page.accessToSearchResult('Tony Stark');
|
||||
await page.accessToSection('client.card.dms.index');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as salesPerson', () => {
|
||||
it('should delete de first file', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.dms.deleteFileButton)
|
||||
.waitToClick(selectors.dms.acceptDeleteButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.dms.deleteFileButton);
|
||||
await page.waitToClick(selectors.dms.acceptDeleteButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should click on the first document line worker name making the descriptor visible`, async() => {
|
||||
const visible = await nightmare
|
||||
.waitToClick(selectors.dms.firstDocWorker)
|
||||
.wait(selectors.dms.firstDocWorkerDescriptor)
|
||||
.isVisible(selectors.dms.firstDocWorkerDescriptor);
|
||||
await page.waitToClick(selectors.dms.firstDocWorker);
|
||||
await page.wait(selectors.dms.firstDocWorkerDescriptor);
|
||||
const visible = await page.isVisible(selectors.dms.firstDocWorkerDescriptor);
|
||||
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
|
|
|
@ -1,32 +1,35 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Worker pbx path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('hr', 'worker');
|
||||
await page.accessToSearchResult('employee');
|
||||
await page.accessToSection('worker.card.pbx');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('hr', 'worker')
|
||||
.accessToSearchResult('employee')
|
||||
.accessToSection('worker.card.pbx');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should receive an error when the extension exceeds 4 characters', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.workerPbx.extensionInput, 55555)
|
||||
|
||||
.waitToClick(selectors.workerPbx.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForContentLoaded();
|
||||
await page.write(selectors.workerPbx.extensionInput, '55555');
|
||||
await page.waitToClick(selectors.workerPbx.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Extension format is invalid');
|
||||
});
|
||||
|
||||
it('should sucessfully save the changes', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.workerPbx.extensionInput)
|
||||
.write(selectors.workerPbx.extensionInput, 4444)
|
||||
.waitToClick(selectors.workerPbx.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.workerPbx.extensionInput);
|
||||
await page.write(selectors.workerPbx.extensionInput, '4444');
|
||||
await page.waitToClick(selectors.workerPbx.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved! User must access web');
|
||||
});
|
||||
|
|
|
@ -1,95 +1,102 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Worker time control path', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('hr', 'worker')
|
||||
.accessToSearchResult('HankPym')
|
||||
.accessToSection('worker.card.timeControl');
|
||||
// #2047 WorkerTimeControl no suma horas
|
||||
xdescribe('Worker time control path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesBoss', 'worker');
|
||||
await page.accessToSearchResult('HankPym');
|
||||
await page.accessToSection('worker.card.timeControl');
|
||||
});
|
||||
|
||||
describe('as HHRR', () => {
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as salesBoss', () => {
|
||||
describe('on Monday', () => {
|
||||
it('should scan in Hank Pym', async() => {
|
||||
const scanTime = '07:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should scan out Hank Pym for break`, async() => {
|
||||
const scanTime = '10:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should scan in Hank Pym for a wrong hour and forget to scan in from the break`, async() => {
|
||||
const scanTime = '18:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should delete the wrong entry for Hank Pym`, async() => {
|
||||
const wrongScanTime = '18:00';
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime)
|
||||
.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete)
|
||||
.waitToClick(selectors.workerTimeControl.acceptDeleteDialog)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete);
|
||||
await page.waitToClick(selectors.workerTimeControl.acceptDeleteDialog);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Entry removed');
|
||||
});
|
||||
|
||||
it(`should scan out Hank Pym to leave early`, async() => {
|
||||
const scanTime = '14:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should add the break's scan in for Hank Pym and be in the right order`, async() => {
|
||||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
|
||||
|
||||
expect(result).toEqual('14:00');
|
||||
});
|
||||
|
||||
it(`should the third entry be the scan in from break`, async() => {
|
||||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 hours`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '07:00 h.')
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '07:00 h.');
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.workerTimeControl.mondayWorkedHours, 'innerText');
|
||||
|
||||
expect(result).toEqual('07:00 h.');
|
||||
|
@ -99,52 +106,51 @@ describe('Worker time control path', () => {
|
|||
describe('on Tuesday', () => {
|
||||
it('should happily scan in Hank Pym', async() => {
|
||||
const scanTime = '08:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should happily scan out Hank Pym for break`, async() => {
|
||||
const scanTime = '10:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should happily scan in Hank Pym from the break`, async() => {
|
||||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should happily scan out Hank Pym for the day`, async() => {
|
||||
const scanTime = '16:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 happy hours`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '08:00 h.')
|
||||
.waitToGetProperty(selectors.workerTimeControl.tuesdayWorkedHours, 'innerText');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '08:00 h.');
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.tuesdayWorkedHours, 'innerText');
|
||||
|
||||
expect(result).toEqual('08:00 h.');
|
||||
});
|
||||
|
@ -153,52 +159,51 @@ describe('Worker time control path', () => {
|
|||
describe('on Wednesday', () => {
|
||||
it('should cheerfully scan in Hank Pym', async() => {
|
||||
const scanTime = '09:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should cheerfully scan out Hank Pym for break`, async() => {
|
||||
const scanTime = '10:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should cheerfully scan in Hank Pym from the break`, async() => {
|
||||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should cheerfully scan out Hank Pym for the day`, async() => {
|
||||
const scanTime = '17:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 cheerfull hours`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '08:00 h.')
|
||||
.waitToGetProperty(selectors.workerTimeControl.wednesdayWorkedHours, 'innerText');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '08:00 h.');
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.wednesdayWorkedHours, 'innerText');
|
||||
|
||||
expect(result).toEqual('08:00 h.');
|
||||
});
|
||||
|
@ -207,52 +212,48 @@ describe('Worker time control path', () => {
|
|||
describe('on Thursday', () => {
|
||||
it('should joyfully scan in Hank Pym', async() => {
|
||||
const scanTime = '09:59';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should joyfully scan out Hank Pym for break`, async() => {
|
||||
const scanTime = '10:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should joyfully scan in Hank Pym from the break`, async() => {
|
||||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should joyfully scan out Hank Pym for the day`, async() => {
|
||||
const scanTime = '17:59';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 joyfull hours`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '08:00 h.')
|
||||
.waitToGetProperty(selectors.workerTimeControl.thursdayWorkedHours, 'innerText');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '08:00 h.');
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thursdayWorkedHours, 'innerText');
|
||||
|
||||
expect(result).toEqual('08:00 h.');
|
||||
});
|
||||
|
@ -261,93 +262,88 @@ describe('Worker time control path', () => {
|
|||
describe('on Friday', () => {
|
||||
it('should smilingly scan in Hank Pym', async() => {
|
||||
const scanTime = '07:30';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should smilingly scan out Hank Pym for break`, async() => {
|
||||
const scanTime = '10:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should smilingly scan in Hank Pym from the break`, async() => {
|
||||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should smilingly scan out Hank Pym for the day`, async() => {
|
||||
const scanTime = '15:30';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 hours with a smile on his face`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '08:00 h.')
|
||||
.waitToGetProperty(selectors.workerTimeControl.fridayWorkedHours, 'innerText');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '08:00 h.');
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fridayWorkedHours, 'innerText');
|
||||
|
||||
expect(result).toEqual('08:00 h.');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('as hr', () => {
|
||||
describe('as HHRR', () => {
|
||||
describe('on Saturday', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('hr', 'worker')
|
||||
.accessToSearchResult('HankPym')
|
||||
.accessToSection('worker.card.timeControl');
|
||||
it('should log in and navigate to timeControl', async() => {
|
||||
await page.loginAndModule('hr', 'worker');
|
||||
await page.accessToSearchResult('HankPym');
|
||||
await Promise.all([
|
||||
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
|
||||
page.waitForContentLoaded(),
|
||||
page.accessToSection('worker.card.timeControl')
|
||||
]);
|
||||
});
|
||||
|
||||
it('should lovingly scan in Hank Pym', async() => {
|
||||
const scanTime = '06:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should lovingly scan out Hank Pym for the day with no break to leave a bit early`, async() => {
|
||||
const scanTime = '13:40';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 hours with all his will`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '08:00 h.')
|
||||
.waitToGetProperty(selectors.workerTimeControl.saturdayWorkedHours, 'innerText');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '08:00 h.');
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.saturdayWorkedHours, 'innerText');
|
||||
|
||||
expect(result).toEqual('08:00 h.');
|
||||
});
|
||||
|
@ -356,49 +352,48 @@ describe('Worker time control path', () => {
|
|||
describe('on Sunday', () => {
|
||||
it('should gladly scan in Hank Pym', async() => {
|
||||
const scanTime = '05:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.sundayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should gladly scan out Hank Pym for the day with no break to leave a bit early`, async() => {
|
||||
const scanTime = '12:40';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.sundayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 glad hours`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '08:00 h.')
|
||||
.waitToGetProperty(selectors.workerTimeControl.sundayWorkedHours, 'innerText');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '08:00 h.');
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.sundayWorkedHours, 'innerText');
|
||||
|
||||
expect(result).toEqual('08:00 h.');
|
||||
});
|
||||
|
||||
it(`should check Hank Pym doesn't have hours set on the next months first week`, async() => {
|
||||
const wholeWeekHours = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.nextMonthButton)
|
||||
.waitToClick(selectors.workerTimeControl.secondWeekDay)
|
||||
.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.')
|
||||
await page.waitToClick(selectors.workerTimeControl.nextMonthButton);
|
||||
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.');
|
||||
const wholeWeekHours = await page
|
||||
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
||||
|
||||
expect(wholeWeekHours).toEqual('00:00 h.');
|
||||
});
|
||||
|
||||
it(`should check he didn't scan in this week yet`, async() => {
|
||||
const wholeWeekHours = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.navigateBackToIndex)
|
||||
.accessToSearchResult('salesBoss')
|
||||
.accessToSection('worker.card.timeControl')
|
||||
await page.waitToClick(selectors.workerTimeControl.navigateBackToIndex);
|
||||
await page.accessToSearchResult('salesBoss');
|
||||
await page.accessToSection('worker.card.timeControl');
|
||||
await page.waitFor(1000);
|
||||
|
||||
const wholeWeekHours = await page
|
||||
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
||||
|
||||
expect(wholeWeekHours).toEqual('00:00 h.');
|
||||
|
@ -407,17 +402,15 @@ describe('Worker time control path', () => {
|
|||
});
|
||||
|
||||
describe('after all this amazing week', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('HankPym', 'worker')
|
||||
.accessToSearchResult('HankPym')
|
||||
.accessToSection('worker.card.timeControl');
|
||||
it('should log in Hank', async() => {
|
||||
await page.loginAndModule('HankPym', 'worker');
|
||||
await page.accessToSearchResult('HankPym');
|
||||
await page.accessToSection('worker.card.timeControl');
|
||||
});
|
||||
|
||||
it('should Hank Pym check his hours are alright', async() => {
|
||||
const wholeWeekHours = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '55:00 h.')
|
||||
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
||||
it('should check his hours are alright', async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '55:00 h.');
|
||||
const wholeWeekHours = await page.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
||||
|
||||
expect(wholeWeekHours).toEqual('55:00 h.');
|
||||
});
|
||||
|
|
|
@ -1,202 +1,175 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item summary path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'item');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'item');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should search for an item', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon longbow 2m')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon longbow 2m');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result summary button to open the item summary popup`, async() => {
|
||||
const isVisible = await nightmare
|
||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon longbow 2m')
|
||||
.waitToClick(selectors.itemsIndex.searchResultPreviewButton)
|
||||
.isVisible(selectors.itemSummary.basicData);
|
||||
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon longbow 2m');
|
||||
await page.waitToClick(selectors.itemsIndex.searchResultPreviewButton);
|
||||
const isVisible = await page.isVisible(selectors.itemSummary.basicData);
|
||||
|
||||
expect(isVisible).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should check the item summary preview shows fields from basic data`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.basicData, 'Ranged weapon longbow 2m')
|
||||
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.basicData, 'Ranged weapon longbow 2m');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
||||
|
||||
expect(result).toContain('Ranged weapon longbow 2m');
|
||||
});
|
||||
|
||||
it(`should check the item summary preview shows fields from tags`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.tags, 'Brown')
|
||||
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.tags, 'Brown');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
||||
|
||||
expect(result).toContain('Brown');
|
||||
});
|
||||
|
||||
it(`should check the item summary preview shows fields from niche`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.niche, 'A1')
|
||||
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.niche, 'A1');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
||||
|
||||
expect(result).toContain('A1');
|
||||
});
|
||||
|
||||
it(`should check the item summary preview shows fields from botanical`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.botanical, 'Hedera helix')
|
||||
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.botanical, 'Hedera helix');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
||||
|
||||
expect(result).toContain('Hedera helix');
|
||||
});
|
||||
|
||||
it(`should check the item summary preview shows fields from barcode`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.barcode, '1')
|
||||
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.barcode, '1');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
||||
|
||||
expect(result).toContain('1');
|
||||
});
|
||||
|
||||
it(`should close the summary popup`, async() => {
|
||||
const result = await nightmare
|
||||
.mousedown(selectors.itemsIndex.closeItemSummaryPreview)
|
||||
.waitUntilNotPresent(selectors.itemSummary.basicData)
|
||||
.visible(selectors.itemSummary.basicData);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
await page.keyboard.press('Escape');
|
||||
await page.waitUntilNotPresent(selectors.itemSummary.basicData);
|
||||
await page.waitFor(selectors.itemSummary.basicData, {hidden: true});
|
||||
});
|
||||
|
||||
it('should search for other item', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput('vn-searchbar input')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Melee weapon combat fist 15cm')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
await page.clearInput('vn-searchbar');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Melee weapon combat fist 15cm');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should now click on the search result summary button to open the item summary popup`, async() => {
|
||||
const isVisible = await nightmare
|
||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Melee weapon combat fist 15cm')
|
||||
.waitToClick(selectors.itemsIndex.searchResultPreviewButton)
|
||||
.isVisible(selectors.itemSummary.basicData);
|
||||
|
||||
|
||||
expect(isVisible).toBeTruthy();
|
||||
await page.waitToClick(selectors.itemsIndex.searchResultPreviewButton);
|
||||
await page.waitForSelector(selectors.itemSummary.basicData, {visible: true});
|
||||
});
|
||||
|
||||
it(`should now check the item summary preview shows fields from basic data`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm')
|
||||
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
||||
|
||||
expect(result).toContain('Melee weapon combat fist 15cm');
|
||||
});
|
||||
|
||||
it(`should now check the item summary preview shows fields from tags`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.tags, 'Silver')
|
||||
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.tags, 'Silver');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
||||
|
||||
expect(result).toContain('Silver');
|
||||
});
|
||||
|
||||
it(`should now check the item summary preview shows fields from niche`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.niche, 'A4')
|
||||
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.niche, 'A4');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
||||
|
||||
expect(result).toContain('A4');
|
||||
});
|
||||
|
||||
it(`should now check the item summary preview shows fields from botanical`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.botanical, '-')
|
||||
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.botanical, '-');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
||||
|
||||
expect(result).toContain('-');
|
||||
});
|
||||
|
||||
it(`should now check the item summary preview shows fields from barcode`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.barcode, '4')
|
||||
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.barcode, '4');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
||||
|
||||
expect(result).toContain('4');
|
||||
});
|
||||
|
||||
it(`should now close the summary popup`, async() => {
|
||||
const result = await nightmare
|
||||
.mousedown(selectors.itemsIndex.closeItemSummaryPreview)
|
||||
.waitUntilNotPresent(selectors.itemSummary.basicData)
|
||||
.visible(selectors.itemSummary.basicData);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
await page.keyboard.press('Escape');
|
||||
await page.waitForSelector(selectors.itemSummary.basicData, {hidden: true});
|
||||
});
|
||||
|
||||
it(`should navigate to the one of the items detailed section`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.searchResult)
|
||||
.waitForURL('summary')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.itemsIndex.searchResult);
|
||||
await page.waitForURL('summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('summary');
|
||||
});
|
||||
|
||||
it(`should check the descritor edit button is not visible for employee`, async() => {
|
||||
const visibleButton = await nightmare
|
||||
.isVisible(selectors.itemDescriptor.editButton);
|
||||
const visibleButton = await page.isVisible(selectors.itemDescriptor.editButton);
|
||||
|
||||
expect(visibleButton).toBeFalsy();
|
||||
});
|
||||
|
||||
it(`should check the item summary shows fields from basic data section`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm')
|
||||
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
||||
|
||||
expect(result).toContain('Melee weapon combat fist 15cm');
|
||||
});
|
||||
|
||||
it(`should check the item summary shows fields from tags section`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
||||
|
||||
expect(result).toContain('Silver');
|
||||
});
|
||||
|
||||
it(`should check the item summary shows fields from niches section`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
||||
|
||||
expect(result).toContain('One A4');
|
||||
});
|
||||
|
||||
it(`should check the item summary shows fields from botanical section`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
||||
|
||||
expect(result).toContain('-');
|
||||
});
|
||||
|
||||
it(`should check the item summary shows fields from barcodes section`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
||||
|
||||
expect(result).toContain('4');
|
||||
});
|
||||
|
|
|
@ -1,102 +1,103 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item Edit basic data path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
await page.accessToSearchResult('Melee weapon combat fist 15cm');
|
||||
await page.accessToSection('item.card.basicData');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item')
|
||||
.accessToSearchResult('Melee weapon combat fist 15cm')
|
||||
.accessToSection('item.card.basicData');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should check the descritor edit button is visible for buyer`, async() => {
|
||||
const visibleButton = await nightmare
|
||||
.isVisible(selectors.itemDescriptor.editButton);
|
||||
|
||||
expect(visibleButton).toBeTruthy();
|
||||
await page.waitForSelector(selectors.itemDescriptor.editButton, {visible: true});
|
||||
});
|
||||
|
||||
it(`should edit the item basic data`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.itemBasicData.nameInput)
|
||||
.write(selectors.itemBasicData.nameInput, 'Rose of Purity')
|
||||
.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Anthurium')
|
||||
.autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares')
|
||||
.clearInput(selectors.itemBasicData.relevancyInput)
|
||||
.write(selectors.itemBasicData.relevancyInput, '1')
|
||||
.autocompleteSearch(selectors.itemBasicData.originAutocomplete, 'Spain')
|
||||
.autocompleteSearch(selectors.itemBasicData.expenseAutocomplete, 'Alquiler VNH')
|
||||
.clearInput(selectors.itemBasicData.longNameInput)
|
||||
.write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity')
|
||||
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
|
||||
.waitToClick(selectors.itemBasicData.priceInKgCheckbox)
|
||||
.waitToClick(selectors.itemBasicData.submitBasicDataButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.itemBasicData.nameInput);
|
||||
await page.write(selectors.itemBasicData.nameInput, 'Rose of Purity');
|
||||
await page.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Anthurium');
|
||||
await page.autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares');
|
||||
await page.clearInput(selectors.itemBasicData.relevancyInput);
|
||||
await page.write(selectors.itemBasicData.relevancyInput, '1');
|
||||
await page.autocompleteSearch(selectors.itemBasicData.originAutocomplete, 'Spain');
|
||||
await page.autocompleteSearch(selectors.itemBasicData.expenseAutocomplete, 'Alquiler VNH');
|
||||
await page.clearInput(selectors.itemBasicData.longNameInput);
|
||||
await page.write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity');
|
||||
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
|
||||
await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox);
|
||||
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
}, 15000);
|
||||
}, 20000);
|
||||
|
||||
it(`should confirm the item name was edited`, async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('item.card.basicData')
|
||||
.waitToGetProperty(selectors.itemBasicData.nameInput, 'value');
|
||||
await page.reloadSection('item.card.basicData');
|
||||
await page.waitForContentLoaded();
|
||||
const result = await page.waitToGetProperty(`${selectors.itemBasicData.nameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Rose of Purity');
|
||||
});
|
||||
|
||||
it(`should confirm the item type was edited`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Anthurium');
|
||||
});
|
||||
|
||||
it(`should confirm the item intrastad was edited`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('5080000 Coral y materiales similares');
|
||||
});
|
||||
|
||||
it(`should confirm the item relevancy was edited`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.itemBasicData.relevancyInput, 'value');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.relevancyInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('1');
|
||||
});
|
||||
|
||||
it(`should confirm the item origin was edited`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Spain');
|
||||
});
|
||||
|
||||
it(`should confirm the item expence was edited`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.expenseAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Alquiler VNH');
|
||||
});
|
||||
|
||||
it(`should confirm the item long name was edited`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.itemBasicData.longNameInput, 'value');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.longNameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('RS Rose of Purity');
|
||||
});
|
||||
|
||||
it('should confirm isActive checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.checkboxState(selectors.itemBasicData.isActiveCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm the priceInKg checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.checkboxState(selectors.itemBasicData.priceInKgCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
|
|
|
@ -1,61 +1,62 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item edit tax path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
await page.accessToSearchResult('Ranged weapon longbow 2m');
|
||||
await page.accessToSection('item.card.tax');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item')
|
||||
.accessToSearchResult('Ranged weapon longbow 2m')
|
||||
.accessToSection('item.card.tax');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should add the item tax to all countries`, async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'General VAT')
|
||||
.autocompleteSearch(selectors.itemTax.secondClassAutocomplete, 'General VAT')
|
||||
.autocompleteSearch(selectors.itemTax.thirdClassAutocomplete, 'General VAT')
|
||||
.waitToClick(selectors.itemTax.submitTaxButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'General VAT');
|
||||
await page.autocompleteSearch(selectors.itemTax.secondClassAutocomplete, 'General VAT');
|
||||
await page.autocompleteSearch(selectors.itemTax.thirdClassAutocomplete, 'General VAT');
|
||||
await page.waitToClick(selectors.itemTax.submitTaxButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the first item tax class was edited`, async() => {
|
||||
const firstVatType = await nightmare
|
||||
.reloadSection('item.card.tax')
|
||||
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
||||
await page.reloadSection('item.card.tax');
|
||||
const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
||||
|
||||
expect(firstVatType).toEqual('General VAT');
|
||||
});
|
||||
|
||||
it(`should confirm the second item tax class was edited`, async() => {
|
||||
const secondVatType = await nightmare
|
||||
const secondVatType = await page
|
||||
.waitToGetProperty(`${selectors.itemTax.secondClassAutocomplete} input`, 'value');
|
||||
|
||||
expect(secondVatType).toEqual('General VAT');
|
||||
});
|
||||
|
||||
it(`should confirm the third item tax class was edited`, async() => {
|
||||
const thirdVatType = await nightmare
|
||||
const thirdVatType = await page
|
||||
.waitToGetProperty(`${selectors.itemTax.thirdClassAutocomplete} input`, 'value');
|
||||
|
||||
expect(thirdVatType).toEqual('General VAT');
|
||||
});
|
||||
|
||||
it(`should edit the first class without saving the form`, async() => {
|
||||
const firstVatType = await nightmare
|
||||
.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT')
|
||||
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
||||
await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT');
|
||||
const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
||||
|
||||
expect(firstVatType).toEqual('Reduced VAT');
|
||||
});
|
||||
|
||||
it(`should now click the undo changes button and see the changes works`, async() => {
|
||||
const firstVatType = await nightmare
|
||||
.waitToClick(selectors.itemTax.undoChangesButton)
|
||||
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
||||
await page.waitToClick(selectors.itemTax.undoChangesButton);
|
||||
const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
||||
|
||||
expect(firstVatType).toEqual('General VAT');
|
||||
});
|
||||
|
|
|
@ -1,58 +1,61 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item create tags path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
await page.accessToSearchResult('Ranged weapon longbow 2m');
|
||||
await page.accessToSection('item.card.tags');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item')
|
||||
.accessToSearchResult('Ranged weapon longbow 2m')
|
||||
.accessToSection('item.card.tags');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should create a new tag and delete a former one`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemTags.fourthRemoveTagButton)
|
||||
.waitToClick(selectors.itemTags.addItemTagButton)
|
||||
.autocompleteSearch(selectors.itemTags.seventhTagAutocomplete, 'Ancho de la base')
|
||||
.write(selectors.itemTags.seventhValueInput, '50')
|
||||
.clearInput(selectors.itemTags.seventhRelevancyInput)
|
||||
.write(selectors.itemTags.seventhRelevancyInput, '4')
|
||||
.waitToClick(selectors.itemTags.submitItemTagsButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.itemTags.fourthRemoveTagButton);
|
||||
await page.waitToClick(selectors.itemTags.addItemTagButton);
|
||||
await page.autocompleteSearch(selectors.itemTags.seventhTagAutocomplete, 'Ancho de la base');
|
||||
await page.write(selectors.itemTags.seventhValueInput, '50');
|
||||
await page.clearInput(selectors.itemTags.seventhRelevancyInput);
|
||||
await page.write(selectors.itemTags.seventhRelevancyInput, '4');
|
||||
await page.waitToClick(selectors.itemTags.submitItemTagsButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the fourth row data is the expected one`, async() => {
|
||||
let result = await nightmare
|
||||
.reloadSection('item.card.tags')
|
||||
.wait('vn-item-tags')
|
||||
.waitToGetProperty(`${selectors.itemTags.fourthTagAutocomplete} input`, 'value');
|
||||
await page.reloadSection('item.card.tags');
|
||||
await page.wait('vn-item-tags');
|
||||
let result = await page.waitToGetProperty(`${selectors.itemTags.fourthTagAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Ancho de la base');
|
||||
|
||||
result = await nightmare
|
||||
.waitToGetProperty(selectors.itemTags.fourthValueInput, 'value');
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.fourthValueInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('50');
|
||||
|
||||
result = await nightmare
|
||||
.waitToGetProperty(selectors.itemTags.fourthRelevancyInput, 'value');
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.fourthRelevancyInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('4');
|
||||
});
|
||||
|
||||
it(`should confirm the fifth row data is the expected one`, async() => {
|
||||
let tag = await nightmare
|
||||
let tag = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.fifthTagAutocomplete} input`, 'value');
|
||||
|
||||
let value = await nightmare
|
||||
.waitToGetProperty(selectors.itemTags.fifthValueInput, 'value');
|
||||
let value = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.fifthValueInput} input`, 'value');
|
||||
|
||||
let relevancy = await nightmare
|
||||
.waitToGetProperty(selectors.itemTags.fifthRelevancyInput, 'value');
|
||||
let relevancy = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.fifthRelevancyInput} input`, 'value');
|
||||
|
||||
expect(tag).toEqual('Color');
|
||||
expect(value).toEqual('Brown');
|
||||
|
@ -60,14 +63,14 @@ describe('Item create tags path', () => {
|
|||
});
|
||||
|
||||
it(`should confirm the sixth row data is the expected one`, async() => {
|
||||
let tag = await nightmare
|
||||
let tag = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.sixthTagAutocomplete} input`, 'value');
|
||||
|
||||
let value = await nightmare
|
||||
.waitToGetProperty(selectors.itemTags.sixthValueInput, 'value');
|
||||
let value = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.sixthValueInput} input`, 'value');
|
||||
|
||||
let relevancy = await nightmare
|
||||
.waitToGetProperty(selectors.itemTags.sixthRelevancyInput, 'value');
|
||||
let relevancy = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.sixthRelevancyInput} input`, 'value');
|
||||
|
||||
expect(tag).toEqual('Categoria');
|
||||
expect(value).toEqual('+1 precission');
|
||||
|
|
|
@ -1,61 +1,65 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item create niche path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
await page.accessToSearchResult('Ranged weapon longbow 2m');
|
||||
await page.accessToSection('item.card.niche');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item')
|
||||
.accessToSearchResult('Ranged weapon longbow 2m')
|
||||
.accessToSection('item.card.niche');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click create a new niche and delete a former one`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInInput(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'Warehouse One')
|
||||
.waitToClick(selectors.itemNiches.addNicheButton)
|
||||
.waitToClick(selectors.itemNiches.secondNicheRemoveButton)
|
||||
.autocompleteSearch(selectors.itemNiches.thirdWarehouseAutocomplete, 'Warehouse Two')
|
||||
.write(selectors.itemNiches.thirdCodeInput, 'A4')
|
||||
.waitToClick(selectors.itemNiches.submitNichesButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForTextInInput(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One');
|
||||
await page.waitToClick(selectors.itemNiches.addNicheButton);
|
||||
await page.waitToClick(selectors.itemNiches.secondNicheRemoveButton);
|
||||
await page.autocompleteSearch(selectors.itemNiches.thirdWarehouseAutocomplete, 'Warehouse Two');
|
||||
await page.write(selectors.itemNiches.thirdCodeInput, 'A4');
|
||||
await page.waitToClick(selectors.itemNiches.submitNichesButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the first niche is the expected one`, async() => {
|
||||
let result = await nightmare
|
||||
.reloadSection('item.card.niche')
|
||||
.waitForTextInInput(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'Warehouse One')
|
||||
await page.reloadSection('item.card.niche');
|
||||
await page.waitForTextInInput(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One');
|
||||
let result = await page
|
||||
.waitToGetProperty(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Warehouse One');
|
||||
result = await nightmare
|
||||
.waitToGetProperty(selectors.itemNiches.firstCodeInput, 'value');
|
||||
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemNiches.firstCodeInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('A1');
|
||||
});
|
||||
|
||||
it(`should confirm the second niche is the expected one`, async() => {
|
||||
let result = await nightmare
|
||||
let result = await page
|
||||
.waitToGetProperty(`${selectors.itemNiches.secondWarehouseAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Warehouse Three');
|
||||
result = await nightmare
|
||||
.waitToGetProperty(selectors.itemNiches.secondCodeInput, 'value');
|
||||
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemNiches.secondCodeInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('A3');
|
||||
});
|
||||
|
||||
it(`should confirm the third niche is the expected one`, async() => {
|
||||
let result = await nightmare
|
||||
let result = await page
|
||||
.waitToGetProperty(`${selectors.itemNiches.thirdWarehouseAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Warehouse Two');
|
||||
result = await nightmare
|
||||
.waitToGetProperty(selectors.itemNiches.thirdCodeInput, 'value');
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemNiches.thirdCodeInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('A4');
|
||||
});
|
||||
|
|
|
@ -1,82 +1,85 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item Create botanical path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
await page.accessToSearchResult('Ranged weapon pistol 9mm');
|
||||
await page.accessToSection('item.card.botanical');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item')
|
||||
.accessToSearchResult('Ranged weapon pistol 9mm')
|
||||
.accessToSection('item.card.botanical');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should create a new botanical for the item`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.itemBotanical.botanicalInput, 'Cicuta maculata')
|
||||
.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abelia')
|
||||
.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'dealbata')
|
||||
.waitToClick(selectors.itemBotanical.submitBotanicalButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.itemBotanical.botanicalInput, 'Cicuta maculata');
|
||||
await page.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abelia');
|
||||
await page.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'dealbata');
|
||||
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the botanical for the item was created`, async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('item.card.botanical')
|
||||
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata')
|
||||
.waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value');
|
||||
await page.reloadSection('item.card.botanical');
|
||||
await page.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBotanical.botanicalInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Cicuta maculata');
|
||||
});
|
||||
|
||||
it(`should confirm the Genus for the item was created`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInInput(`${selectors.itemBotanical.genusAutocomplete} input`, 'Abelia')
|
||||
await page.waitForTextInInput(selectors.itemBotanical.genusAutocomplete, 'Abelia');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Abelia');
|
||||
});
|
||||
|
||||
it(`should confirm the Species for the item was created`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBotanical.speciesAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('dealbata');
|
||||
});
|
||||
|
||||
it(`should edit botanical for the item`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.itemBotanical.botanicalInput)
|
||||
.write(selectors.itemBotanical.botanicalInput, 'Herp Derp')
|
||||
.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abies')
|
||||
.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'decurrens')
|
||||
.waitToClick(selectors.itemBotanical.submitBotanicalButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.itemBotanical.botanicalInput);
|
||||
await page.write(selectors.itemBotanical.botanicalInput, 'Herp Derp');
|
||||
await page.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abies');
|
||||
await page.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'decurrens');
|
||||
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the botanical for the item was edited`, async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('item.card.botanical')
|
||||
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp')
|
||||
.waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value');
|
||||
await page.reloadSection('item.card.botanical');
|
||||
await page.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBotanical.botanicalInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Herp Derp');
|
||||
});
|
||||
|
||||
it(`should confirm the Genus for the item was edited`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInInput(`${selectors.itemBotanical.genusAutocomplete} input`, 'Abies')
|
||||
await page.waitForTextInInput(selectors.itemBotanical.genusAutocomplete, 'Abies');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Abies');
|
||||
});
|
||||
|
||||
it(`should confirm the Species for the item was edited`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBotanical.speciesAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('decurrens');
|
||||
|
|
|
@ -1,32 +1,36 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item Create barcodes path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
await page.accessToSearchResult('Ranged weapon longbow 2m');
|
||||
await page.accessToSection('item.card.itemBarcode');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item')
|
||||
.accessToSearchResult('Ranged weapon longbow 2m')
|
||||
.accessToSection('item.card.itemBarcode');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click create a new code and delete a former one`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemBarcodes.firstCodeRemoveButton)
|
||||
.waitToClick(selectors.itemBarcodes.addBarcodeButton)
|
||||
.write(selectors.itemBarcodes.thirdCodeInput, '5')
|
||||
.waitToClick(selectors.itemBarcodes.submitBarcodesButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.itemBarcodes.firstCodeRemoveButton);
|
||||
await page.waitToClick(selectors.itemBarcodes.addBarcodeButton);
|
||||
await page.write(selectors.itemBarcodes.thirdCodeInput, '5');
|
||||
await page.waitToClick(selectors.itemBarcodes.submitBarcodesButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('item.card.itemBarcode')
|
||||
.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5')
|
||||
.waitToGetProperty(selectors.itemBarcodes.thirdCodeInput, 'value');
|
||||
await page.reloadSection('item.card.itemBarcode');
|
||||
await page.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBarcodes.thirdCodeInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('5');
|
||||
});
|
||||
|
|
|
@ -1,82 +1,84 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item Create/Clone path', () => {
|
||||
const nightmare = createNightmare();
|
||||
describe('create', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item');
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('create', () => {
|
||||
it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0);
|
||||
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(0);
|
||||
});
|
||||
|
||||
it('should access to the create item view by clicking the create floating button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.createItemButton)
|
||||
.wait(selectors.itemCreateView.createButton)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
||||
await page.wait(selectors.itemCreateView.createButton);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/item/create');
|
||||
});
|
||||
|
||||
it('should return to the item index by clickig the cancel button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.itemCreateView.cancelButton)
|
||||
.wait(selectors.itemsIndex.createItemButton)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.itemCreateView.cancelButton);
|
||||
await page.wait(selectors.itemsIndex.createItemButton);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/item/index');
|
||||
});
|
||||
|
||||
it('should now access to the create item view by clicking the create floating button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.createItemButton)
|
||||
.wait(selectors.itemCreateView.createButton)
|
||||
.parsedUrl();
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
||||
await page.wait(selectors.itemCreateView.createButton);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/item/create');
|
||||
});
|
||||
|
||||
it('should create the Infinity Gauntlet item', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet')
|
||||
.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo')
|
||||
.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares')
|
||||
.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand')
|
||||
.waitToClick(selectors.itemCreateView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand');
|
||||
await page.waitToClick(selectors.itemCreateView.createButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm Infinity Gauntlet item was created', async() => {
|
||||
let result = await nightmare
|
||||
.waitToGetProperty(selectors.itemBasicData.nameInput, 'value');
|
||||
let result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.nameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Infinity Gauntlet');
|
||||
|
||||
|
||||
result = await nightmare
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Crisantemo');
|
||||
|
||||
result = await nightmare
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('5080000 Coral y materiales similares');
|
||||
|
||||
result = await nightmare
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Holand');
|
||||
|
@ -85,45 +87,41 @@ describe('Item Create/Clone path', () => {
|
|||
|
||||
describe('clone', () => {
|
||||
it('should return to the items index by clicking the return to items button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.itemBasicData.goToItemIndexButton)
|
||||
.wait(selectors.itemsIndex.createItemButton)
|
||||
.waitForURL('#!/item/index')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.itemBasicData.goToItemIndexButton);
|
||||
await page.wait(selectors.itemsIndex.createItemButton);
|
||||
await page.waitForURL('#!/item/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('#!/item/index');
|
||||
});
|
||||
|
||||
it(`should search for the item Infinity Gauntlet`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should clone the Infinity Gauntlet`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet')
|
||||
.waitToClick(selectors.itemsIndex.searchResultCloneButton)
|
||||
.waitToClick(selectors.itemsIndex.acceptClonationAlertButton)
|
||||
.waitForURL('tags')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet');
|
||||
await page.waitToClick(selectors.itemsIndex.searchResultCloneButton);
|
||||
await page.waitToClick(selectors.itemsIndex.acceptClonationAlertButton);
|
||||
await page.waitForURL('tags');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('tags');
|
||||
});
|
||||
|
||||
it('should search for the item Infinity Gauntlet and find two', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemTags.goToItemIndexButton)
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
await page.waitToClick(selectors.itemTags.goToItemIndexButton);
|
||||
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2);
|
||||
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(2);
|
||||
});
|
||||
|
|
|
@ -1,206 +1,203 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item regularize path', () => {
|
||||
const nightmare = createNightmare();
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'item');
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'item');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should edit the user local warehouse', async() => {
|
||||
let result = await nightmare
|
||||
.waitForSpinnerLoad()
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four')
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForSpinnerLoad();
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
await page.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four');
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should open the user config form to check the local settings', async() => {
|
||||
let userLocalWarehouse = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
it('should check the local settings were saved', async() => {
|
||||
const userLocalWarehouse = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
||||
|
||||
await page.keyboard.press('Escape');
|
||||
await page.waitForSelector('.user-popover.vn-popover', {hidden: true});
|
||||
|
||||
expect(userLocalWarehouse).toContain('Warehouse Four');
|
||||
});
|
||||
|
||||
it('should search for an item', async() => {
|
||||
const resultCount = await nightmare
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
it('should search for an specific item', async() => {
|
||||
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
||||
const resultCount = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(resultCount).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the item tax`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm')
|
||||
.waitToClick(selectors.itemsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm');
|
||||
await page.waitToClick(selectors.itemsIndex.searchResult);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it('should open the regularize dialog and check the warehouse matches the local user settings', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemDescriptor.moreMenu)
|
||||
.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton)
|
||||
.waitToGetProperty(`${selectors.itemDescriptor.regularizeWarehouseAutocomplete} input`, 'value');
|
||||
await page.waitToClick(selectors.itemDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton);
|
||||
const result = await page.waitToGetProperty(`${selectors.itemDescriptor.regularizeWarehouseAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Warehouse Four');
|
||||
});
|
||||
|
||||
it('should regularize the item', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.itemDescriptor.regularizeQuantityInput, 100)
|
||||
.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One')
|
||||
.waitToClick(selectors.itemDescriptor.regularizeSaveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.itemDescriptor.regularizeQuantityInput, '100');
|
||||
await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One');
|
||||
await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should click on the Tickets button of the top bar menu', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await Promise.all([
|
||||
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
|
||||
page.waitToClick(selectors.globalItems.ticketsButton)
|
||||
]);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
});
|
||||
|
||||
it('should now clear the user local settings', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
.waitToClick(selectors.globalItems.userConfigFirstAutocompleteClear)
|
||||
.waitForLastSnackbar();
|
||||
it('should clear the user local settings now', async() => {
|
||||
await page.waitForTransitionEnd('vn-searchbar');
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should search for the ticket with alias missing', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 'missing')
|
||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
await page.keyboard.press('Escape');
|
||||
await page.write(selectors.ticketsIndex.searchTicketInput, 'missing');
|
||||
await page.keyboard.press('Enter');
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the ticket summary`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Missing')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Missing');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchResult);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it(`should check the ticket sale quantity is showing a negative value`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100')
|
||||
await page.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100');
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.ticketSummary.firstSaleQuantity, 'innerText');
|
||||
|
||||
expect(result).toContain('-100');
|
||||
});
|
||||
|
||||
it(`should check the ticket sale discount is 100%`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.ticketSummary.firstSaleDiscount, 'innerText');
|
||||
|
||||
expect(result).toContain('100 %');
|
||||
});
|
||||
|
||||
it('should now click on the Items button of the top bar menu', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.itemsButton)
|
||||
.wait(selectors.itemsIndex.searchItemInput)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.itemsButton);
|
||||
await page.wait(selectors.itemsIndex.searchItemInput);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/item/index');
|
||||
});
|
||||
|
||||
it('should search for the item once again', async() => {
|
||||
const resultCount = await nightmare
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
||||
const resultCount = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(resultCount).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the item tax`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm')
|
||||
.waitToClick(selectors.itemsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm');
|
||||
await page.waitToClick(selectors.itemsIndex.searchResult);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it('should regularize the item once more', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemDescriptor.moreMenu)
|
||||
.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton)
|
||||
.write(selectors.itemDescriptor.regularizeQuantityInput, 100)
|
||||
.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One')
|
||||
.waitToClick(selectors.itemDescriptor.regularizeSaveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.itemDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton);
|
||||
await page.write(selectors.itemDescriptor.regularizeQuantityInput, '100');
|
||||
await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One');
|
||||
await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should again click on the Tickets button of the top bar menu', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await Promise.all([
|
||||
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
|
||||
page.waitToClick(selectors.globalItems.ticketsButton)
|
||||
]);
|
||||
await page.waitForTransitionEnd('vn-searchbar');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
});
|
||||
|
||||
it('should search for the ticket with id 25 once again', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 25)
|
||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
await page.write(selectors.ticketsIndex.searchTicketInput, '25');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should now click on the search result to access to the ticket summary`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, '25')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.ticketsIndex.searchResult, '25');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchResult);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it(`should check the ticket contains now two sales`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100')
|
||||
.countElement(selectors.ticketSummary.sale);
|
||||
await page.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100');
|
||||
const result = await page.countElement(selectors.ticketSummary.sale);
|
||||
|
||||
expect(result).toEqual(2);
|
||||
});
|
||||
|
|
|
@ -1,86 +1,83 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item index path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesPerson', 'item');
|
||||
await page.waitToClick(selectors.itemsIndex.searchIcon);
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'item')
|
||||
.waitToClick(selectors.itemsIndex.searchIcon);
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should click on the fields to show button to open the list of columns to show', async() => {
|
||||
const visible = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.fieldsToShowButton)
|
||||
.isVisible(selectors.itemsIndex.fieldsToShowForm);
|
||||
await page.waitToClick(selectors.itemsIndex.fieldsToShowButton);
|
||||
const visible = await page.isVisible(selectors.itemsIndex.fieldsToShowForm);
|
||||
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should unmark all checkboxes except the first and the last ones', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.idCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.stemsCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.sizeCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.nicheCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.typeCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.categoryCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.intrastadCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.originCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.buyerCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.destinyCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.saveFieldsButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.itemsIndex.idCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.stemsCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.sizeCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.nicheCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.typeCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.categoryCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.originCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.destinyCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should navigate forth and back to see the images column is still visible', async() => {
|
||||
const imageVisible = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.searchResult)
|
||||
.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton)
|
||||
.waitToClick(selectors.itemsIndex.searchIcon)
|
||||
.wait(selectors.itemsIndex.searchResult)
|
||||
.waitImgLoad(selectors.itemsIndex.firstItemImage)
|
||||
.isVisible(selectors.itemsIndex.firstItemImageTd);
|
||||
await page.waitToClick(selectors.itemsIndex.searchResult);
|
||||
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
|
||||
await page.waitToClick(selectors.itemsIndex.searchIcon);
|
||||
await page.wait(selectors.itemsIndex.searchResult);
|
||||
await page.waitImgLoad(selectors.itemsIndex.firstItemImage);
|
||||
const imageVisible = await page.isVisible(selectors.itemsIndex.firstItemImageTd);
|
||||
|
||||
expect(imageVisible).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should check the ids column is not visible', async() => {
|
||||
const idVisible = await nightmare
|
||||
.isVisible(selectors.itemsIndex.firstItemId);
|
||||
|
||||
expect(idVisible).toBeFalsy();
|
||||
await page.waitForSelector(selectors.itemsIndex.firstItemId, {hidden: true});
|
||||
});
|
||||
|
||||
it('should mark all unchecked boxes to leave the index as it was', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.fieldsToShowButton)
|
||||
.waitToClick(selectors.itemsIndex.idCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.stemsCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.sizeCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.nicheCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.typeCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.categoryCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.intrastadCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.originCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.buyerCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.destinyCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.saveFieldsButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.itemsIndex.fieldsToShowButton);
|
||||
await page.waitToClick(selectors.itemsIndex.idCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.stemsCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.sizeCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.nicheCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.typeCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.categoryCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.originCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.destinyCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should now navigate forth and back to see the ids column is now visible', async() => {
|
||||
const idVisible = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.searchResult)
|
||||
.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton)
|
||||
.waitToClick(selectors.itemsIndex.searchIcon)
|
||||
.wait(selectors.itemsIndex.searchResult)
|
||||
.isVisible(selectors.itemsIndex.firstItemId);
|
||||
await page.waitToClick(selectors.itemsIndex.searchResult);
|
||||
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
|
||||
await page.waitToClick(selectors.itemsIndex.searchIcon);
|
||||
await page.wait(selectors.itemsIndex.searchResult);
|
||||
const idVisible = await page.isVisible(selectors.itemsIndex.firstItemId);
|
||||
|
||||
expect(idVisible).toBeTruthy();
|
||||
});
|
||||
|
|
|
@ -1,74 +1,74 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item log path', () => {
|
||||
const nightmare = createNightmare();
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('developer', 'item');
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('developer', 'item');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should search for the Knowledge artifact to confirm it isn't created yet`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Knowledge artifact')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Knowledge artifact');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0);
|
||||
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(0);
|
||||
});
|
||||
|
||||
it('should access to the create item view by clicking the create floating button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.createItemButton)
|
||||
.wait(selectors.itemCreateView.createButton)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
||||
await page.wait(selectors.itemCreateView.createButton);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/item/create');
|
||||
});
|
||||
|
||||
it('should create the Knowledge artifact item', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.itemCreateView.temporalName, 'Knowledge artifact')
|
||||
.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo')
|
||||
.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares')
|
||||
.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand')
|
||||
.waitToClick(selectors.itemCreateView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.itemCreateView.temporalName, 'Knowledge artifact');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand');
|
||||
await page.waitToClick(selectors.itemCreateView.createButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should return to the items index by clicking the return to items button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.itemBasicData.goToItemIndexButton)
|
||||
.wait(selectors.itemsIndex.createItemButton)
|
||||
.waitForURL('#!/item/index')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.itemBasicData.goToItemIndexButton);
|
||||
await page.wait(selectors.itemsIndex.createItemButton);
|
||||
await page.waitForURL('#!/item/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('#!/item/index');
|
||||
});
|
||||
|
||||
it(`should search for the created item and navigate to it's log section`, async() => {
|
||||
const url = await nightmare
|
||||
.accessToSearchResult('Knowledge artifact')
|
||||
.accessToSection('item.card.log')
|
||||
.waitForURL('/log')
|
||||
.parsedUrl();
|
||||
await page.accessToSearchResult('Knowledge artifact');
|
||||
await page.accessToSection('item.card.log');
|
||||
await page.waitForURL('/log');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/log');
|
||||
});
|
||||
|
||||
it(`should confirm the log is showing 5 entries`, async() => {
|
||||
const anyLineCreatedCount = await nightmare
|
||||
.wait(selectors.itemLog.anyLineCreated)
|
||||
.countElement(selectors.itemLog.anyLineCreated);
|
||||
await page.wait(selectors.itemLog.anyLineCreated);
|
||||
const anyLineCreatedCount = await page.countElement(selectors.itemLog.anyLineCreated);
|
||||
|
||||
expect(anyLineCreatedCount).toEqual(5);
|
||||
});
|
||||
|
||||
it(`should confirm the log is showing the intrastat for the created item`, async() => {
|
||||
const fifthLineCreatedProperty = await nightmare
|
||||
const fifthLineCreatedProperty = await page
|
||||
.waitToGetProperty(selectors.itemLog.fifthLineCreatedProperty, 'innerText');
|
||||
|
||||
expect(fifthLineCreatedProperty).toEqual('Coral y materiales similares');
|
||||
|
|
|
@ -1,47 +1,49 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item descriptor path', () => {
|
||||
const nightmare = createNightmare();
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item')
|
||||
.accessToSearchResult(1)
|
||||
.accessToSection('item.card.basicData');
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('item.card.basicData');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should check the descriptor inactive icon is dark as the item is active', async() => {
|
||||
let darkIcon = await nightmare
|
||||
.wait(selectors.itemDescriptor.inactiveIcon)
|
||||
.waitForClassNotPresent(selectors.itemDescriptor.inactiveIcon, 'bright')
|
||||
.isVisible(selectors.itemDescriptor.inactiveIcon);
|
||||
await page.wait(selectors.itemDescriptor.inactiveIcon);
|
||||
await page.waitForClassNotPresent(selectors.itemDescriptor.inactiveIcon, 'bright');
|
||||
let darkIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
|
||||
|
||||
expect(darkIcon).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should set the item to inactive', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
|
||||
.waitToClick(selectors.itemBasicData.submitBasicDataButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
|
||||
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should reload the section and check the inactive icon is bright', async() => {
|
||||
let brightIcon = await nightmare
|
||||
.reloadSection('item.card.basicData')
|
||||
.waitForClassPresent(selectors.itemDescriptor.inactiveIcon, 'bright')
|
||||
.isVisible(selectors.itemDescriptor.inactiveIcon);
|
||||
await page.reloadSection('item.card.basicData');
|
||||
await page.waitForClassPresent(selectors.itemDescriptor.inactiveIcon, 'bright');
|
||||
let brightIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
|
||||
|
||||
expect(brightIcon).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should set the item back to active', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
|
||||
.waitToClick(selectors.itemBasicData.submitBasicDataButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
|
||||
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
|
|
@ -1,94 +1,114 @@
|
|||
import selectors from '../../../helpers/selectors.js';
|
||||
import createNightmare from '../../../helpers/nightmare';
|
||||
import getBrowser from '../../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket List sale path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('employee', 'ticket')
|
||||
.accessToSearchResult(13)
|
||||
.accessToSection('ticket.card.sale');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
await page.accessToSearchResult('13');
|
||||
await page.accessToSection('ticket.card.sale');
|
||||
});
|
||||
|
||||
it('should confirm the first ticket sale contains the colour', async() => {
|
||||
const value = await nightmare
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should confirm the first ticket sale contains the colour tag', async() => {
|
||||
await page.waitForContentLoaded();
|
||||
const value = await page
|
||||
.waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText');
|
||||
|
||||
expect(value).toContain('Black');
|
||||
});
|
||||
|
||||
it('should confirm the first sale contains the price', async() => {
|
||||
const value = await nightmare
|
||||
const value = await page
|
||||
.waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
|
||||
|
||||
expect(value).toContain('1.72');
|
||||
});
|
||||
|
||||
it('should confirm the first sale contains the discount', async() => {
|
||||
const value = await nightmare
|
||||
const value = await page
|
||||
.waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText');
|
||||
|
||||
expect(value).toContain('0.00%');
|
||||
});
|
||||
|
||||
it('should confirm the first sale contains the total import', async() => {
|
||||
const value = await nightmare
|
||||
const value = await page
|
||||
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
|
||||
|
||||
expect(value).toContain('34.40');
|
||||
});
|
||||
|
||||
it('should add an empty item to the sale list', async() => {
|
||||
const sales = await nightmare
|
||||
.waitToClick(selectors.ticketSales.newItemButton)
|
||||
await page.waitToClick(selectors.ticketSales.newItemButton);
|
||||
const sales = await page
|
||||
.countElement(selectors.ticketSales.saleLine);
|
||||
|
||||
expect(sales).toEqual(2);
|
||||
});
|
||||
|
||||
it('should select a valid item to be added as the second item in the sales list', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketSales.secondSaleIdInput)
|
||||
.write(selectors.ticketSales.secondSaleIdAutocomplete, 'Melee weapon heavy shield 1x0.5m')
|
||||
.waitToClick(selectors.ticketSales.idAutocompleteFirstResult)
|
||||
.write(selectors.ticketSales.secondSaleQuantity, '1\u000d')
|
||||
.waitForLastSnackbar();
|
||||
let searchValue = 'Melee weapon heavy shield 1x0.5m';
|
||||
await page.waitToClick(`${selectors.ticketSales.secondSaleIdAutocomplete} input`);
|
||||
await page.waitForSelector(selector => {
|
||||
document
|
||||
.querySelector(`${selector} vn-drop-down`).$ctrl.content
|
||||
.querySelectorAll('li');
|
||||
}, selectors.ticketSales.secondSaleIdAutocomplete);
|
||||
|
||||
await page.write(`.vn-drop-down.shown`, searchValue);
|
||||
await page.waitForFunction((selector, searchValue) => {
|
||||
let element = document
|
||||
.querySelector(`${selector} vn-drop-down`).$ctrl.content
|
||||
.querySelector('li.active');
|
||||
if (element)
|
||||
return element.innerText.includes(searchValue);
|
||||
}, {}, selectors.ticketSales.secondSaleIdAutocomplete, searchValue);
|
||||
|
||||
await page.keyboard.press('Enter');
|
||||
await page.write(selectors.ticketSales.secondSaleQuantity, '1');
|
||||
await page.keyboard.press('Enter');
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
// #1865
|
||||
xit('should update the description of the new sale', async() => {
|
||||
const result = await nightmare
|
||||
.focusElement(selectors.ticketSales.secondSaleConceptCell)
|
||||
.write(selectors.ticketSales.secondSaleConceptInput, 'Aegis of Valor\u000d')
|
||||
.waitForLastSnackbar();
|
||||
await page.focusElement(selectors.ticketSales.secondSaleConceptCell);
|
||||
await page.write(selectors.ticketSales.secondSaleConceptInput, 'Aegis of Valor');
|
||||
await page.keyboard.press('Enter');
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should add a third empty item to the sale list', async() => {
|
||||
const sales = await nightmare
|
||||
.waitToClick(selectors.ticketSales.newItemButton)
|
||||
.countElement(selectors.ticketSales.saleLine);
|
||||
await page.waitToClick(selectors.ticketSales.newItemButton);
|
||||
const sales = await page.countElement(selectors.ticketSales.saleLine);
|
||||
|
||||
expect(sales).toEqual(3);
|
||||
});
|
||||
|
||||
it('should select the 2nd and 3th item and delete both', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketSales.secondSaleCheckbox)
|
||||
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
|
||||
.waitToClick(selectors.ticketSales.deleteSaleButton)
|
||||
.waitToClick(selectors.ticketSales.acceptDeleteLineButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
|
||||
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
|
||||
await page.waitToClick(selectors.ticketSales.deleteSaleButton);
|
||||
await page.waitToClick(selectors.ticketSales.acceptDeleteLineButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should verify there's only 1 single line remaining`, async() => {
|
||||
const sales = await nightmare
|
||||
.countElement(selectors.ticketSales.saleLine);
|
||||
const sales = await page.countElement(selectors.ticketSales.saleLine);
|
||||
|
||||
expect(sales).toEqual(1);
|
||||
});
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
import selectors from '../../../helpers/selectors.js';
|
||||
import createNightmare from '../../../helpers/nightmare';
|
||||
import getBrowser from '../../../helpers/puppeteer';
|
||||
|
||||
// #1632 [e2e] ticket.sale - Transferir líneas
|
||||
xdescribe('Ticket Edit sale path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'ticket')
|
||||
.accessToSearchResult(16)
|
||||
.accessToSection('ticket.card.sale');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesPerson', 'ticket');
|
||||
await page.accessToSearchResult(16);
|
||||
await page.accessToSection('ticket.card.sale');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click on the first sale claim icon to navigate over there`, async() => {
|
||||
|
@ -59,7 +65,6 @@ xdescribe('Ticket Edit sale path', () => {
|
|||
|
||||
it(`should click on the zoomed image to close it`, async() => {
|
||||
const result = await nightmare
|
||||
.wait(100)
|
||||
.clickIfVisible(selectors.ticketSales.firstSaleZoomedImage)
|
||||
.countElement(selectors.ticketSales.firstSaleZoomedImage);
|
||||
|
||||
|
@ -149,7 +154,6 @@ xdescribe('Ticket Edit sale path', () => {
|
|||
|
||||
it('should confirm the price have been updated', async() => {
|
||||
const result = await nightmare
|
||||
.wait(1999)
|
||||
.waitToGetProperty(`${selectors.ticketSales.firstSalePrice} span`, 'innerText');
|
||||
|
||||
expect(result).toContain('5.00');
|
||||
|
@ -426,7 +430,7 @@ xdescribe('Ticket Edit sale path', () => {
|
|||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketSales.moreMenu)
|
||||
.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount)
|
||||
.write(selectors.ticketSales.moreMenuUpdateDiscountInput, 100)
|
||||
// .write(selectors.ticketSales.moreMenuUpdateDiscountInput, 100) can't find the selector on app (deleted the selector), menu option was removed?
|
||||
.write('body', '\u000d')
|
||||
.waitForTextInElement(selectors.ticketSales.totalImport, '0.00')
|
||||
.waitToGetProperty(selectors.ticketSales.totalImport, 'innerText');
|
||||
|
|
|
@ -1,45 +1,50 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket Create notes path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('employee', 'ticket')
|
||||
.accessToSearchResult(1)
|
||||
.accessToSection('ticket.card.observation');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('ticket.card.observation');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should create a new note', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.ticketNotes.addNoteButton)
|
||||
.autocompleteSearch(selectors.ticketNotes.firstNoteTypeAutocomplete, 'observation one')
|
||||
.write(selectors.ticketNotes.firstDescriptionInput, 'description')
|
||||
.waitToClick(selectors.ticketNotes.submitNotesButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.ticketNotes.addNoteButton);
|
||||
await page.autocompleteSearch(selectors.ticketNotes.firstNoteTypeAutocomplete, 'observation one');
|
||||
await page.write(selectors.ticketNotes.firstDescriptionInput, 'description');
|
||||
await page.waitToClick(selectors.ticketNotes.submitNotesButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
}, 15000);
|
||||
|
||||
it('should confirm the note is the expected one', async() => {
|
||||
let result = await nightmare
|
||||
.reloadSection('ticket.card.observation')
|
||||
await page.reloadSection('ticket.card.observation');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.ticketNotes.firstNoteTypeAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('observation one');
|
||||
|
||||
let firstDescription = await nightmare
|
||||
.waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value');
|
||||
const firstDescription = await page
|
||||
.waitToGetProperty(`${selectors.ticketNotes.firstDescriptionInput} input`, 'value');
|
||||
|
||||
expect(firstDescription).toEqual('description');
|
||||
});
|
||||
|
||||
it('should delete the note', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.ticketNotes.firstNoteRemoveButton)
|
||||
.waitToClick(selectors.ticketNotes.submitNotesButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketNotes.firstNoteRemoveButton);
|
||||
await page.waitToClick(selectors.ticketNotes.submitNotesButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
|
|
@ -1,36 +1,42 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket expeditions and log path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('production', 'ticket')
|
||||
.accessToSearchResult('1')
|
||||
.accessToSection('ticket.card.expedition');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('production', 'ticket');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('ticket.card.expedition');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton)
|
||||
.waitToClick(selectors.ticketExpedition.acceptDeleteRowButton)
|
||||
.waitToClick(selectors.ticketPackages.packagesButton)
|
||||
.wait(selectors.ticketPackages.firstPackageAutocomplete)
|
||||
.waitToClick(selectors.ticketExpedition.expeditionButton)
|
||||
.wait(selectors.ticketExpedition.expeditionRow)
|
||||
await page.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton);
|
||||
await page.waitToClick(selectors.ticketExpedition.acceptDeleteRowButton),
|
||||
await page.reloadSection('ticket.card.expedition');
|
||||
await page.waitForSelector(selectors.ticketExpedition.expeditionRow, {});
|
||||
const result = await page
|
||||
.countElement(selectors.ticketExpedition.expeditionRow);
|
||||
|
||||
expect(result).toEqual(3);
|
||||
});
|
||||
|
||||
it(`should confirm the expedition deleted is shown now in the ticket log`, async() => {
|
||||
const changedBy = await nightmare
|
||||
.waitToClick(selectors.ticketLog.logButton)
|
||||
await page.waitToClick(selectors.ticketLog.logButton);
|
||||
const changedBy = await page
|
||||
.waitToGetProperty(selectors.ticketLog.changedBy, 'innerText');
|
||||
const actionTaken = await nightmare
|
||||
|
||||
const actionTaken = await page
|
||||
.waitToGetProperty(selectors.ticketLog.actionTaken, 'innerText');
|
||||
const id = await nightmare
|
||||
|
||||
const id = await page
|
||||
.waitToGetProperty(selectors.ticketLog.id, 'innerText');
|
||||
|
||||
expect(changedBy).toEqual('production');
|
||||
|
|
|
@ -1,69 +1,70 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket Create packages path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('employee', 'ticket')
|
||||
.accessToSearchResult('1')
|
||||
.accessToSection('ticket.card.package');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('ticket.card.package');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should attempt create a new package but receive an error if package is blank`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketPackages.firstRemovePackageButton)
|
||||
.waitToClick(selectors.ticketPackages.addPackageButton)
|
||||
.write(selectors.ticketPackages.firstQuantityInput, 99)
|
||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketPackages.firstRemovePackageButton);
|
||||
await page.waitToClick(selectors.ticketPackages.addPackageButton);
|
||||
await page.write(selectors.ticketPackages.firstQuantityInput, '99');
|
||||
await page.waitToClick(selectors.ticketPackages.savePackagesButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Package cannot be blank');
|
||||
});
|
||||
|
||||
it(`should delete the first package and receive and error to save a new one with blank quantity`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
||||
.autocompleteSearch(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m')
|
||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.ticketPackages.firstQuantityInput);
|
||||
await page.autocompleteSearch(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m');
|
||||
await page.waitToClick(selectors.ticketPackages.savePackagesButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it(`should confirm the quantity input isn't invalid yet`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checkValidity();
|
||||
return document.querySelector(`${selector} input`).checkValidity();
|
||||
}, selectors.ticketPackages.firstQuantityInput);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should create a new package with correct data`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
||||
.write(selectors.ticketPackages.firstQuantityInput, -99)
|
||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.ticketPackages.firstQuantityInput);
|
||||
await page.write(selectors.ticketPackages.firstQuantityInput, '-99');
|
||||
await page.waitToClick(selectors.ticketPackages.savePackagesButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the first select is the expected one`, async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('ticket.card.package')
|
||||
.waitForTextInInput(`${selectors.ticketPackages.firstPackageAutocomplete} input`, 'Container medical box 1m')
|
||||
.waitToGetProperty(`${selectors.ticketPackages.firstPackageAutocomplete} input`, 'value');
|
||||
await page.reloadSection('ticket.card.package');
|
||||
await page.waitForTextInInput(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m');
|
||||
const result = await page.waitToGetProperty(`${selectors.ticketPackages.firstPackageAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('7 : Container medical box 1m');
|
||||
});
|
||||
|
||||
it(`should confirm the first quantity is just a number and the string part was ignored by the imput number`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '-99')
|
||||
.waitToGetProperty(selectors.ticketPackages.firstQuantityInput, 'value');
|
||||
await page.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '-99');
|
||||
const result = await page.waitToGetProperty(`${selectors.ticketPackages.firstQuantityInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('-99');
|
||||
});
|
||||
|
|
|
@ -1,83 +1,83 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket Create new tracking state path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as production', () => {
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('production', 'ticket')
|
||||
.accessToSearchResult('1')
|
||||
.accessToSection('ticket.card.tracking.index');
|
||||
it('should log into the ticket 1 tracking', async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('production', 'ticket');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('ticket.card.tracking.index');
|
||||
});
|
||||
|
||||
it('should access to the create state view by clicking the create floating button', async() => {
|
||||
let url = await nightmare
|
||||
.clickIfVisible(selectors.ticketTracking.createStateButton)
|
||||
.wait(selectors.createStateView.stateAutocomplete)
|
||||
.parsedUrl();
|
||||
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.ticketTracking.createStateButton);
|
||||
await page.waitForSelector(selectors.createStateView.stateAutocomplete, {visible: true});
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('tracking/edit');
|
||||
});
|
||||
|
||||
it(`should attempt create a new state but receive an error if state is empty`, async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.createStateView.saveStateButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('State cannot be blank');
|
||||
});
|
||||
|
||||
it(`should create a new state`, async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?')
|
||||
.waitToClick(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?');
|
||||
await page.waitToClick(selectors.createStateView.saveStateButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as salesPerson', () => {
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('salesPerson', 'ticket')
|
||||
.accessToSearchResult('1')
|
||||
.accessToSection('ticket.card.tracking.index');
|
||||
it('should now log into the ticket 1 tracking', async() => {
|
||||
await page.loginAndModule('salesPerson', 'ticket');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('ticket.card.tracking.index');
|
||||
});
|
||||
|
||||
it('should now access to the create state view by clicking the create floating button', async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.ticketTracking.createStateButton)
|
||||
.wait(selectors.createStateView.stateAutocomplete)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.ticketTracking.createStateButton);
|
||||
await page.waitForURL('tracking/edit');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('tracking/edit');
|
||||
});
|
||||
|
||||
it(`should attemp to create an state for which salesPerson doesn't have permissions`, async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'Encajado')
|
||||
.waitToClick(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitFor(1500);
|
||||
await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'Encajado');
|
||||
await page.waitToClick(selectors.createStateView.saveStateButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(`You don't have enough privileges`);
|
||||
});
|
||||
|
||||
it(`should make sure the worker gets autocomplete uppon selecting the assigned state`, async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'asignado')
|
||||
await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'asignado');
|
||||
let result = await page
|
||||
.waitToGetProperty(`${selectors.createStateView.workerAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('salesPersonNick');
|
||||
});
|
||||
|
||||
it(`should succesfully create a valid state`, async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.createStateView.saveStateButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
|
|
@ -1,20 +1,25 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket Edit basic data path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('employee', 'ticket')
|
||||
.accessToSearchResult(11)
|
||||
.accessToSection('ticket.card.basicData.stepOne');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
await page.accessToSearchResult('11');
|
||||
await page.accessToSection('ticket.card.basicData.stepOne');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should confirm the zone autocomplete is disabled unless your role is productionBoss`, async() => {
|
||||
const disabled = await nightmare
|
||||
.wait(selectors.ticketBasicData.zoneAutocomplete)
|
||||
.evaluate(selector => {
|
||||
await page.waitForSelector(selectors.ticketBasicData.zoneAutocomplete, {});
|
||||
const disabled = await page.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.ticketBasicData.zoneAutocomplete} input`);
|
||||
|
||||
|
@ -22,17 +27,15 @@ describe('Ticket Edit basic data path', () => {
|
|||
});
|
||||
|
||||
it(`should now log as productionBoss to perform the rest of the tests`, async() => {
|
||||
await nightmare
|
||||
.loginAndModule('productionBoss', 'ticket')
|
||||
.accessToSearchResult(11)
|
||||
.accessToSection('ticket.card.basicData.stepOne');
|
||||
await page.loginAndModule('productionBoss', 'ticket');
|
||||
await page.accessToSearchResult('11');
|
||||
await page.accessToSection('ticket.card.basicData.stepOne');
|
||||
});
|
||||
|
||||
it(`should confirm the zone autocomplete is enabled for the role productionBoss`, async() => {
|
||||
const disabled = await nightmare
|
||||
.waitForSpinnerLoad()
|
||||
.wait(selectors.ticketBasicData.zoneAutocomplete)
|
||||
.evaluate(selector => {
|
||||
await page.waitForSpinnerLoad();
|
||||
await page.wait(selectors.ticketBasicData.zoneAutocomplete);
|
||||
const disabled = await page.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.ticketBasicData.zoneAutocomplete} input`);
|
||||
|
||||
|
@ -40,59 +43,56 @@ describe('Ticket Edit basic data path', () => {
|
|||
});
|
||||
|
||||
it(`should check the zone is for Silla247`, async() => {
|
||||
let zone = await nightmare
|
||||
let zone = await page
|
||||
.waitToGetProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value');
|
||||
|
||||
expect(zone).toContain('Zone 247 A');
|
||||
});
|
||||
|
||||
it(`should edit the ticket agency then check there are no zones for it`, async() => {
|
||||
let zone = await nightmare
|
||||
.autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Entanglement')
|
||||
await page.autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Entanglement');
|
||||
let zone = await page
|
||||
.getProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value');
|
||||
|
||||
expect(zone.length).toEqual(0);
|
||||
});
|
||||
|
||||
it(`should edit the ticket zone then check the agency is for the new zone`, async() => {
|
||||
let zone = await nightmare
|
||||
.autocompleteSearch(selectors.ticketBasicData.zoneAutocomplete, 'Zone expensive A')
|
||||
await page.autocompleteSearch(selectors.ticketBasicData.zoneAutocomplete, 'Zone expensive A');
|
||||
let zone = await page
|
||||
.waitToGetProperty(`${selectors.ticketBasicData.agencyAutocomplete} input`, 'value');
|
||||
|
||||
expect(zone).toContain('Silla247Expensive');
|
||||
});
|
||||
|
||||
it(`should click next`, async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.ticketBasicData.nextStepButton)
|
||||
.waitForURL('data/step-two')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.ticketBasicData.nextStepButton);
|
||||
await page.waitForURL('data/step-two');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('data/step-two');
|
||||
});
|
||||
|
||||
it(`should have a price diference`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
|
||||
|
||||
expect(result).toContain('-€248.00');
|
||||
});
|
||||
|
||||
it(`should then click next to move on to step three`, async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.ticketBasicData.nextStepButton)
|
||||
.waitForURL('data/step-three')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.ticketBasicData.nextStepButton);
|
||||
await page.waitForURL('data/step-three');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('data/step-three');
|
||||
});
|
||||
|
||||
it(`should select a new reason for the changes made then click on finalize`, async() => {
|
||||
let url = await nightmare
|
||||
.autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'Cambiar los precios en el ticket')
|
||||
.waitToClick(selectors.ticketBasicData.finalizeButton)
|
||||
.waitForURL('summary')
|
||||
.parsedUrl();
|
||||
await page.autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'Cambiar los precios en el ticket');
|
||||
await page.waitToClick(selectors.ticketBasicData.finalizeButton);
|
||||
await page.waitForURL('summary');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('summary');
|
||||
});
|
||||
|
|
|
@ -1,23 +1,28 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket List components path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('employee', 'ticket')
|
||||
.accessToSearchResult('1')
|
||||
.accessToSection('ticket.card.components');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('ticket.card.components');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should confirm the total base is correct', async() => {
|
||||
const name = 'Base €';
|
||||
const minLength = name.length;
|
||||
|
||||
const base = await nightmare
|
||||
.waitPropertyLength(selectors.ticketComponents.base, 'innerText', minLength)
|
||||
.waitToGetProperty(selectors.ticketComponents.base, 'innerText');
|
||||
await page.waitPropertyLength(selectors.ticketComponents.base, 'innerText', minLength);
|
||||
const base = await page.waitToGetProperty(selectors.ticketComponents.base, 'innerText');
|
||||
|
||||
|
||||
expect(base).toContain('Base');
|
||||
|
|
|
@ -1,166 +1,140 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket descriptor path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'ticket');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
await page.accessToSection('ticket.weekly.index');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should count the amount of tickets in the turns section', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.menuWeeklyTickets)
|
||||
.wait(selectors.ticketsIndex.weeklyTicket)
|
||||
.countElement(selectors.ticketsIndex.weeklyTicket);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.weeklyTicket, 5);
|
||||
const result = await page.countElement(selectors.ticketsIndex.weeklyTicket);
|
||||
|
||||
expect(result).toEqual(5);
|
||||
});
|
||||
|
||||
it('should now click on the Tickets button of the top bar menu', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
});
|
||||
|
||||
it('should search for the ticket 11', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 11)
|
||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the ticket`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
it('should go back to the ticket index then search and access a ticket summary', async() => {
|
||||
await page.accessToSection('ticket.index');
|
||||
await page.accessToSearchResult('11');
|
||||
await page.waitForContentLoaded();
|
||||
});
|
||||
|
||||
it('should add the ticket to thursday turn using the descriptor more menu', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn)
|
||||
.waitToClick(selectors.ticketDescriptor.thursdayButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn);
|
||||
await page.waitToClick(selectors.ticketDescriptor.thursdayButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should again click on the Tickets button of the top bar menu', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.ticketsButton);
|
||||
await page.waitForContentLoaded();
|
||||
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
});
|
||||
|
||||
it('should confirm the ticket 11 was added on thursday', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.menuWeeklyTickets)
|
||||
.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value');
|
||||
it('should confirm the ticket 11 was added to thursday', async() => {
|
||||
await page.accessToSection('ticket.weekly.index');
|
||||
const result = await page.waitToGetProperty(`${selectors.ticketsIndex.sixthWeeklyTicket} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Thursday');
|
||||
});
|
||||
|
||||
it('should click on the Tickets button of the top bar menu once more', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.ticketsButton);
|
||||
await page.waitForURL('#!/ticket/index');
|
||||
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
});
|
||||
|
||||
it('should now search for the ticket 11', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 11)
|
||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
await page.waitForContentLoaded();
|
||||
await page.write(selectors.ticketsIndex.searchTicketInput, '11');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the ticket`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.ticketsIndex.searchResult);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it('should add the ticket to saturday turn using the descriptor more menu', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn)
|
||||
.waitToClick(selectors.ticketDescriptor.saturdayButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn);
|
||||
await page.waitToClick(selectors.ticketDescriptor.saturdayButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should click on the Tickets button of the top bar menu once again', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.ticketsButton);
|
||||
await page.wait(selectors.ticketsIndex.searchTicketInput);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
});
|
||||
|
||||
it('should confirm the ticket 11 was added on saturday', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.menuWeeklyTickets)
|
||||
.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value');
|
||||
await page.accessToSection('ticket.weekly.index');
|
||||
const result = await page.waitToGetProperty(`${selectors.ticketsIndex.sixthWeeklyTicket} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Saturday');
|
||||
});
|
||||
|
||||
it('should now search for the weekly ticket 11', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchWeeklyTicketInput, 11)
|
||||
.waitToClick(selectors.ticketsIndex.searchWeeklyButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
||||
await page.write(selectors.ticketsIndex.searchTicketInput, '11');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it('should delete the weekly ticket 11', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.firstWeeklyTicketDeleteIcon)
|
||||
.waitToClick(selectors.ticketsIndex.acceptDeleteTurn)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketsIndex.firstWeeklyTicketDeleteIcon);
|
||||
await page.waitToClick(selectors.ticketsIndex.acceptDeleteTurn);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the sixth weekly ticket was deleted', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick('vn-searchbar vn-icon[icon=clear]')
|
||||
.waitToClick(selectors.ticketsIndex.searchWeeklyButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 5)
|
||||
.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
||||
await page.waitForContentLoaded();
|
||||
await page.clearInput('vn-searchbar');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchWeeklyButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 5);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
||||
|
||||
expect(result).toEqual(5);
|
||||
});
|
||||
|
|
|
@ -1,59 +1,58 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket purchase request path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'ticket')
|
||||
.accessToSearchResult('16')
|
||||
.accessToSection('ticket.card.request.index');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesPerson', 'ticket');
|
||||
await page.accessToSearchResult('16');
|
||||
await page.accessToSection('ticket.card.request.index');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should add a new request`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketRequests.addRequestButton)
|
||||
.write(selectors.ticketRequests.descriptionInput, 'New stuff')
|
||||
.write(selectors.ticketRequests.quantityInput, 99)
|
||||
.autocompleteSearch(selectors.ticketRequests.atenderAutocomplete, 'buyerNick')
|
||||
.write(selectors.ticketRequests.priceInput, 999)
|
||||
.waitToClick(selectors.ticketRequests.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketRequests.addRequestButton);
|
||||
await page.write(selectors.ticketRequests.descriptionInput, 'New stuff');
|
||||
await page.write(selectors.ticketRequests.quantityInput, '99');
|
||||
await page.autocompleteSearch(selectors.ticketRequests.atenderAutocomplete, 'buyerNick');
|
||||
await page.write(selectors.ticketRequests.priceInput, '999');
|
||||
await page.waitToClick(selectors.ticketRequests.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should have been redirected to the request index`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForURL('/request')
|
||||
.parsedUrl();
|
||||
await page.waitForURL('/request');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/request');
|
||||
});
|
||||
|
||||
it(`should confirm the new request was added`, async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('ticket.card.request.index')
|
||||
.waitToGetProperty(selectors.ticketRequests.firstDescription, 'innerText');
|
||||
await page.reloadSection('ticket.card.request.index');
|
||||
const result = await page.waitToGetProperty(selectors.ticketRequests.firstDescription, 'innerText');
|
||||
|
||||
expect(result).toEqual('New stuff');
|
||||
});
|
||||
|
||||
it(`should delete the added request`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketRequests.firstRemoveRequestButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketRequests.firstRemoveRequestButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the request was deleted`, async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('ticket.card.request.index')
|
||||
.wait(selectors.ticketRequests.addRequestButton)
|
||||
.exists(selectors.ticketRequests.request);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
await page.reloadSection('ticket.card.request.index');
|
||||
await page.wait(selectors.ticketRequests.addRequestButton);
|
||||
await page.waitForSelector(selectors.ticketRequests.request, {hidden: true});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,61 +1,66 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket diary path', () => {
|
||||
const nightmare = createNightmare();
|
||||
// #2026 Fallo en relocate de descriptor popover
|
||||
xdescribe('Ticket diary path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'ticket');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should search for a specific ticket', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 1)
|
||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
await page.write(selectors.ticketsIndex.searchTicketInput, '1');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the ticket summary`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchResult);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.ticketSummary.firstSaleItemId)
|
||||
.waitToClick(selectors.ticketSummary.popoverDiaryButton)
|
||||
.waitForURL('/diary')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.ticketSummary.firstSaleItemId);
|
||||
await page.waitForTransitionEnd('.vn-popover');
|
||||
await page.waitToClick(selectors.ticketSummary.popoverDiaryButton);
|
||||
await page.waitForURL('/diary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/diary');
|
||||
});
|
||||
|
||||
it(`should check the second line id is marked as message`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.itemDiary.secondTicketId, 'className');
|
||||
|
||||
expect(result).toContain('message');
|
||||
});
|
||||
|
||||
it(`should check the third line balance is marked as message`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemDiary.fourthBalance} > span`, 'className');
|
||||
|
||||
expect(result).toContain('message');
|
||||
});
|
||||
|
||||
it(`should change to the warehouse two and check there are sales marked as negative balance`, async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.itemDiary.warehouseAutocomplete, 'Warehouse Two')
|
||||
await page.autocompleteSearch(selectors.itemDiary.warehouseAutocomplete, 'Warehouse Two');
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.itemDiary.firstBalance, 'className');
|
||||
|
||||
expect(result).toContain('balance');
|
||||
|
|
|
@ -1,77 +1,78 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket descriptor path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesperson', 'ticket');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesperson', 'ticket');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('Delete ticket', () => {
|
||||
it('should search for an specific ticket', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 18)
|
||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
await page.write(selectors.ticketsIndex.searchTicketInput, '18');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the ticket summary`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Cerebro')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Cerebro');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchResult);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it(`should update the shipped hour using the descriptor menu`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour)
|
||||
.pickTime(selectors.ticketDescriptor.changeShippedHourInput, '08:15')
|
||||
.waitToClick(selectors.ticketDescriptor.acceptChangeHourButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour);
|
||||
await page.pickTime(selectors.ticketDescriptor.changeShippedHourInput, '08:15');
|
||||
await page.waitToClick(selectors.ticketDescriptor.acceptChangeHourButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Shipped hour updated');
|
||||
});
|
||||
|
||||
it(`should confirm the ticket descriptor shows the correct shipping hour`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryDate, 'innerText');
|
||||
|
||||
expect(result).toContain('08:15');
|
||||
});
|
||||
|
||||
it('should delete the ticket using the descriptor more menu', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket)
|
||||
.waitToClick(selectors.ticketDescriptor.acceptDeleteButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket);
|
||||
await page.waitToClick(selectors.ticketDescriptor.acceptDeleteButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Ticket deleted');
|
||||
});
|
||||
|
||||
it('should have been relocated to the ticket index', async() => {
|
||||
const url = await nightmare
|
||||
.parsedUrl();
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
});
|
||||
|
||||
it(`should search for the deleted ticket and check it's date`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 18)
|
||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.wait(selectors.ticketsIndex.searchResultDate)
|
||||
.waitToGetProperty(selectors.ticketsIndex.searchResultDate, 'innerText');
|
||||
await page.write(selectors.ticketsIndex.searchTicketInput, '18');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||
await page.wait(selectors.ticketsIndex.searchResultDate);
|
||||
const result = await page.waitToGetProperty(selectors.ticketsIndex.searchResultDate, 'innerText');
|
||||
|
||||
expect(result).toContain(2000);
|
||||
});
|
||||
|
@ -79,116 +80,105 @@ describe('Ticket descriptor path', () => {
|
|||
|
||||
describe('add stowaway', () => {
|
||||
it('should search for a ticket', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.ticketsIndex.searchTicketInput)
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 16)
|
||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
await page.clearInput(selectors.ticketsIndex.searchTicketInput);
|
||||
await page.write(selectors.ticketsIndex.searchTicketInput, '16');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should now click on the search result to access to the ticket summary`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Many Places')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Many Places');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchResult);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it('should open the add stowaway dialog', async() => {
|
||||
const isVisible = await nightmare
|
||||
.wait(() => {
|
||||
await page.waitForFunction(() => {
|
||||
let element = document.querySelector('vn-ticket-descriptor');
|
||||
return element.$ctrl.canShowStowaway === true;
|
||||
})
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway)
|
||||
.wait(selectors.ticketDescriptor.addStowawayDialogFirstTicket)
|
||||
.visible(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
|
||||
});
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway);
|
||||
await page.wait(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
|
||||
const isVisible = await page.isVisible(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
|
||||
|
||||
expect(isVisible).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should add a ticket as stowaway', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should check the state of the stowaway ticket is embarked`, async() => {
|
||||
const state = await nightmare
|
||||
.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
|
||||
const state = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
|
||||
|
||||
expect(state).toEqual('State Embarcando');
|
||||
});
|
||||
|
||||
it(`should navigate back to the added ticket using the descriptors ship button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.shipButton)
|
||||
.waitForURL('#!/ticket/17/summary')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.ticketDescriptor.shipButton);
|
||||
await page.waitForURL('#!/ticket/17/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('#!/ticket/17/summary');
|
||||
});
|
||||
|
||||
it('should delete the stowaway', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton)
|
||||
.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton);
|
||||
await page.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the ship buton doesn't exisist any more`, async() => {
|
||||
const exists = await nightmare
|
||||
.exists(selectors.ticketDescriptor.shipButton);
|
||||
|
||||
expect(exists).toBeFalsy();
|
||||
await page.waitForSelector(selectors.ticketDescriptor.shipButton, {hidden: true});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Make invoice', () => {
|
||||
it('should login as adminBoss role then search for a ticket', async() => {
|
||||
const invoiceableTicketId = 14;
|
||||
const invoiceableTicketId = '14';
|
||||
|
||||
const url = await nightmare
|
||||
.loginAndModule('adminBoss', 'ticket')
|
||||
.accessToSearchResult(invoiceableTicketId)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.loginAndModule('adminBoss', 'ticket');
|
||||
await page.accessToSearchResult(invoiceableTicketId);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain(`ticket/${invoiceableTicketId}/summary`);
|
||||
});
|
||||
|
||||
it(`should make sure the ticket doesn't have an invoiceOutFk yet`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText');
|
||||
|
||||
expect(result).toEqual('-');
|
||||
});
|
||||
|
||||
it('should invoice the ticket using the descriptor more menu', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenuMakeInvoice)
|
||||
.waitToClick(selectors.ticketDescriptor.acceptInvoiceOutButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenuMakeInvoice);
|
||||
await page.waitToClick(selectors.ticketDescriptor.acceptInvoiceOutButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Ticket invoiced');
|
||||
});
|
||||
|
||||
it(`should make sure the ticket summary have an invoiceOutFk`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.ticketSummary.invoiceOutRef, 'T4444445')
|
||||
.waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText');
|
||||
await page.waitForTextInElement(selectors.ticketSummary.invoiceOutRef, 'T4444445');
|
||||
const result = await page.waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText');
|
||||
|
||||
expect(result).toEqual('T4444445');
|
||||
});
|
||||
|
|
|
@ -1,141 +1,139 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket services path', () => {
|
||||
const nightmare = createNightmare();
|
||||
const invoicedTicketId = 1;
|
||||
let browser;
|
||||
let page;
|
||||
const invoicedTicketId = '1';
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as employee', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'ticket')
|
||||
.accessToSearchResult(invoicedTicketId)
|
||||
.accessToSection('ticket.card.service');
|
||||
it('should log in as employee, search for an invoice and get to services', async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
await page.accessToSearchResult(invoicedTicketId);
|
||||
await page.accessToSection('ticket.card.service');
|
||||
});
|
||||
|
||||
it('should find the add descripton button disabled for this user role', async() => {
|
||||
const result = await nightmare
|
||||
.waitForClassPresent(selectors.ticketService.firstAddServiceTypeButton, 'disabled')
|
||||
.waitToClick(selectors.ticketService.addServiceButton)
|
||||
.wait(selectors.ticketService.firstAddServiceTypeButton)
|
||||
.isDisabled(selectors.ticketService.firstAddServiceTypeButton);
|
||||
await page.waitForClassPresent(selectors.ticketService.firstAddServiceTypeButton, 'disabled');
|
||||
await page.waitToClick(selectors.ticketService.addServiceButton);
|
||||
await page.wait(selectors.ticketService.firstAddServiceTypeButton);
|
||||
const result = await page.isDisabled(selectors.ticketService.firstAddServiceTypeButton);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
}, 100000);
|
||||
}, 15000);
|
||||
|
||||
it('should receive an error if you attempt to save a service without access rights', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.ticketService.firstPriceInput)
|
||||
.write(selectors.ticketService.firstPriceInput, 999)
|
||||
.waitToClick(selectors.ticketService.saveServiceButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.ticketService.firstPriceInput);
|
||||
await page.write(selectors.ticketService.firstPriceInput, '999');
|
||||
await page.waitToClick(selectors.ticketService.saveServiceButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(`The current ticket can't be modified`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('as administrative', () => {
|
||||
let editableTicketId = 16;
|
||||
let editableTicketId = '16';
|
||||
it('should navigate to the services of a target ticket', async() => {
|
||||
const url = await nightmare
|
||||
.loginAndModule('administrative', 'ticket')
|
||||
.accessToSearchResult(editableTicketId)
|
||||
.accessToSection('ticket.card.service')
|
||||
.waitForURL('/service')
|
||||
.parsedUrl();
|
||||
await page.loginAndModule('administrative', 'ticket');
|
||||
await page.accessToSearchResult(editableTicketId);
|
||||
await page.accessToSection('ticket.card.service');
|
||||
await page.waitForURL('/service');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/service');
|
||||
});
|
||||
|
||||
it('should click on the add button to prepare the form to create a new service', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketService.addServiceButton)
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.ticketService.addServiceButton);
|
||||
const result = await page
|
||||
.isVisible(selectors.ticketService.firstServiceTypeAutocomplete);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should receive an error if you attempt to save it with empty fields', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketService.saveServiceButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketService.saveServiceButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(`can't be blank`);
|
||||
});
|
||||
|
||||
it('should click on the add new service type to open the dialog', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketService.firstAddServiceTypeButton)
|
||||
.wait('.vn-dialog.shown')
|
||||
.isVisible(selectors.ticketService.newServiceTypeNameInput);
|
||||
await page.waitToClick(selectors.ticketService.firstAddServiceTypeButton);
|
||||
await page.wait('.vn-dialog.shown');
|
||||
const result = await page.isVisible(selectors.ticketService.newServiceTypeNameInput);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should receive an error if service type is empty on submit', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketService.saveServiceTypeButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketService.saveServiceTypeButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(`Name can't be empty`);
|
||||
});
|
||||
|
||||
it('should create a new service type then add price then create the service', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketService.newServiceTypeNameInput, 'Documentos')
|
||||
.autocompleteSearch(selectors.ticketService.newServiceTypeExpenseAutocomplete, 'Retencion')
|
||||
.waitToClick(selectors.ticketService.saveServiceTypeButton)
|
||||
.write(selectors.ticketService.firstPriceInput, 999)
|
||||
.waitToClick(selectors.ticketService.saveServiceButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.ticketService.newServiceTypeNameInput, 'Documentos');
|
||||
await page.autocompleteSearch(selectors.ticketService.newServiceTypeExpenseAutocomplete, 'Retencion');
|
||||
await page.waitToClick(selectors.ticketService.saveServiceTypeButton);
|
||||
await page.write(selectors.ticketService.firstPriceInput, '999');
|
||||
await page.waitToClick(selectors.ticketService.saveServiceButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the service description was created correctly', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('ticket.card.service')
|
||||
await page.reloadSection('ticket.card.service');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.ticketService.firstServiceTypeAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Documentos');
|
||||
});
|
||||
|
||||
it('should confirm the service quantity was created correctly', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.ticketService.firstQuantityInput, 'value');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.ticketService.firstQuantityInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('1');
|
||||
});
|
||||
|
||||
it('should confirm the service price was created correctly', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.ticketService.firstPriceInput, 'value');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.ticketService.firstPriceInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('999');
|
||||
});
|
||||
|
||||
it('should confirm the service VAT was created correctly', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.ticketService.firstVatTypeAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('General VAT');
|
||||
});
|
||||
|
||||
it('should delete the service', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketService.fistDeleteServiceButton)
|
||||
.waitForNumberOfElements(selectors.ticketService.serviceLine, 0)
|
||||
.waitToClick(selectors.ticketService.saveServiceButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketService.fistDeleteServiceButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketService.serviceLine, 0);
|
||||
await page.waitToClick(selectors.ticketService.saveServiceButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the service was removed`, async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('ticket.card.service')
|
||||
.waitForNumberOfElements(selectors.ticketService.serviceLine, 0)
|
||||
.countElement(selectors.ticketService.serviceLine);
|
||||
await page.reloadSection('ticket.card.service');
|
||||
await page.waitForNumberOfElements(selectors.ticketService.serviceLine, 0);
|
||||
const result = await page.countElement(selectors.ticketService.serviceLine);
|
||||
|
||||
expect(result).toEqual(0);
|
||||
});
|
||||
|
|
|
@ -1,40 +1,43 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket create path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'ticket');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should open the new ticket form', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.newTicketButton)
|
||||
.wait(selectors.createTicketView.clientAutocomplete)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.ticketsIndex.newTicketButton);
|
||||
await page.wait(selectors.createTicketView.clientAutocomplete);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/ticket/create');
|
||||
});
|
||||
|
||||
it('should succeed to create a ticket', async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.createTicketView.clientAutocomplete, 'Tony Stark')
|
||||
.autocompleteSearch(selectors.createTicketView.addressAutocomplete, 'Tony Stark')
|
||||
.datePicker(selectors.createTicketView.deliveryDateInput, 1, null)
|
||||
.autocompleteSearch(selectors.createTicketView.warehouseAutocomplete, 'Warehouse One')
|
||||
.autocompleteSearch(selectors.createTicketView.agencyAutocomplete, 'Silla247')
|
||||
.waitToClick(selectors.createTicketView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.createTicketView.clientAutocomplete, 'Tony Stark');
|
||||
await page.autocompleteSearch(selectors.createTicketView.addressAutocomplete, 'Tony Stark');
|
||||
await page.datePicker(selectors.createTicketView.deliveryDateInput, 1, null);
|
||||
await page.autocompleteSearch(selectors.createTicketView.warehouseAutocomplete, 'Warehouse One');
|
||||
await page.autocompleteSearch(selectors.createTicketView.agencyAutocomplete, 'Silla247');
|
||||
await page.waitToClick(selectors.createTicketView.createButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should check the url is now the summary of the ticket', async() => {
|
||||
const url = await nightmare
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
|
|
@ -1,30 +1,35 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket create from client path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Petter Parker');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Petter Parker');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should click the create simple ticket on the descriptor menu', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientDescriptor.moreMenu)
|
||||
.waitToClick(selectors.clientDescriptor.simpleTicketButton)
|
||||
.waitForURL('#!/ticket/create?clientFk=102')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.clientDescriptor.simpleTicketButton);
|
||||
await page.waitForURL('#!/ticket/create?clientFk=102');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('clientFk=102');
|
||||
});
|
||||
|
||||
it('should check if the client details are the expected ones', async() => {
|
||||
const client = await nightmare
|
||||
const client = await page
|
||||
.waitToGetProperty(`${selectors.createTicketView.clientAutocomplete} input`, 'value');
|
||||
|
||||
const address = await nightmare
|
||||
const address = await page
|
||||
.waitToGetProperty(`${selectors.createTicketView.addressAutocomplete} input`, 'value');
|
||||
|
||||
|
||||
|
|
|
@ -1,24 +1,32 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket Summary path', () => {
|
||||
const nightmare = createNightmare();
|
||||
const ticketId = 20;
|
||||
let browser;
|
||||
let page;
|
||||
const ticketId = '20';
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should navigate to the target ticket summary section', async() => {
|
||||
let url = await nightmare
|
||||
.loginAndModule('employee', 'ticket')
|
||||
.accessToSearchResult(ticketId)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
await page.accessToSearchResult(ticketId);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it(`should display details from the ticket and it's client on the top of the header`, async() => {
|
||||
let result = await nightmare
|
||||
.waitForTextInElement(selectors.ticketSummary.header, 'Bruce Banner')
|
||||
.waitToGetProperty(selectors.ticketSummary.header, 'innerText');
|
||||
await page.waitForTextInElement(selectors.ticketSummary.header, 'Bruce Banner');
|
||||
const result = await page.waitToGetProperty(selectors.ticketSummary.header, 'innerText');
|
||||
|
||||
expect(result).toContain(`Ticket #${ticketId}`);
|
||||
expect(result).toContain('Bruce Banner (109)');
|
||||
|
@ -26,71 +34,64 @@ describe('Ticket Summary path', () => {
|
|||
});
|
||||
|
||||
it('should display ticket details', async() => {
|
||||
let result = await nightmare
|
||||
let result = await page
|
||||
.waitToGetProperty(selectors.ticketSummary.state, 'innerText');
|
||||
|
||||
expect(result).toContain('Arreglar');
|
||||
});
|
||||
|
||||
it('should display delivery details', async() => {
|
||||
let result = await nightmare
|
||||
let result = await page
|
||||
.waitToGetProperty(selectors.ticketSummary.route, 'innerText');
|
||||
|
||||
expect(result).toContain('3');
|
||||
});
|
||||
|
||||
it('should display the ticket total', async() => {
|
||||
let result = await nightmare
|
||||
let result = await page
|
||||
.waitToGetProperty(selectors.ticketSummary.total, 'innerText');
|
||||
|
||||
expect(result).toContain('€155.54');
|
||||
});
|
||||
|
||||
it('should display the ticket line(s)', async() => {
|
||||
let result = await nightmare
|
||||
let result = await page
|
||||
.waitToGetProperty(selectors.ticketSummary.firstSaleItemId, 'innerText');
|
||||
|
||||
expect(result).toContain('000002');
|
||||
});
|
||||
|
||||
it(`should click on the first sale ID making the item descriptor visible`, async() => {
|
||||
const visible = await nightmare
|
||||
.waitToClick(selectors.ticketSummary.firstSaleItemId)
|
||||
.waitImgLoad(selectors.ticketSummary.firstSaleDescriptorImage)
|
||||
.isVisible(selectors.ticketSummary.itemDescriptorPopover);
|
||||
await page.waitToClick(selectors.ticketSummary.firstSaleItemId);
|
||||
await page.waitImgLoad(selectors.ticketSummary.firstSaleDescriptorImage);
|
||||
const visible = await page.isVisible(selectors.ticketSummary.itemDescriptorPopover);
|
||||
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should check the url for the item diary link of the descriptor is for the right item id`, async() => {
|
||||
const exists = await nightmare
|
||||
.exists(selectors.ticketSummary.itemDescriptorPopoverItemDiaryButton);
|
||||
|
||||
expect(exists).toBeTruthy();
|
||||
await page.waitForSelector(selectors.ticketSummary.itemDescriptorPopoverItemDiaryButton, {visible: true});
|
||||
});
|
||||
|
||||
it('should log in as production then navigate to the summary of the same ticket', async() => {
|
||||
let url = await nightmare
|
||||
.loginAndModule('production', 'ticket')
|
||||
.accessToSearchResult(ticketId)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.loginAndModule('production', 'ticket');
|
||||
await page.accessToSearchResult(ticketId);
|
||||
await page.waitForURL('/summary');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it('should click on the SET OK button', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.ticketSummary.setOk)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketSummary.setOk);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the ticket state was updated', async() => {
|
||||
let result = await nightmare
|
||||
.waitForSpinnerLoad()
|
||||
.waitToGetProperty(selectors.ticketSummary.state, 'innerText');
|
||||
await page.waitForSpinnerLoad();
|
||||
let result = await page.waitToGetProperty(selectors.ticketSummary.state, 'innerText');
|
||||
|
||||
expect(result).toContain('OK');
|
||||
});
|
||||
|
|
|
@ -1,58 +1,60 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Claim edit basic data path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesAssistant', 'claim')
|
||||
.accessToSearchResult('1')
|
||||
.accessToSection('claim.card.basicData');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesAssistant', 'claim');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('claim.card.basicData');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should edit claim state and observation fields`, async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Gestionado')
|
||||
.clearTextarea(selectors.claimBasicData.observationInput)
|
||||
.write(selectors.claimBasicData.observationInput, 'edited observation')
|
||||
.waitToClick(selectors.claimBasicData.saveButton)
|
||||
.waitForSnackbar();
|
||||
await page.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Gestionado');
|
||||
await page.clearTextarea(selectors.claimBasicData.observationInput);
|
||||
await page.type(selectors.claimBasicData.observationInput, 'edited observation');
|
||||
await page.waitToClick(selectors.claimBasicData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
|
||||
});
|
||||
|
||||
it(`should have been redirected to the next section of claims as the role is salesAssistant`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForURL('/detail')
|
||||
.parsedUrl();
|
||||
await page.waitForURL('/detail');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/detail');
|
||||
});
|
||||
|
||||
it('should confirm the claim state was edited', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('claim.card.basicData')
|
||||
.wait(selectors.claimBasicData.claimStateAutocomplete)
|
||||
.waitToGetProperty(`${selectors.claimBasicData.claimStateAutocomplete} input`, 'value');
|
||||
await page.reloadSection('claim.card.basicData');
|
||||
await page.wait(selectors.claimBasicData.claimStateAutocomplete);
|
||||
const result = await page.waitToGetProperty(`${selectors.claimBasicData.claimStateAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Gestionado');
|
||||
});
|
||||
|
||||
it('should confirm the claim observation was edited', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.claimBasicData.observationInput, 'value');
|
||||
|
||||
expect(result).toEqual('edited observation');
|
||||
});
|
||||
|
||||
it(`should edit the claim to leave it untainted`, async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Pendiente')
|
||||
.clearTextarea(selectors.claimBasicData.observationInput)
|
||||
.write(selectors.claimBasicData.observationInput, 'Observation one')
|
||||
.waitToClick(selectors.claimBasicData.saveButton)
|
||||
.waitForSnackbar();
|
||||
await page.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Pendiente');
|
||||
await page.clearTextarea(selectors.claimBasicData.observationInput);
|
||||
await page.type(selectors.claimBasicData.observationInput, 'Observation one');
|
||||
await page.waitToClick(selectors.claimBasicData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
|
||||
});
|
||||
|
|
|
@ -1,68 +1,71 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Claim development', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesAssistant', 'claim')
|
||||
.accessToSearchResult('1')
|
||||
.accessToSection('claim.card.development');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesAssistant', 'claim');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('claim.card.development');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should delete a development and create a new one', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.claimDevelopment.firstDeleteDevelopmentButton)
|
||||
.waitToClick(selectors.claimDevelopment.addDevelopmentButton)
|
||||
.autocompleteSearch(selectors.claimDevelopment.secondClaimReasonAutocomplete, 'Baja calidad')
|
||||
.autocompleteSearch(selectors.claimDevelopment.secondClaimResultAutocomplete, 'Deshidratacion')
|
||||
.autocompleteSearch(selectors.claimDevelopment.secondClaimResponsibleAutocomplete, 'Calidad general')
|
||||
.autocompleteSearch(selectors.claimDevelopment.secondClaimWorkerAutocomplete, 'deliveryNick')
|
||||
.autocompleteSearch(selectors.claimDevelopment.secondClaimRedeliveryAutocomplete, 'Reparto')
|
||||
.waitToClick(selectors.claimDevelopment.saveDevelopmentButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.claimDevelopment.firstDeleteDevelopmentButton);
|
||||
await page.waitToClick(selectors.claimDevelopment.addDevelopmentButton);
|
||||
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimReasonAutocomplete, 'Baja calidad');
|
||||
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResultAutocomplete, 'Deshidratacion');
|
||||
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResponsibleAutocomplete, 'Calidad general');
|
||||
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimWorkerAutocomplete, 'deliveryNick');
|
||||
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimRedeliveryAutocomplete, 'Reparto');
|
||||
await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
}, 15000);
|
||||
|
||||
it(`should redirect to the next section of claims as the role is salesAssistant`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForURL('/action')
|
||||
.parsedUrl();
|
||||
await page.waitForURL('/action');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/action');
|
||||
});
|
||||
|
||||
it('should edit a development', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('claim.card.development')
|
||||
.autocompleteSearch(selectors.claimDevelopment.firstClaimReasonAutocomplete, 'Calor')
|
||||
.autocompleteSearch(selectors.claimDevelopment.firstClaimResultAutocomplete, 'Cocido')
|
||||
.autocompleteSearch(selectors.claimDevelopment.firstClaimResponsibleAutocomplete, 'Calidad general')
|
||||
.autocompleteSearch(selectors.claimDevelopment.firstClaimWorkerAutocomplete, 'adminAssistantNick')
|
||||
.autocompleteSearch(selectors.claimDevelopment.firstClaimRedeliveryAutocomplete, 'Cliente')
|
||||
.waitToClick(selectors.claimDevelopment.saveDevelopmentButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.reloadSection('claim.card.development');
|
||||
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimReasonAutocomplete, 'Calor');
|
||||
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResultAutocomplete, 'Cocido');
|
||||
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResponsibleAutocomplete, 'Calidad general');
|
||||
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimWorkerAutocomplete, 'adminAssistantNick');
|
||||
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimRedeliveryAutocomplete, 'Cliente');
|
||||
await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the first development is the expected one', async() => {
|
||||
const reason = await nightmare
|
||||
.reloadSection('claim.card.development')
|
||||
await page.reloadSection('claim.card.development');
|
||||
const reason = await page
|
||||
.waitToGetProperty(`${selectors.claimDevelopment.firstClaimReasonAutocomplete} input`, 'value');
|
||||
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.claimDevelopment.firstClaimResultAutocomplete} input`, 'value');
|
||||
|
||||
const responsible = await nightmare
|
||||
const responsible = await page
|
||||
.waitToGetProperty(`${selectors.claimDevelopment.firstClaimResponsibleAutocomplete} input`, 'value');
|
||||
|
||||
const worker = await nightmare
|
||||
const worker = await page
|
||||
.waitToGetProperty(`${selectors.claimDevelopment.firstClaimWorkerAutocomplete} input`, 'value');
|
||||
|
||||
const redelivery = await nightmare
|
||||
const redelivery = await page
|
||||
.waitToGetProperty(`${selectors.claimDevelopment.firstClaimRedeliveryAutocomplete} input`, 'value');
|
||||
|
||||
expect(reason).toEqual('Calor');
|
||||
|
@ -73,19 +76,19 @@ describe('Claim development', () => {
|
|||
});
|
||||
|
||||
it('should confirm the second development is the expected one', async() => {
|
||||
const reason = await nightmare
|
||||
const reason = await page
|
||||
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimReasonAutocomplete} input`, 'value');
|
||||
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimResultAutocomplete} input`, 'value');
|
||||
|
||||
const responsible = await nightmare
|
||||
const responsible = await page
|
||||
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimResponsibleAutocomplete} input`, 'value');
|
||||
|
||||
const worker = await nightmare
|
||||
const worker = await page
|
||||
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimWorkerAutocomplete} input`, 'value');
|
||||
|
||||
const redelivery = await nightmare
|
||||
const redelivery = await page
|
||||
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimRedeliveryAutocomplete} input`, 'value');
|
||||
|
||||
expect(reason).toEqual('Baja calidad');
|
||||
|
|
|
@ -1,48 +1,51 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
// #1528 e2e claim/detail
|
||||
xdescribe('Claim detail', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'claim')
|
||||
.accessToSearchResult(1)
|
||||
.accessToSection('claim.card.detail');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesPerson', 'claim');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('claim.card.detail');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should add the first claimable item from ticket to the claim', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.claimDetail.addItemButton)
|
||||
.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.claimDetail.addItemButton);
|
||||
await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the claim contains now two items', async() => {
|
||||
const result = await nightmare
|
||||
.countElement(selectors.claimDetail.claimDetailLine);
|
||||
const result = await page.countElement(selectors.claimDetail.claimDetailLine);
|
||||
|
||||
expect(result).toEqual(2);
|
||||
});
|
||||
|
||||
it('should edit de first item claimed quantity', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.claimDetail.firstItemQuantityInput)
|
||||
.write(selectors.claimDetail.firstItemQuantityInput, 4)
|
||||
.write('body', '\u000d') // simulates enter
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.claimDetail.firstItemQuantityInput); // selector deleted, find new upon fixes
|
||||
await page.write(selectors.claimDetail.firstItemQuantityInput, '4'); // selector deleted, find new upon fixes
|
||||
await page.keyboard.press('Enter');
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the first item quantity, and the claimed total were correctly edited', async() => {
|
||||
const claimedQuantity = await nightmare
|
||||
.waitToGetProperty(selectors.claimDetail.firstItemQuantityInput, 'value');
|
||||
const claimedQuantity = page
|
||||
.waitToGetProperty(selectors.claimDetail.firstItemQuantityInput, 'value'); // selector deleted, find new upon fixes
|
||||
|
||||
const totalClaimed = await nightmare
|
||||
const totalClaimed = page
|
||||
.waitToGetProperty(selectors.claimDetail.totalClaimed, 'innerText');
|
||||
|
||||
expect(claimedQuantity).toEqual('4');
|
||||
|
@ -50,71 +53,63 @@ xdescribe('Claim detail', () => {
|
|||
});
|
||||
|
||||
it('should login as salesAssistant and navigate to the claim.detail section', async() => {
|
||||
const url = await nightmare
|
||||
.loginAndModule('salesAssistant', 'claim')
|
||||
.accessToSearchResult(1)
|
||||
.accessToSection('claim.card.detail')
|
||||
.waitForURL('/detail')
|
||||
.parsedUrl();
|
||||
await page.loginAndModule('salesAssistant', 'claim');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('claim.card.detail');
|
||||
await page.waitForURL('/detail');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/detail');
|
||||
});
|
||||
|
||||
it('should edit de second item claimed discount', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.claimDetail.secondItemDiscount)
|
||||
.write(selectors.claimDetail.discountInput, 100)
|
||||
.write('body', '\u000d') // simulates enter
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.claimDetail.secondItemDiscount);
|
||||
await page.write(selectors.claimDetail.discountInput, '100');
|
||||
await page.keyboard.press('Enter');
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should check the mana is the expected one', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.claimDetail.secondItemDiscount)
|
||||
.waitToGetProperty(selectors.claimDetail.discoutPopoverMana, 'innerText');
|
||||
await page.waitToClick(selectors.claimDetail.secondItemDiscount);
|
||||
const result = await page.waitToGetProperty(selectors.claimDetail.discoutPopoverMana, 'innerText');
|
||||
|
||||
expect(result).toContain('MANÁ: €106');
|
||||
});
|
||||
|
||||
it('should delete the second item from the claim', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.claimDetail.secondItemDeleteButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.claimDetail.secondItemDeleteButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the claim contains now one item', async() => {
|
||||
const result = await nightmare
|
||||
.countElement(selectors.claimDetail.claimDetailLine);
|
||||
const result = await page.countElement(selectors.claimDetail.claimDetailLine);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it('should add the deleted ticket from to the claim', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.claimDetail.addItemButton)
|
||||
.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.claimDetail.addItemButton);
|
||||
await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should have been redirected to the next section in claims`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForURL('/development')
|
||||
.parsedUrl();
|
||||
await page.waitForURL('/development');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('development');
|
||||
});
|
||||
|
||||
it('should navigate back to claim.detail to confirm the claim contains now two items', async() => {
|
||||
const result = await nightmare
|
||||
.accessToSection('claim.card.detail')
|
||||
.wait(selectors.claimDetail.claimDetailLine)
|
||||
.countElement(selectors.claimDetail.claimDetailLine);
|
||||
await page.accessToSection('claim.card.detail');
|
||||
await page.wait(selectors.claimDetail.claimDetailLine);
|
||||
const result = await page.countElement(selectors.claimDetail.claimDetailLine);
|
||||
|
||||
expect(result).toEqual(2);
|
||||
});
|
||||
|
|
|
@ -1,77 +1,76 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Claim action path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'claim')
|
||||
.accessToSearchResult(2)
|
||||
.accessToSection('claim.card.action');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('administrative', 'claim');
|
||||
await page.accessToSearchResult('2');
|
||||
await page.accessToSection('claim.card.action');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should import the claim', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.claimAction.importClaimButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.claimAction.importClaimButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should import the second importable ticket', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.claimAction.importTicketButton)
|
||||
.waitToClick(selectors.claimAction.secondImportableTicket)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.claimAction.importTicketButton);
|
||||
await page.waitToClick(selectors.claimAction.secondImportableTicket);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
// #2036 claim.action destinatario
|
||||
it('should edit the second line destination field', async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno')
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno');
|
||||
// const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
// expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should delete the first line', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.claimAction.firstDeleteLine)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.claimAction.firstDeleteLine);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should refresh the view to check the remaining line is the expected one', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('claim.card.action')
|
||||
.waitToGetProperty(`${selectors.claimAction.firstLineDestination} input`, 'value');
|
||||
await page.reloadSection('claim.card.action');
|
||||
const result = await page.waitToGetProperty(`${selectors.claimAction.firstLineDestination} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Bueno');
|
||||
});
|
||||
|
||||
it('should delete the current first line', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.claimAction.firstDeleteLine)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.claimAction.firstDeleteLine);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should check the "is paid with mana" checkbox', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.claimAction.isPaidWithManaCheckbox)
|
||||
.waitForSnackbar();
|
||||
await page.waitToClick(selectors.claimAction.isPaidWithManaCheckbox);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
|
||||
});
|
||||
|
||||
it('should confirm the "is paid with mana" checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('claim.card.action')
|
||||
.checkboxState(selectors.claimAction.isPaidWithManaCheckbox);
|
||||
await page.reloadSection('claim.card.action');
|
||||
const result = await page.checkboxState(selectors.claimAction.isPaidWithManaCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
|
|
@ -1,96 +1,95 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('claim Summary path', () => {
|
||||
const nightmare = createNightmare();
|
||||
const claimId = 4;
|
||||
let browser;
|
||||
let page;
|
||||
const claimId = '4';
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should navigate to the target claim summary section', async() => {
|
||||
let url = await nightmare
|
||||
.loginAndModule('employee', 'claim')
|
||||
.accessToSearchResult(claimId)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.loginAndModule('employee', 'claim');
|
||||
await page.accessToSearchResult(claimId);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it(`should display details from the claim and it's client on the top of the header`, async() => {
|
||||
let result = await nightmare
|
||||
.waitForTextInElement(selectors.claimSummary.header, 'Tony Stark')
|
||||
.waitToGetProperty(selectors.claimSummary.header, 'innerText');
|
||||
await page.waitForTextInElement(selectors.claimSummary.header, 'Tony Stark');
|
||||
const result = await page.waitToGetProperty(selectors.claimSummary.header, 'innerText');
|
||||
|
||||
expect(result).toContain('4 -');
|
||||
expect(result).toContain('Tony Stark');
|
||||
});
|
||||
|
||||
it('should display the claim state', async() => {
|
||||
let result = await nightmare
|
||||
.waitToGetProperty(selectors.claimSummary.state, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.claimSummary.state, 'innerText');
|
||||
|
||||
expect(result).toContain('Resuelto');
|
||||
});
|
||||
|
||||
it('should display the observation', async() => {
|
||||
let result = await nightmare
|
||||
.waitToGetProperty(selectors.claimSummary.observation, 'value');
|
||||
const result = await page.waitToGetProperty(selectors.claimSummary.observation, 'value');
|
||||
|
||||
expect(result).toContain('observation four');
|
||||
});
|
||||
|
||||
it('should display the claimed line(s)', async() => {
|
||||
let result = await nightmare
|
||||
.waitToGetProperty(selectors.claimSummary.firstSaleItemId, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.claimSummary.firstSaleItemId, 'innerText');
|
||||
|
||||
expect(result).toContain('000002');
|
||||
});
|
||||
|
||||
it(`should click on the first sale ID making the item descriptor visible`, async() => {
|
||||
const visible = await nightmare
|
||||
.waitToClick(selectors.claimSummary.firstSaleItemId)
|
||||
.waitImgLoad(selectors.claimSummary.firstSaleDescriptorImage)
|
||||
.isVisible(selectors.claimSummary.itemDescriptorPopover);
|
||||
await page.waitToClick(selectors.claimSummary.firstSaleItemId);
|
||||
await page.waitImgLoad(selectors.claimSummary.firstSaleDescriptorImage);
|
||||
const visible = await page.isVisible(selectors.claimSummary.itemDescriptorPopover);
|
||||
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should check the url for the item diary link of the descriptor is for the right item id`, async() => {
|
||||
const exists = await nightmare
|
||||
.exists(selectors.claimSummary.itemDescriptorPopoverItemDiaryButton);
|
||||
await page.waitForSelector(selectors.claimSummary.itemDescriptorPopoverItemDiaryButton, {visible: true});
|
||||
|
||||
expect(exists).toBeTruthy();
|
||||
await nightmare.mousedown('.vn-popover.shown');
|
||||
await page.keyboard.press('Escape');
|
||||
await page.waitFor(1000);
|
||||
});
|
||||
|
||||
it('should display the claim development details', async() => {
|
||||
let result = await nightmare
|
||||
.waitToGetProperty(selectors.claimSummary.firstDevelopmentWorker, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.claimSummary.firstDevelopmentWorker, 'innerText');
|
||||
|
||||
expect(result).toContain('salesAssistantNick');
|
||||
});
|
||||
|
||||
it(`should click on the first development worker making the worker descriptor visible`, async() => {
|
||||
const visible = await nightmare
|
||||
.waitToClick(selectors.claimSummary.firstDevelopmentWorker)
|
||||
.wait(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton)
|
||||
.isVisible(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton);
|
||||
await page.waitToClick(selectors.claimSummary.firstDevelopmentWorker);
|
||||
|
||||
const visible = await page.isVisible(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton);
|
||||
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should check the url for the go to clientlink of the descriptor is for the right client id`, async() => {
|
||||
const exists = await nightmare
|
||||
.exists(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton);
|
||||
await page.waitForSelector(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton, {visible: true});
|
||||
|
||||
expect(exists).toBeTruthy();
|
||||
await nightmare.mousedown('.vn-popover.shown');
|
||||
await page.keyboard.press('Escape');
|
||||
await page.waitFor(1000);
|
||||
});
|
||||
|
||||
it(`should click on the first action ticket ID making the ticket descriptor visible`, async() => {
|
||||
const visible = await nightmare
|
||||
.waitToClick(selectors.claimSummary.firstActionTicketId)
|
||||
.wait(selectors.claimSummary.firstActionTicketDescriptor)
|
||||
.isVisible(selectors.claimSummary.firstActionTicketDescriptor);
|
||||
await page.waitToClick(selectors.claimSummary.firstActionTicketId);
|
||||
await page.waitForSelector(selectors.claimSummary.firstActionTicketDescriptor);
|
||||
const visible = await page.isVisible(selectors.claimSummary.firstActionTicketDescriptor);
|
||||
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
|
|
|
@ -1,70 +1,69 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('claim Descriptor path', () => {
|
||||
const nightmare = createNightmare();
|
||||
const claimId = 1;
|
||||
let browser;
|
||||
let page;
|
||||
const claimId = '1';
|
||||
|
||||
it('should navigate to the target claim summary section', async() => {
|
||||
let url = await nightmare
|
||||
.loginAndModule('employee', 'claim')
|
||||
.accessToSearchResult(claimId)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should now navigate to the target claim summary section', async() => {
|
||||
await page.loginAndModule('employee', 'claim');
|
||||
await page.accessToSearchResult(claimId);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it(`should not be able to see the delete claim button of the descriptor more menu`, async() => {
|
||||
let exists = await nightmare
|
||||
.waitToClick(selectors.claimDescriptor.moreMenu)
|
||||
.exists(selectors.claimDescriptor.moreMenuDeleteClaim);
|
||||
|
||||
expect(exists).toBeFalsy();
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.claimDescriptor.moreMenu);
|
||||
await page.waitForSelector(selectors.claimDescriptor.moreMenuDeleteClaim, {hidden: true});
|
||||
});
|
||||
|
||||
it(`should log in as salesAssistant and navigate to the target claim`, async() => {
|
||||
let url = await nightmare
|
||||
.loginAndModule('salesAssistant', 'claim')
|
||||
.accessToSearchResult(claimId)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.loginAndModule('salesAssistant', 'claim');
|
||||
await page.accessToSearchResult(claimId);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it(`should be able to see the delete claim button of the descriptor more menu`, async() => {
|
||||
let exists = await nightmare
|
||||
.waitToClick(selectors.claimDescriptor.moreMenu)
|
||||
.wait(selectors.claimDescriptor.moreMenuDeleteClaim)
|
||||
.exists(selectors.claimDescriptor.moreMenuDeleteClaim);
|
||||
|
||||
expect(exists).toBeTruthy();
|
||||
await page.waitToClick(selectors.claimDescriptor.moreMenu);
|
||||
await page.waitForSelector(selectors.claimDescriptor.moreMenuDeleteClaim, {visible: true});
|
||||
});
|
||||
|
||||
it(`should delete the claim`, async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.claimDescriptor.moreMenuDeleteClaim)
|
||||
.waitToClick(selectors.claimDescriptor.acceptDeleteClaim)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.claimDescriptor.moreMenuDeleteClaim);
|
||||
await page.waitToClick(selectors.claimDescriptor.acceptDeleteClaim);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Claim deleted!');
|
||||
});
|
||||
|
||||
it(`should have been relocated to the claim index`, async() => {
|
||||
let url = await nightmare
|
||||
.waitForURL('/claim/index')
|
||||
.parsedUrl();
|
||||
await page.waitForURL('/claim/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/claim/index');
|
||||
});
|
||||
|
||||
it(`should search for the deleted claim to find no results`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.claimsIndex.searchClaimInput, claimId)
|
||||
.waitToClick(selectors.claimsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.claimsIndex.searchResult, 0)
|
||||
.countElement(selectors.claimsIndex.searchResult);
|
||||
await page.write(selectors.claimsIndex.searchClaimInput, claimId);
|
||||
await page.waitToClick(selectors.claimsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.claimsIndex.searchResult, 0);
|
||||
const result = await page.countElement(selectors.claimsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(0);
|
||||
});
|
||||
|
|
|
@ -1,24 +1,30 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Order edit basic data path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
const today = new Date().getDate();
|
||||
|
||||
describe('when confirmed order', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'order')
|
||||
.accessToSearchResult(1)
|
||||
.accessToSection('order.card.basicData');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
|
||||
await page.loginAndModule('employee', 'order');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('order.card.basicData');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('when confirmed order', () => {
|
||||
it('should not be able to change the client', async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark')
|
||||
.autocompleteSearch(selectors.orderBasicData.addressAutocomplete, 'Tony Stark')
|
||||
.waitToClick(selectors.orderBasicData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark');
|
||||
await page.autocompleteSearch(selectors.orderBasicData.addressAutocomplete, 'Tony Stark');
|
||||
await page.waitToClick(selectors.orderBasicData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(`You can't make changes on the basic data of an confirmed order or with rows`);
|
||||
}, 15000);
|
||||
|
@ -26,24 +32,25 @@ describe('Order edit basic data path', () => {
|
|||
|
||||
describe('when order with rows', () => {
|
||||
it('should now navigate to order index', async() => {
|
||||
const orderId = 16;
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.orderDescriptor.returnToModuleIndexButton)
|
||||
.waitToClick(selectors.orderDescriptor.acceptNavigationButton)
|
||||
.wait(selectors.ordersIndex.createOrderButton)
|
||||
.accessToSearchResult(orderId)
|
||||
.accessToSection('order.card.basicData')
|
||||
.wait(selectors.orderBasicData.observationInput)
|
||||
.parsedUrl();
|
||||
const orderId = '16';
|
||||
|
||||
await page.waitToClick(selectors.orderDescriptor.returnToModuleIndexButton);
|
||||
await page.waitToClick(selectors.orderDescriptor.acceptNavigationButton);
|
||||
await page.waitForContentLoaded();
|
||||
await page.accessToSearchResult(orderId);
|
||||
await page.accessToSection('order.card.basicData');
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitForSelector(selectors.orderBasicData.observationInput, {visible: true});
|
||||
await page.waitForURL('basic-data');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual(`#!/order/${orderId}/basic-data`);
|
||||
});
|
||||
|
||||
it('should not be able to change anything', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.orderBasicData.observationInput, 'observation')
|
||||
.waitToClick(selectors.orderBasicData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.type(selectors.orderBasicData.observationInput, 'observation');
|
||||
await page.waitToClick(selectors.orderBasicData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(`You can't make changes on the basic data of an confirmed order or with rows`);
|
||||
});
|
||||
|
@ -51,66 +58,63 @@ describe('Order edit basic data path', () => {
|
|||
|
||||
describe('when new order', () => {
|
||||
it('should navigate to the order index and click the new order button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.returnToModuleIndexButton)
|
||||
.waitToClick(selectors.orderBasicData.acceptButton)
|
||||
.waitToClick(selectors.ordersIndex.createOrderButton)
|
||||
.waitForURL('#!/order/create')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.returnToModuleIndexButton);
|
||||
await page.waitToClick(selectors.orderBasicData.acceptButton);
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.ordersIndex.createOrderButton);
|
||||
await page.waitForURL('#!/order/create');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('#!/order/create');
|
||||
});
|
||||
|
||||
it('should now create a new one', async() => {
|
||||
const url = await nightmare
|
||||
.autocompleteSearch(selectors.createOrderView.clientAutocomplete, 'Jessica Jones')
|
||||
.datePicker(selectors.createOrderView.landedDatePicker, 0, today)
|
||||
.autocompleteSearch(selectors.createOrderView.agencyAutocomplete, 'inhouse pickup')
|
||||
.waitToClick(selectors.createOrderView.createButton)
|
||||
.waitForURL('/catalog')
|
||||
.parsedUrl();
|
||||
await page.autocompleteSearch(selectors.createOrderView.clientAutocomplete, 'Jessica Jones');
|
||||
await page.datePicker(selectors.createOrderView.landedDatePicker, 0, today);
|
||||
await page.autocompleteSearch(selectors.createOrderView.agencyAutocomplete, 'Other agency');
|
||||
await page.waitToClick(selectors.createOrderView.createButton);
|
||||
await page.waitForURL('/catalog');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/catalog');
|
||||
});
|
||||
|
||||
it('should navigate to the basic data section of the new order', async() => {
|
||||
const url = await nightmare
|
||||
.accessToSection('order.card.basicData')
|
||||
.wait(selectors.orderBasicData.observationInput)
|
||||
.parsedUrl();
|
||||
await page.accessToSection('order.card.basicData');
|
||||
await page.wait(selectors.orderBasicData.observationInput);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/basic-data');
|
||||
});
|
||||
|
||||
it('should be able to modify all the properties', async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark')
|
||||
.autocompleteSearch(selectors.orderBasicData.addressAutocomplete, 'Tony Stark')
|
||||
.autocompleteSearch(selectors.orderBasicData.agencyAutocomplete, 'Silla247')
|
||||
.write(selectors.orderBasicData.observationInput, 'my observation')
|
||||
.waitToClick(selectors.orderBasicData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark');
|
||||
await page.autocompleteSearch(selectors.orderBasicData.addressAutocomplete, 'Tony Stark');
|
||||
await page.autocompleteSearch(selectors.orderBasicData.agencyAutocomplete, 'Silla247');
|
||||
await page.type(selectors.orderBasicData.observationInput, 'my observation');
|
||||
await page.waitToClick(selectors.orderBasicData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should now confirm the client have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('order.card.basicData')
|
||||
await page.reloadSection('order.card.basicData');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.orderBasicData.clientAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('104: Tony Stark');
|
||||
});
|
||||
|
||||
it('should now confirm the agency have been edited', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.orderBasicData.agencyAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('7: Silla247');
|
||||
});
|
||||
|
||||
it('should now confirm the observations have been edited', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.orderBasicData.observationInput, 'value');
|
||||
|
||||
expect(result).toEqual('my observation');
|
||||
|
|
|
@ -1,82 +1,87 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Order catalog', () => {
|
||||
const nightmare = createNightmare();
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'order');
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'order');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should open the create new order form', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.ordersIndex.createOrderButton)
|
||||
.waitForURL('order/create')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.ordersIndex.createOrderButton);
|
||||
await page.waitForURL('order/create');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('order/create');
|
||||
});
|
||||
|
||||
it('should create a new order', async() => {
|
||||
let today = new Date().getDate();
|
||||
const url = await nightmare
|
||||
.autocompleteSearch(selectors.createOrderView.clientAutocomplete, 'Tony Stark')
|
||||
.datePicker(selectors.createOrderView.landedDatePicker, 0, today)
|
||||
.autocompleteSearch(selectors.createOrderView.agencyAutocomplete, 'inhouse pickup')
|
||||
.waitToClick(selectors.createOrderView.createButton)
|
||||
.waitForURL('/catalog')
|
||||
.parsedUrl();
|
||||
|
||||
await page.autocompleteSearch(selectors.createOrderView.clientAutocomplete, 'Tony Stark');
|
||||
await page.datePicker(selectors.createOrderView.landedDatePicker, 0, today);
|
||||
await page.autocompleteSearch(selectors.createOrderView.agencyAutocomplete, 'Other agency');
|
||||
await page.waitToClick(selectors.createOrderView.createButton);
|
||||
await page.waitForURL('/catalog');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
|
||||
expect(url.hash).toContain('/catalog');
|
||||
});
|
||||
|
||||
it('should add the realm and type filters and obtain results', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.orderCatalog.plantRealmButton)
|
||||
.autocompleteSearch(selectors.orderCatalog.typeAutocomplete, 'Anthurium')
|
||||
.waitForNumberOfElements('section.product', 4)
|
||||
.countElement('section.product');
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.orderCatalog.plantRealmButton);
|
||||
await page.autocompleteSearch(selectors.orderCatalog.typeAutocomplete, 'Anthurium');
|
||||
await page.waitForNumberOfElements('section.product', 4);
|
||||
const result = await page.countElement('section.product');
|
||||
|
||||
expect(result).toEqual(4);
|
||||
});
|
||||
|
||||
it('should search for the item tag value +1 and find two results', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.orderCatalog.itemTagValueInput, '+1\u000d')
|
||||
.waitForNumberOfElements('section.product', 2)
|
||||
.countElement('section.product');
|
||||
await page.write(selectors.orderCatalog.itemTagValueInput, '+1');
|
||||
await page.keyboard.press('Enter');
|
||||
await page.waitForNumberOfElements('section.product', 2);
|
||||
const result = await page.countElement('section.product');
|
||||
|
||||
expect(result).toEqual(2);
|
||||
});
|
||||
|
||||
it('should search for the item tag categoria +1 and find two results', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.orderCatalog.openTagSearch)
|
||||
.autocompleteSearch(selectors.orderCatalog.tagAutocomplete, 'categoria')
|
||||
.write(selectors.orderCatalog.tagValueInput, '+1')
|
||||
.waitToClick(selectors.orderCatalog.searchTagButton)
|
||||
.waitForNumberOfElements('section.product', 1)
|
||||
.countElement('section.product');
|
||||
await page.waitToClick(selectors.orderCatalog.openTagSearch);
|
||||
await page.autocompleteSearch(selectors.orderCatalog.tagAutocomplete, 'categoria');
|
||||
await page.write(selectors.orderCatalog.tagValueInput, '+1');
|
||||
await page.waitToClick(selectors.orderCatalog.searchTagButton);
|
||||
await page.waitForNumberOfElements('section.product', 1);
|
||||
const result = await page.countElement('section.product');
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it('should remove the tag filters and have 4 results', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.orderCatalog.fourthFilterRemoveButton)
|
||||
.waitToClick(selectors.orderCatalog.thirdFilterRemoveButton)
|
||||
.waitForNumberOfElements('.product', 4)
|
||||
.countElement('section.product');
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.orderCatalog.fourthFilterRemoveButton);
|
||||
await page.waitToClick(selectors.orderCatalog.thirdFilterRemoveButton);
|
||||
await page.waitForNumberOfElements('.product', 4);
|
||||
const result = await page.countElement('section.product');
|
||||
|
||||
expect(result).toEqual(4);
|
||||
});
|
||||
|
||||
it('should search for the item id 1 and have only 1 result', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.orderCatalog.itemIdInput, '2\u000d')
|
||||
.waitForNumberOfElements('section.product', 1)
|
||||
.countElement('section.product');
|
||||
it('should search for an item by id', async() => {
|
||||
await page.write(selectors.orderCatalog.itemIdInput, '2');
|
||||
await page.keyboard.press('Enter');
|
||||
await page.waitForNumberOfElements('section.product', 1);
|
||||
const result = await page.countElement('section.product');
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
|
|
@ -1,43 +1,48 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Order lines', () => {
|
||||
const nightmare = createNightmare();
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'order')
|
||||
.accessToSearchResult(16)
|
||||
.accessToSection('order.card.line');
|
||||
// #2050 Order.lines confirm error
|
||||
xdescribe('Order lines', () => {
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'order');
|
||||
await page.accessToSearchResult('16');
|
||||
await page.accessToSection('order.card.line');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should check the order subtotal', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText');
|
||||
|
||||
expect(result).toContain('135.60');
|
||||
});
|
||||
|
||||
it('should delete the first line in the order', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.orderLine.firstLineDeleteButton)
|
||||
.waitToClick(selectors.orderLine.confirmButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.orderLine.firstLineDeleteButton);
|
||||
await page.waitToClick(selectors.orderLine.confirmButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the order subtotal has changed', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText');
|
||||
|
||||
expect(result).toContain('90.10');
|
||||
});
|
||||
|
||||
it('should confirm the whole order and redirect to ticket index filtered by clientFk', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.orderLine.confirmOrder)
|
||||
.waitForURL('ticket/index')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.orderLine.confirmOrder);
|
||||
await page.waitForURL('ticket/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('ticket/index');
|
||||
expect(url.hash).toContain('clientFk');
|
||||
|
|
|
@ -1,67 +1,69 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Route create path', () => {
|
||||
const nightmare = createNightmare();
|
||||
describe('as employee', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'route');
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'route');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as employee', () => {
|
||||
it('should click on the add new route button and open the creation form', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.routeIndex.addNewRouteButton)
|
||||
.wait(selectors.createRouteView.workerAutocomplete)
|
||||
.parsedUrl();
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.routeIndex.addNewRouteButton);
|
||||
await page.wait(selectors.createRouteView.workerAutocomplete);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/route/create');
|
||||
});
|
||||
|
||||
it(`should attempt to create a new route but fail since employee has no access rights`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.createRouteView.descriptionInput, 'faster faster!!')
|
||||
.waitToClick(selectors.createRouteView.submitButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.createRouteView.descriptionInput, 'faster faster!!');
|
||||
await page.waitToClick(selectors.createRouteView.submitButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Access denied');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as delivery', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.login('delivery')
|
||||
.selectModule('route')
|
||||
.changeLanguageToEnglish();
|
||||
beforeAll(async() => {
|
||||
await page.login('delivery');
|
||||
await page.selectModule('route');
|
||||
await page.changeLanguageToEnglish();
|
||||
});
|
||||
|
||||
it('should again click on the add new route button and open the creation form', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.routeIndex.addNewRouteButton)
|
||||
.wait(selectors.createRouteView.workerAutocomplete)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.routeIndex.addNewRouteButton);
|
||||
await page.wait(selectors.createRouteView.workerAutocomplete);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/route/create');
|
||||
});
|
||||
|
||||
it(`should create a new route`, async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.createRouteView.workerAutocomplete, 'teamManagerNick')
|
||||
.datePicker(selectors.createRouteView.createdDatePicker, 0, null)
|
||||
.autocompleteSearch(selectors.createRouteView.vehicleAutoComplete, '4444-IMK')
|
||||
.autocompleteSearch(selectors.createRouteView.agencyAutoComplete, 'Teleportation device')
|
||||
.write(selectors.createRouteView.descriptionInput, 'faster faster!!')
|
||||
.waitToClick(selectors.createRouteView.submitButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.createRouteView.workerAutocomplete, 'teamManagerNick');
|
||||
await page.datePicker(selectors.createRouteView.createdDatePicker, 0, null);
|
||||
await page.autocompleteSearch(selectors.createRouteView.vehicleAutoComplete, '4444-IMK');
|
||||
await page.autocompleteSearch(selectors.createRouteView.agencyAutoComplete, 'Teleportation device');
|
||||
await page.write(selectors.createRouteView.descriptionInput, 'faster faster!!');
|
||||
await page.waitToClick(selectors.createRouteView.submitButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the redirection to the created route summary`, async() => {
|
||||
const url = await nightmare
|
||||
.wait(selectors.routeSummary.routeId)
|
||||
.parsedUrl();
|
||||
await page.wait(selectors.routeSummary.routeId);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
|
|
@ -1,62 +1,60 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Route basic Data path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('delivery', 'route')
|
||||
.accessToSearchResult(1)
|
||||
.accessToSection('route.card.basicData');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('delivery', 'route');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('route.card.basicData');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should edit the route basic data', async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.routeBasicData.workerAutoComplete, 'adminBossNick')
|
||||
.autocompleteSearch(selectors.routeBasicData.vehicleAutoComplete, '1111-IMK')
|
||||
.datePicker(selectors.routeBasicData.createdDateInput, 1, null)
|
||||
.clearInput(selectors.routeBasicData.kmStartInput)
|
||||
.write(selectors.routeBasicData.kmStartInput, 1)
|
||||
.clearInput(selectors.routeBasicData.kmEndInput)
|
||||
.write(selectors.routeBasicData.kmEndInput, 2)
|
||||
.write(selectors.routeBasicData.startedHourInput, '0800')
|
||||
.write(selectors.routeBasicData.finishedHourInput, '1230')
|
||||
.waitToClick(selectors.routeBasicData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.routeBasicData.workerAutoComplete, 'adminBossNick');
|
||||
await page.autocompleteSearch(selectors.routeBasicData.vehicleAutoComplete, '1111-IMK');
|
||||
await page.datePicker(selectors.routeBasicData.createdDateInput, 1, null);
|
||||
await page.clearInput(selectors.routeBasicData.kmStartInput);
|
||||
await page.write(selectors.routeBasicData.kmStartInput, '1');
|
||||
await page.clearInput(selectors.routeBasicData.kmEndInput);
|
||||
await page.write(selectors.routeBasicData.kmEndInput, '2');
|
||||
await page.type(`${selectors.routeBasicData.startedHourInput} input`, '0800');
|
||||
await page.type(`${selectors.routeBasicData.finishedHourInput} input`, '1230');
|
||||
await page.waitToClick(selectors.routeBasicData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
}, 15000);
|
||||
|
||||
it('should confirm the worker was edited', async() => {
|
||||
const worker = await nightmare
|
||||
.reloadSection('route.card.basicData')
|
||||
.waitToGetProperty(`${selectors.routeBasicData.workerAutoComplete} input`, 'value');
|
||||
await page.reloadSection('route.card.basicData');
|
||||
const worker = await page.waitToGetProperty(`${selectors.routeBasicData.workerAutoComplete} input`, 'value');
|
||||
|
||||
|
||||
expect(worker).toEqual('adminBoss - adminBossNick');
|
||||
});
|
||||
|
||||
it('should confirm the vehicle was edited', async() => {
|
||||
const vehicle = await nightmare
|
||||
.waitToGetProperty(`${selectors.routeBasicData.vehicleAutoComplete} input`, 'value');
|
||||
|
||||
const vehicle = await page.waitToGetProperty(`${selectors.routeBasicData.vehicleAutoComplete} input`, 'value');
|
||||
|
||||
expect(vehicle).toEqual('1111-IMK');
|
||||
});
|
||||
|
||||
it('should confirm the km start was edited', async() => {
|
||||
const kmStart = await nightmare
|
||||
.waitToGetProperty(selectors.routeBasicData.kmStartInput, 'value');
|
||||
|
||||
const kmStart = await page.waitToGetProperty(`${selectors.routeBasicData.kmStartInput} input`, 'value');
|
||||
|
||||
expect(kmStart).toEqual('1');
|
||||
});
|
||||
|
||||
it('should confirm the km end was edited', async() => {
|
||||
const kmEnd = await nightmare
|
||||
.waitToGetProperty(selectors.routeBasicData.kmEndInput, 'value');
|
||||
|
||||
const kmEnd = await page.waitToGetProperty(`${selectors.routeBasicData.kmEndInput} input`, 'value');
|
||||
|
||||
expect(kmEnd).toEqual('2');
|
||||
});
|
||||
|
|
|
@ -1,29 +1,35 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
// #1528 e2e claim/detail
|
||||
xdescribe('Route basic Data path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('delivery', 'route')
|
||||
.accessToSearchResult(3)
|
||||
.accessToSection('route.card.tickets');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('delivery', 'route');
|
||||
await page.accessToSearchResult('3');
|
||||
await page.accessToSection('route.card.tickets');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should modify the first ticket priority', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.routeTickets.firstTicketPriority, 2)
|
||||
.write('body', '\u000d') // simulates enter
|
||||
.waitForLastSnackbar();
|
||||
const result = await nightmare;
|
||||
await page.write(selectors.routeTickets.firstTicketPriority, '2');
|
||||
await page.keyboard.press('Enter');
|
||||
await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the buscamanButton is disabled', async() => {
|
||||
const result = await nightmare
|
||||
.evaluate(selector => {
|
||||
const result = await nightmare;
|
||||
await page.evaluate(selector => {
|
||||
return document.querySelector(selector);
|
||||
}, `${selectors.routeTickets.buscamanButton} :disabled`);
|
||||
|
||||
|
@ -31,9 +37,9 @@ xdescribe('Route basic Data path', () => {
|
|||
});
|
||||
|
||||
it('should check the first ticket checkbox and confirm the buscamanButton button is no longer disabled', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.routeTickets.firstTicketCheckbox)
|
||||
.evaluate(selector => {
|
||||
const result = await nightmare;
|
||||
await page.waitToClick(selectors.routeTickets.firstTicketCheckbox);
|
||||
await page.evaluate(selector => {
|
||||
return document.querySelector(selector);
|
||||
}, `${selectors.routeTickets.buscamanButton} :disabled`);
|
||||
|
||||
|
@ -41,47 +47,47 @@ xdescribe('Route basic Data path', () => {
|
|||
});
|
||||
|
||||
it('should check the route volume on the descriptor', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
|
||||
const result = await nightmare;
|
||||
await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
|
||||
|
||||
expect(result).toEqual('1.1 / 18 m³');
|
||||
});
|
||||
|
||||
it('should count how many tickets are in route', async() => {
|
||||
const result = await nightmare
|
||||
.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]');
|
||||
const result = await nightmare;
|
||||
await page.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]');
|
||||
|
||||
expect(result).toEqual(11);
|
||||
});
|
||||
|
||||
it('should delete the first ticket in route', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.routeTickets.firstTicketDeleteButton)
|
||||
.waitToClick(selectors.routeTickets.confirmButton)
|
||||
.waitForLastSnackbar();
|
||||
const result = await nightmare;
|
||||
await page.waitToClick(selectors.routeTickets.firstTicketDeleteButton);
|
||||
await page.waitToClick(selectors.routeTickets.confirmButton);
|
||||
await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Ticket removed from route');
|
||||
});
|
||||
|
||||
it('should again delete the first ticket in route', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.routeTickets.firstTicketDeleteButton)
|
||||
.waitToClick(selectors.routeTickets.confirmButton)
|
||||
.waitForLastSnackbar();
|
||||
const result = await nightmare;
|
||||
await page.waitToClick(selectors.routeTickets.firstTicketDeleteButton);
|
||||
await page.waitToClick(selectors.routeTickets.confirmButton);
|
||||
await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Ticket removed from route');
|
||||
});
|
||||
|
||||
it('should now count how many tickets are in route to find one less', async() => {
|
||||
const result = await nightmare
|
||||
.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]');
|
||||
const result = await nightmare;
|
||||
await page.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]');
|
||||
|
||||
expect(result).toEqual(9);
|
||||
});
|
||||
|
||||
it('should confirm the route volume on the descriptor has been updated by the changes made', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
|
||||
const result = await nightmare;
|
||||
await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
|
||||
|
||||
expect(result).toEqual('0.9 / 18 m³');
|
||||
});
|
||||
|
|
|
@ -1,139 +1,137 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('InvoiceOut descriptor path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
describe('as Administrative', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'ticket');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('administrative', 'ticket');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as Administrative', () => {
|
||||
it('should search for tickets with an specific invoiceOut', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton)
|
||||
.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222')
|
||||
.waitToClick(selectors.ticketsIndex.advancedSearchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton);
|
||||
await page.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222');
|
||||
await page.waitToClick(selectors.ticketsIndex.advancedSearchButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it('should navigate to the invoiceOut index', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.invoiceOutButton)
|
||||
.wait(selectors.invoiceOutIndex.searchInvoiceOutInput)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.invoiceOutButton);
|
||||
await page.wait(selectors.invoiceOutIndex.searchInvoiceOutInput);
|
||||
await page.waitForURL('#!/invoice-out/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/invoice-out/index');
|
||||
});
|
||||
|
||||
it('should search for the target invoiceOut', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.invoiceOutIndex.searchInvoiceOutInput, 'T2222222')
|
||||
.waitToClick(selectors.invoiceOutIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 1)
|
||||
.countElement(selectors.invoiceOutIndex.searchResult);
|
||||
await page.waitForContentLoaded();
|
||||
await page.write(selectors.invoiceOutIndex.searchInvoiceOutInput, 'T2222222');
|
||||
await page.waitToClick(selectors.invoiceOutIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.invoiceOutIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the invoiceOut summary`, async() => {
|
||||
const url = await nightmare
|
||||
.accessToSearchResult('T2222222')
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.accessToSearchResult('T2222222');
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it('should delete the invoiceOut using the descriptor more menu', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.invoiceOutDescriptor.moreMenu)
|
||||
.waitToClick(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut)
|
||||
.waitToClick(selectors.invoiceOutDescriptor.acceptDeleteButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut);
|
||||
await page.waitToClick(selectors.invoiceOutDescriptor.acceptDeleteButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('InvoiceOut deleted');
|
||||
});
|
||||
|
||||
it('should have been relocated to the invoiceOut index', async() => {
|
||||
const url = await nightmare
|
||||
.parsedUrl();
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/invoice-out/index');
|
||||
});
|
||||
|
||||
it(`should search for the deleted invouceOut to find no results`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.invoiceOutIndex.searchInvoiceOutInput, 'T2222222')
|
||||
.waitToClick(selectors.invoiceOutIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 0)
|
||||
.countElement(selectors.invoiceOutIndex.searchResult);
|
||||
await page.write(selectors.invoiceOutIndex.searchInvoiceOutInput, 'T2222222');
|
||||
await page.waitToClick(selectors.invoiceOutIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 0);
|
||||
const result = await page.countElement(selectors.invoiceOutIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(0);
|
||||
});
|
||||
|
||||
it('should navigate to the ticket index', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.ticketsButton);
|
||||
await page.wait(selectors.ticketsIndex.searchTicketInput);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
});
|
||||
|
||||
it('should search for tickets with an specific invoiceOut to find no results', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton)
|
||||
.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222')
|
||||
.waitToClick(selectors.ticketsIndex.advancedSearchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 0)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
await page.waitFor(2000);
|
||||
await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton);
|
||||
await page.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222');
|
||||
await page.waitToClick(selectors.ticketsIndex.advancedSearchButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 0);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(0);
|
||||
});
|
||||
|
||||
it('should now navigate to the invoiceOut index', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.invoiceOutButton)
|
||||
.wait(selectors.invoiceOutIndex.searchInvoiceOutInput)
|
||||
.parsedUrl();
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.invoiceOutButton);
|
||||
await page.wait(selectors.invoiceOutIndex.searchInvoiceOutInput);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/invoice-out/index');
|
||||
});
|
||||
|
||||
it(`should search and access to the invoiceOut summary`, async() => {
|
||||
const url = await nightmare
|
||||
.accessToSearchResult('T1111111')
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitForContentLoaded();
|
||||
await page.accessToSearchResult('T1111111');
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it(`should check the invoiceOut is booked in the summary data`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.invoiceOutSummary.bookedLabel, '/')
|
||||
.waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText');
|
||||
await page.waitForTextInElement(selectors.invoiceOutSummary.bookedLabel, '/');
|
||||
const result = await page.waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText');
|
||||
|
||||
expect(result.length).toBeGreaterThan(1);
|
||||
});
|
||||
|
||||
it('should re-book the invoiceOut using the descriptor more menu', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.invoiceOutDescriptor.moreMenu)
|
||||
.waitToClick(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut)
|
||||
.waitToClick(selectors.invoiceOutDescriptor.acceptBookingButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut);
|
||||
await page.waitToClick(selectors.invoiceOutDescriptor.acceptBookingButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('InvoiceOut booked');
|
||||
});
|
||||
|
@ -149,7 +147,7 @@ describe('InvoiceOut descriptor path', () => {
|
|||
|
||||
let expectedDate = `${day}/${month}/${today.getFullYear()}`;
|
||||
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText');
|
||||
|
||||
expect(result).toEqual(expectedDate);
|
||||
|
@ -157,26 +155,19 @@ describe('InvoiceOut descriptor path', () => {
|
|||
});
|
||||
|
||||
describe('as salesPerson', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'invoiceOut')
|
||||
.accessToSearchResult('A1111111');
|
||||
it(`should log in as salesPerson then go to the target invoiceOut summary`, async() => {
|
||||
await page.loginAndModule('salesPerson', 'invoiceOut');
|
||||
await page.accessToSearchResult('A1111111');
|
||||
});
|
||||
|
||||
it(`should check the salesPerson role doens't see the book option in the more menu`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.invoiceOutDescriptor.moreMenu)
|
||||
.wait(selectors.invoiceOutDescriptor.moreMenuShowInvoiceOutPdf)
|
||||
.exists(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu);
|
||||
await page.wait(selectors.invoiceOutDescriptor.moreMenuShowInvoiceOutPdf);
|
||||
await page.waitForSelector(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut, {hidden: true});
|
||||
});
|
||||
|
||||
it(`should check the salesPerson role doens't see the delete option in the more menu`, async() => {
|
||||
const result = await nightmare
|
||||
.exists(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
await page.waitForSelector(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut, {hidden: true});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,29 +1,32 @@
|
|||
import selectors from '../helpers/selectors';
|
||||
import createNightmare from '../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('create client path', () => {
|
||||
let nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('employee', 'client');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should access to the create client view by clicking the create-client floating button', async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.clientsIndex.createClientButton)
|
||||
.wait(selectors.createClientView.createButton)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientsIndex.createClientButton);
|
||||
await page.wait(selectors.createClientView.createButton);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/create');
|
||||
});
|
||||
|
||||
it('should cancel the client creation to go back to clients index', async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.waitToClick(selectors.globalItems.clientsButton)
|
||||
.wait(selectors.clientsIndex.createClientButton)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.waitToClick(selectors.globalItems.clientsButton);
|
||||
await page.wait(selectors.clientsIndex.createClientButton);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/index');
|
||||
});
|
||||
|
|
|
@ -46,11 +46,11 @@ export default class Controller extends Component {
|
|||
|
||||
let parent = this.snackbar.querySelectorAll('.shape')[0];
|
||||
|
||||
if (parent) {
|
||||
if (parent)
|
||||
this.snackbar.insertBefore(shape, parent);
|
||||
} else {
|
||||
else
|
||||
this.snackbar.appendChild(shape);
|
||||
}
|
||||
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
@ -108,12 +108,11 @@ export default class Controller extends Component {
|
|||
}
|
||||
|
||||
onButtonClick(shape) {
|
||||
if (this.actionHandler) {
|
||||
if (this.actionHandler)
|
||||
this.actionHandler();
|
||||
} else {
|
||||
else
|
||||
this.hide(shape);
|
||||
}
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$element', '$translate'];
|
||||
|
||||
|
|
|
@ -23,13 +23,10 @@ describe('Directive vnId', () => {
|
|||
}).toThrow(new Error(`vnId: Attribute can't be null`));
|
||||
});
|
||||
|
||||
// FIXME: Sometimes fails with '$scope is undefined'
|
||||
xit(`should set the controller into the $scope as there are no errors being thrown`, () => {
|
||||
let html = `<form vn-id="1"></form>`;
|
||||
|
||||
expect($scope['1']).not.toBeDefined();
|
||||
it(`should set the controller into the $scope as there are no errors being thrown`, () => {
|
||||
let html = `<form vn-id="myId"></form>`;
|
||||
compile(html);
|
||||
|
||||
expect($scope['1']).toBeDefined();
|
||||
expect($scope.myId).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,4 +6,5 @@
|
|||
ng-if="!$ctrl.showLayout">
|
||||
</ui-view>
|
||||
<vn-snackbar vn-id="snackbar"></vn-snackbar>
|
||||
<vn-debug-info></vn-debug-info>
|
||||
|
||||
<!-- <vn-debug-info></vn-debug-info> -->
|
||||
|
|
27
gulpfile.js
27
gulpfile.js
|
@ -154,19 +154,12 @@ function backTest(done) {
|
|||
backTest.description = `Watches for changes in modules to execute backTest task`;
|
||||
|
||||
// End to end tests
|
||||
|
||||
function e2eOnly() {
|
||||
function e2eSingleRun() {
|
||||
require('@babel/register')({presets: ['@babel/preset-env']});
|
||||
require('@babel/polyfill');
|
||||
|
||||
const jasmine = require('gulp-jasmine');
|
||||
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
|
||||
const createNightmare = require('./e2e/helpers/nightmare');
|
||||
|
||||
if (argv.show || argv.s)
|
||||
process.env.E2E_SHOW = true;
|
||||
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true;
|
||||
|
||||
|
||||
const specFiles = [
|
||||
`${__dirname}/e2e/paths/01*/*[sS]pec.js`,
|
||||
|
@ -178,8 +171,7 @@ function e2eOnly() {
|
|||
`${__dirname}/e2e/paths/07*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/08*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/09*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/**/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/helpers/extensions.js`
|
||||
`${__dirname}/e2e/paths/**/*[sS]pec.js`
|
||||
];
|
||||
|
||||
return gulp.src(specFiles).pipe(jasmine({
|
||||
|
@ -195,14 +187,9 @@ function e2eOnly() {
|
|||
}
|
||||
})
|
||||
]
|
||||
})
|
||||
.on('jasmineDone', function() {
|
||||
const nightmare = createNightmare();
|
||||
nightmare.end(() => {});
|
||||
})
|
||||
);
|
||||
}));
|
||||
}
|
||||
e2eOnly.description = `Runs the e2e tests only`;
|
||||
e2eSingleRun.description = `Runs the e2e tests just once`;
|
||||
|
||||
async function backendStatus() {
|
||||
const milliseconds = 250;
|
||||
|
@ -230,7 +217,7 @@ e2e = gulp.series(docker, async function isBackendReady() {
|
|||
log(`Backend ready after ${attempts} attempt(s)`);
|
||||
|
||||
return attempts;
|
||||
}, e2eOnly);
|
||||
}, e2eSingleRun);
|
||||
e2e.description = `Restarts database and runs the e2e tests`;
|
||||
|
||||
function smokesOnly() {
|
||||
|
@ -570,7 +557,6 @@ module.exports = {
|
|||
backTest,
|
||||
backTestDocker,
|
||||
e2e,
|
||||
e2eOnly,
|
||||
smokes,
|
||||
smokesOnly,
|
||||
i,
|
||||
|
@ -586,5 +572,6 @@ module.exports = {
|
|||
docker,
|
||||
dockerStart,
|
||||
dockerWait,
|
||||
backendStatus
|
||||
backendStatus,
|
||||
e2eSingleRun
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"name": "storage",
|
||||
"connector": "loopback-component-storage",
|
||||
"provider": "filesystem",
|
||||
"root": "./e2e/dms",
|
||||
"root": "../../e2e/dms",
|
||||
"maxFileSize": "262144000",
|
||||
"allowedContentTypes": [
|
||||
"application/x-7z-compressed",
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
},
|
||||
"inflation": {
|
||||
"type": "Number"
|
||||
},
|
||||
"m3Max": {
|
||||
"type": "Number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -29,6 +29,15 @@
|
|||
vn-acl="deliveryBoss"
|
||||
rule>
|
||||
</vn-autocomplete>
|
||||
<vn-input-number
|
||||
vn-one
|
||||
label="Maximum m³"
|
||||
ng-model="$ctrl.zone.m3Max"
|
||||
min="0"
|
||||
step="0.01"
|
||||
vn-acl="deliveryBoss"
|
||||
rule>
|
||||
</vn-input-number>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-input-number
|
||||
|
|
|
@ -26,3 +26,4 @@ Province: Provincia
|
|||
Postcode: Código postal
|
||||
Inflation: Inflación
|
||||
Query: Consultar
|
||||
Maximum m³: M³ máximo
|
|
@ -7,7 +7,7 @@ describe('Client activeWorkersWithRole', () => {
|
|||
|
||||
let isSalesPerson = await app.models.Account.hasRole(result[0].id, 'salesPerson');
|
||||
|
||||
expect(result.length).toEqual(15);
|
||||
expect(result.length).toEqual(14);
|
||||
expect(isSalesPerson).toBeTruthy();
|
||||
});
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ describe('Client listWorkers', () => {
|
|||
.then(result => {
|
||||
let amountOfEmployees = Object.keys(result).length;
|
||||
|
||||
expect(amountOfEmployees).toEqual(50);
|
||||
expect(amountOfEmployees).toEqual(49);
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<vn-textfield
|
||||
label="Type the visible quantity"
|
||||
ng-model="$ctrl.quantity"
|
||||
name="user"
|
||||
vn-id="userField"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
<vn-autocomplete
|
||||
|
|
|
@ -24,7 +24,7 @@ describe('order new()', () => {
|
|||
expect(error).toEqual(new UserError(`You can't create an order for a inactive client`));
|
||||
});
|
||||
|
||||
it('should create a new order a user when all conditions are met', async() => {
|
||||
it('should now create a new order when all conditions are met', async() => {
|
||||
let landed = new Date();
|
||||
let addressFk = 121;
|
||||
let agencyModeFk = 1;
|
||||
|
|
|
@ -16,10 +16,7 @@
|
|||
"type": "String"
|
||||
},
|
||||
"isBase":{
|
||||
"type":"String",
|
||||
"mysql": {
|
||||
"columnName": "base"
|
||||
}
|
||||
"type":"Boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,10 +33,11 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.getWorkedHours = async(id, from, to) => {
|
||||
Self.getWorkedHours = async(id, started, ended) => {
|
||||
const conn = Self.dataSource.connector;
|
||||
const stmts = [];
|
||||
|
||||
const startedMinusOne = new Date();
|
||||
const endedPlusOne = new Date();
|
||||
let worker = await Self.app.models.Worker.findById(id);
|
||||
let userId = worker.userFk;
|
||||
|
||||
|
@ -45,14 +46,16 @@ module.exports = Self => {
|
|||
tmp.timeControlCalculate,
|
||||
tmp.timeBusinessCalculate
|
||||
`);
|
||||
|
||||
stmts.push(new ParameterizedSQL('CALL vn.timeControl_calculateByUser(?, ?, ?)', [userId, from, to]));
|
||||
stmts.push(new ParameterizedSQL('CALL vn.timeBusiness_calculateByUser(?, ?, ?)', [userId, from, to]));
|
||||
let resultIndex = stmts.push(`
|
||||
startedMinusOne.setDate(started.getDate() - 1);
|
||||
endedPlusOne.setDate(ended.getDate() + 1);
|
||||
stmts.push(new ParameterizedSQL('CALL vn.timeControl_calculateByUser(?, ?, ?)', [userId, startedMinusOne, endedPlusOne]));
|
||||
stmts.push(new ParameterizedSQL('CALL vn.timeBusiness_calculateByUser(?, ?, ?)', [userId, startedMinusOne, endedPlusOne]));
|
||||
let resultIndex = stmts.push(new ParameterizedSQL(`
|
||||
SELECT tbc.dated, tbc.timeWorkSeconds expectedHours, tcc.timeWorkSeconds workedHours
|
||||
FROM tmp.timeBusinessCalculate tbc
|
||||
LEFT JOIN tmp.timeControlCalculate tcc ON tcc.dated = tbc.dated
|
||||
`) - 1;
|
||||
WHERE tbc.dated BETWEEN ? AND ?
|
||||
`, [started, ended])) - 1;
|
||||
stmts.push(`
|
||||
DROP TEMPORARY TABLE IF EXISTS
|
||||
tmp.timeControlCalculate,
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<vn-table model="model">
|
||||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th field="creationDate">Date</vn-th>
|
||||
<vn-th class="firstColumn" field="creationDate">Date</vn-th>
|
||||
<vn-th field="userFk" class="expendable" shrink>Author</vn-th>
|
||||
<vn-th field="changedModel" class="expendable" shrink>Model</vn-th>
|
||||
<vn-th field="action" class="expendable" shrink>Action</vn-th>
|
||||
|
@ -25,7 +25,7 @@
|
|||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="log in $ctrl.logs">
|
||||
<vn-td>
|
||||
<vn-td class="firstColumn">
|
||||
{{::log.creationDate | date:'dd/MM/yyyy HH:mm'}}
|
||||
<div class="changes">
|
||||
<div>
|
||||
|
|
|
@ -18,6 +18,10 @@ vn-log {
|
|||
max-width: 250px;
|
||||
}
|
||||
|
||||
vn-table .firstColumn {
|
||||
min-width: 150px
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1570px) {
|
||||
vn-table .expendable {
|
||||
display: none;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue