{{ t(`filterPanel.${tag.label}`) }}:
diff --git a/src/pages/Zone/ZoneList.vue b/src/pages/Zone/ZoneList.vue
index 357ef871e..2a5d290ef 100644
--- a/src/pages/Zone/ZoneList.vue
+++ b/src/pages/Zone/ZoneList.vue
@@ -1,7 +1,7 @@
@@ -156,7 +152,6 @@ onMounted(() => (stateStore.rightDrawer = true));
:columns="columns"
redirect="zone"
:right-search="false"
- auto-load
>
import('src/components/common/VnSectionMain.vue'),
+ props: (route) => ({ leftDrawer: route.name === 'MonitorClientsActions' }),
redirect: { name: 'MonitorTickets' },
children: [
{
diff --git a/src/router/modules/shelving.js b/src/router/modules/shelving.js
index b7f50a3b6..2eeec4b98 100644
--- a/src/router/modules/shelving.js
+++ b/src/router/modules/shelving.js
@@ -25,7 +25,7 @@ export default {
path: 'list',
name: 'ShelvingList',
meta: {
- title: 'shelvingList',
+ title: 'list',
icon: 'view_list',
},
component: () => import('src/pages/Shelving/ShelvingList.vue'),
diff --git a/src/router/modules/travel.js b/src/router/modules/travel.js
index 627692be8..dff693d2f 100644
--- a/src/router/modules/travel.js
+++ b/src/router/modules/travel.js
@@ -75,9 +75,9 @@ export default {
},
{
name: 'TravelHistory',
- path: 'history',
+ path: 'log',
meta: {
- title: 'history',
+ title: 'log',
icon: 'history',
},
component: () => import('src/pages/Travel/Card/TravelLog.vue'),
diff --git a/src/router/modules/wagon.js b/src/router/modules/wagon.js
index e25e585eb..3556f215f 100644
--- a/src/router/modules/wagon.js
+++ b/src/router/modules/wagon.js
@@ -25,7 +25,7 @@ export default {
path: 'list',
name: 'WagonList',
meta: {
- title: 'wagonsList',
+ title: 'list',
icon: 'vn:trolley',
},
component: () => import('src/pages/Wagon/WagonList.vue'),
diff --git a/src/router/modules/zone.js b/src/router/modules/zone.js
index 1f27cc76f..fc8161fb3 100644
--- a/src/router/modules/zone.js
+++ b/src/router/modules/zone.js
@@ -38,7 +38,7 @@ export default {
name: 'ZoneList',
meta: {
title: 'zonesList',
- icon: 'vn:zone',
+ icon: 'view_list',
},
component: () => import('src/pages/Zone/ZoneList.vue'),
},
@@ -106,7 +106,7 @@ export default {
},
{
name: 'ZoneHistory',
- path: 'history',
+ path: 'log',
meta: {
title: 'log',
icon: 'history',
diff --git a/test/vitest/__tests__/stores/useStateQueryStore.spec.js b/src/stores/__tests__/useStateQueryStore.spec.js
similarity index 100%
rename from test/vitest/__tests__/stores/useStateQueryStore.spec.js
rename to src/stores/__tests__/useStateQueryStore.spec.js
diff --git a/src/stores/invoiceOutGlobal.js b/src/stores/invoiceOutGlobal.js
index 332494aa8..cc8d86ea8 100644
--- a/src/stores/invoiceOutGlobal.js
+++ b/src/stores/invoiceOutGlobal.js
@@ -19,7 +19,7 @@ export const useInvoiceOutGlobalStore = defineStore({
maxShipped: null,
clientId: null,
printer: null,
- serialType: null,
+ serialType: 'global',
},
addresses: [],
minInvoicingDate: null,
@@ -41,7 +41,6 @@ export const useInvoiceOutGlobalStore = defineStore({
async fetchAllData() {
try {
- const userInfo = await useUserConfig().fetch();
const date = Date.vnNew();
this.formInitialData.maxShipped = new Date(
date.getFullYear(),
@@ -53,7 +52,7 @@ export const useInvoiceOutGlobalStore = defineStore({
await Promise.all([
this.fetchParallelism(),
- this.fetchInvoiceOutConfig(userInfo.companyFk),
+ this.fetchInvoiceOutConfig(),
]);
this.initialDataLoading = false;
@@ -62,21 +61,23 @@ export const useInvoiceOutGlobalStore = defineStore({
}
},
- async fetchInvoiceOutConfig(companyFk) {
+ async fetchInvoiceOutConfig(formData = this.formInitialData) {
try {
- this.formInitialData.companyFk = companyFk;
- const params = { companyFk: companyFk };
+ const userInfo = await useUserConfig().fetch();
+ const params = {
+ companyFk: userInfo.companyFk,
+ serialType: formData.serialType,
+ };
const { data } = await axios.get('InvoiceOuts/getInvoiceDate', {
params,
});
- const stringDate = data.issued.substring(0, 10);
- this.minInvoicingDate = stringDate;
- this.formInitialData.invoiceDate = stringDate;
-
- this.minInvoicingDate = new Date(data.issued);
+ this.minInvoicingDate = data?.issued
+ ? new Date(data.issued)
+ : Date.vnNew();
this.formInitialData.invoiceDate = this.minInvoicingDate;
+ formData.invoiceDate = this.minInvoicingDate;
} catch (err) {
console.error('Error fetching invoice out global initial data');
throw new Error();
diff --git a/src/stores/useArrayDataStore.js b/src/stores/useArrayDataStore.js
index 6a0e7dfa8..d0a1c3a8f 100644
--- a/src/stores/useArrayDataStore.js
+++ b/src/stores/useArrayDataStore.js
@@ -17,6 +17,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => {
searchUrl: 'params',
navigate: null,
page: 1,
+ mapKey: 'id',
};
function get(key) {
@@ -46,6 +47,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => {
function getDefaultState() {
return Object.assign(JSON.parse(JSON.stringify(defaultOpts)), {
data: ref(),
+ map: ref(new Map()),
});
}
diff --git a/src/stores/useStateStore.js b/src/stores/useStateStore.js
index 328df9978..686e76c77 100644
--- a/src/stores/useStateStore.js
+++ b/src/stores/useStateStore.js
@@ -15,6 +15,10 @@ export const useStateStore = defineStore('stateStore', () => {
rightDrawer.value = !rightDrawer.value;
}
+ function rightDrawerChangeValue(value) {
+ rightDrawer.value = value;
+ }
+
function toggleSubToolbar() {
subToolbar.value = !subToolbar.value;
}
@@ -50,5 +54,6 @@ export const useStateStore = defineStore('stateStore', () => {
isRightDrawerShown,
isSubToolbarShown,
toggleSubToolbar,
+ rightDrawerChangeValue,
};
});
diff --git a/test/cypress/integration/claim/claimDevelopment.spec.js b/test/cypress/integration/claim/claimDevelopment.spec.js
index eb39f340a..df9d09a49 100755
--- a/test/cypress/integration/claim/claimDevelopment.spec.js
+++ b/test/cypress/integration/claim/claimDevelopment.spec.js
@@ -3,6 +3,8 @@ describe('ClaimDevelopment', () => {
const claimId = 1;
const firstLineReason = 'tbody > :nth-child(1) > :nth-child(2)';
const thirdRow = 'tbody > :nth-child(3)';
+ const lastReason = 'Incompetencia';
+ const newReason = 'Calor';
beforeEach(() => {
cy.viewport(1920, 1080);
@@ -14,22 +16,22 @@ describe('ClaimDevelopment', () => {
});
it('should reset line', () => {
- cy.selectOption(firstLineReason, 'Novato');
+ cy.selectOption(firstLineReason, newReason);
cy.resetCard();
- cy.getValue(firstLineReason).should('equal', 'Prisas');
+ cy.getValue(firstLineReason).should('equal', lastReason);
});
it('should edit line', () => {
- cy.selectOption(firstLineReason, 'Novato');
+ cy.selectOption(firstLineReason, newReason);
cy.saveCard();
cy.login('developer');
cy.visit(`/#/claim/${claimId}/development`);
- cy.getValue(firstLineReason).should('equal', 'Novato');
+ cy.getValue(firstLineReason).should('equal', newReason);
//Restart data
- cy.selectOption(firstLineReason, 'Prisas');
+ cy.selectOption(firstLineReason, lastReason);
cy.saveCard();
});
@@ -42,7 +44,7 @@ describe('ClaimDevelopment', () => {
const rowData = [
false,
- 'Novato',
+ newReason,
'Roces',
'Compradores',
'administrativeNick',
diff --git a/test/cypress/integration/client/clientBasicData.spec.js b/test/cypress/integration/client/clientBasicData.spec.js
index efaad33c2..bed28dc22 100644
--- a/test/cypress/integration/client/clientBasicData.spec.js
+++ b/test/cypress/integration/client/clientBasicData.spec.js
@@ -7,8 +7,8 @@ describe('Client basic data', () => {
});
it('Should load layout', () => {
cy.get('.q-card').should('be.visible');
- cy.dataCy('customerPhone').filter('input').should('be.visible');
- cy.dataCy('customerPhone').filter('input').type('123456789');
+ cy.dataCy('customerPhone').find('input').should('be.visible');
+ cy.dataCy('customerPhone').find('input').type('123456789');
cy.get('.q-btn-group > .q-btn--standard').click();
cy.intercept('PATCH', '/api/Clients/1102', (req) => {
const { body } = req;
diff --git a/test/cypress/integration/client/clientList.spec.js b/test/cypress/integration/client/clientList.spec.js
index e89b5fc77..dcded63b0 100644
--- a/test/cypress/integration/client/clientList.spec.js
+++ b/test/cypress/integration/client/clientList.spec.js
@@ -16,25 +16,25 @@ describe('Client list', () => {
});
it('Client list create new client', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
+ cy.addBtnClick();
const randomInt = Math.floor(Math.random() * 90) + 10;
const data = {
Name: { val: `Name ${randomInt}` },
'Social name': { val: `TEST ${randomInt}` },
- 'Tax number': { val: `20852${randomInt.length}3Z` },
+ 'Tax number': { val: `20852${randomInt}3Z` },
'Web user': { val: `user_test_${randomInt}` },
Street: { val: `C/ STREET ${randomInt}` },
- Email: { val: 'user.test@1.com' },
- 'Sales person': { val: 'employee', type: 'select' },
- Location: { val: '46000, Valencia(Province one), España', type: 'select' },
+ Email: { val: `user.test${randomInt}@cypress.com` },
+ 'Sales person': { val: 'salesPerson', type: 'select' },
+ Location: { val: '46000', type: 'select' },
'Business type': { val: 'Otros', type: 'select' },
};
cy.fillInForm(data);
cy.get('.q-mt-lg > .q-btn--standard').click();
- cy.checkNotification('Data saved');
+ cy.checkNotification('Data created');
cy.url().should('include', '/summary');
});
it('Client list search client', () => {
diff --git a/test/cypress/integration/entry/stockBought.spec.js b/test/cypress/integration/entry/stockBought.spec.js
index 66e06b79e..078ad19cc 100644
--- a/test/cypress/integration/entry/stockBought.spec.js
+++ b/test/cypress/integration/entry/stockBought.spec.js
@@ -11,7 +11,7 @@ describe('EntryStockBought', () => {
cy.get('.q-notification__message').should('have.text', 'Data saved');
});
it('Should add a new reserved space for buyerBoss', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
+ cy.addBtnClick();
cy.get('input[aria-label="Reserve"]').type('1');
cy.get('input[aria-label="Date"]').eq(1).clear();
cy.get('input[aria-label="Date"]').eq(1).type('01-01');
diff --git a/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js b/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js
index f6dac4c73..4c2550548 100644
--- a/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js
@@ -2,7 +2,7 @@
describe('InvoiceInIntrastat', () => {
const firstRow = 'tbody > :nth-child(1)';
const thirdRow = 'tbody > :nth-child(3)';
- const firstRowCode = `${firstRow} > :nth-child(2)`;
+ const codes = `[data-cy="intrastat-code"]`;
const firstRowAmount = `${firstRow} > :nth-child(3)`;
beforeEach(() => {
@@ -11,13 +11,12 @@ describe('InvoiceInIntrastat', () => {
});
it('should edit the first line', () => {
- cy.selectOption(firstRowCode, 'Plantas vivas: Esqueje/injerto, Vid');
+ cy.selectOption(`${firstRow} ${codes}`, 'Plantas vivas: Esqueje/injerto, Vid');
cy.get(firstRowAmount).clear();
cy.saveCard();
- cy.get(`${firstRowCode} span`).should(
- 'have.text',
- '6021010:Plantas vivas: Esqueje/injerto, Vid'
- );
+ cy.get(codes)
+ .eq(0)
+ .should('have.value', '6021010: Plantas vivas: Esqueje/injerto, Vid');
});
it('should add a new row', () => {
diff --git a/test/cypress/integration/invoiceIn/invoiceInList.spec.js b/test/cypress/integration/invoiceIn/invoiceInList.spec.js
index fa0d1c5e4..d9ab3f7e7 100644
--- a/test/cypress/integration/invoiceIn/invoiceInList.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInList.spec.js
@@ -1,7 +1,7 @@
///
describe('InvoiceInList', () => {
const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
- const firstId = `${firstRow} > td:nth-child(1) span`;
+ const firstId = `${firstRow} > td:nth-child(2) span`;
const firstDetailBtn = `${firstRow} .q-btn:nth-child(1)`;
const summaryHeaders = '.summaryBody .header-link';
diff --git a/test/cypress/integration/invoiceIn/invoiceInVat.spec.js b/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
index b84d743d1..f8b403a45 100644
--- a/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
@@ -2,6 +2,7 @@
describe('InvoiceInVat', () => {
const thirdRow = 'tbody > :nth-child(3)';
const firstLineVat = 'tbody > :nth-child(1) > :nth-child(4)';
+ const vats = '[data-cy="vat-sageiva"]';
const dialogInputs = '.q-dialog label input';
const addBtn = 'tbody tr:nth-child(1) td:nth-child(2) .--add-icon';
const randomInt = Math.floor(Math.random() * 100);
@@ -14,9 +15,9 @@ describe('InvoiceInVat', () => {
});
it('should edit the sage iva', () => {
- cy.selectOption(firstLineVat, 'H.P. IVA 21% CEE');
+ cy.selectOption(`${firstLineVat} ${vats}`, 'H.P. IVA 21% CEE');
cy.saveCard();
- cy.get(`${firstLineVat} span`).should('have.text', '8:H.P. IVA 21% CEE');
+ cy.get(vats).eq(0).should('have.value', '8: H.P. IVA 21% CEE');
});
it('should add a new row', () => {
diff --git a/test/cypress/integration/item/ItemFixedPrice.spec.js b/test/cypress/integration/item/ItemFixedPrice.spec.js
new file mode 100644
index 000000000..92dc27fda
--- /dev/null
+++ b/test/cypress/integration/item/ItemFixedPrice.spec.js
@@ -0,0 +1,63 @@
+///
+function goTo(n = 1) {
+ return `.q-virtual-scroll__content > :nth-child(${n})`;
+}
+const firstRow = goTo();
+`.q-virtual-scroll__content > :nth-child(2)`;
+describe('Handle Items FixedPrice', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('/#/item/fixed-price', { timeout: 5000 });
+ cy.waitForElement('.q-table');
+ cy.get(
+ '.q-header > .q-toolbar > :nth-child(1) > .q-btn__content > .q-icon'
+ ).click();
+ });
+ it('filter', function () {
+ cy.get('.category-filter > :nth-child(1) > .q-btn__content > .q-icon').click();
+ cy.selectOption('.list > :nth-child(2)', 'Alstroemeria');
+ cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
+
+ cy.addBtnClick();
+ cy.selectOption(`${firstRow} > :nth-child(2)`, '#13');
+ cy.get(`${firstRow} > :nth-child(4)`).find('input').type(1);
+ cy.get(`${firstRow} > :nth-child(5)`).find('input').type('2');
+ cy.selectOption(`${firstRow} > :nth-child(9)`, 'Warehouse One');
+ cy.get('.q-notification__message').should('have.text', 'Data saved');
+ /* ==== End Cypress Studio ==== */
+ });
+ it('Create and delete ', function () {
+ cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
+ cy.addBtnClick();
+ cy.selectOption(`${firstRow} > :nth-child(2)`, '#11');
+ cy.get(`${firstRow} > :nth-child(4)`).type('1');
+ cy.get(`${firstRow} > :nth-child(5)`).type('2');
+ cy.selectOption(`${firstRow} > :nth-child(9)`, 'Warehouse One');
+ cy.get('.q-notification__message').should('have.text', 'Data saved');
+ cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
+ cy.get(`${firstRow} > .text-right > .q-btn > .q-btn__content > .q-icon`).click();
+ cy.get(
+ '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block'
+ ).click();
+ cy.get('.q-notification__message').should('have.text', 'Data saved');
+ });
+
+ it('Massive edit', function () {
+ cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
+ cy.get('#subToolbar > .q-btn--standard').click();
+ cy.selectOption("[data-cy='field-to-edit']", 'Min price');
+ cy.dataCy('value-to-edit').find('input').type('1');
+ cy.get('.countLines').should('have.text', ' 1 ');
+ cy.get('.q-mt-lg > .q-btn--standard').click();
+ cy.get('.q-notification__message').should('have.text', 'Data saved');
+ });
+ it('Massive remove', function () {
+ cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
+ cy.get('#subToolbar > .q-btn--flat').click();
+ cy.get(
+ '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block'
+ ).click();
+ cy.get('.q-notification__message').should('have.text', 'Data saved');
+ });
+});
diff --git a/test/cypress/integration/item/itemLastEntries.spec.js b/test/cypress/integration/item/itemLastEntries.spec.js
new file mode 100644
index 000000000..c94cfa480
--- /dev/null
+++ b/test/cypress/integration/item/itemLastEntries.spec.js
@@ -0,0 +1,20 @@
+describe('ItemLastEntries', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('buyer');
+ cy.visit('/#/item/1/last-entries');
+ cy.intercept('GET', /.*lastEntriesFilter/).as('item');
+ cy.waitForElement('tbody');
+ });
+
+ it('should filter by agency', () => {
+ cy.get('tbody > tr')
+ .its('length')
+ .then((rowCount) => {
+ cy.get('[data-cy="hideInventory"]').click();
+ cy.wait('@item');
+ cy.waitForElement('tbody');
+ cy.get('tbody > tr').should('have.length.greaterThan', rowCount);
+ });
+ });
+});
diff --git a/test/cypress/integration/route/roadMap/roadmapList.spec.js b/test/cypress/integration/route/roadMap/roadmapList.spec.js
index ba602fdf6..2f5e5672f 100644
--- a/test/cypress/integration/route/roadMap/roadmapList.spec.js
+++ b/test/cypress/integration/route/roadMap/roadmapList.spec.js
@@ -5,7 +5,7 @@ describe('RoadMap', () => {
cy.visit(`/#/route/roadmap`);
});
it('Route list create roadmap and redirect', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
+ cy.addBtnClick();
cy.get('input[name="name"]').eq(1).type('roadMapTestOne{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created');
cy.url().should('include', '/summary');
diff --git a/test/cypress/integration/route/routeList.spec.js b/test/cypress/integration/route/routeList.spec.js
index 8020d3ea9..4da43ce8e 100644
--- a/test/cypress/integration/route/routeList.spec.js
+++ b/test/cypress/integration/route/routeList.spec.js
@@ -9,7 +9,7 @@ describe('Route', () => {
const getRowColumn = (row, column) => `:nth-child(${row}) > :nth-child(${column})`;
it('Route list create route', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
+ cy.addBtnClick();
cy.get('input[name="description"]').type('routeTestOne{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created');
cy.url().should('include', '/summary');
diff --git a/test/cypress/integration/ticket/ticketList.spec.js b/test/cypress/integration/ticket/ticketList.spec.js
index bbdbcea92..b30b4cdad 100644
--- a/test/cypress/integration/ticket/ticketList.spec.js
+++ b/test/cypress/integration/ticket/ticketList.spec.js
@@ -47,7 +47,8 @@ describe('TicketList', () => {
Landed: { val: '01-01-2024', type: 'date' },
};
cy.fillInForm(data);
- cy.get('.q-mt-lg > .q-btn--standard').click();
+ cy.dataCy('Agency_select').click();
+ cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data created');
cy.url().should('match', /\/ticket\/\d+\/summary/);
});
diff --git a/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js b/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js
index e996a65d5..8e37d8c9c 100644
--- a/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js
+++ b/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js
@@ -1,6 +1,5 @@
///
describe('VnBreadcrumbs', () => {
- const firstCard = '.q-infinite-scroll > :nth-child(1)';
const lastBreadcrumb = '.q-breadcrumbs--last > .q-breadcrumbs__el';
beforeEach(() => {
cy.viewport(1920, 1080);
@@ -13,10 +12,7 @@ describe('VnBreadcrumbs', () => {
});
it('should get the correct breadcrumbs', () => {
- cy.visit('#/customer/list');
- cy.get('.q-breadcrumbs__el').should('have.length', 2);
-
- cy.get(firstCard).click();
+ cy.visit('#/customer/1/summary');
cy.get(`${lastBreadcrumb} > .q-icon`).should('have.text', 'launch');
});
});
diff --git a/test/cypress/integration/vnComponent/VnLog.spec.js b/test/cypress/integration/vnComponent/VnLog.spec.js
index 4db724e99..80b9d07df 100644
--- a/test/cypress/integration/vnComponent/VnLog.spec.js
+++ b/test/cypress/integration/vnComponent/VnLog.spec.js
@@ -9,15 +9,15 @@ describe('VnLog', () => {
cy.visit(`/#/claim/${1}/log`);
cy.openRightMenu();
});
- // Se tiene que cambiar el Accept-Language a 'en', ya hay una tarea para eso #7189.
- xit('should filter by insert actions', () => {
+
+ it('should filter by insert actions', () => {
cy.checkOption(':nth-child(7) > .q-checkbox');
cy.get('.q-page').click();
cy.validateContent(chips[0], 'Document');
cy.validateContent(chips[1], 'Beginning');
});
- xit('should filter by entity', () => {
+ it('should filter by entity', () => {
cy.selectOption('.q-drawer--right .q-item > .q-select', 'Claim');
cy.get('.q-page').click();
cy.validateContent(chips[0], 'Claim');
diff --git a/test/cypress/integration/wagonType/wagonTypeCreate.spec.js b/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js
similarity index 100%
rename from test/cypress/integration/wagonType/wagonTypeCreate.spec.js
rename to test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js
diff --git a/test/cypress/integration/wagonType/wagonTypeEdit.spec.js b/test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js
similarity index 100%
rename from test/cypress/integration/wagonType/wagonTypeEdit.spec.js
rename to test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js
diff --git a/test/cypress/integration/worker/workerPda.spec.js b/test/cypress/integration/worker/workerPda.spec.js
index fe8efa834..31ec19eda 100644
--- a/test/cypress/integration/worker/workerPda.spec.js
+++ b/test/cypress/integration/worker/workerPda.spec.js
@@ -1,6 +1,5 @@
describe('WorkerPda', () => {
- const deviceProductionField =
- '.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container';
+ const select = '[data-cy="pda-dialog-select"]';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
@@ -8,8 +7,9 @@ describe('WorkerPda', () => {
});
it('assign pda', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
- cy.get(deviceProductionField).type('{downArrow}{enter}');
+ cy.addBtnClick();
+ cy.get(select).click();
+ cy.get(select).type('{downArrow}{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created');
});
diff --git a/test/cypress/integration/zone/zoneBasicData.spec.js b/test/cypress/integration/zone/zoneBasicData.spec.js
index c6151a49b..6229039b7 100644
--- a/test/cypress/integration/zone/zoneBasicData.spec.js
+++ b/test/cypress/integration/zone/zoneBasicData.spec.js
@@ -1,5 +1,6 @@
describe('ZoneBasicData', () => {
const notification = '.q-notification__message';
+ const priceBasicData = '[data-cy="Price_input"]';
beforeEach(() => {
cy.viewport(1280, 720);
@@ -8,14 +9,20 @@ describe('ZoneBasicData', () => {
});
it('should throw an error if the name is empty', () => {
- cy.get('.q-card > :nth-child(1)').clear();
+ cy.get('[data-cy="zone-basic-data-name"] input').type('{selectall}{backspace}');
cy.get('.q-btn-group > .q-btn--standard').click();
cy.get(notification).should('contains.text', "can't be blank");
});
+ it('should throw an error if the price is empty', () => {
+ cy.get(priceBasicData).clear();
+ cy.get('.q-btn-group > .q-btn--standard').click();
+ cy.get(notification).should('contains.text', 'cannot be blank');
+ });
+
it("should edit the basicData's zone", () => {
cy.get('.q-card > :nth-child(1)').type(' modified');
cy.get('.q-btn-group > .q-btn--standard').click();
- cy.get(notification).should('contains.text', 'Data saved');
+ cy.checkNotification('Data saved');
});
});
diff --git a/test/cypress/integration/zone/zoneCreate.spec.js b/test/cypress/integration/zone/zoneCreate.spec.js
index 9618ea846..cc5de8c6c 100644
--- a/test/cypress/integration/zone/zoneCreate.spec.js
+++ b/test/cypress/integration/zone/zoneCreate.spec.js
@@ -22,6 +22,7 @@ describe('ZoneCreate', () => {
...data,
});
cy.get('input[aria-label="Close"]').type('10:00');
+ cy.get('body').click();
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(notification).should('contains.text', 'Agency cannot be blank');
});
@@ -32,6 +33,7 @@ describe('ZoneCreate', () => {
Agency: { val: 'inhouse pickup', type: 'select' },
});
cy.get('input[aria-label="Close"]').type('10:00');
+ cy.get('body').click();
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(notification).should('contains.text', 'Data created');
});
diff --git a/test/cypress/integration/zone/zoneList.spec.js b/test/cypress/integration/zone/zoneList.spec.js
index 92c77a2c6..8d01d4e4e 100644
--- a/test/cypress/integration/zone/zoneList.spec.js
+++ b/test/cypress/integration/zone/zoneList.spec.js
@@ -6,9 +6,7 @@ describe('ZoneList', () => {
});
it('should filter by agency', () => {
- cy.get(
- ':nth-child(1) > .column > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
- ).type('{downArrow}{enter}');
+ cy.get('input[aria-label="Agency"]').type('{downArrow}{enter}');
});
it('should open the zone summary', () => {
diff --git a/test/cypress/integration/zone/zoneWarehouse.spec.js b/test/cypress/integration/zone/zoneWarehouse.spec.js
index 3ffa3f69d..817e26312 100644
--- a/test/cypress/integration/zone/zoneWarehouse.spec.js
+++ b/test/cypress/integration/zone/zoneWarehouse.spec.js
@@ -1,10 +1,10 @@
describe('ZoneWarehouse', () => {
const data = {
- Warehouse: { val: 'Algemesi', type: 'select' },
+ Warehouse: { val: 'Warehouse One', type: 'select' },
};
- const deviceProductionField =
- '.vn-row > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container';
- const dataError = "ER_DUP_ENTRY: Duplicate entry '2-2' for key 'zoneFk'";
+
+ const dataError = 'ER_DUP_ENTRY: Duplicate entry';
+ const saveBtn = '.q-btn--standard > .q-btn__content > .block';
beforeEach(() => {
cy.viewport(1280, 720);
@@ -13,22 +13,21 @@ describe('ZoneWarehouse', () => {
});
it('should throw an error if the warehouse chosen is already put in the zone', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
- cy.get(deviceProductionField).click();
- cy.get(deviceProductionField).type('{upArrow}{enter}');
- cy.get('.q-notification__message').should('have.text', dataError);
+ cy.addBtnClick();
+ cy.selectOption('[data-cy="Warehouse_select"]', 'Warehouse Two');
+ cy.get(saveBtn).click();
+ cy.checkNotification(dataError);
});
- it('should create a warehouse', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
- cy.get(deviceProductionField).click();
+ it('should create & remove a warehouse', () => {
+ cy.addBtnClick();
cy.fillInForm(data);
+ cy.get(saveBtn).click();
cy.get('.q-mt-lg > .q-btn--standard').click();
- });
- it('should delete a warehouse', () => {
cy.get('tbody > :nth-child(2) > :nth-child(2) > .q-icon').click();
- cy.get('.q-card__actions > .q-btn--flat > .q-btn__content').click();
+ cy.get('[title="Confirm"]').click();
+
cy.reload();
});
});
diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js
index 21121d9df..df2c00e03 100755
--- a/test/cypress/support/commands.js
+++ b/test/cypress/support/commands.js
@@ -58,8 +58,9 @@ Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => {
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
});
Cypress.Commands.add('waitForElement', (element, timeout = 5000) => {
- cy.waitUntil(() => cy.get(element).then(($el) => $el.is(':visible')));
+ cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
});
+
Cypress.Commands.add('getValue', (selector) => {
cy.get(selector).then(($el) => {
if ($el.find('.q-checkbox__inner').length > 0) {
@@ -86,15 +87,40 @@ Cypress.Commands.add('getValue', (selector) => {
});
// Fill Inputs
-Cypress.Commands.add('selectOption', (selector, option, timeout) => {
- cy.waitForElement(selector);
+Cypress.Commands.add('selectOption', (selector, option, timeout = 5000) => {
+ cy.waitForElement(selector, timeout);
cy.get(selector).click();
- cy.wait(timeout || 1000);
- cy.get('.q-menu .q-item').contains(option).click();
+ cy.get(selector).invoke('data', 'url').as('dataUrl');
+ cy.get(selector)
+ .clear()
+ .type(option)
+ .then(() => {
+ cy.get('.q-menu', { timeout })
+ .should('be.visible') // Asegurarse de que el menú está visible
+ .and('exist') // Verificar que el menú existe
+ .then(() => {
+ cy.get('@dataUrl').then((url) => {
+ if (url) {
+ cy.log('url: ', url);
+ // Esperar a que el menú no esté visible (desaparezca)
+ cy.get('.q-menu').should('not.be.visible');
+ // Ahora esperar a que el menú vuelva a aparecer
+ cy.get('.q-menu').should('be.visible').and('exist');
+ }
+ });
+ });
+ });
+
+ // Finalmente, seleccionar la opción deseada
+ cy.get('.q-menu:visible') // Asegurarse de que estamos dentro del menú visible
+ .find('.q-item') // Encontrar los elementos de las opciones
+ .contains(option) // Verificar que existe una opción que contenga el texto deseado
+ .click(); // Hacer clic en la opción
});
+
Cypress.Commands.add('countSelectOptions', (selector, option) => {
cy.waitForElement(selector);
- cy.get(selector).click();
+ cy.get(selector).click({ force: true });
cy.get('.q-menu .q-item').should('have.length', option);
});
@@ -110,14 +136,13 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
const { type, val } = field;
switch (type) {
case 'select':
- cy.wrap(el).type(val);
- cy.get('.q-menu .q-item').contains(val).click();
+ cy.selectOption(el, val);
break;
case 'date':
- cy.wrap(el).type(val.split('-').join(''));
+ cy.get(el).type(val.split('-').join(''));
break;
case 'time':
- cy.wrap(el).click();
+ cy.get(el).click();
cy.get('.q-time .q-time__clock').contains(val.h).click();
cy.get('.q-time .q-time__clock').contains(val.m).click();
cy.get('.q-time .q-time__link').contains(val.x).click();
@@ -347,3 +372,10 @@ Cypress.Commands.add('searchByLabel', (label, value) => {
Cypress.Commands.add('dataCy', (tag, attr = 'data-cy') => {
return cy.get(`[${attr}="${tag}"]`);
});
+
+Cypress.Commands.add('addBtnClick', () => {
+ cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon')
+ .should('exist')
+ .and('be.visible')
+ .click();
+});
diff --git a/test/vitest/__tests__/pages/InvoiceIn/InvoiceInIntrastat.spec.js b/test/vitest/__tests__/pages/InvoiceIn/InvoiceInIntrastat.spec.js
deleted file mode 100644
index adfb054c6..000000000
--- a/test/vitest/__tests__/pages/InvoiceIn/InvoiceInIntrastat.spec.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import { vi, describe, expect, it, beforeAll } from 'vitest';
-import { createWrapper, axios } from 'app/test/vitest/helper';
-import InvoiceInIntrastat from 'src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue';
-
-describe('InvoiceInIntrastat', () => {
- let vm;
-
- beforeAll(() => {
- vm = createWrapper(InvoiceInIntrastat, {
- global: {
- stubs: ['vnPaginate'],
- mocks: {
- fetch: vi.fn(),
- },
- },
- }).vm;
- vi.spyOn(axios, 'get').mockResolvedValue({ data: [{}] });
- });
-
- describe('getTotal()', () => {
- it('should correctly handle the sum', () => {
- const invoceInIntrastat = [
- { amount: 10, stems: 162 },
- { amount: 20, stems: 21 },
- ];
-
- const totalAmount = vm.getTotal(invoceInIntrastat, 'amount');
- const totalStems = vm.getTotal(invoceInIntrastat, 'stems');
-
- expect(totalAmount).toBe(10 + 20);
- expect(totalStems).toBe(162 + 21);
- });
- });
-});
diff --git a/test/vitest/__tests__/pages/InvoiceIn/InvoiceInVat.spec.js b/test/vitest/__tests__/pages/InvoiceIn/InvoiceInVat.spec.js
deleted file mode 100644
index 76453f65a..000000000
--- a/test/vitest/__tests__/pages/InvoiceIn/InvoiceInVat.spec.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import { vi, describe, expect, it, beforeAll } from 'vitest';
-import { createWrapper } from 'app/test/vitest/helper';
-import InvoiceInVat from 'src/pages/InvoiceIn/Card/InvoiceInVat.vue';
-
-describe('InvoiceInVat', () => {
- let vm;
-
- beforeAll(() => {
- vm = createWrapper(InvoiceInVat, {
- global: {
- stubs: [],
- mocks: {
- fetch: vi.fn(),
- },
- },
- }).vm;
- });
-
- describe('taxRate()', () => {
- it('should correctly compute the tax rate', () => {
- const invoiceInTax = { taxableBase: 100, taxTypeSageFk: 1 };
- vm.sageTaxTypes = [
- { id: 1, rate: 10 },
- { id: 2, rate: 20 },
- ];
- const result = vm.taxRate(invoiceInTax);
- expect(result).toBe((10 / 100) * 100);
- });
-
- it('should return 0 if there is not tax rate', () => {
- const invoiceInTax = { taxableBase: 100, taxTypeSageFk: 1 };
- vm.sageTaxTypes = [];
-
- const result = vm.taxRate(invoiceInTax);
- expect(result).toBe(0);
- });
- });
-});
diff --git a/test/vitest/helper.js b/test/vitest/helper.js
index 4bfae5dc8..ce057c7c3 100644
--- a/test/vitest/helper.js
+++ b/test/vitest/helper.js
@@ -44,7 +44,18 @@ vi.mock('vue-router', () => ({
vi.mock('axios');
vi.spyOn(useValidator, 'useValidator').mockImplementation(() => {
- return { validate: vi.fn() };
+ return {
+ validate: vi.fn(),
+ validations: () => ({
+ format: vi.fn(),
+ presence: vi.fn(),
+ required: vi.fn(),
+ length: vi.fn(),
+ numericality: vi.fn(),
+ min: vi.fn(),
+ custom: vi.fn(),
+ }),
+ };
});
class FormDataMock {
diff --git a/vitest.config.js b/vitest.config.js
index ca9f6c1fe..a465f0e2d 100644
--- a/vitest.config.js
+++ b/vitest.config.js
@@ -13,7 +13,7 @@ export default defineConfig({
include: [
// Matches vitest tests in any subfolder of 'src' or into 'test/vitest/__tests__'
// Matches all files with extension 'js', 'jsx', 'ts' and 'tsx'
- 'test/vitest/__tests__/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
+ 'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
],
},
plugins: [