diff --git a/db/Dockerfile b/db/Dockerfile
index c376e6893..60e25319f 100644
--- a/db/Dockerfile
+++ b/db/Dockerfile
@@ -35,5 +35,5 @@ ENTRYPOINT ["docker-start.sh"]
CMD ["mysqld"]
-#HEALTHCHECK --interval=5s --timeout=10s --retries=200 \
-# CMD mysqladmin ping -h 127.0.0.1 -u root || exit 1
+HEALTHCHECK --interval=5s --timeout=10s --retries=200 \
+ CMD mysqladmin ping -h 127.0.0.1 -u root || exit 1
diff --git a/db/changes/10170-NOFallas/00-aclWorkerDms.sql b/db/changes/10170-NOFallas/00-aclWorkerDms.sql
deleted file mode 100644
index 46e56f77e..000000000
--- a/db/changes/10170-NOFallas/00-aclWorkerDms.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
-VALUES
-('WorkerDms', 'filter', 'READ', 'ALLOW', 'ROLE', 'employee'),
-('WorkerDms', 'downloadFile', 'READ', 'ALLOW', 'ROLE', 'employee');
-DELETE FROM `salix`.`ACL` WHERE (`id` = '205');
diff --git a/db/changes/10170-NOFallas/00-zone_getEvents.sql b/db/changes/10170-NOFallas/00-zone_getEvents.sql
deleted file mode 100644
index 991150db7..000000000
--- a/db/changes/10170-NOFallas/00-zone_getEvents.sql
+++ /dev/null
@@ -1,119 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `zone_getEvents`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `zone_getEvents`(
- vGeoFk INT,
- vAgencyModeFk INT)
-BEGIN
-/**
- * Returns available events for the passed province/postcode and agency.
- *
- * @param vGeoFk The geo id
- * @param vAgencyModeFk The agency mode id
- */
- DECLARE vDeliveryMethodFk VARCHAR(255);
-
- DROP TEMPORARY TABLE IF EXISTS tZone;
- CREATE TEMPORARY TABLE tZone
- (id INT PRIMARY KEY)
- ENGINE = MEMORY;
-
- SELECT dm.`code` INTO vDeliveryMethodFk
- FROM agencyMode am
- JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
- WHERE am.id = vAgencyModeFk;
-
- IF vDeliveryMethodFk = 'PICKUP' THEN
- INSERT INTO tZone
- SELECT id
- FROM zone
- WHERE agencyModeFk = vAgencyModeFk;
- ELSE
- CALL zone_getFromGeo(vGeoFk);
-
- IF vAgencyModeFk IS NOT NULL THEN
- INSERT INTO tZone
- SELECT t.id
- FROM tmp.zone t
- JOIN zone z ON z.id = t.id
- WHERE z.agencyModeFk = vAgencyModeFk;
- ELSE
- INSERT INTO tZone
- SELECT t.id
- FROM tmp.zone t
- JOIN zone z ON z.id = t.id
- JOIN agencyMode am ON am.id = z.agencyModeFk
- JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
- WHERE dm.`code` IN ('AGENCY', 'DELIVERY');
- END IF;
- DROP TEMPORARY TABLE tmp.zone;
- END IF;
-
- SELECT e.zoneFk, e.`type`, e.dated, e.`started`, e.`ended`, e.weekDays
- FROM tZone t
- JOIN zoneEvent e ON e.zoneFk = t.id;
-
- SELECT e.zoneFk, e.dated
- FROM tZone t
- JOIN zoneExclusion e ON e.zoneFk = t.id;
-
- DROP TEMPORARY TABLE tZone;
-END$$
-
-DELIMITER ;
-
-USE `vn`;
-DROP procedure IF EXISTS `zone_getEvents__`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `zone_getEvents__`(
- vProvinceFk INT,
- vPostCode VARCHAR(255),
- vAgencyModeFk INT)
-BEGIN
-/**
- * Returns available events for the passed province/postcode and agency.
- *
- * @param vAgencyModeFk The agency mode id
- * @param vProvinceFk The province id
- * @param vPostCode The postcode or %NULL to use the province
- */
-
- DECLARE vGeoFk INT;
-
- IF vPostCode IS NOT NULL THEN
- SELECT p.geoFk INTO vGeoFk
- FROM postCode p
- JOIN town t ON t.id = p.townFk
- WHERE p.`code` = vPostCode
- AND t.provinceFk = vProvinceFk;
- ELSE
- SELECT geoFk INTO vGeoFk
- FROM province
- WHERE id = vProvinceFk;
- END IF;
-
- CALL zone_getFromGeo(vGeoFk);
-
- IF vAgencyModeFk IS NOT NULL THEN
- DELETE t FROM tmp.zone t
- JOIN zone z ON z.id = t.id
- WHERE z.agencyModeFk != vAgencyModeFk;
- END IF;
-
- SELECT e.zoneFk, e.`type`, e.dated, e.`started`, e.`ended`, e.weekDays
- FROM tmp.zone t
- JOIN zoneEvent e ON e.zoneFk = t.id;
-
- SELECT e.zoneFk, e.dated
- FROM tmp.zone t
- JOIN zoneExclusion e ON e.zoneFk = t.id;
-
- DROP TEMPORARY TABLE tmp.zone;
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10170-NOFallas/00-zone_getWarehouse.sql b/db/changes/10170-NOFallas/00-zone_getWarehouse.sql
deleted file mode 100644
index a65643ff5..000000000
--- a/db/changes/10170-NOFallas/00-zone_getWarehouse.sql
+++ /dev/null
@@ -1,87 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `zone_getWarehouse`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `zone_getWarehouse`(vAddress INT, vLanded DATE, vWarehouse INT)
-BEGIN
-/**
- * Devuelve el listado de agencias disponibles para la fecha,
- * dirección y almacén pasados.
- *
- * @param vAddress
- * @param vWarehouse warehouse
- * @param vLanded Fecha de recogida
- * @select Listado de agencias disponibles
- */
-
- CALL zone_getFromGeo(address_getGeo(vAddress));
- CALL zone_getOptionsForLanding(vLanded, FALSE);
-
- SELECT am.id agencyModeFk,
- am.name agencyMode,
- am.description,
- am.deliveryMethodFk,
- TIMESTAMPADD(DAY, -zo.travelingDays, vLanded) shipped,
- zw.warehouseFk,
- z.id zoneFk
- FROM tmp.zoneOption zo
- JOIN zone z ON z.id = zo.zoneFk
- JOIN agencyMode am ON am.id = z.agencyModeFk
- JOIN zoneWarehouse zw ON zw.zoneFk = zo.zoneFk
- WHERE zw.warehouseFk = vWarehouse
- GROUP BY z.agencyModeFk
- ORDER BY agencyMode;
-
- DROP TEMPORARY TABLE
- tmp.zone,
- tmp.zoneOption;
-
-END$$
-
-DELIMITER ;
-
-USE `vn`;
-DROP procedure IF EXISTS `zone_getWarehouse__`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `zone_getWarehouse__`(vAddress INT, vLanded DATE, vWarehouse INT)
-BEGIN
-/**
- * Devuelve el listado de agencias disponibles para la fecha,
- * dirección y almacén pasados.
- *
- * @param vAddress
- * @param vWarehouse warehouse
- * @param vLanded Fecha de recogida
- * @select Listado de agencias disponibles
- */
-
- CALL zone_getFromGeo(address_getGeo(vAddress));
- CALL zone_getOptionsForLanding(vLanded, FALSE);
-
- SELECT am.id agencyModeFk,
- am.name agencyMode,
- am.description,
- am.deliveryMethodFk,
- TIMESTAMPADD(DAY, -zo.travelingDays, vLanded) shipped,
- zw.warehouseFk,
- z.id zoneFk
- FROM tmp.zoneOption zo
- JOIN zone z ON z.id = zo.zoneFk
- JOIN agencyMode am ON am.id = z.agencyModeFk
- JOIN zoneWarehouse zw ON zw.zoneFk = zo.zoneFk
- WHERE zw.warehouseFk
- GROUP BY z.agencyModeFk
- ORDER BY agencyMode;
-
- DROP TEMPORARY TABLE
- tmp.zone,
- tmp.zoneOption;
-
-END$$
-
-DELIMITER ;
-
-
diff --git a/db/changes/10190-PostErte/00-ACL.sql b/db/changes/10190-PostErte/00-ACL.sql
index 2a2673fcc..8ef44224a 100644
--- a/db/changes/10190-PostErte/00-ACL.sql
+++ b/db/changes/10190-PostErte/00-ACL.sql
@@ -1,4 +1,5 @@
UPDATE `salix`.`ACL` SET `accessType`='WRITE' WHERE `id`='213';
+UPDATE `salix`.`ACL` SET `property` = 'deleteSales' WHERE (`id` = '80');
INSERT IGNORE INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('CustomsAgent', '*', '*', 'ALLOW', 'ROLE', 'employee');
diff --git a/db/changes/PASTE_COMMENT_REMINDER b/db/changes/PASTE_COMMENT_REMINDER
new file mode 100644
index 000000000..07b707920
--- /dev/null
+++ b/db/changes/PASTE_COMMENT_REMINDER
@@ -0,0 +1,4 @@
+/*
+Hay una versión en salix que machacará toda esta función/procedimiento
+avisa a ___ de los cambios que quieres hacer
+*/
\ No newline at end of file
diff --git a/db/docker.js b/db/docker.js
index 0a221a0be..0cb912be6 100644
--- a/db/docker.js
+++ b/db/docker.js
@@ -39,8 +39,7 @@ module.exports = class Docker {
let runChown = process.platform != 'linux';
- const healthCheck = `--health-cmd='mysqladmin ping --silent'`;
- const container = await this.execP(`docker run ${healthCheck} --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
+ const container = await this.execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
this.id = container.stdout;
try {
@@ -54,7 +53,7 @@ module.exports = class Docker {
this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
}
- if (runChown) await this.wait();
+ await this.waitForHealthy();
} catch (err) {
if (this.isRandom)
await this.rm();
diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql
index ed2ee8a8f..acd0fbdfb 100644
--- a/db/dump/fixtures.sql
+++ b/db/dump/fixtures.sql
@@ -1472,6 +1472,9 @@ INSERT INTO `vn`.`clientContact`(`id`, `clientFk`, `name`, `phone`)
(3, 101, 'contact 3', 222333444),
(4, 102, 'contact 1', 876543219);
+INSERT INTO `vn`.`workerManaExcluded`(`workerFk`)
+ VALUES
+ (9);
/*
el mana de los trabajadores lo podemos poner a mano en la tabla si lo calculamos antes,
pero si hazemos alguna modificacion en alguna tabla que utiliza para calcularlo ya no seria correcto
@@ -1678,11 +1681,13 @@ INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`)
('1', '24.5', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR))),
('5', '23', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)));
-INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`, `code`)
+INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`, `code`, `holidayEntitlementRate`)
VALUES
- (1, 'Holidays', '#FF4444', 'holiday'),
- (2, 'Leave of absence', '#C71585', 'absence'),
- (6, 'Half holiday', '#E65F00', 'halfHoliday');
+ (1, 'Holidays', '#FF4444', 'holiday', 0),
+ (2, 'Leave of absence', '#C71585', 'absence', 0),
+ (6, 'Half holiday', '#E65F00', 'halfHoliday', 0),
+ (20, 'Furlough', '#97B92F', 'furlough', 1),
+ (21, 'Furlough half day', '#778899', 'halfFurlough', 0.5);
INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`)
VALUES
diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js
index 636819860..a3c52748d 100644
--- a/e2e/helpers/extensions.js
+++ b/e2e/helpers/extensions.js
@@ -558,7 +558,7 @@ let actions = {
}, selector);
},
- closePopup: async function(selector) {
+ closePopup: async function() {
await Promise.all([
this.keyboard.press('Escape'),
this.waitFor('.vn-popup', {hidden: true}),
diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index 1f1ce7da5..cb29afac9 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -401,8 +401,9 @@ export default {
createButton: `button[type=submit]`
},
ticketDescriptor: {
- idLabelValue: 'vn-ticket-descriptor vn-label-value[label="Id"]',
+ id: 'vn-descriptor-content div.top > div',
stateLabelValue: 'vn-ticket-descriptor vn-label-value[label="State"]',
+ isDeletedIcon: 'vn-ticket-descriptor vn-icon[icon="icon-deletedTicket"]',
goBackToModuleIndexButton: 'vn-ticket-descriptor a[ui-sref="ticket.index"]',
moreMenu: 'vn-ticket-descriptor vn-icon-button[icon=more_vert]',
moreMenuAddStowaway: '.vn-menu [name="addStowaway"]',
@@ -445,20 +446,23 @@ export default {
savePackagesButton: `button[type=submit]`
},
ticketSales: {
+ setOk: 'vn-ticket-sale vn-tool-bar > vn-button[label="Ok"] > button',
saleButton: 'vn-left-menu a[ui-sref="ticket.card.sale"]',
saleLine: 'vn-table div > vn-tbody > vn-tr',
saleDescriptorPopover: '.vn-popover.shown vn-item-descriptor',
- saleDescriptorPopoverSummaryButton: '.vn-popover.shown vn-item-descriptor a[ui-sref="item.card.summary({id: $ctrl.item.id})"]',
+ saleDescriptorPopoverSummaryButton: '.vn-popover.shown vn-item-descriptor a[ui-sref="item.card.summary({id: $ctrl.descriptor.id})"]',
descriptorItemDiaryButton: '.vn-popover vn-item-descriptor vn-quick-link[icon="icon-transaction"] > a',
newItemFromCatalogButton: 'vn-ticket-sale vn-float-button[icon="add"]',
newItemButton: 'vn-ticket-sale vn-card vn-icon-button[icon="add_circle"]',
- moreMenu: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] > div > button',
- moreMenuCreateClaim: '.vn-drop-down.shown li[name="Add claim"]',
- 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"]',
+ moreMenu: 'vn-ticket-sale vn-button[label="More"]',
+ moreMenuCreateClaim: 'vn-item[name="claim"]',
+ moreMenuReserve: 'vn-item[name="reserve"]',
+ moreMenuUnmarkReseved: 'vn-item[name="unreserve"]',
+ moreMenuUpdateDiscount: 'vn-item[name="discount"]',
+ moreMenuUpdateDiscountInput: 'vn-input-number[ng-model="$ctrl.edit.discount"] 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',
+ firstSaleId: 'vn-ticket-sale vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > span',
firstSaleClaimIcon: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) vn-icon[icon="icon-claims"]',
firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img',
firstSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(1)',
@@ -468,9 +472,9 @@ export default {
firstSaleQuantityCell: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td-editable:nth-child(5)',
firstSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > vn-autocomplete',
firstSalePrice: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(7) > span',
- firstSalePriceInput: '.vn-popover.shown [ng-model="$ctrl.editedPrice"]',
+ firstSalePriceInput: '.vn-popover.shown input[ng-model="$ctrl.field"]',
firstSaleDiscount: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(8) > span',
- firstSaleDiscountInput: '.vn-popover.shown [ng-model="$ctrl.newDiscount"]',
+ firstSaleDiscountInput: '.vn-popover.shown [ng-model="$ctrl.field"]',
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',
@@ -486,20 +490,22 @@ export default {
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',
+ secondSaleQuantityCell: 'vn-ticket-sale > div > vn-card > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td-editable:nth-child(5)',
secondSaleConceptCell: 'vn-ticket-sale vn-tbody > :nth-child(2) > :nth-child(6)',
secondSaleConceptInput: 'vn-ticket-sale vn-tbody > :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',
+ totalImport: 'vn-ticket-sale vn-one.taxes > 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"]',
+ moveToTicketInput: 'form vn-input-number[ng-model="$ctrl.transfer.ticketId"] input',
moveToTicketButton: '.vn-popover.shown vn-icon[icon="arrow_forward_ios"]',
moveToNewTicketButton: '.vn-popover.shown vn-button[label="New ticket"]',
acceptDeleteLineButton: '.vn-confirm.shown button[response=accept]',
acceptDeleteTicketButton: '.vn-confirm.shown button[response=accept]',
- stateMenuButton: 'vn-ticket-sale vn-tool-bar > vn-button-menu[label="State"]'
+ stateMenuButton: 'vn-ticket-sale vn-tool-bar > vn-button-menu[label="State"]',
+ stateMenuFixOption: ''
},
ticketTracking: {
trackingButton: 'vn-left-menu a[ui-sref="ticket.card.tracking.index"]',
diff --git a/e2e/paths/05-ticket/01-sale/01_list_sales.spec.js b/e2e/paths/05-ticket/01-sale/01_list_sales.spec.js
index f97447c06..f883d08dc 100644
--- a/e2e/paths/05-ticket/01-sale/01_list_sales.spec.js
+++ b/e2e/paths/05-ticket/01-sale/01_list_sales.spec.js
@@ -72,7 +72,8 @@ describe('Ticket List sale path', () => {
}, {}, selectors.ticketSales.secondSaleIdAutocomplete, searchValue);
await page.keyboard.press('Enter');
- await page.write(selectors.ticketSales.secondSaleQuantity, '1');
+ await page.waitToClick(selectors.ticketSales.secondSaleQuantityCell);
+ await page.type(selectors.ticketSales.secondSaleQuantity, '1');
await page.keyboard.press('Enter');
const message = await page.waitForSnackbar();
diff --git a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js
index a22b0e022..a7b24e4a3 100644
--- a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js
+++ b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js
@@ -1,8 +1,7 @@
import selectors from '../../../helpers/selectors.js';
import getBrowser from '../../../helpers/puppeteer';
-// #1632 [e2e] ticket.sale - Transferir líneas
-xdescribe('Ticket Edit sale path', () => {
+describe('Ticket Edit sale path', () => {
let browser;
let page;
@@ -10,7 +9,7 @@ xdescribe('Ticket Edit sale path', () => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('salesPerson', 'ticket');
- await page.accessToSearchResult(16);
+ await page.accessToSearchResult('16');
await page.accessToSection('ticket.card.sale');
});
@@ -20,29 +19,50 @@ xdescribe('Ticket Edit sale path', () => {
it(`should click on the first sale claim icon to navigate over there`, async() => {
await page.waitToClick(selectors.ticketSales.firstSaleClaimIcon);
- await page.wait(selectors.claimBasicData.claimState);
- const url = await page.parsedUrl();
-
- expect(url.hash).toEqual('#!/claim/2/basic-data');
+ await page.waitForState('claim.card.basicData');
});
it('should navigate to the tickets index', async() => {
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.wait(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.ticketsButton);
- await page.wait(selectors.ticketsIndex.topbarSearch);
- const url = await page.parsedUrl();
-
- expect(url.hash).toEqual('#!/ticket/index');
+ await page.waitForState('ticket.index');
});
it(`should search for a ticket and then navigate to it's sales`, async() => {
- await page.accessToSearchResult(16);
+ await page.accessToSearchResult('16');
await page.accessToSection('ticket.card.sale');
- await page.waitForURL('/sale');
- const url = await page.parsedUrl();
+ });
- expect(url.hash).toContain('/sale');
+ it(`should set the ticket as libre`, async() => {
+ await page.waitToClick(selectors.ticketSales.stateMenuButton);
+ await page.write('body > div > div > div.content > div.filter.ng-scope > vn-textfield', 'libre');
+ await page.waitFor(500);
+ await page.keyboard.press('Enter');
+ const message = await page.waitForSnackbar();
+
+ expect(message.type).toBe('success');
+ });
+
+ it(`should check it's state is libre now`, async() => {
+ await page.waitForTextInElement(selectors.ticketDescriptor.stateLabelValue, 'Libre');
+ const result = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
+
+ expect(result).toEqual('State Libre');
+ });
+
+ it(`should set the ticket as OK`, async() => {
+ await page.waitToClick(selectors.ticketSales.setOk);
+ const message = await page.waitForSnackbar();
+
+ expect(message.type).toBe('success');
+ });
+
+ it(`should check it's state is OK now`, async() => {
+ await page.waitForTextInElement(selectors.ticketDescriptor.stateLabelValue, 'OK');
+ const result = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
+
+ expect(result).toEqual('State OK');
});
it(`should check the zoomed image isn't present`, async() => {
@@ -52,26 +72,20 @@ xdescribe('Ticket Edit sale path', () => {
});
it(`should click on the thumbnail image of the 1st sale and see the zoomed image`, async() => {
- await page.clickIfVisible(selectors.ticketSales.firstSaleThumbnailImage);
+ await page.waitToClick(selectors.ticketSales.firstSaleThumbnailImage);
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
expect(result).toEqual(1);
});
it(`should click on the zoomed image to close it`, async() => {
- await page.clickIfVisible(selectors.ticketSales.firstSaleZoomedImage);
+ await page.waitToClick(selectors.ticketSales.firstSaleZoomedImage);
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
expect(result).toEqual(0);
});
- it(`should confirm the item descriptor insnt visible yet`, async() => {
- const visible = await page.isVisible(selectors.ticketSales.saleDescriptorPopover);
-
- expect(visible).toBeFalsy();
- });
-
- it(`should click on the first sale ID making the item descriptor visible`, async() => {
+ it(`should click on the first sale ID making now the item descriptor visible`, async() => {
await page.waitToClick(selectors.ticketSales.firstSaleId);
await page.waitImgLoad(selectors.ticketSales.firstSaleDescriptorImage);
const visible = await page.isVisible(selectors.ticketSales.saleDescriptorPopover);
@@ -80,14 +94,14 @@ xdescribe('Ticket Edit sale path', () => {
});
it(`should click on the descriptor image of the 1st sale and see the zoomed image`, async() => {
- await page.clickIfVisible('vn-item-descriptor img');
+ await page.waitToClick('vn-item-descriptor img');
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
expect(result).toEqual(1);
});
it(`should now click on the zoomed image to close it`, async() => {
- await page.clickIfVisible(selectors.ticketSales.firstSaleZoomedImage);
+ await page.waitToClick(selectors.ticketSales.firstSaleZoomedImage);
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
expect(result).toEqual(0);
@@ -95,50 +109,46 @@ xdescribe('Ticket Edit sale path', () => {
it(`should click on the summary icon of the item-descriptor to access to the item summary`, async() => {
await page.waitToClick(selectors.ticketSales.saleDescriptorPopoverSummaryButton);
- await page.waitForURL('/summary');
- const url = await page.parsedUrl();
-
- expect(url.hash).toContain('/summary');
+ await page.waitForState('item.card.summary');
});
it('should return to ticket sales section', async() => {
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.wait(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.ticketsButton);
- await page.accessToSearchResult(16);
+ await page.accessToSearchResult('16');
await page.accessToSection('ticket.card.sale');
- await page.waitForURL('/sale');
- const url = await page.parsedUrl();
-
- expect(url.hash).toContain('/sale');
});
it('should try to add a higher quantity value and then receive an error', async() => {
- await page.focusElement(selectors.ticketSales.firstSaleQuantityCell);
- await page.write(selectors.ticketSales.firstSaleQuantity, '11\u000d');
+ await page.waitToClick(selectors.ticketSales.firstSaleQuantityCell);
+ await page.type(selectors.ticketSales.firstSaleQuantity, '11\u000d');
const message = await page.waitForSnackbar();
expect(message.text).toBe('The new quantity should be smaller than the old one');
});
it('should remove 1 from the first sale quantity', async() => {
- await page.focusElement(selectors.ticketSales.firstSaleQuantityCell);
- await page.write(selectors.ticketSales.firstSaleQuantity, '9\u000d');
+ await page.waitFor(500);
+ await page.waitToClick(selectors.ticketSales.firstSaleQuantityCell);
+ await page.waitFor(selectors.ticketSales.firstSaleQuantity);
+ await page.type(selectors.ticketSales.firstSaleQuantity, '9\u000d');
const message = await page.waitForSnackbar();
expect(message.type).toBe('success');
});
it('should update the price', async() => {
- await page.waitToClick(`${selectors.ticketSales.firstSalePrice} > span`);
- await page.write(selectors.ticketSales.firstSalePriceInput, '5\u000d');
+ await page.waitToClick(selectors.ticketSales.firstSalePrice);
+ await page.waitFor(selectors.ticketSales.firstSalePriceInput);
+ await page.type(selectors.ticketSales.firstSalePriceInput, '5\u000d');
const message = await page.waitForSnackbar();
expect(message.type).toBe('success');
});
it('should confirm the price have been updated', async() => {
- const result = await page.waitToGetProperty(`${selectors.ticketSales.firstSalePrice} span`, 'innerText');
+ const result = await page.waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
expect(result).toContain('5.00');
});
@@ -150,16 +160,17 @@ xdescribe('Ticket Edit sale path', () => {
});
it('should update the discount', async() => {
- await page.waitToClick(`${selectors.ticketSales.firstSaleDiscount} > span`);
- await page.write(selectors.ticketSales.firstSaleDiscountInput, '50\u000d');
+ await page.waitToClick(selectors.ticketSales.firstSaleDiscount);
+ await page.waitFor(selectors.ticketSales.firstSaleDiscountInput);
+ await page.type(selectors.ticketSales.firstSaleDiscountInput, '50\u000d');
const message = await page.waitForSnackbar();
expect(message.type).toBe('success');
});
it('should confirm the discount have been updated', async() => {
- await page.waitForTextInElement(`${selectors.ticketSales.firstSaleDiscount} > span`, '50.00%');
- const result = await page.waitToGetProperty(`${selectors.ticketSales.firstSaleDiscount} > span`, 'innerText');
+ await page.waitForTextInElement(selectors.ticketSales.firstSaleDiscount, '50.00%');
+ const result = await page.waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText');
expect(result).toContain('50.00%');
});
@@ -175,48 +186,31 @@ xdescribe('Ticket Edit sale path', () => {
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
await page.waitToClick(selectors.ticketSales.moreMenu);
await page.waitToClick(selectors.ticketSales.moreMenuCreateClaim);
- await page.wait(selectors.claimBasicData.claimState);
- const url = await page.parsedUrl();
-
- expect(url.hash).toContain('basic-data');
+ await page.waitForState('claim.card.basicData');
});
it('should click on the Claims button of the top bar menu', async() => {
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.wait(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.claimsButton);
- await page.wait(selectors.claimsIndex.searchClaimInput);
- const url = await page.parsedUrl();
-
- expect(url.hash).toEqual('#!/claim/index');
+ await page.waitForState('claim.index');
});
it('should search for the claim with id 4', async() => {
- await page.write(selectors.claimsIndex.searchClaimInput, 4);
- await page.waitToClick(selectors.claimsIndex.searchButton);
- await page.waitForNumberOfElements(selectors.claimsIndex.searchResult, 1);
- const result = await page.countElement(selectors.claimsIndex.searchResult);
-
- expect(result).toEqual(1);
+ await page.accessToSearchResult('4');
+ await page.waitForState('claim.card.summary');
});
it('should click the Tickets button of the top bar menu', async() => {
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.wait(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.ticketsButton);
- await page.wait(selectors.ticketsIndex.topbarSearch);
- const url = await page.parsedUrl();
-
- expect(url.hash).toEqual('#!/ticket/index');
+ await page.waitForState('ticket.index');
});
it('should search for a ticket then access to the sales section', async() => {
- await page.accessToSearchResult(16);
+ await page.accessToSearchResult('16');
await page.accessToSection('ticket.card.sale');
- await page.waitForURL('/sale');
- const url = await page.parsedUrl();
-
- expect(url.hash).toContain('/sale');
});
it('should select the third sale and delete it', async() => {
@@ -236,18 +230,15 @@ xdescribe('Ticket Edit sale path', () => {
});
it('should select the second sale and transfer it to a valid ticket', async() => {
- const targetTicketId = 12;
+ const targetTicketId = '12';
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
await page.waitToClick(selectors.ticketSales.transferSaleButton);
- await page.focusElement(selectors.ticketSales.transferQuantityCell);
- await page.write(selectors.ticketSales.transferQuantityInput, '10\u000d');
- await page.write(selectors.ticketSales.moveToTicketInput, targetTicketId);
+ await page.waitToClick(selectors.ticketSales.transferQuantityCell);
+ await page.type(selectors.ticketSales.transferQuantityInput, '10\u000d');
+ await page.type(selectors.ticketSales.moveToTicketInput, targetTicketId);
await page.waitToClick(selectors.ticketSales.moveToTicketButton);
- await page.waitForURL(`ticket/${targetTicketId}/sale`);
- const result = await page.parsedUrl();
-
- expect(result.hash).toContain(`ticket/${targetTicketId}/sale`);
+ await page.expectURL(`ticket/${targetTicketId}/sale`);
});
it('should confirm the transfered line is the correct one', async() => {
@@ -265,12 +256,8 @@ xdescribe('Ticket Edit sale path', () => {
it('should go back to the original ticket sales section', async() => {
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
- await page.accessToSearchResult(16);
+ await page.accessToSearchResult('16');
await page.accessToSection('ticket.card.sale');
- await page.waitForURL('/sale');
- const url = await page.parsedUrl();
-
- expect(url.hash).toContain('/sale');
});
it(`should confirm the original ticket has still three lines`, async() => {
@@ -288,25 +275,18 @@ xdescribe('Ticket Edit sale path', () => {
it('should go back to the receiver ticket sales section', async() => {
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
- await page.accessToSearchResult(12);
+ await page.accessToSearchResult('12');
await page.accessToSection('ticket.card.sale');
- await page.waitForURL('/sale');
- const url = await page.parsedUrl();
-
- expect(url.hash).toContain('/sale');
});
it('should transfer the sale back to the original ticket', async() => {
- const targetTicketId = 16;
+ const targetTicketId = '16';
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
await page.waitToClick(selectors.ticketSales.transferSaleButton);
- await page.write(selectors.ticketSales.moveToTicketInput, targetTicketId);
+ await page.type(selectors.ticketSales.moveToTicketInput, targetTicketId);
await page.waitToClick(selectors.ticketSales.moveToTicketButton);
- await page.waitForURL(`ticket/${targetTicketId}/sale`);
- const result = await page.parsedUrl();
-
- expect(result.hash).toContain(`ticket/${targetTicketId}/sale`);
+ await page.expectURL(`ticket/${targetTicketId}/sale`);
});
it('should confirm the original ticket received the line', async() => {
@@ -321,35 +301,29 @@ xdescribe('Ticket Edit sale path', () => {
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
await page.waitToClick(selectors.ticketSales.transferSaleButton);
await page.waitToClick(selectors.ticketSales.moveToNewTicketButton);
- await page.waitToClick(selectors.ticketSales.acceptDeleteTicketButton);
const message = await page.waitForSnackbar();
expect(message.text).toBe(`You can't create a ticket for a inactive client`);
+
+ await page.closePopup();
});
it('should go now to the ticket sales section of an active, not frozen client', async() => {
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
- await page.accessToSearchResult(13);
+ await page.accessToSearchResult('13');
await page.accessToSection('ticket.card.sale');
- await page.waitForURL('/sale');
- const url = await page.parsedUrl();
-
- expect(url.hash).toContain('/sale');
});
it(`should select all sales, tranfer them to a new ticket and delete the sender ticket as it would've been left empty`, async() => {
- const senderTicketId = 13;
+ const senderTicketId = '13';
await page.waitToClick(selectors.ticketSales.selectAllSalesCheckbox);
await page.waitToClick(selectors.ticketSales.transferSaleButton);
await page.waitToClick(selectors.ticketSales.moveToNewTicketButton);
- await page.waitToClick(selectors.ticketSales.acceptDeleteTicketButton);
- await page.wait((selector, ticketId) => {
- return document.querySelector(selector).innerText.toLowerCase().indexOf(`${ticketId}`) == -1;
- }, selectors.ticketDescriptor.idLabelValue, senderTicketId);
- const url = await page.parsedUrl();
-
- expect(url.hash).toContain('/sale');
+ await page.evaluate((selector, ticketId) => {
+ return document.querySelector(selector).innerText.toLowerCase().indexOf(`#${ticketId}`) == -1;
+ }, selectors.ticketDescriptor.id, senderTicketId);
+ await page.waitForState('ticket.card.sale');
});
it('should confirm the new ticket received the line', async() => {
@@ -368,6 +342,7 @@ xdescribe('Ticket Edit sale path', () => {
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
await page.waitToClick(selectors.ticketSales.moreMenu);
await page.waitToClick(selectors.ticketSales.moreMenuReserve);
+ await page.closePopup();
await page.waitForClassNotPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide');
const result = await page.isVisible(selectors.ticketSales.firstSaleReservedIcon);
@@ -384,10 +359,12 @@ xdescribe('Ticket Edit sale path', () => {
});
it('should update all sales discount', async() => {
+ await page.closePopup();
await page.waitToClick(selectors.ticketSales.moreMenu);
await page.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount);
- // .write(selectors.ticketSales.moreMenuUpdateDiscountInput, 100) can't find the selector on app (deleted the selector), menu option was removed?
- await page.write('body', '\u000d');
+ await page.waitForSelector(selectors.ticketSales.moreMenuUpdateDiscountInput);
+ await page.type(selectors.ticketSales.moreMenuUpdateDiscountInput, '100');
+ await page.keyboard.press('Enter');
await page.waitForTextInElement(selectors.ticketSales.totalImport, '0.00');
const result = await page.waitToGetProperty(selectors.ticketSales.totalImport, 'innerText');
@@ -396,75 +373,12 @@ xdescribe('Ticket Edit sale path', () => {
it('should log in as Production role and go to a target ticket summary', async() => {
await page.loginAndModule('production', 'ticket');
- await page.accessToSearchResult(13);
- await page.waitForURL('/summary');
- const url = await page.parsedUrl();
-
- expect(url.hash).toContain('/summary');
+ await page.accessToSearchResult('13');
+ await page.waitForState('ticket.card.summary');
});
- it(`should check it's state is deleted`, async() => {
- const result = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
-
- expect(result).toEqual('State Eliminado');
- });
-
- describe('when state is preparation and loged as Production', () => {
- it(`should not be able to edit the sale price`, async() => {
- await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
- await page.accessToSearchResult(8);
- await page.accessToSection('ticket.card.sale');
- await page.waitToClick(selectors.ticketSales.firstSalePrice);
- const result = await page.exists(selectors.ticketSales.firstSalePriceInput);
-
- expect(result).toBeFalsy();
- });
-
- it(`should not be able to edit the sale discount`, async() => {
- await page.waitToClick(selectors.ticketSales.firstSaleDiscount);
- const result = await page.exists(selectors.ticketSales.firstSaleDiscountInput);
-
- expect(result).toBeFalsy();
- });
-
- it(`should not be able to edit the sale state`, async() => {
- await page.waitToClick(selectors.ticketSales.stateMenuButton);
- const result = await page.exists(selectors.ticketSales.stateMenuOptions);
-
- expect(result).toBeFalsy();
- });
-
- it('should log in as salesPerson then go to the sales of a target ticket', async() => {
- await page.loginAndModule('salesPerson', 'ticket');
- await page.accessToSearchResult(8);
- await page.accessToSection('ticket.card.sale');
- await page.waitForURL('/sale');
- const url = await page.parsedUrl();
-
- expect(url.hash).toContain('/sale');
- });
- });
-
- describe('when state is preparation and loged as salesPerson', () => {
- it(`shouldn't be able to edit the sale price`, async() => {
- await page.waitToClick(selectors.ticketSales.firstSalePrice);
- const result = await page.exists(selectors.ticketSales.firstSalePriceInput);
-
- expect(result).toBeFalsy();
- });
-
- it(`should be able to edit the sale discount`, async() => {
- await page.waitToClick(selectors.ticketSales.firstSaleDiscount);
- const result = await page.exists(selectors.ticketSales.firstSaleDiscountInput);
-
- expect(result).toBeFalsy();
- });
-
- it(`should not be able to edit the sale state`, async() => {
- await page.waitToClick(selectors.ticketSales.stateMenuButton);
- const result = await page.exists(selectors.ticketSales.stateMenuOptions);
-
- expect(result).toBeFalsy();
- });
+ it(`should check the ticket is deleted`, async() => {
+ await page.waitForSelector(selectors.ticketDescriptor.isDeletedIcon);
+ await page.waitForClassPresent(selectors.ticketDescriptor.isDeletedIcon, 'bright');
});
});
diff --git a/e2e/paths/05-ticket/05_tracking_state.spec.js b/e2e/paths/05-ticket/05_tracking_state.spec.js
index 34f3c4d44..53f082007 100644
--- a/e2e/paths/05-ticket/05_tracking_state.spec.js
+++ b/e2e/paths/05-ticket/05_tracking_state.spec.js
@@ -48,6 +48,7 @@ describe('Ticket Create new tracking state path', () => {
});
it('should now access to the create state view by clicking the create floating button', async() => {
+ await page.waitFor('.vn-popup', {hidden: true}),
await page.waitToClick(selectors.ticketTracking.createStateButton);
await page.waitForState('ticket.card.tracking.edit');
});
diff --git a/e2e/paths/05-ticket/10_request.spec.js b/e2e/paths/05-ticket/10_request.spec.js
index 334b8ba5e..afab9b9e9 100644
--- a/e2e/paths/05-ticket/10_request.spec.js
+++ b/e2e/paths/05-ticket/10_request.spec.js
@@ -18,6 +18,7 @@ describe('Ticket purchase request path', () => {
});
it('should add a new request', async() => {
+ await page.waitFor('.vn-popup', {hidden: true}),
await page.waitToClick(selectors.ticketRequests.addRequestButton);
await page.write(selectors.ticketRequests.descriptionInput, 'New stuff');
await page.write(selectors.ticketRequests.quantity, '9');
diff --git a/e2e/paths/05-ticket/16_summary.spec.js b/e2e/paths/05-ticket/16_summary.spec.js
index f6808651e..70d7592d7 100644
--- a/e2e/paths/05-ticket/16_summary.spec.js
+++ b/e2e/paths/05-ticket/16_summary.spec.js
@@ -58,7 +58,7 @@ describe('Ticket Summary path', () => {
expect(result).toContain('000002');
});
- it(`should click on the first sale ID making the item descriptor visible`, async() => {
+ it(`should click on the first sale ID to make the item descriptor visible`, async() => {
await page.waitToClick(selectors.ticketSummary.firstSaleItemId);
await page.waitImgLoad(selectors.ticketSummary.firstSaleDescriptorImage);
const visible = await page.isVisible(selectors.ticketSummary.itemDescriptorPopover);
diff --git a/e2e/paths/07-order/03_lines.spec.js b/e2e/paths/07-order/03_lines.spec.js
index c054bbaa3..e74eaae23 100644
--- a/e2e/paths/07-order/03_lines.spec.js
+++ b/e2e/paths/07-order/03_lines.spec.js
@@ -8,7 +8,7 @@ describe('Order lines', () => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'order');
- await page.accessToSearchResult('16');
+ await page.accessToSearchResult('8');
await page.accessToSection('order.card.line');
});
@@ -20,7 +20,7 @@ describe('Order lines', () => {
const result = await page
.waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText');
- expect(result).toContain('135.60');
+ expect(result).toContain('112.30');
});
it('should delete the first line in the order', async() => {
@@ -32,11 +32,11 @@ describe('Order lines', () => {
});
it('should confirm the order subtotal has changed', async() => {
- await page.waitForTextInElement(selectors.orderLine.orderSubtotal, '90.10');
+ await page.waitForTextInElement(selectors.orderLine.orderSubtotal, '92.80');
const result = await page
.waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText');
- expect(result).toContain('90.10');
+ expect(result).toContain('92.80');
});
it('should confirm the whole order and redirect to ticket index filtered by clientFk', async() => {
diff --git a/front/core/components/input-number/index.spec.js b/front/core/components/input-number/index.spec.js
index d1bbe251c..0e0f8c4a5 100644
--- a/front/core/components/input-number/index.spec.js
+++ b/front/core/components/input-number/index.spec.js
@@ -7,7 +7,7 @@ describe('Component vnInputNumber', () => {
beforeEach(ngModule('vnCore'));
beforeEach(angular.mock.inject(($compile, $rootScope) => {
- $element = $compile(`
New price
-{{$ctrl.newPrice | currency: 'EUR':2}}
-New price
-{{$ctrl.newPrice | currency: 'EUR':2}}
++ {{$ctrl.getNewPrice() | currency: 'EUR': 2}} +
New price
++ {{$ctrl.getNewPrice() | currency: 'EUR': 2}} +
+