-
-
- {{ t('order.summary.basket') }} #{{ entity?.id }} -
- {{ entity?.client?.name }} ({{ entity?.clientFk }})
-
-
-
- {{ t('order.summary.confirmLines') }}
-
-
-
-
-
-
-
-
-
-
-
-
- {{ dashIfEmpty(entity?.address?.nickname) }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ dashIfEmpty(entity?.address?.phone) }}
-
-
-
-
-
-
-
-
-
-
-
- {{ entity?.note }}
-
-
-
-
-
-
- {{ t('globals.subtotal') }}
-
-
- {{
- toCurrency(entity?.subTotal)
- }}
-
-
-
-
- {{ t('globals.vat') }}
-
-
- {{ toCurrency(entity?.VAT) }}
-
-
-
-
- {{ t('order.summary.total') }}
-
-
- {{ toCurrency(entity?.total) }}
-
-
-
-
-
-
-
-
- {{ t('globals.item') }}
- {{ t('globals.description') }}
- {{ t('globals.quantity') }}
- {{ t('globals.price') }}
- {{ t('order.summary.amount') }}
-
-
-
-
-
-
- {{ props.row.item?.id }}
-
-
-
-
-
-
- {{ props.row.item.name }}
-
- {{ props.row.item.subName }}
-
-
+
+
+ {{ t('order.summary.basket') }} #{{ entity?.id }} -
+ {{ entity?.client?.name }} ({{ entity?.clientFk }})
+
+
+
+ {{ t('order.summary.confirmLines') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ dashIfEmpty(entity?.address?.nickname) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ dashIfEmpty(entity?.address?.phone) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ entity?.note }}
+
+
+
+
+
+
+ {{ t('globals.subtotal') }}
+
+
+ {{ toCurrency(entity?.subTotal) }}
+
+
+
+
+ {{ t('globals.vat') }}
+
+
+ {{ toCurrency(entity?.VAT) }}
+
+
+
+
+ {{ t('order.summary.total') }}
+
+
+ {{ toCurrency(entity?.total) }}
+
+
+
+
+
+
+
+
+ {{ t('globals.item') }}
+ {{ t('globals.description') }}
+ {{ t('globals.quantity') }}
+ {{ t('globals.price') }}
+ {{ t('order.summary.amount') }}
+
+
+
+
+
+
+ {{ props.row.item?.id }}
+
+
+
+
+
+
+ {{ props.row.item.name }}
+
+ {{ props.row.item.subName }}
+
-
-
-
- {{ props.row.quantity }}
-
-
- {{ toCurrency(props.row.price) }}
-
-
- {{
- toCurrency(props.row?.quantity * props.row?.price)
- }}
-
-
-
-
-
-
-
-
+
+
+
+
+ {{ props.row.quantity }}
+
+
+ {{ toCurrency(props.row.price) }}
+
+
+ {{ toCurrency(props.row?.quantity * props.row?.price) }}
+
+
+
+
+
+
+
diff --git a/src/router/__tests__/hooks.spec.js b/src/router/__tests__/hooks.spec.js
new file mode 100644
index 000000000..97f5eacdc
--- /dev/null
+++ b/src/router/__tests__/hooks.spec.js
@@ -0,0 +1,36 @@
+import { describe, it, expect, vi } from 'vitest';
+import { ref, nextTick } from 'vue';
+import { stateQueryGuard } from 'src/router/hooks';
+import { useStateQueryStore } from 'src/stores/useStateQueryStore';
+
+vi.mock('src/stores/useStateQueryStore', () => {
+ const isLoading = ref(true);
+ return {
+ useStateQueryStore: () => ({
+ isLoading: () => isLoading,
+ setLoading: isLoading,
+ }),
+ };
+});
+
+describe('hooks', () => {
+ describe('stateQueryGuard', () => {
+ const foo = { name: 'foo' };
+ it('should wait until the state query is not loading and then call next()', async () => {
+ const next = vi.fn();
+
+ stateQueryGuard(foo, { name: 'bar' }, next);
+ expect(next).not.toHaveBeenCalled();
+
+ useStateQueryStore().setLoading.value = false;
+ await nextTick();
+ expect(next).toHaveBeenCalled();
+ });
+
+ it('should ignore if both routes are the same', () => {
+ const next = vi.fn();
+ stateQueryGuard(foo, foo, next);
+ expect(next).toHaveBeenCalled();
+ });
+ });
+});
diff --git a/src/router/hooks.js b/src/router/hooks.js
new file mode 100644
index 000000000..bd9e5334f
--- /dev/null
+++ b/src/router/hooks.js
@@ -0,0 +1,95 @@
+import { useRole } from 'src/composables/useRole';
+import { useUserConfig } from 'src/composables/useUserConfig';
+import { useTokenConfig } from 'src/composables/useTokenConfig';
+import { useAcl } from 'src/composables/useAcl';
+import { isLoggedIn } from 'src/utils/session';
+import { useSession } from 'src/composables/useSession';
+import { useStateQueryStore } from 'src/stores/useStateQueryStore';
+import { watch } from 'vue';
+import { i18n } from 'src/boot/i18n';
+
+let session = null;
+const { t, te } = i18n.global;
+
+export async function navigationGuard(to, from, next, Router, state) {
+ if (!session) session = useSession();
+ const outLayout = Router.options.routes[0].children.map((r) => r.name);
+ if (!session.isLoggedIn() && !outLayout.includes(to.name)) {
+ return next({ name: 'Login', query: { redirect: to.fullPath } });
+ }
+
+ if (isLoggedIn()) {
+ const stateRoles = state.getRoles().value;
+ if (stateRoles.length === 0) {
+ await useRole().fetch();
+ await useAcl().fetch();
+ await useUserConfig().fetch();
+ await useTokenConfig().fetch();
+ }
+ const matches = to.matched;
+ const hasRequiredAcls = matches.every((route) => {
+ const meta = route.meta;
+ if (!meta?.acls) return true;
+ return useAcl().hasAny(meta.acls);
+ });
+ if (!hasRequiredAcls) return next({ path: '/' });
+ }
+
+ next();
+}
+
+export async function stateQueryGuard(to, from, next) {
+ if (to.name !== from.name) {
+ const stateQuery = useStateQueryStore();
+ await waitUntilFalse(stateQuery.isLoading());
+ }
+
+ next();
+}
+
+export function setPageTitle(to) {
+ let title = t(`login.title`);
+
+ const matches = to.matched;
+ if (matches && matches.length > 1) {
+ const module = matches[1];
+ const moduleTitle = module.meta?.title;
+ if (moduleTitle) {
+ title = t(`globals.pageTitles.${moduleTitle}`);
+ }
+ }
+
+ const childPage = to.meta;
+ const childPageTitle = childPage?.title;
+ if (childPageTitle && matches.length > 2) {
+ if (title != '') title += ': ';
+
+ const moduleLocale = `globals.pageTitles.${childPageTitle}`;
+ const pageTitle = te(moduleLocale)
+ ? t(moduleLocale)
+ : t(`globals.pageTitles.${childPageTitle}`);
+ const idParam = to.params?.id;
+ const idPageTitle = `${idParam} - ${pageTitle}`;
+ const builtTitle = idParam ? idPageTitle : pageTitle;
+
+ title += builtTitle;
+ }
+
+ document.title = title;
+}
+
+function waitUntilFalse(ref) {
+ return new Promise((resolve) => {
+ if (!ref.value) return resolve();
+ const stop = watch(
+ ref,
+ (val) => {
+ if (!val) {
+ stop();
+ resolve();
+ }
+ },
+ { immediate: true },
+ );
+ });
+}
diff --git a/src/router/index.js b/src/router/index.js
index 4403901cb..628a53c8e 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -6,101 +6,25 @@ import {
createWebHashHistory,
} from 'vue-router';
import routes from './routes';
-import { i18n } from 'src/boot/i18n';
import { useState } from 'src/composables/useState';
-import { useRole } from 'src/composables/useRole';
-import { useUserConfig } from 'src/composables/useUserConfig';
-import { useTokenConfig } from 'src/composables/useTokenConfig';
-import { useAcl } from 'src/composables/useAcl';
-import { isLoggedIn } from 'src/utils/session';
-import { useSession } from 'src/composables/useSession';
+import { navigationGuard, setPageTitle, stateQueryGuard } from './hooks';
-let session = null;
-const { t, te } = i18n.global;
-
-const createHistory = process.env.SERVER
- ? createMemoryHistory
- : process.env.VUE_ROUTER_MODE === 'history'
- ? createWebHistory
- : createWebHashHistory;
+const webHistory =
+ process.env.VUE_ROUTER_MODE === 'history' ? createWebHistory : createWebHashHistory;
+const createHistory = process.env.SERVER ? createMemoryHistory : webHistory;
const Router = createRouter({
scrollBehavior: () => ({ left: 0, top: 0 }),
routes,
-
- // Leave this as is and make changes in quasar.conf.js instead!
- // quasar.conf.js -> build -> vueRouterMode
- // quasar.conf.js -> build -> publicPath
history: createHistory(process.env.VUE_ROUTER_BASE),
});
-/*
- * If not building with SSR mode, you can
- * directly export the Router instantiation;
- *
- * The function below can be async too; either use
- * async/await or return a Promise which resolves
- * with the Router instance.
- */
export { Router };
-export default defineRouter(function (/* { store, ssrContext } */) {
+export default defineRouter(() => {
const state = useState();
- Router.beforeEach(async (to, from, next) => {
- if (!session) session = useSession();
- const outLayout = Router.options.routes[0].children.map((r) => r.name);
- if (!session.isLoggedIn() && !outLayout.includes(to.name)) {
- return next({ name: 'Login', query: { redirect: to.fullPath } });
- }
-
- if (isLoggedIn()) {
- const stateRoles = state.getRoles().value;
- if (stateRoles.length === 0) {
- await useRole().fetch();
- await useAcl().fetch();
- await useUserConfig().fetch();
- await useTokenConfig().fetch();
- }
- const matches = to.matched;
- const hasRequiredAcls = matches.every((route) => {
- const meta = route.meta;
- if (!meta?.acls) return true;
- return useAcl().hasAny(meta.acls);
- });
- if (!hasRequiredAcls) return next({ path: '/' });
- }
-
- next();
- });
-
- Router.afterEach((to) => {
- let title = t(`login.title`);
-
- const matches = to.matched;
- if (matches && matches.length > 1) {
- const module = matches[1];
- const moduleTitle = module.meta && module.meta.title;
- if (moduleTitle) {
- title = t(`globals.pageTitles.${moduleTitle}`);
- }
- }
-
- const childPage = to.meta;
- const childPageTitle = childPage && childPage.title;
- if (childPageTitle && matches.length > 2) {
- if (title != '') title += ': ';
-
- const moduleLocale = `globals.pageTitles.${childPageTitle}`;
- const pageTitle = te(moduleLocale)
- ? t(moduleLocale)
- : t(`globals.pageTitles.${childPageTitle}`);
- const idParam = to.params && to.params.id;
- const idPageTitle = `${idParam} - ${pageTitle}`;
- const builtTitle = idParam ? idPageTitle : pageTitle;
-
- title += builtTitle;
- }
- document.title = title;
- });
+ Router.beforeEach((to, from, next) => navigationGuard(to, from, next, Router, state));
+ Router.beforeEach(stateQueryGuard);
+ Router.afterEach(setPageTitle);
Router.onError(({ message }) => {
const errorMessages = [
diff --git a/src/router/modules/route.js b/src/router/modules/route.js
index 62765a49c..0dd41c86e 100644
--- a/src/router/modules/route.js
+++ b/src/router/modules/route.js
@@ -166,7 +166,7 @@ const vehicleCard = {
component: () => import('src/pages/Route/Vehicle/Card/VehicleCard.vue'),
redirect: { name: 'VehicleSummary' },
meta: {
- menu: ['VehicleBasicData'],
+ menu: ['VehicleBasicData', 'VehicleNotes'],
},
children: [
{
@@ -187,6 +187,15 @@ const vehicleCard = {
},
component: () => import('src/pages/Route/Vehicle/Card/VehicleBasicData.vue'),
},
+ {
+ name: 'VehicleNotes',
+ path: 'notes',
+ meta: {
+ title: 'notes',
+ icon: 'vn:notes',
+ },
+ component: () => import('src/pages/Route/Vehicle/Card/VehicleNotes.vue'),
+ }
],
};
@@ -229,6 +238,7 @@ export default {
title: 'list',
icon: 'view_list',
},
+ component: () => import('src/pages/Route/RouteList.vue'),
},
routeCard,
],
@@ -277,6 +287,7 @@ export default {
title: 'list',
icon: 'view_list',
},
+ component: () => import('src/pages/Route/RouteRoadmap.vue'),
},
roadmapCard,
],
@@ -307,6 +318,8 @@ export default {
title: 'list',
icon: 'view_list',
},
+ component: () =>
+ import('src/pages/Route/Agency/AgencyList.vue'),
},
agencyCard,
],
@@ -328,6 +341,8 @@ export default {
title: 'vehicleList',
icon: 'directions_car',
},
+ component: () =>
+ import('src/pages/Route/Vehicle/VehicleList.vue'),
},
vehicleCard,
],
diff --git a/src/stores/useDescriptorStore.js b/src/stores/useDescriptorStore.js
index 89189f32e..be342b016 100644
--- a/src/stores/useDescriptorStore.js
+++ b/src/stores/useDescriptorStore.js
@@ -11,14 +11,12 @@ export const useDescriptorStore = defineStore('descriptorStore', () => {
const files = import.meta.glob(`/src/**/*DescriptorProxy.vue`);
const moduleParser = {
account: 'user',
- client: 'customer',
+ customer: 'client',
};
for (const file in files) {
const name = file.split('/').at(-1).slice(0, -19).toLowerCase();
const descriptor = moduleParser[name] ?? name;
- currentDescriptors[descriptor + 'Fk'] = defineAsyncComponent(
- () => import(/* @vite-ignore */ file),
- );
+ currentDescriptors[descriptor + 'Fk'] = defineAsyncComponent(files[file]);
}
setDescriptors(currentDescriptors);
return currentDescriptors;
diff --git a/test/cypress/integration/account/accountDescriptorMenu.spec.js b/test/cypress/integration/account/accountDescriptorMenu.spec.js
index 67a7d8ef6..04fc57040 100644
--- a/test/cypress/integration/account/accountDescriptorMenu.spec.js
+++ b/test/cypress/integration/account/accountDescriptorMenu.spec.js
@@ -1,4 +1,4 @@
-describe('ClaimNotes', () => {
+describe('Account descriptor', () => {
const descriptorOptions = '[data-cy="descriptor-more-opts-menu"] > .q-list';
const url = '/#/account/1/summary';
@@ -7,6 +7,9 @@ describe('ClaimNotes', () => {
cy.visit(url);
cy.dataCy('descriptor-more-opts').click();
cy.get(descriptorOptions)
+ .should('exist')
+ .should('be.visible')
+
.find('.q-item')
.its('length')
.then((count) => {
diff --git a/test/cypress/integration/entry/commands.js b/test/cypress/integration/entry/commands.js
index 7c96a5440..4d4a8f980 100644
--- a/test/cypress/integration/entry/commands.js
+++ b/test/cypress/integration/entry/commands.js
@@ -1,6 +1,6 @@
Cypress.Commands.add('selectTravel', (warehouse = '1') => {
cy.get('i[data-cy="Travel_icon"]').click();
- cy.get('input[data-cy="Warehouse Out_select"]').type(warehouse);
+ cy.selectOption('input[data-cy="Warehouse Out_select"]', warehouse);
cy.get('div[role="listbox"] > div > div[role="option"]').eq(0).click();
cy.get('button[data-cy="save-filter-travel-form"]').click();
cy.get('tr').eq(1).click();
@@ -9,7 +9,6 @@ Cypress.Commands.add('selectTravel', (warehouse = '1') => {
Cypress.Commands.add('deleteEntry', () => {
cy.get('[data-cy="descriptor-more-opts"]').should('be.visible').click();
cy.waitForElement('div[data-cy="delete-entry"]').click();
- cy.url().should('include', 'list');
});
Cypress.Commands.add('createEntry', () => {
diff --git a/test/cypress/integration/entry/entryCard/entryDescriptor.spec.js b/test/cypress/integration/entry/entryCard/entryDescriptor.spec.js
index 554471008..8185866db 100644
--- a/test/cypress/integration/entry/entryCard/entryDescriptor.spec.js
+++ b/test/cypress/integration/entry/entryCard/entryDescriptor.spec.js
@@ -28,12 +28,8 @@ describe('EntryDescriptor', () => {
cy.get('.q-notification__message')
.eq(2)
.should('have.text', 'Entry prices recalculated');
-
- cy.get('[data-cy="descriptor-more-opts"]').click();
cy.deleteEntry();
- cy.log(previousUrl);
-
cy.visit(previousUrl);
cy.waitForElement('[data-cy="entry-buys"]');
diff --git a/test/cypress/integration/entry/entryList.spec.js b/test/cypress/integration/entry/entryList.spec.js
index 990f74261..bad47615f 100644
--- a/test/cypress/integration/entry/entryList.spec.js
+++ b/test/cypress/integration/entry/entryList.spec.js
@@ -44,11 +44,12 @@ describe('EntryList', () => {
},
);
- checkBadgeDate(
+ // fix on task https://redmine.verdnatura.es/issues/8638
+ /* checkBadgeDate(
'td[data-col-field="landed"] > div .bg-info',
(badgeDate, compareDate) => {
expect(badgeDate.getTime()).to.be.lessThan(compareDate.getTime());
},
- );
+ ); */
});
});
diff --git a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js
index 7058e154c..fdaa01876 100644
--- a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js
@@ -13,7 +13,7 @@ describe('InvoiceInDescriptor', () => {
cy.validateCheckbox(checkbox, false);
});
- it('should delete the invoice properly', () => {
+ it.skip('should delete the invoice properly', () => {
cy.visit('/#/invoice-in/2/summary');
cy.selectDescriptorOption(2);
cy.clickConfirm();
diff --git a/test/cypress/integration/invoiceIn/invoiceInList.spec.js b/test/cypress/integration/invoiceIn/invoiceInList.spec.js
index 44a61609e..7254e8909 100644
--- a/test/cypress/integration/invoiceIn/invoiceInList.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInList.spec.js
@@ -4,7 +4,7 @@ describe('InvoiceInList', () => {
const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
const firstId = `${firstRow} > td:nth-child(2) span`;
const firstDetailBtn = `${firstRow} .q-btn:nth-child(1)`;
- const summaryHeaders = '.summaryBody .header-link';
+ const summaryHeaders = (opt) => `.summaryBody > .${opt} > .q-pb-lg > .header-link`;
const mockInvoiceRef = `createMockInvoice${Math.floor(Math.random() * 100)}`;
const mock = {
vnSupplierSelect: { val: 'farmer king', type: 'select' },
@@ -32,8 +32,8 @@ describe('InvoiceInList', () => {
it('should open the details', () => {
cy.get(firstDetailBtn).click();
- cy.get(summaryHeaders).eq(1).contains('Basic data');
- cy.get(summaryHeaders).eq(4).contains('Vat');
+ cy.get(summaryHeaders('max-width')).contains('Basic data');
+ cy.get(summaryHeaders('vat')).contains('Vat');
});
it('should create a new Invoice', () => {
@@ -41,12 +41,12 @@ describe('InvoiceInList', () => {
cy.fillInForm({ ...mock }, { attr: 'data-cy' });
cy.dataCy('FormModelPopup_save').click();
cy.intercept('GET', /\/api\/InvoiceIns\/\d+\/getTotals$/).as('invoice');
- cy.wait('@invoice').then(() =>
+ cy.wait('@invoice').then(() => {
cy.validateDescriptor({
title: mockInvoiceRef,
listBox: { 0: '11/16/2001', 3: 'The farmer' },
- }),
- );
- cy.get('[data-cy="vnLvCompany"]').should('contain.text', 'ORN');
+ });
+ cy.dataCy('invoiceInBasicDataCompanyFk').should('have.value', 'ORN');
+ });
});
});
diff --git a/test/cypress/integration/invoiceIn/invoiceInVat.spec.js b/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
index e9412244f..ff7d639e6 100644
--- a/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
@@ -1,7 +1,7 @@
///
describe('InvoiceInVat', () => {
const thirdRow = 'tbody > :nth-child(3)';
- const firstLineVat = 'tbody > :nth-child(1) > :nth-child(4)';
+ const firstLineVat = 'tbody > :nth-child(1) ';
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';
@@ -18,6 +18,17 @@ describe('InvoiceInVat', () => {
cy.get(vats).eq(0).should('have.value', '8: H.P. IVA 21% CEE');
});
+ it('should mark the line as deductible VAT', () => {
+ cy.get(`${firstLineVat} [data-cy="isDeductible_checkbox"]`).click();
+
+ cy.saveCard();
+
+ cy.get(`${firstLineVat} [data-cy="isDeductible_checkbox"]`)
+
+ .click();
+ cy.saveCard();
+ });
+
it('should add a new row', () => {
cy.addRow();
cy.fillRow(thirdRow, [true, 2000000001, 30, 'H.P. IVA 10']);
diff --git a/test/cypress/integration/order/orderList.spec.js b/test/cypress/integration/order/orderList.spec.js
index 34cd2bffc..ee011ea05 100644
--- a/test/cypress/integration/order/orderList.spec.js
+++ b/test/cypress/integration/order/orderList.spec.js
@@ -30,9 +30,11 @@ describe('OrderList', () => {
cy.url().should('include', `/order`);
});
- it.skip('filter list and create order', () => {
+ it('filter list and create order', () => {
cy.dataCy('Customer ID_input').type('1101{enter}');
+ cy.intercept('GET', /\/api\/Clients/).as('clientFilter');
cy.dataCy('vnTableCreateBtn').click();
+ cy.wait('@clientFilter');
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.selectOption(agencyCreateSelect, 1);
diff --git a/test/cypress/integration/route/agency/agencyModes.spec.js b/test/cypress/integration/route/agency/agencyModes.spec.js
new file mode 100644
index 000000000..3f5784997
--- /dev/null
+++ b/test/cypress/integration/route/agency/agencyModes.spec.js
@@ -0,0 +1,15 @@
+describe('Agency modes', () => {
+ const name = 'inhouse pickup';
+
+ beforeEach(() => {
+ cy.viewport(1920, 1080);
+ cy.login('developer');
+ cy.visit(`/#/route/agency/1/modes`);
+ });
+
+ it('should display the agency modes page', () => {
+ cy.get('.flex > .title').should('have.text', name);
+ cy.get('.flex > .q-chip > .q-chip__content').should('have.text', 'ID: 1');
+ cy.get('.list-items > :nth-child(1) > .value').should('have.text', name);
+ });
+});
diff --git a/test/cypress/integration/route/routeAutonomous.spec.js b/test/cypress/integration/route/routeAutonomous.spec.js
index acf82bd95..d77584c04 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`;
@@ -49,12 +49,12 @@ describe('RouteAutonomous', () => {
cy.get(selectors.firstRowCheckbox).click();
cy.get(selectors.createInvoiceBtn).click();
cy.dataCy(selectors.reference).type(data.reference);
+ cy.dataCy('attachFile').click();
cy.get('.q-file').selectFile('test/cypress/fixtures/image.jpg', {
force: true,
});
- cy.dataCy(selectors.saveFormBtn).click();
+ cy.dataCy(selectors.saveFormBtn).should('be.visible').click();
cy.checkNotification(dataSaved);
- cy.typeSearchbar('{enter}');
});
it('Should display the total price of the selected rows', () => {
diff --git a/test/cypress/integration/route/routeExtendedList.spec.js b/test/cypress/integration/route/routeExtendedList.spec.js
index a183c08cb..e6c873d5e 100644
--- a/test/cypress/integration/route/routeExtendedList.spec.js
+++ b/test/cypress/integration/route/routeExtendedList.spec.js
@@ -53,17 +53,20 @@ describe('Route extended list', () => {
function fillField(selector, type, value) {
switch (type) {
case 'select':
- cy.get(selector).should('be.visible').click();
- cy.dataCy('null_select').clear().type(value);
+ cy.get(selector).should('be.visible').click().clear().type(value);
cy.get('.q-item').contains(value).click();
break;
case 'input':
- cy.get(selector).should('be.visible').click();
- cy.dataCy('null_input').clear().type(`${value}`);
+ cy.get(selector)
+ .should('be.visible')
+ .click()
+ .type(`{selectall}{backspace}${value}`);
break;
case 'date':
- cy.get(selector).should('be.visible').click();
- cy.dataCy('null_inputDate').clear().type(`${value}`);
+ cy.get(selector)
+ .should('be.visible')
+ .click()
+ .type(`{selectall}{backspace}${value}`);
break;
case 'checkbox':
cy.get(selector).should('be.visible').click().click();
@@ -103,8 +106,8 @@ describe('Route extended list', () => {
cy.fillInForm(data);
cy.dataCy(selectors.saveFormBtn).click();
- cy.checkNotification(dataCreated);
cy.url().should('include', '/summary');
+ cy.checkNotification(dataCreated);
});
it('Should reset changed values when click reset button', () => {
@@ -140,7 +143,7 @@ describe('Route extended list', () => {
const downloadsFolder = Cypress.config('downloadsFolder');
cy.get(selectors.lastRowSelectCheckBox).click();
cy.get(selectors.downloadBtn).click();
- cy.wait(5000);
+ cy.wait(3000);
const fileName = 'download.zip';
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
@@ -177,7 +180,7 @@ describe('Route extended list', () => {
const [month, day, year] = value.split('/');
value = `${day}/${month}/${year}`;
}
- cy.validateContent(selector, value);
+ cy.get(selector).should('contain', value);
});
});
diff --git a/test/cypress/integration/route/vehicle/vehicleNotes.spec.js b/test/cypress/integration/route/vehicle/vehicleNotes.spec.js
new file mode 100644
index 000000000..cd92cc4af
--- /dev/null
+++ b/test/cypress/integration/route/vehicle/vehicleNotes.spec.js
@@ -0,0 +1,28 @@
+describe('Vehicle Notes', () => {
+ const selectors = {
+ addNoteInput: 'Add note here..._input',
+ saveNoteBtn: 'saveNote',
+ deleteNoteBtn: 'notesRemoveNoteBtn',
+ noteCard: '.column.full-width > :nth-child(1) > .q-card__section--vert',
+ };
+
+ const noteText = 'Golpe parachoques trasero';
+ const newNoteText = 'probando';
+
+ beforeEach(() => {
+ cy.viewport(1920, 1080);
+ cy.login('developer');
+ cy.visit(`/#/route/vehicle/1/notes`);
+ });
+
+ it('Should add new note', () => {
+ cy.dataCy(selectors.addNoteInput).should('be.visible').type(newNoteText);
+ cy.dataCy(selectors.saveNoteBtn).click();
+ cy.validateContent(selectors.noteCard, newNoteText);
+ });
+
+ it('Should delete note', () => {
+ cy.dataCy(selectors.deleteNoteBtn).first().should('be.visible').click();
+ cy.get(selectors.noteCard).first().should('have.text', noteText);
+ });
+});
diff --git a/test/cypress/integration/ticket/ticketDescriptor.spec.js b/test/cypress/integration/ticket/ticketDescriptor.spec.js
index 0ba2723a2..b5c95c463 100644
--- a/test/cypress/integration/ticket/ticketDescriptor.spec.js
+++ b/test/cypress/integration/ticket/ticketDescriptor.spec.js
@@ -3,10 +3,10 @@ describe('Ticket descriptor', () => {
const listItem = '[role="menu"] .q-list .q-item';
const toCloneOpt = 'To clone ticket';
const setWeightOpt = 'Set weight';
- const warehouseValue = ':nth-child(1) > :nth-child(6) > .value > span';
+ const warehouseValue = ':nth-child(1) > [data-cy="vnLvWarehouse"]';
const summaryHeader = '.summaryHeader > div';
const weight = 25;
- const weightValue = '.summaryBody.row :nth-child(1) > :nth-child(9) > .value > span';
+ const weightValue = '[data-cy="vnLvWeight"]';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
diff --git a/test/cypress/integration/vnComponent/UserPanel.spec.js b/test/cypress/integration/vnComponent/UserPanel.spec.js
index 25724e873..8722fe37e 100644
--- a/test/cypress/integration/vnComponent/UserPanel.spec.js
+++ b/test/cypress/integration/vnComponent/UserPanel.spec.js
@@ -39,11 +39,11 @@ describe('UserPanel', () => {
cy.get(userCompany).should('have.value', 'Warehouse One').click();
//Actualizo la opción
- cy.getOption(2);
+ cy.getOption(3);
//Compruebo la notificación
cy.get('.q-notification').should('be.visible');
- cy.get(userCompany).should('have.value', 'Warehouse Two');
+ cy.get(userCompany).should('have.value', 'TestingWarehouse');
//Restauro el valor
cy.get(userCompany).click();
diff --git a/test/cypress/integration/vnComponent/VnAccountNumber.spec.js b/test/cypress/integration/vnComponent/VnAccountNumber.spec.js
deleted file mode 100644
index 053902f35..000000000
--- a/test/cypress/integration/vnComponent/VnAccountNumber.spec.js
+++ /dev/null
@@ -1,37 +0,0 @@
-describe('VnAccountNumber', () => {
- const accountInput = 'input[data-cy="supplierFiscalDataAccount_input"]';
- beforeEach(() => {
- cy.login('developer');
- cy.viewport(1920, 1080);
- cy.visit('/#/supplier/1/fiscal-data');
- });
-
- describe('VnInput handleInsertMode()', () => {
- it('should replace character at cursor position in insert mode', () => {
- cy.get(accountInput).type('{selectall}4100000001');
- cy.get(accountInput).type('{movetostart}');
- cy.get(accountInput).type('999');
- cy.get(accountInput).should('have.value', '9990000001');
- });
-
- it('should replace character at cursor position in insert mode', () => {
- cy.get(accountInput).clear();
- cy.get(accountInput).type('4100000001');
- cy.get(accountInput).type('{movetostart}');
- cy.get(accountInput).type('999');
- cy.get(accountInput).should('have.value', '9990000001');
- });
-
- it('should respect maxlength prop', () => {
- cy.get(accountInput).clear();
- cy.get(accountInput).type('123456789012345');
- cy.get(accountInput).should('have.value', '1234567890');
- });
- });
-
- it('should convert short account number to standard format', () => {
- cy.get(accountInput).clear();
- cy.get(accountInput).type('123.');
- cy.get(accountInput).should('have.value', '1230000000');
- });
-});
diff --git a/test/cypress/integration/vnComponent/VnLog.spec.js b/test/cypress/integration/vnComponent/VnLog.spec.js
index ae0013150..57faeac85 100644
--- a/test/cypress/integration/vnComponent/VnLog.spec.js
+++ b/test/cypress/integration/vnComponent/VnLog.spec.js
@@ -1,26 +1,23 @@
///
describe('VnLog', () => {
- const chips = [
- ':nth-child(1) > :nth-child(1) > .q-item__label > .q-chip > .q-chip__content',
- ':nth-child(2) > :nth-child(1) > .q-item__label > .q-chip > .q-chip__content',
- ];
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/claim/${1}/log`);
- cy.openRightMenu();
});
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');
+ cy.get('[data-cy="vnLog-checkbox"]').eq(0).click();
+ cy.get('[data-cy="vnLog-action-icon"]').each(($el) => {
+ cy.wrap($el).should('have.attr', 'title', 'Creates');
+ });
});
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');
+ const entity = 'Document';
+ cy.selectOption('[data-cy="vnLog-entity"]', entity);
+ cy.get('[data-cy="vnLog-model-chip"]').each(($el) => {
+ cy.wrap($el).should('have.text', entity);
+ });
});
it('should show claimDescriptor', () => {
diff --git a/test/cypress/integration/vnComponent/VnShortcut.spec.js b/test/cypress/integration/vnComponent/VnShortcut.spec.js
index e08c44635..fa05e2e3d 100644
--- a/test/cypress/integration/vnComponent/VnShortcut.spec.js
+++ b/test/cypress/integration/vnComponent/VnShortcut.spec.js
@@ -27,12 +27,15 @@ describe('VnShortcuts', () => {
code: `Key${shortcut.toUpperCase()}`,
});
+ cy.waitSpinner();
cy.url().should('include', module);
if (['monitor', 'claim'].includes(module)) {
return;
}
cy.waitForElement('.q-page').should('exist');
cy.dataCy('vnTableCreateBtn').should('exist');
+ cy.waitSpinner();
+
cy.get('.q-page').trigger('keydown', {
ctrlKey: true,
altKey: true,
diff --git a/test/cypress/integration/worker/workerSummary.spec.js b/test/cypress/integration/worker/workerSummary.spec.js
index c50b2c943..6071c4cdf 100644
--- a/test/cypress/integration/worker/workerSummary.spec.js
+++ b/test/cypress/integration/worker/workerSummary.spec.js
@@ -1,27 +1,25 @@
describe('WorkerSummary', () => {
- const departmentDescriptor = ':nth-child(1) > :nth-child(3) > .value > .link';
- const roleDescriptor = ':nth-child(3) > :nth-child(4) > .value > .link';
+ const department = ':nth-child(1) > [data-cy="vnLvDepartment"] > .value';
+ const role = '[data-cy="vnLvRole"] > .value';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/worker/19/summary');
});
- it('should load worker summary', () => {
+ it('should load worker summary and show the department', () => {
cy.waitForElement('.summaryHeader');
cy.get('.summaryHeader > div').should('have.text', '19 - salesboss salesboss');
- cy.get(':nth-child(1) > :nth-child(2) > .value > span').should(
- 'have.text',
- 'salesBossNick',
- );
+ cy.get(department).should('have.text', 'VENTAS');
});
it('should try descriptors', () => {
cy.waitForElement('.summaryHeader');
- cy.get(departmentDescriptor).click();
+ cy.get(department).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '43');
- cy.get(roleDescriptor).click();
+ cy.get('.summaryBody').click();
+ cy.get(role).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '19');
});