-
-
-
-
-
import VnCard from 'components/common/VnCard.vue';
import ShelvingDescriptor from 'pages/Shelving/Card/ShelvingDescriptor.vue';
+import ShelvingFilter from './ShelvingFilter.vue';
+import ShelvingSearchbar from './ShelvingSearchbar.vue';
-
+
+
+
+
+
diff --git a/src/pages/Supplier/Card/SupplierCard.vue b/src/pages/Supplier/Card/SupplierCard.vue
index c8c503056..adf0315da 100644
--- a/src/pages/Supplier/Card/SupplierCard.vue
+++ b/src/pages/Supplier/Card/SupplierCard.vue
@@ -1,14 +1,16 @@
diff --git a/src/pages/Ticket/Card/TicketCard.vue b/src/pages/Ticket/Card/TicketCard.vue
index 471bfe490..04363b506 100644
--- a/src/pages/Ticket/Card/TicketCard.vue
+++ b/src/pages/Ticket/Card/TicketCard.vue
@@ -1,14 +1,16 @@
diff --git a/src/pages/Worker/Card/WorkerCard.vue b/src/pages/Worker/Card/WorkerCard.vue
index d76ef6f59..fb9ab9666 100644
--- a/src/pages/Worker/Card/WorkerCard.vue
+++ b/src/pages/Worker/Card/WorkerCard.vue
@@ -1,14 +1,16 @@
diff --git a/test/cypress/integration/invoiceIn/invoiceInBasicData.spec.js b/test/cypress/integration/invoiceIn/invoiceInBasicData.spec.js
index fc989d6c5..963dda3e2 100644
--- a/test/cypress/integration/invoiceIn/invoiceInBasicData.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInBasicData.spec.js
@@ -1,7 +1,8 @@
///
describe('InvoiceInBasicData', () => {
- const selects = '.q-form .q-card>:nth-child(1) > :nth-child(1) > .q-field';
- const appendBtns = 'label button';
+ const formInputs = '.q-form > .q-card input';
+ const firstFormSelect = '.q-card > .vn-row:nth-child(1) > .q-select';
+ const appendBtns = '.q-form label button';
const dialogAppendBtns = '.q-dialog label button';
const dialogInputs = '.q-dialog input';
const dialogActionBtns = '.q-card__actions button';
@@ -12,15 +13,14 @@ describe('InvoiceInBasicData', () => {
});
it('should edit the provideer and supplier ref', () => {
- cy.selectOption(selects, 'Bros');
-
+ cy.selectOption(firstFormSelect, 'Bros');
cy.get('[title="Reset"]').click();
cy.get(appendBtns).eq(0).click();
- cy.get('input').eq(2).type(4739);
+ cy.get(formInputs).eq(1).type(4739);
cy.saveCard();
- cy.get(`${selects} input`).eq(0).invoke('val').should('eq', 'Plants nick');
- cy.get('input').eq(2).invoke('val').should('eq', '4739');
+ cy.get(`${firstFormSelect} input`).invoke('val').should('eq', 'Plants nick');
+ cy.get(formInputs).eq(1).invoke('val').should('eq', '4739');
});
it('should edit the dms data', () => {
diff --git a/test/cypress/integration/invoiceIn/invoiceInDueDay.spec.js b/test/cypress/integration/invoiceIn/invoiceInDueDay.spec.js
index f39c80809..124b60c34 100644
--- a/test/cypress/integration/invoiceIn/invoiceInDueDay.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInDueDay.spec.js
@@ -1,6 +1,6 @@
///
describe('InvoiceInDueDay', () => {
- const inputs = 'label input';
+ const amountInput = 'tbody > tr:nth-child(1) td:nth-child(4)';
const addBtn = '.q-page-sticky > div > .q-btn > .q-btn__content';
beforeEach(() => {
@@ -9,7 +9,7 @@ describe('InvoiceInDueDay', () => {
});
it('should update the amount', () => {
- cy.get(inputs).eq(3).type(23);
+ cy.get(amountInput).type('{selectall}{backspace}23');
cy.saveCard();
cy.get('.q-notification__message').should('have.text', 'Data saved');
});
diff --git a/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js b/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js
index 306c0b8c0..c87fd4315 100644
--- a/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js
@@ -17,10 +17,7 @@ describe('InvoiceInIntrastat', () => {
cy.saveCard();
cy.visit(`/#/invoice-in/1/intrastat`);
- cy.getValue(firstLineCode).should(
- 'equal',
- 'Plantas vivas: Esqueje/injerto, Vid'
- );
+ cy.getValue(firstLineCode).should('equal', 'Plantas vivas: Esqueje/injerto, Vid');
});
it('should add a new row', () => {
@@ -33,6 +30,6 @@ describe('InvoiceInIntrastat', () => {
});
it('should remove the first line', () => {
- cy.removeRow(1);
+ cy.removeRow(2);
});
});
diff --git a/test/cypress/integration/invoiceIn/invoiceInVat.spec.js b/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
index ff891399b..389be671c 100644
--- a/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
@@ -29,7 +29,7 @@ describe('InvoiceInVat', () => {
});
it('should remove the first line', () => {
- cy.removeRow(1);
+ cy.removeRow(2);
});
it('should throw an error if there are fields undefined', () => {
diff --git a/test/cypress/integration/ticket/ticketDescriptor.spec.js b/test/cypress/integration/ticket/ticketDescriptor.spec.js
index 22401f0b4..fc920f346 100644
--- a/test/cypress/integration/ticket/ticketDescriptor.spec.js
+++ b/test/cypress/integration/ticket/ticketDescriptor.spec.js
@@ -1,6 +1,6 @@
///
describe('Ticket descriptor', () => {
- const toCloneOpt = '.q-list > :nth-child(5)';
+ const toCloneOpt = '[role="menu"] .q-list > :nth-child(5)';
const warehouseValue = ':nth-child(1) > :nth-child(6) > .value > span';
const summaryHeader = '.summaryHeader > div';
diff --git a/test/cypress/integration/worker/workerLocker.spec.js b/test/cypress/integration/worker/workerLocker.spec.js
index 8c1886438..01e74760b 100644
--- a/test/cypress/integration/worker/workerLocker.spec.js
+++ b/test/cypress/integration/worker/workerLocker.spec.js
@@ -1,6 +1,6 @@
describe('WorkerList', () => {
- const workerId = 1110;
- const lockerCode = '200A';
+ const workerId = 1109;
+ const lockerCode = '201A';
const input = '.q-card input';
const firstOpt = '[role="listbox"] .q-item:nth-child(1)';
beforeEach(() => {
diff --git a/test/vitest/__tests__/components/common/VnSearchBar.spec.js b/test/vitest/__tests__/components/common/VnSearchBar.spec.js
deleted file mode 100644
index 0938ae9c0..000000000
--- a/test/vitest/__tests__/components/common/VnSearchBar.spec.js
+++ /dev/null
@@ -1,62 +0,0 @@
-import { vi, describe, expect, it, beforeAll, afterEach, beforeEach } from 'vitest';
-import { createWrapper } from 'app/test/vitest/helper';
-import VnSearchbar from 'components/ui/VnSearchbar.vue';
-// Probar a importar como plugin vue-router en archivo helper
-describe('VnSearchBar', () => {
- let vm;
- let wrapper;
- let pushSpy;
-
- beforeAll(() => {
- wrapper = createWrapper(VnSearchbar, {
- propsData: {
- dataKey: 'CustomerList',
- label: 'Search customer',
- info: 'Info customer',
- },
- });
- vm = wrapper.vm;
- vm.router.currentRoute.value.matched = [
- {
- path: '/',
- },
- {
- path: '/customer',
- },
- {
- path: '/customer/:id',
- },
- {
- path: '/customer/:id/basic-data',
- },
- ];
-
- pushSpy = vi.spyOn(vm.router, 'push');
- vi.spyOn(vm.arrayData, 'applyFilter');
- });
-
- beforeEach(() => (vm.store.data = [{ id: 1112, name: 'Trash' }]));
- afterEach(() => vi.clearAllMocks());
-
- it('should be defined', async () => {
- expect(vm.searchText).toBeDefined();
- expect(vm.searchText).toEqual('');
- });
-
- it('should redirect to list page if there are several results', async () => {
- vm.store.data.push({ id: 1, name: 'employee' });
- await vm.search();
- expect(pushSpy).toHaveBeenCalledWith({ path: '/customer/list' });
- });
-
- it('should redirect to list page if there is no results', async () => {
- vm.store.data.pop();
- await vm.search();
- expect(pushSpy).toHaveBeenCalledWith({ path: '/customer/list' });
- });
-
- it('should redirect to basic-data page if there is only one result', async () => {
- await vm.search();
- expect(pushSpy).toHaveBeenCalledWith({ path: '/customer/1112/basic-data' });
- });
-});
diff --git a/test/vitest/__tests__/composables/useRedirect.spec.js b/test/vitest/__tests__/composables/useRedirect.spec.js
new file mode 100644
index 000000000..ce56189b9
--- /dev/null
+++ b/test/vitest/__tests__/composables/useRedirect.spec.js
@@ -0,0 +1,52 @@
+import { vi, describe, expect, it, beforeEach, beforeAll } from 'vitest';
+import useRedirect from 'src/composables/useRedirect';
+import { useRouter } from 'vue-router';
+
+vi.mock('vue-router');
+
+describe('useRedirect', () => {
+ useRouter.mockReturnValue({
+ push: vi.fn(),
+ currentRoute: {
+ value: {
+ matched: [
+ { path: '/' },
+ { path: '/customer' },
+ { path: '/customer/:id' },
+ { path: '/customer/:id/basic-data' },
+ ],
+ },
+ },
+ });
+ const data = [];
+ let navigate;
+ let spy;
+
+ beforeAll(() => {
+ const { navigate: navigateFn } = useRedirect();
+ navigate = navigateFn;
+ spy = useRouter().push;
+ });
+
+ beforeEach(() => {
+ data.length = 0;
+ spy.mockReset();
+ });
+
+ it('should redirect to list page if there are several results', async () => {
+ data.push({ id: 1, name: 'employee' }, { id: 2, name: 'boss' });
+ navigate(data, {});
+ expect(spy).toHaveBeenCalledWith({ path: '/customer/' });
+ });
+
+ it('should redirect to list page if there is no results', async () => {
+ navigate(data, {});
+ expect(spy).toHaveBeenCalledWith({ path: '/customer/' });
+ });
+
+ it('should redirect to basic-data page if there is only one result', async () => {
+ data.push({ id: 1, name: 'employee' });
+ navigate(data, {});
+ expect(spy).toHaveBeenCalledWith({ path: '/customer/1/basic-data' });
+ });
+});