+
-import VnCardBeta from 'src/components/common/VnCardBeta.vue';
+import VnCard from 'src/components/common/VnCard.vue';
import ZoneDescriptor from './ZoneDescriptor.vue';
-
+
diff --git a/src/pages/Zone/Card/ZoneLocationsTree.vue b/src/pages/Zone/Card/ZoneLocationsTree.vue
index 083436440..d5d7d52b6 100644
--- a/src/pages/Zone/Card/ZoneLocationsTree.vue
+++ b/src/pages/Zone/Card/ZoneLocationsTree.vue
@@ -73,6 +73,7 @@ const onNodeExpanded = async (nodeKeysArray) => {
const response = await axios.get(`Zones/${route.params.id}/getLeaves`, {
params,
});
+ response.data = JSON.parse(response.data);
if (response.data) {
node.childs = response.data.map((n) => {
if (n.sons > 0) n.childs = [{}];
@@ -126,14 +127,17 @@ watch(
async (val) => {
if (!val) return;
// // Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar
+ val = JSON.parse(val);
if (!nodes.value[0]) nodes.value = [defaultNode];
nodes.value[0].childs = [...val];
const fetchedNodeKeys = val.flatMap(getNodeIds);
state.set('Tree', [...fetchedNodeKeys]);
expanded.value = [null, ...fetchedNodeKeys];
+ const fetchs = [];
for (let n of state.get('Tree')) {
- await fetchNodeLeaves(n);
+ fetchs.push(fetchNodeLeaves(n));
}
+ await Promise.all(fetchs);
previousExpandedNodes.value = new Set(expanded.value);
},
{ immediate: true },
diff --git a/src/router/modules/route.js b/src/router/modules/route.js
index 835324d20..c84795a98 100644
--- a/src/router/modules/route.js
+++ b/src/router/modules/route.js
@@ -220,7 +220,6 @@ export default {
path: '',
name: 'RouteIndexMain',
redirect: { name: 'RouteList' },
- component: () => import('src/pages/Route/RouteList.vue'),
children: [
{
name: 'RouteList',
@@ -229,6 +228,7 @@ export default {
title: 'list',
icon: 'view_list',
},
+ component: () => import('src/pages/Route/RouteList.vue'),
},
routeCard,
],
@@ -268,7 +268,6 @@ export default {
title: 'RouteRoadmap',
icon: 'vn:troncales',
},
- component: () => import('src/pages/Route/RouteRoadmap.vue'),
children: [
{
name: 'RoadmapList',
@@ -277,6 +276,7 @@ export default {
title: 'list',
icon: 'view_list',
},
+ component: () => import('src/pages/Route/RouteRoadmap.vue'),
},
roadmapCard,
],
@@ -298,7 +298,6 @@ export default {
title: 'agency',
icon: 'garage_home',
},
- component: () => import('src/pages/Route/Agency/AgencyList.vue'),
children: [
{
name: 'AgencyList',
@@ -307,6 +306,8 @@ export default {
title: 'list',
icon: 'view_list',
},
+ component: () =>
+ import('src/pages/Route/Agency/AgencyList.vue'),
},
agencyCard,
],
@@ -319,7 +320,6 @@ export default {
title: 'vehicle',
icon: 'directions_car',
},
- component: () => import('src/pages/Route/Vehicle/VehicleList.vue'),
children: [
{
path: 'list',
@@ -328,6 +328,8 @@ export default {
title: 'vehicleList',
icon: 'directions_car',
},
+ component: () =>
+ import('src/pages/Route/Vehicle/VehicleList.vue'),
},
vehicleCard,
],
diff --git a/test/cypress/integration/claim/claimAction.spec.js b/test/cypress/integration/claim/claimAction.spec.js
index b0a16a2ad..7eba07f51 100644
--- a/test/cypress/integration/claim/claimAction.spec.js
+++ b/test/cypress/integration/claim/claimAction.spec.js
@@ -15,12 +15,14 @@ describe('ClaimAction', () => {
cy.get('[title="Import claim"]').click();
});
- it('should change destination', () => {
+ // https://redmine.verdnatura.es/issues/8756
+ xit('should change destination', () => {
const rowData = [true, null, null, 'Bueno'];
cy.fillRow(firstRow, rowData);
});
- it('should change destination from other button', () => {
+ // https://redmine.verdnatura.es/issues/8756
+ xit('should change destination from other button', () => {
const rowData = [true];
cy.fillRow(firstRow, rowData);
@@ -33,7 +35,8 @@ describe('ClaimAction', () => {
cy.get('[title="Regularize"]').click();
});
- it('should remove the line', () => {
+ // https://redmine.verdnatura.es/issues/8756
+ xit('should remove the line', () => {
cy.fillRow(firstRow, [true]);
cy.removeCard();
cy.clickConfirm();
diff --git a/test/cypress/integration/claim/claimPhoto.spec.js b/test/cypress/integration/claim/claimPhoto.spec.js
index b84b4f958..ac0460029 100755
--- a/test/cypress/integration/claim/claimPhoto.spec.js
+++ b/test/cypress/integration/claim/claimPhoto.spec.js
@@ -1,5 +1,5 @@
///
-describe('ClaimPhoto', () => {
+describe.skip('ClaimPhoto', () => {
const carrouselClose =
'.q-dialog__inner > .q-toolbar > .q-btn > .q-btn__content > .q-icon';
beforeEach(() => {
diff --git a/test/cypress/integration/client/clientBalance.spec.js b/test/cypress/integration/client/clientBalance.spec.js
index abfa74cec..fff6a5e04 100644
--- a/test/cypress/integration/client/clientBalance.spec.js
+++ b/test/cypress/integration/client/clientBalance.spec.js
@@ -1,11 +1,13 @@
///
describe('Client balance', () => {
beforeEach(() => {
- cy.viewport(1280, 720);
cy.login('developer');
cy.visit('#/customer/1101/balance');
});
- it('Should load layout', () => {
- cy.get('.q-page').should('be.visible');
+ it('Should create a mandate', () => {
+ cy.get('.q-page-sticky > div > .q-btn').click();
+ cy.selectOption('[data-cy="paymentBank"]', 2);
+ cy.dataCy('paymentAmount_input').clear().type('100');
+ cy.saveCard();
});
});
diff --git a/test/cypress/integration/invoiceOut/invoiceOutList.spec.js b/test/cypress/integration/invoiceOut/invoiceOutList.spec.js
index d3a84d226..b8b42fa4b 100644
--- a/test/cypress/integration/invoiceOut/invoiceOutList.spec.js
+++ b/test/cypress/integration/invoiceOut/invoiceOutList.spec.js
@@ -13,7 +13,6 @@ describe('InvoiceOut list', () => {
':nth-child(1) > .text-right > [data-cy="tableAction-0"] > .q-btn__content > .q-icon';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/list`);
cy.typeSearchbar('{enter}');
@@ -41,7 +40,7 @@ describe('InvoiceOut list', () => {
});
it('should filter the results by client ID, then check the first result is correct', () => {
- cy.dataCy('Customer ID_input').type('1103');
+ cy.dataCy('Client id_input').type('1103');
cy.get(filterBtn).click();
cy.get(firstRowDescriptor).click();
cy.get('.q-item > .q-item__label').should('include.text', '1103');
diff --git a/test/cypress/integration/order/orderList.spec.js b/test/cypress/integration/order/orderList.spec.js
index 8b8852a02..c48b317a8 100644
--- a/test/cypress/integration/order/orderList.spec.js
+++ b/test/cypress/integration/order/orderList.spec.js
@@ -34,8 +34,8 @@ describe('OrderList', () => {
cy.dataCy('Customer ID_input').type('1101{enter}');
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('landedDate').find('input').type('06/01/2001');
- cy.get(agencyCreateSelect).click();
- cy.get('.q-menu > div> .q-item:nth-child(1)').click();
+ cy.selectOption(agencyCreateSelect, 1);
+
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale');
@@ -60,8 +60,8 @@ describe('OrderList', () => {
cy.get(clientCreateSelect).should('have.value', 'Bruce Wayne');
cy.get(addressCreateSelect).should('have.value', 'Bruce Wayne');
cy.dataCy('landedDate').find('input').type('06/01/2001');
- cy.get(agencyCreateSelect).click();
- cy.get('.q-menu > div> .q-item:nth-child(1)').click();
+ cy.selectOption(agencyCreateSelect, 1);
+
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale');
diff --git a/test/cypress/integration/route/agency/agencyWorkCenter.spec.js b/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
index 5679ceba1..22a1a0143 100644
--- a/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
+++ b/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
@@ -1,27 +1,34 @@
describe.skip('AgencyWorkCenter', () => {
+ const selectors = {
+ workCenter: 'workCenter_select',
+ popupSave: 'FormModelPopup_save',
+ popupCancel: 'FormModelPopup_cancel',
+ remove: 'removeWorkCenterBtn',
+ };
+
+ const messages = {
+ dataCreated: 'Data created',
+ alreadyAssigned: 'This workCenter is already assigned to this agency',
+ removed: 'WorkCenter removed successfully',
+ };
+
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/agency/11/workCenter`);
});
- const createButton = '.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon';
- const workCenterCombobox = 'input[role="combobox"]';
- it('check workCenter crud', () => {
- // create
- cy.get(createButton).click();
- cy.get(workCenterCombobox).type('workCenterOne{enter}');
+ it('Should add work center, check already assigned and remove work center', () => {
+ cy.addBtnClick();
+ cy.selectOption('[data-cy="workCenter_select"]', 'workCenterOne');
+ cy.dataCy(selectors.popupSave).click();
cy.checkNotification('Data created');
-
- // expect error when duplicate
- cy.get(createButton).click();
- cy.selectOption(workCenterCombobox, 'workCenterOne');
- cy.get('[data-cy="FormModelPopup_save"]').click();
- cy.checkNotification('This workCenter is already assigned to this agency');
- cy.get('[data-cy="FormModelPopup_cancel"]').click();
-
- // delete
- cy.get('.q-item__section--side > .q-btn > .q-btn__content > .q-icon').click();
- cy.checkNotification('WorkCenter removed successfully');
+ cy.addBtnClick();
+ cy.selectOption('[data-cy="workCenter_select"]', 'workCenterOne');
+ cy.dataCy(selectors.popupSave).click();
+ cy.checkNotification(messages.alreadyAssigned);
+ cy.dataCy(selectors.popupCancel).click();
+ cy.dataCy(selectors.remove).click();
+ cy.checkNotification(messages.removed);
});
});
diff --git a/test/cypress/integration/route/roadMap/roadmapList.spec.js b/test/cypress/integration/route/roadMap/roadmapList.spec.js
index 6d46b2cf6..35c0c2b02 100644
--- a/test/cypress/integration/route/roadMap/roadmapList.spec.js
+++ b/test/cypress/integration/route/roadMap/roadmapList.spec.js
@@ -1,12 +1,74 @@
describe('RoadMap', () => {
+ const getSelector = (colField) =>
+ `tr:last-child > [data-col-field="${colField}"] > .no-padding`;
+
+ const selectors = {
+ roadmap: getSelector('name'),
+ id: getSelector('id'),
+ etd: getSelector('etd'),
+ summaryHeader: '.summaryHeader > :nth-child(2)',
+ summaryGoToSummaryBtn: '.summaryHeader > a > .q-icon',
+ summaryBtn: 'tableAction-0',
+ inputRoadmap: 'Roadmap_input',
+ checkbox: '.q-virtual-scroll__content tr:last-child .q-checkbox',
+ cloneFormBtn: '.q-card__actions > .q-btn--standard',
+ cloneBtn: '#subToolbar > :nth-child(3)',
+ deleteBtn: ':nth-child(4) > .q-btn__content',
+ confirmBtn: 'VnConfirm_confirm',
+ inputEtd: 'ETD_inputDate',
+ };
+
+ const data = {
+ roadmap: 'TEST-ROADMAP',
+ etd: '01/01/2025',
+ };
+
+ const dataCreated = 'Data created';
+ const summaryUrl = '/summary';
+
beforeEach(() => {
+ cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/roadmap`);
+ cy.typeSearchbar('{enter}');
});
+
+ it('Should list roadmaps', () => {
+ cy.get('.q-table')
+ .children()
+ .should('be.visible')
+ .should('have.length.greaterThan', 0);
+ });
+
it('Route list create roadmap and redirect', () => {
cy.addBtnClick();
- cy.get('input[name="name"]').type('roadMapTestOne{enter}');
- cy.get('.q-notification__message').should('have.text', 'Data created');
- cy.url().should('include', '/summary');
+ cy.dataCy(selectors.inputRoadmap).type(`${data.roadmap}{enter}`);
+ cy.checkNotification(dataCreated);
+ cy.url().should('include', summaryUrl);
+ });
+
+ it('open summary', () => {
+ cy.dataCy(selectors.summaryBtn).last().click();
+ cy.get(selectors.summaryHeader).should('contain', data.roadmap);
+ cy.get(selectors.summaryGoToSummaryBtn).click();
+ cy.get(selectors.summaryHeader).should('contain', data.roadmap);
+ });
+
+ it('Should clone selected roadmap with new ETD', () => {
+ cy.get(selectors.checkbox).click();
+ cy.get(selectors.cloneBtn).click();
+ cy.dataCy(selectors.inputEtd).click().type(`${data.etd}{enter}`);
+ cy.get(selectors.cloneFormBtn).click();
+ cy.get(selectors.etd).should('contain', data.etd);
+ });
+
+ it('Should delete selected roadmap', () => {
+ cy.get(selectors.id).then(($el) => {
+ cy.get(selectors.checkbox).click();
+ cy.get(selectors.deleteBtn).click();
+ cy.dataCy(selectors.confirmBtn).click();
+ cy.typeSearchbar('{enter}');
+ cy.get(selectors.id).should('not.have.text', $el.text);
+ });
});
});
diff --git a/test/cypress/integration/route/routeAutonomous.spec.js b/test/cypress/integration/route/routeAutonomous.spec.js
index acf82bd95..08fd7d7ea 100644
--- a/test/cypress/integration/route/routeAutonomous.spec.js
+++ b/test/cypress/integration/route/routeAutonomous.spec.js
@@ -1,4 +1,4 @@
-describe('RouteAutonomous', () => {
+describe.skip('RouteAutonomous', () => {
const getLinkSelector = (colField) =>
`tr:first-child > [data-col-field="${colField}"] > .no-padding > .link`;
diff --git a/test/cypress/integration/shelving/parking/parkingList.spec.js b/test/cypress/integration/shelving/parking/parkingList.spec.js
index ca1877621..7372da164 100644
--- a/test/cypress/integration/shelving/parking/parkingList.spec.js
+++ b/test/cypress/integration/shelving/parking/parkingList.spec.js
@@ -2,7 +2,7 @@
describe('ParkingList', () => {
const searchbar = '#searchbar input';
const firstCard = ':nth-child(1) > .q-card > .no-margin > .q-py-none';
- const summaryHeader = '.summaryBody .header';
+ const summaryHeader = '.header-link';
beforeEach(() => {
cy.viewport(1920, 1080);
diff --git a/test/cypress/integration/shelving/shelvingList.spec.js b/test/cypress/integration/shelving/shelvingList.spec.js
index 745dd1b78..20b72e419 100644
--- a/test/cypress/integration/shelving/shelvingList.spec.js
+++ b/test/cypress/integration/shelving/shelvingList.spec.js
@@ -16,8 +16,8 @@ describe('ShelvingList', () => {
it('should redirect from preview to basic-data', () => {
cy.typeSearchbar('{enter}');
cy.dataCy('cardBtn').eq(0).click();
- cy.get('.q-card > .header').click();
- cy.url().should('include', '/shelving/1/basic-data');
+ cy.get('.summaryHeader > .header > .q-icon').click();
+ cy.url().should('include', '/shelving/1/summary');
});
it('should filter and redirect if only one result', () => {
diff --git a/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js b/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js
index 19f4dc3b2..b4997fa69 100644
--- a/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js
+++ b/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js
@@ -138,7 +138,7 @@ describe.skip('Ticket Lack detail', () => {
cy.get('[data-cy="itemProposal"]').click();
cy.wait('@getItemGetSimilar');
});
- describe('Replace item if', () => {
+ describe.skip('Replace item if', () => {
it('Quantity is less than available', () => {
cy.get(':nth-child(1) > .text-right > .q-btn').click();
});
diff --git a/test/cypress/integration/ticket/ticketList.spec.js b/test/cypress/integration/ticket/ticketList.spec.js
index 25ee05033..2409dd149 100644
--- a/test/cypress/integration/ticket/ticketList.spec.js
+++ b/test/cypress/integration/ticket/ticketList.spec.js
@@ -38,8 +38,8 @@ describe('TicketList', () => {
it('filter client and create ticket', () => {
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketSearchbar');
searchResults();
+ cy.wait('@ticketSearchbar');
- cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
cy.dataCy('Customer ID_input').clear('1');
cy.dataCy('Customer ID_input').type('1101{enter}');
diff --git a/test/cypress/integration/ticket/ticketSale.spec.js b/test/cypress/integration/ticket/ticketSale.spec.js
index 81ea761c4..61ba9fe4f 100644
--- a/test/cypress/integration/ticket/ticketSale.spec.js
+++ b/test/cypress/integration/ticket/ticketSale.spec.js
@@ -1,139 +1,14 @@
///
+const firstRow = 'tbody > :nth-child(1)';
describe('TicketSale', () => {
- describe.skip('Free ticket #31', () => {
- beforeEach(() => {
- cy.login('developer');
- cy.viewport(1920, 1080);
- cy.visit('/#/ticket/31/sale');
- });
-
- const firstRow = 'tbody > :nth-child(1)';
-
- const selectFirstRow = () => {
- cy.waitForElement(firstRow);
- cy.get(firstRow).find('.q-checkbox__inner').click();
- };
-
- it('it should add item to basket', () => {
- cy.window().then((win) => {
- cy.stub(win, 'open').as('windowOpen');
- });
- cy.dataCy('ticketSaleAddToBasketBtn').should('exist');
- cy.dataCy('ticketSaleAddToBasketBtn').click();
- cy.get('@windowOpen').should('be.calledWithMatch', /\/order\/\d+\/catalog/);
- });
-
- it('should send SMS', () => {
- selectFirstRow();
- cy.dataCy('ticketSaleMoreActionsDropdown').click();
- cy.waitForElement('[data-cy="sendShortageSMSItem"]');
- cy.dataCy('sendShortageSMSItem').should('exist');
- cy.dataCy('sendShortageSMSItem').click();
- cy.dataCy('vnSmsDialog').should('exist');
- cy.dataCy('sendSmsBtn').click();
- cy.checkNotification('SMS sent');
- });
-
- it('should recalculate price when "Recalculate price" is clicked', () => {
- cy.intercept('POST', '**/recalculatePrice').as('recalculatePrice');
- selectFirstRow();
- cy.dataCy('ticketSaleMoreActionsDropdown').click();
- cy.waitForElement('[data-cy="recalculatePriceItem"]');
- cy.dataCy('recalculatePriceItem').should('exist');
- cy.dataCy('recalculatePriceItem').click();
- cy.wait('@recalculatePrice').its('response.statusCode').should('eq', 200);
- cy.checkNotification('Data saved');
- });
-
- it('should update discount when "Update discount" is clicked', () => {
- selectFirstRow();
- cy.dataCy('ticketSaleMoreActionsDropdown').click();
- cy.waitForElement('[data-cy="updateDiscountItem"]');
- cy.dataCy('updateDiscountItem').should('exist');
- cy.dataCy('updateDiscountItem').click();
- cy.waitForElement('[data-cy="ticketSaleDiscountInput"]');
- cy.dataCy('ticketSaleDiscountInput').find('input').focus();
- cy.dataCy('ticketSaleDiscountInput').find('input').type('10');
- cy.dataCy('saveManaBtn').click();
- cy.waitForElement('.q-notification__message');
- cy.checkNotification('Data saved');
- });
-
- it('adds claim', () => {
- selectFirstRow();
- cy.dataCy('ticketSaleMoreActionsDropdown').click();
- cy.dataCy('createClaimItem').click();
- cy.dataCy('VnConfirm_confirm').click();
- cy.url().should('contain', 'claim/');
- // Delete created claim to avoid cluttering the database
- cy.dataCy('descriptor-more-opts').click();
- cy.dataCy('deleteClaim').click();
- cy.dataCy('VnConfirm_confirm').click();
- cy.checkNotification('Data deleted');
- });
-
- it('marks row as reserved', () => {
- selectFirstRow();
- cy.dataCy('ticketSaleMoreActionsDropdown').click();
- cy.waitForElement('[data-cy="markAsReservedItem"]');
- cy.dataCy('markAsReservedItem').click();
- cy.dataCy('ticketSaleReservedIcon').should('exist');
- });
-
- it('unmarks row as reserved', () => {
- selectFirstRow();
- cy.dataCy('ticketSaleMoreActionsDropdown').click();
- cy.waitForElement('[data-cy="unmarkAsReservedItem"]');
- cy.dataCy('unmarkAsReservedItem').click();
- cy.dataCy('ticketSaleReservedIcon').should('not.exist');
- });
-
- it('refunds row with warehouse', () => {
- selectFirstRow();
- cy.dataCy('ticketSaleMoreActionsDropdown').click();
- cy.dataCy('ticketSaleRefundItem').click();
- cy.dataCy('ticketSaleRefundWithWarehouse').click();
- cy.checkNotification('The following refund ticket have been created');
- });
-
- it('refunds row without warehouse', () => {
- selectFirstRow();
- cy.dataCy('ticketSaleMoreActionsDropdown').click();
- cy.dataCy('ticketSaleRefundItem').click();
- cy.dataCy('ticketSaleRefundWithoutWarehouse').click();
- cy.checkNotification('The following refund ticket have been created');
- });
-
- it('transfer sale to a new ticket', () => {
- cy.visit('/#/ticket/32/sale');
- cy.get('.q-item > .q-item__label').should('have.text', ' #32');
- selectFirstRow();
- cy.dataCy('ticketSaleTransferBtn').click();
- cy.dataCy('ticketTransferPopup').should('exist');
- cy.dataCy('ticketTransferNewTicketBtn').click();
- cy.get('.q-item > .q-item__label').should('not.have.text', ' #32');
- });
-
- it('should redirect to ticket logs', () => {
- cy.get(firstRow).find('.q-btn:last').click();
- cy.url().should('match', /\/ticket\/31\/log/);
- });
- });
- describe.skip('Ticket prepared #23', () => {
+ describe('Ticket #23', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/23/sale');
});
- const firstRow = 'tbody > :nth-child(1)';
-
- const selectFirstRow = () => {
- cy.waitForElement(firstRow);
- cy.get(firstRow).find('.q-checkbox__inner').click();
- };
-
it('update price', () => {
const price = Number((Math.random() * 99 + 1).toFixed(2));
cy.waitForElement(firstRow);
@@ -196,8 +71,144 @@ describe('TicketSale', () => {
.should('have.value', `${quantity}`);
});
});
-});
+ describe('Ticket to add claim #24', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ cy.visit('/#/ticket/24/sale');
+ });
+ it('adds claim', () => {
+ selectFirstRow();
+ cy.dataCy('ticketSaleMoreActionsDropdown').click();
+ cy.dataCy('createClaimItem').click();
+ cy.dataCy('VnConfirm_confirm').click();
+ cy.url().should('contain', 'claim/');
+ // Delete created claim to avoid cluttering the database
+ cy.dataCy('descriptor-more-opts').click();
+ cy.dataCy('deleteClaim').click();
+ cy.dataCy('VnConfirm_confirm').click();
+ });
+ });
+ describe('Free ticket #31', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ cy.visit('/#/ticket/31/sale');
+ });
+
+ it('it should add item to basket', () => {
+ cy.window().then((win) => {
+ cy.stub(win, 'open').as('windowOpen');
+ });
+ cy.dataCy('ticketSaleAddToBasketBtn').should('exist');
+ cy.dataCy('ticketSaleAddToBasketBtn').click();
+ cy.get('@windowOpen').should('be.calledWithMatch', /\/order\/\d+\/catalog/);
+ });
+
+ it('should send SMS', () => {
+ selectFirstRow();
+ cy.dataCy('ticketSaleMoreActionsDropdown').click();
+ cy.waitForElement('[data-cy="sendShortageSMSItem"]');
+ cy.dataCy('sendShortageSMSItem').should('exist');
+ cy.dataCy('sendShortageSMSItem').click();
+ cy.dataCy('vnSmsDialog').should('exist');
+ cy.dataCy('sendSmsBtn').click();
+ cy.checkNotification('SMS sent');
+ });
+
+ it('should recalculate price when "Recalculate price" is clicked', () => {
+ cy.intercept('POST', '**/recalculatePrice').as('recalculatePrice');
+ selectFirstRow();
+ cy.dataCy('ticketSaleMoreActionsDropdown').click();
+ cy.waitForElement('[data-cy="recalculatePriceItem"]');
+ cy.dataCy('recalculatePriceItem').should('exist');
+ cy.dataCy('recalculatePriceItem').click();
+ cy.wait('@recalculatePrice').its('response.statusCode').should('eq', 200);
+ cy.checkNotification('Data saved');
+ cy.dataCy('ticketSaleMoreActionsDropdown').should('be.disabled');
+ });
+
+ it('should update discount when "Update discount" is clicked', () => {
+ selectFirstRow();
+ cy.dataCy('ticketSaleMoreActionsDropdown').click();
+ cy.waitForElement('[data-cy="updateDiscountItem"]');
+ cy.dataCy('updateDiscountItem').should('exist');
+ cy.dataCy('updateDiscountItem').click();
+ cy.waitForElement('[data-cy="ticketSaleDiscountInput"]');
+ cy.dataCy('ticketSaleDiscountInput').find('input').focus();
+ cy.dataCy('ticketSaleDiscountInput').find('input').type('10');
+ cy.dataCy('saveManaBtn').click();
+ cy.waitForElement('.q-notification__message');
+ cy.checkNotification('Data saved');
+ cy.dataCy('ticketSaleMoreActionsDropdown').should('be.disabled');
+ });
+
+ it('adds claim', () => {
+ selectFirstRow();
+ cy.dataCy('ticketSaleMoreActionsDropdown').click();
+ cy.dataCy('createClaimItem').click();
+ cy.dataCy('VnConfirm_confirm').click();
+ cy.checkNotification('Future ticket date not allowed');
+ });
+
+ it('marks row as reserved', () => {
+ selectFirstRow();
+ cy.dataCy('ticketSaleMoreActionsDropdown').click();
+ cy.waitForElement('[data-cy="markAsReservedItem"]');
+ cy.dataCy('markAsReservedItem').click();
+ cy.dataCy('ticketSaleReservedIcon').should('exist');
+ });
+
+ it('unmarks row as reserved', () => {
+ selectFirstRow();
+ cy.dataCy('ticketSaleMoreActionsDropdown').click();
+ cy.waitForElement('[data-cy="unmarkAsReservedItem"]');
+ cy.dataCy('unmarkAsReservedItem').click();
+ cy.dataCy('ticketSaleReservedIcon').should('not.exist');
+ });
+
+ it('refunds row with warehouse', () => {
+ selectFirstRow();
+ cy.dataCy('ticketSaleMoreActionsDropdown').click();
+ cy.dataCy('ticketSaleRefundItem').click();
+ cy.dataCy('ticketSaleRefundWithWarehouse').click();
+ cy.checkNotification('The following refund ticket have been created');
+ });
+
+ it('refunds row without warehouse', () => {
+ selectFirstRow();
+ cy.dataCy('ticketSaleMoreActionsDropdown').click();
+ cy.dataCy('ticketSaleRefundItem').click();
+ cy.dataCy('ticketSaleRefundWithoutWarehouse').click();
+ cy.checkNotification('The following refund ticket have been created');
+ });
+
+ it('should redirect to ticket logs', () => {
+ cy.get(firstRow).find('.q-btn:last').click();
+ cy.url().should('match', /\/ticket\/31\/log/);
+ });
+ });
+ describe('Ticket to transfer #32', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ cy.visit('/#/ticket/32/sale');
+ });
+ it('transfer sale to a new ticket', () => {
+ cy.get('.q-item > .q-item__label').should('have.text', ' #32');
+ selectFirstRow();
+ cy.dataCy('ticketSaleTransferBtn').click();
+ cy.dataCy('ticketTransferPopup').should('exist');
+ cy.dataCy('ticketTransferNewTicketBtn').click();
+ cy.get('.q-item > .q-item__label').should('not.have.text', ' #32');
+ });
+ });
+});
+function selectFirstRow() {
+ cy.waitForElement(firstRow);
+ cy.get(firstRow).find('.q-checkbox__inner').click();
+}
function handleVnConfirm() {
cy.get('[data-cy="VnConfirm_confirm"]').click();
cy.waitForElement('.q-notification__message');
diff --git a/test/cypress/integration/worker/workerBasicData.spec.js b/test/cypress/integration/worker/workerBasicData.spec.js
new file mode 100644
index 000000000..cf452a044
--- /dev/null
+++ b/test/cypress/integration/worker/workerBasicData.spec.js
@@ -0,0 +1,15 @@
+describe('WorkerBasicData', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('/#/worker/1107/basic-data');
+ });
+
+ it('should modify worker summary', () => {
+ cy.dataCy('MaritalStatus').type('Married');
+ cy.dataCy('fi').type('42572374H');
+ cy.dataCy('country').type('Alemania');
+ cy.saveCard();
+ cy.checkNotification('Data saved');
+ });
+});
diff --git a/test/cypress/integration/worker/workerBusiness.spec.js b/test/cypress/integration/worker/workerBusiness.spec.js
new file mode 100644
index 000000000..46da28cd6
--- /dev/null
+++ b/test/cypress/integration/worker/workerBusiness.spec.js
@@ -0,0 +1,34 @@
+describe.skip('WorkerBusiness', () => {
+ const saveBtn = '.q-mt-lg > .q-btn--standard';
+ const contributionCode = `Representantes de comercio`;
+ const contractType = `INDEFINIDO A TIEMPO COMPLETO`;
+
+ const Business = {
+ 'Start Date': { val: '26-12-2002', type: 'date' },
+ Company: { val: `VNL`, type: 'select' },
+ Department: { val: `RECICLAJE`, type: 'select' },
+ 'Professional Category': { val: `employee`, type: 'select' },
+ 'Work Calendar': { val: `General schedule`, type: 'select' },
+ 'Work Center': { val: `Silla`, type: 'select' },
+ 'Contract Category': { val: `INFORMATICA`, type: 'select' },
+ 'Contribution Code': { val: contributionCode, type: 'select' },
+ Rate: { val: `5` },
+ 'Contract Type': { val: contractType, type: 'select' },
+ 'Transport Workers Salary': { val: `1000` },
+ };
+
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('hr');
+ cy.visit('/#/worker/1107/business');
+ cy.addCard();
+ });
+
+ it('should create a business', () => {
+ cy.fillInForm({
+ ...Business,
+ });
+ cy.get(saveBtn).click();
+ cy.checkNotification('Data created');
+ });
+});
diff --git a/test/cypress/integration/worker/workerMutual.spec.js b/test/cypress/integration/worker/workerMutual.spec.js
new file mode 100644
index 000000000..a6d2c5f4f
--- /dev/null
+++ b/test/cypress/integration/worker/workerMutual.spec.js
@@ -0,0 +1,23 @@
+///
+describe('WorkerMutual', () => {
+ const userId = 1106;
+ const saveBtn = '.q-mt-lg > .q-btn--standard';
+ const medicalReview = {
+ Date: { val: '01-01-2001', type: 'date' },
+ 'Formation Center': { val: '1', type: 'select' },
+ Invoice: { val: '24532' },
+ Amount: { val: '540' },
+ };
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit(`/#/worker/${userId}/medical`);
+ cy.addCard();
+ });
+
+ it('should create a medical Review', () => {
+ cy.fillInForm(medicalReview);
+ cy.get(saveBtn).click();
+ cy.checkNotification('Data created');
+ });
+});
diff --git a/test/cypress/integration/worker/workerNotes.spec.js b/test/cypress/integration/worker/workerNotes.spec.js
new file mode 100644
index 000000000..661314ac9
--- /dev/null
+++ b/test/cypress/integration/worker/workerNotes.spec.js
@@ -0,0 +1,13 @@
+///
+describe('WorkerNotes', () => {
+ const userId = 1106;
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit(`/#/worker/${userId}/notes`);
+ });
+
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/worker/workerOperator.spec.js b/test/cypress/integration/worker/workerOperator.spec.js
new file mode 100644
index 000000000..95839aeba
--- /dev/null
+++ b/test/cypress/integration/worker/workerOperator.spec.js
@@ -0,0 +1,19 @@
+///
+describe('WorkerOperator', () => {
+ const userId = 1106;
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('hr');
+ cy.visit(`/#/worker/${userId}/operator`);
+ });
+
+ it('should fill the operator form', () => {
+ cy.dataCy('numberOfWagons').type('4');
+ cy.dataCy('linesLimit').type('6');
+ cy.dataCy('volumeLimit').type('3');
+ cy.dataCy('sizeLimit').type('3');
+ cy.saveCard();
+
+ cy.checkNotification('Data saved');
+ });
+});
diff --git a/test/cypress/integration/worker/workerPit.spec.js b/test/cypress/integration/worker/workerPit.spec.js
index 19cbebc20..04f232648 100644
--- a/test/cypress/integration/worker/workerPit.spec.js
+++ b/test/cypress/integration/worker/workerPit.spec.js
@@ -1,19 +1,5 @@
describe('WorkerPit', () => {
- const familySituationInput = '[data-cy="Family Situation_input"]';
- const familySituation = '1';
- const childPensionInput = '[data-cy="Child Pension_input"]';
- const childPension = '120';
- const spouseNifInput = '[data-cy="Spouse Pension_input"]';
- const spouseNif = '65117125P';
- const spousePensionInput = '[data-cy="Spouse Pension_input"]';
- const spousePension = '120';
const addRelative = '[data-cy="addRelative"]';
- const isDescendantSelect = '[data-cy="Descendant/Ascendant"]';
- const Descendant = 'Descendiente';
- const birthedInput = '[data-cy="Birth Year_input"]';
- const birthed = '2002';
- const adoptionYearInput = '[data-cy="Adoption Year_input"]';
- const adoptionYear = '2004';
const saveRelative = '[data-cy="workerPitRelativeSaveBtn"]';
const savePIT = '#st-actions > .q-btn-group > .q-btn--standard';
@@ -24,15 +10,15 @@ describe('WorkerPit', () => {
});
it('complete PIT', () => {
- cy.get(familySituationInput).type(familySituation);
- cy.get(childPensionInput).type(childPension);
- cy.get(spouseNifInput).type(spouseNif);
- cy.get(spousePensionInput).type(spousePension);
+ cy.dataCy('familySituation').type('1');
+ cy.dataCy('childPension').type('120');
+ cy.dataCy('spouseNif').type('65117125P');
+ cy.dataCy('spousePension').type('120');
cy.get(savePIT).click();
cy.get(addRelative).click();
- cy.get(isDescendantSelect).type(Descendant);
- cy.get(birthedInput).type(birthed);
- cy.get(adoptionYearInput).type(adoptionYear);
+ cy.dataCy('Descendant/Ascendant').type('Descendiente');
+ cy.dataCy('birthed').type('2002');
+ cy.dataCy('adoptionYear').type('2004');
cy.get(saveRelative).click();
});
});
diff --git a/test/cypress/integration/worker/workerSummary.spec.js b/test/cypress/integration/worker/workerSummary.spec.js
index 3d70fdf96..c50b2c943 100644
--- a/test/cypress/integration/worker/workerSummary.spec.js
+++ b/test/cypress/integration/worker/workerSummary.spec.js
@@ -1,4 +1,6 @@
describe('WorkerSummary', () => {
+ const departmentDescriptor = ':nth-child(1) > :nth-child(3) > .value > .link';
+ const roleDescriptor = ':nth-child(3) > :nth-child(4) > .value > .link';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
@@ -10,7 +12,17 @@ describe('WorkerSummary', () => {
cy.get('.summaryHeader > div').should('have.text', '19 - salesboss salesboss');
cy.get(':nth-child(1) > :nth-child(2) > .value > span').should(
'have.text',
- 'salesBossNick'
+ 'salesBossNick',
);
});
+
+ it('should try descriptors', () => {
+ cy.waitForElement('.summaryHeader');
+ cy.get(departmentDescriptor).click();
+ cy.get('.descriptor').should('be.visible');
+ cy.get('.q-item > .q-item__label').should('include.text', '43');
+ cy.get(roleDescriptor).click();
+ cy.get('.descriptor').should('be.visible');
+ cy.get('.q-item > .q-item__label').should('include.text', '19');
+ });
});
diff --git a/test/cypress/integration/zone/zoneLocations.spec.js b/test/cypress/integration/zone/zoneLocations.spec.js
index cdc2c778b..3a52d276c 100644
--- a/test/cypress/integration/zone/zoneLocations.spec.js
+++ b/test/cypress/integration/zone/zoneLocations.spec.js
@@ -1,4 +1,4 @@
-describe('ZoneLocations', () => {
+describe.skip('ZoneLocations', () => {
const data = {
Warehouse: { val: 'Warehouse One', type: 'select' },
};
diff --git a/test/cypress/run.sh b/test/cypress/run.sh
index 1f506aa57..0f8c59902 100755
--- a/test/cypress/run.sh
+++ b/test/cypress/run.sh
@@ -1,24 +1,39 @@
#!/bin/bash
+salix_dir="${1:-$HOME/Projects/salix}"
+salix_dir=$(eval echo "$salix_dir")
+
+echo "$salix_dir"
+
+current_dir=$(pwd)
+
cleanup() {
- if [[ -z "$ended" ]]; then
- ended=true
- docker-compose -p e2e --project-directory . -f test/cypress/docker-compose.yml down -v
- fi
+ docker-compose -p e2e --project-directory . -f test/cypress/docker-compose.yml down -v
}
trap cleanup SIGINT
-#CLEAN
+# CLEAN
rm -rf test/cypress/screenshots
rm -f test/cypress/results/*
rm -f test/cypress/reports/*
rm -f junit/e2e-*.xml
-#RUN
+# RUN
export CI=true
export TZ=Europe/Madrid
+# IMAGES
+docker build -t registry.verdnatura.es/salix-back:dev -f "$salix_dir/back/Dockerfile" "$salix_dir"
+cd "$salix_dir" && npx myt run -t
+docker exec vn-database sh -c "rm -rf /mysql-template"
+docker exec vn-database sh -c "cp -a /var/lib/mysql /mysql-template"
+docker commit vn-database registry.verdnatura.es/salix-db:dev
+docker rm -f vn-database
+cd "$current_dir"
+docker build -f ./docs/Dockerfile.dev -t lilium-dev .
+# END IMAGES
+
docker-compose -p e2e --project-directory . -f test/cypress/docker-compose.yml up -d
docker run -it --rm \
diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js
index 8437112e0..105d021ad 100755
--- a/test/cypress/support/commands.js
+++ b/test/cypress/support/commands.js
@@ -62,12 +62,7 @@ Cypress.Commands.overwrite('visit', (originalFn, url, options, waitRequest = tru
originalFn(url, options);
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
cy.waitUntil(() => cy.get('main').should('exist'));
- if (waitRequest)
- cy.get('body').then(($body) => {
- if ($body.find('[data-cy="loading-spinner"]').length) {
- cy.get('[data-cy="loading-spinner"]').should('not.be.visible');
- }
- });
+ if (waitRequest) cy.waitSpinner();
});
Cypress.Commands.add('waitForElement', (element) => {
@@ -99,6 +94,14 @@ Cypress.Commands.add('getValue', (selector) => {
});
});
+Cypress.Commands.add('waitSpinner', () => {
+ cy.get('body').then(($body) => {
+ if ($body.find('[data-cy="loading-spinner"]').length) {
+ cy.get('[data-cy="loading-spinner"]').should('not.be.visible');
+ }
+ });
+});
+
// Fill Inputs
Cypress.Commands.add('selectOption', (selector, option, timeout = 2500) => {
cy.waitForElement(selector, timeout);
@@ -116,6 +119,7 @@ Cypress.Commands.add('selectOption', (selector, option, timeout = 2500) => {
function selectItem(selector, option, ariaControl, hasWrite = true) {
if (!hasWrite) cy.wait(100);
+ cy.waitSpinner();
getItems(ariaControl).then((items) => {
const matchingItem = items
@@ -135,6 +139,7 @@ function getItems(ariaControl, startTime = Cypress._.now(), timeout = 2500) {
.should('exist')
.find('.q-item')
.should('exist')
+ .should('be.visible')
.then(($items) => {
if (!$items?.length || $items.first().text().trim() === '') {
if (Cypress._.now() - startTime > timeout) {