-
-
- {{ 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 921a9a72e..95d3279f0 100644
--- a/src/router/modules/route.js
+++ b/src/router/modules/route.js
@@ -168,6 +168,7 @@ const vehicleCard = {
meta: {
menu: [
'VehicleBasicData',
+ 'VehicleNotes',
'VehicleDms',
],
},
@@ -190,6 +191,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'),
+ }
{
name: 'VehicleDms',
path: 'dms',
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/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/entryBuys.spec.js b/test/cypress/integration/entry/entryCard/entryBuys.spec.js
index f8f5e6b80..b5e185a8e 100644
--- a/test/cypress/integration/entry/entryCard/entryBuys.spec.js
+++ b/test/cypress/integration/entry/entryCard/entryBuys.spec.js
@@ -80,6 +80,11 @@ describe('EntryBuys', () => {
checkColor('amount', COLORS.positive);
cy.saveCard();
+ cy.get('tbody > tr [tabindex="0"][role="checkbox"]').click();
+ cy.dataCy('transferBuys').should('be.enabled').click();
+ cy.dataCy('entryDestinyInput').should('be.visible').type('100');
+ cy.dataCy('transferBuysBtn').click();
+
cy.deleteEntry();
});
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/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/invoiceInSerial.spec.js b/test/cypress/integration/invoiceIn/invoiceInSerial.spec.js
index faad22f12..3750f8f06 100644
--- a/test/cypress/integration/invoiceIn/invoiceInSerial.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInSerial.spec.js
@@ -10,14 +10,16 @@ describe('InvoiceInSerial', () => {
});
it('should filter by last days ', () => {
- let before;
cy.dataCy('vnTableCell_total')
.invoke('text')
- .then((total) => (before = +total));
-
- cy.dataCy('Last days_input').type('{selectall}1{enter}');
- cy.dataCy('vnTableCell_total')
- .invoke('text')
- .then((total) => expect(+total).to.be.lessThan(before));
+ .then((before) => {
+ cy.dataCy('Last days_input')
+ .type('{selectall}1{enter}')
+ .then(() => {
+ cy.dataCy('vnTableCell_total')
+ .invoke('text')
+ .then((after) => expect(+after).to.be.lessThan(+before));
+ });
+ });
});
});
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/route/cmr/cmrList.spec.js b/test/cypress/integration/route/cmr/cmrList.spec.js
new file mode 100644
index 000000000..d33508e3a
--- /dev/null
+++ b/test/cypress/integration/route/cmr/cmrList.spec.js
@@ -0,0 +1,91 @@
+describe('Cmr list', () => {
+ const getLinkSelector = (colField) =>
+ `tr:first-child > [data-col-field="${colField}"] > .no-padding > .link`;
+
+ const selectors = {
+ ticket: getLinkSelector('ticketFk'),
+ client: getLinkSelector('clientFk'),
+ lastRowSelectCheckBox:
+ '.q-virtual-scroll__content > tr:last-child > :nth-child(1) > .q-checkbox',
+ downloadBtn: '#subToolbar > .q-btn',
+ viewCmr: 'tableAction-0',
+ descriptorOpenSummaryBtn: '.descriptor [data-cy="openSummaryBtn"]',
+ summaryTitle: '.summaryHeader',
+ descriptorId: '.descriptor .subtitle',
+ descriptorTitle: '.descriptor .title',
+ summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
+ descriptorGoToSummaryBtn: '.descriptor [data-cy="goToSummaryBtn"]',
+ removeFilter: '.q-chip__icon--remove',
+ };
+
+ const data = {
+ ticket: '1',
+ client: 'Bruce Wayne',
+ };
+
+ beforeEach(() => {
+ cy.viewport(1920, 1080);
+ cy.login('developer');
+ cy.visit('/#/route/cmr');
+ cy.typeSearchbar('{enter}');
+ cy.get(selectors.removeFilter).click();
+ });
+
+ it('Should download selected cmr', () => {
+ const downloadsFolder = Cypress.config('downloadsFolder');
+ cy.get(selectors.lastRowSelectCheckBox).should('be.visible').click();
+ cy.get(selectors.downloadBtn).should('be.visible').click();
+ cy.wait(3000);
+
+ const fileName = 'cmrs.zip';
+ cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
+ });
+
+ it('Should open selected cmr pdf', () => {
+ cy.window().then((win) => {
+ cy.stub(win, 'open').as('windowOpen');
+ });
+ cy.dataCy(selectors.viewCmr).last().click();
+ cy.get('@windowOpen').should('be.calledWithMatch', '\/api\/Cmrs\/3');
+ });
+
+ describe('Ticket pop-ups', () => {
+ it('Should redirect to the ticket summary from the ticket descriptor pop-up', () => {
+ cy.get(selectors.ticket).should('be.visible').click();
+ cy.containContent(selectors.descriptorId, data.ticket);
+ cy.get(selectors.descriptorGoToSummaryBtn).should('be.visible').click();
+ cy.url().should('include', '/ticket/1/summary');
+ cy.containContent(selectors.summaryTitle, data.client);
+ });
+
+ it('Should redirect to the ticket summary from summary pop-up from the ticket descriptor pop-up', () => {
+ cy.get(selectors.ticket).should('be.visible').click();
+ cy.containContent(selectors.descriptorId, data.ticket);
+ cy.get(selectors.descriptorOpenSummaryBtn).should('be.visible').click();
+ cy.containContent(selectors.summaryTitle, data.client);
+ cy.get(selectors.summaryGoToSummaryBtn).should('be.visible').click();
+ cy.url().should('include', '/ticket/1/summary');
+ cy.containContent(selectors.summaryTitle, data.client);
+ });
+ });
+
+ describe('Client pop-ups', () => {
+ it('Should redirect to the client summary from the client descriptor pop-up', () => {
+ cy.get(selectors.client).should('be.visible').click();
+ cy.containContent(selectors.descriptorTitle, data.client);
+ cy.get(selectors.descriptorGoToSummaryBtn).should('be.visible').click();
+ cy.url().should('include', '/customer/1101/summary');
+ cy.containContent(selectors.summaryTitle, data.client);
+ });
+
+ it('Should redirect to the client summary from summary pop-up from the client descriptor pop-up', () => {
+ cy.get(selectors.client).should('be.visible').click();
+ cy.containContent(selectors.descriptorTitle, data.client);
+ cy.get(selectors.descriptorOpenSummaryBtn).should('be.visible').click();
+ cy.containContent(selectors.summaryTitle, data.client);
+ cy.get(selectors.summaryGoToSummaryBtn).should('be.visible').click();
+ cy.url().should('include', '/customer/1101/summary');
+ cy.containContent(selectors.summaryTitle, data.client);
+ });
+ });
+});
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/route/routeExtendedList.spec.js b/test/cypress/integration/route/routeExtendedList.spec.js
index fb2885f35..a183c08cb 100644
--- a/test/cypress/integration/route/routeExtendedList.spec.js
+++ b/test/cypress/integration/route/routeExtendedList.spec.js
@@ -154,10 +154,9 @@ describe('Route extended list', () => {
cy.validateContent(selectors.served, checkboxState.check);
});
- it('Should delete the selected routes', () => {
+ it('Should delete the selected route', () => {
cy.get(selectors.lastRowSelectCheckBox).click();
cy.get(selectors.removeBtn).click();
-
cy.dataCy(selectors.confirmBtn).click();
cy.checkNotification(dataSaved);
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/ticket/ticketList.spec.js b/test/cypress/integration/ticket/ticketList.spec.js
index a3d8fe908..5613a5854 100644
--- a/test/cypress/integration/ticket/ticketList.spec.js
+++ b/test/cypress/integration/ticket/ticketList.spec.js
@@ -35,7 +35,7 @@ describe('TicketList', () => {
cy.get('.summaryBody').should('exist');
});
- it.skip('filter client and create ticket', () => {
+ it('filter client and create ticket', () => {
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketSearchbar');
searchResults();
cy.wait('@ticketSearchbar');
@@ -44,6 +44,7 @@ describe('TicketList', () => {
cy.dataCy('Customer ID_input').type('1101{enter}');
cy.get('[data-cy="vnTableCreateBtn"] > .q-btn__content > .q-icon').click();
+ cy.waitSpinner();
cy.dataCy('Customer_select').should('have.value', 'Bruce Wayne');
cy.dataCy('Address_select').click();
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/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/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');
});