{
beforeEach(() => {
wrapper = createWrapper(CardSummary, {
+ global: {
+ mocks: {
+ validate: vi.fn(),
+ },
+ },
propsData: {
dataKey: 'cardSummaryKey',
url: 'cardSummaryUrl',
- filter: 'cardFilter',
+ filter: { key: 'cardFilter' },
},
});
vm = wrapper.vm;
@@ -50,7 +55,7 @@ describe('CardSummary', () => {
it('should set correct props to the store', () => {
expect(vm.store.url).toEqual('cardSummaryUrl');
- expect(vm.store.filter).toEqual('cardFilter');
+ expect(vm.store.filter).toEqual({ key: 'cardFilter' });
});
it('should respond to prop changes and refetch data', async () => {
diff --git a/src/components/ui/__tests__/VnSearchbar.spec.js b/src/components/ui/__tests__/VnSearchbar.spec.js
index 25649194d..64014e8d8 100644
--- a/src/components/ui/__tests__/VnSearchbar.spec.js
+++ b/src/components/ui/__tests__/VnSearchbar.spec.js
@@ -7,7 +7,7 @@ describe('VnSearchbar', () => {
let wrapper;
let applyFilterSpy;
const searchText = 'Bolas de madera';
- const userParams = {staticKey: 'staticValue'};
+ const userParams = { staticKey: 'staticValue' };
beforeEach(async () => {
wrapper = createWrapper(VnSearchbar, {
@@ -23,8 +23,9 @@ describe('VnSearchbar', () => {
vm.searchText = searchText;
vm.arrayData.store.userParams = userParams;
- applyFilterSpy = vi.spyOn(vm.arrayData, 'applyFilter').mockImplementation(() => {});
-
+ applyFilterSpy = vi
+ .spyOn(vm.arrayData, 'applyFilter')
+ .mockImplementation(() => {});
});
afterEach(() => {
@@ -32,7 +33,9 @@ describe('VnSearchbar', () => {
});
it('search resets pagination and applies filter', async () => {
- const resetPaginationSpy = vi.spyOn(vm.arrayData, 'resetPagination').mockImplementation(() => {});
+ const resetPaginationSpy = vi
+ .spyOn(vm.arrayData, 'resetPagination')
+ .mockImplementation(() => {});
await vm.search();
expect(resetPaginationSpy).toHaveBeenCalled();
@@ -48,7 +51,7 @@ describe('VnSearchbar', () => {
expect(applyFilterSpy).toHaveBeenCalledWith({
params: { staticKey: 'staticValue', search: searchText },
- filter: {skip: 0},
+ filter: { skip: 0 },
});
});
@@ -68,4 +71,4 @@ describe('VnSearchbar', () => {
});
expect(vm.to.query.searchParam).toBe(expectedQuery);
});
-});
\ No newline at end of file
+});
diff --git a/src/components/ui/__tests__/VnSms.spec.js b/src/components/ui/__tests__/VnSms.spec.js
index 4f4fd7d49..b71d8ccb0 100644
--- a/src/components/ui/__tests__/VnSms.spec.js
+++ b/src/components/ui/__tests__/VnSms.spec.js
@@ -1,5 +1,4 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
-import axios from 'axios';
import { createWrapper } from 'app/test/vitest/helper';
import VnSms from 'src/components/ui/VnSms.vue';
@@ -12,6 +11,9 @@ describe('VnSms', () => {
stubs: ['VnPaginate'],
mocks: {},
},
+ propsData: {
+ url: 'SmsUrl',
+ },
}).vm;
});
diff --git a/src/composables/__tests__/useArrayData.spec.js b/src/composables/__tests__/useArrayData.spec.js
index a3fbbdd5d..74be8ccff 100644
--- a/src/composables/__tests__/useArrayData.spec.js
+++ b/src/composables/__tests__/useArrayData.spec.js
@@ -4,6 +4,8 @@ import { useArrayData } from 'composables/useArrayData';
import { useRouter } from 'vue-router';
import * as vueRouter from 'vue-router';
import { setActivePinia, createPinia } from 'pinia';
+import { defineComponent, h } from 'vue';
+import { mount } from '@vue/test-utils';
describe('useArrayData', () => {
const filter = '{"limit":20,"skip":0}';
@@ -43,7 +45,7 @@ describe('useArrayData', () => {
it('should fetch and replace url with new params', async () => {
vi.spyOn(axios, 'get').mockResolvedValueOnce({ data: [] });
- const arrayData = useArrayData('ArrayData', {
+ const arrayData = mountArrayData('ArrayData', {
url: 'mockUrl',
searchUrl: 'params',
});
@@ -72,7 +74,7 @@ describe('useArrayData', () => {
data: [{ id: 1 }],
});
- const arrayData = useArrayData('ArrayData', {
+ const arrayData = mountArrayData('ArrayData', {
url: 'mockUrl',
navigate: {},
});
@@ -94,7 +96,7 @@ describe('useArrayData', () => {
],
});
- const arrayData = useArrayData('ArrayData', {
+ const arrayData = mountArrayData('ArrayData', {
url: 'mockUrl',
oneRecord: true,
});
@@ -107,3 +109,17 @@ describe('useArrayData', () => {
});
});
});
+
+function mountArrayData(...args) {
+ let arrayData;
+
+ const TestComponent = defineComponent({
+ setup() {
+ arrayData = useArrayData(...args);
+ return () => h('div');
+ },
+ });
+
+ const asd = mount(TestComponent);
+ return arrayData;
+}
diff --git a/src/composables/__tests__/useSession.spec.js b/src/composables/__tests__/useSession.spec.js
index e86847b70..eb390e096 100644
--- a/src/composables/__tests__/useSession.spec.js
+++ b/src/composables/__tests__/useSession.spec.js
@@ -64,88 +64,84 @@ describe('session', () => {
});
});
- describe(
- 'login',
- () => {
- const expectedUser = {
- id: 999,
- name: `T'Challa`,
- nickname: 'Black Panther',
- lang: 'en',
- userConfig: {
- darkMode: false,
+ describe('login', () => {
+ const expectedUser = {
+ id: 999,
+ name: `T'Challa`,
+ nickname: 'Black Panther',
+ lang: 'en',
+ userConfig: {
+ darkMode: false,
+ },
+ worker: { department: { departmentFk: 155 } },
+ };
+ const rolesData = [
+ {
+ role: {
+ name: 'salesPerson',
},
- worker: { department: { departmentFk: 155 } },
- };
- const rolesData = [
- {
- role: {
- name: 'salesPerson',
- },
+ },
+ {
+ role: {
+ name: 'admin',
},
- {
- role: {
- name: 'admin',
- },
- },
- ];
- beforeEach(() => {
- vi.spyOn(axios, 'get').mockImplementation((url) => {
- if (url === 'VnUsers/acls') return Promise.resolve({ data: [] });
- return Promise.resolve({
- data: { roles: rolesData, user: expectedUser },
- });
+ },
+ ];
+ beforeEach(() => {
+ vi.spyOn(axios, 'get').mockImplementation((url) => {
+ if (url === 'VnUsers/acls') return Promise.resolve({ data: [] });
+ return Promise.resolve({
+ data: { roles: rolesData, user: expectedUser },
});
});
+ });
- it('should fetch the user roles and then set token in the sessionStorage', async () => {
- const expectedRoles = ['salesPerson', 'admin'];
- const expectedToken = 'mySessionToken';
- const expectedTokenMultimedia = 'mySessionTokenMultimedia';
- const keepLogin = false;
+ it('should fetch the user roles and then set token in the sessionStorage', async () => {
+ const expectedRoles = ['salesPerson', 'admin'];
+ const expectedToken = 'mySessionToken';
+ const expectedTokenMultimedia = 'mySessionTokenMultimedia';
+ const keepLogin = false;
- await session.login({
- token: expectedToken,
- tokenMultimedia: expectedTokenMultimedia,
- keepLogin,
- });
-
- const roles = state.getRoles();
- const localToken = localStorage.getItem('token');
- const sessionToken = sessionStorage.getItem('token');
-
- expect(roles.value).toEqual(expectedRoles);
- expect(localToken).toBeNull();
- expect(sessionToken).toEqual(expectedToken);
-
- await session.destroy(); // this clears token and user for any other test
+ await session.login({
+ token: expectedToken,
+ tokenMultimedia: expectedTokenMultimedia,
+ keepLogin,
});
- it('should fetch the user roles and then set token in the localStorage', async () => {
- const expectedRoles = ['salesPerson', 'admin'];
- const expectedToken = 'myLocalToken';
- const expectedTokenMultimedia = 'myLocalTokenMultimedia';
- const keepLogin = true;
+ const roles = state.getRoles();
+ const localToken = localStorage.getItem('token');
+ const sessionToken = sessionStorage.getItem('token');
- await session.login({
- token: expectedToken,
- tokenMultimedia: expectedTokenMultimedia,
- keepLogin,
- });
+ expect(roles.value).toEqual(expectedRoles);
+ expect(localToken).toBeNull();
+ expect(sessionToken).toEqual(expectedToken);
- const roles = state.getRoles();
- const localToken = localStorage.getItem('token');
- const sessionToken = sessionStorage.getItem('token');
+ await session.destroy(); // this clears token and user for any other test
+ });
- expect(roles.value).toEqual(expectedRoles);
- expect(localToken).toEqual(expectedToken);
- expect(sessionToken).toBeNull();
+ it('should fetch the user roles and then set token in the localStorage', async () => {
+ const expectedRoles = ['salesPerson', 'admin'];
+ const expectedToken = 'myLocalToken';
+ const expectedTokenMultimedia = 'myLocalTokenMultimedia';
+ const keepLogin = true;
- await session.destroy(); // this clears token and user for any other test
+ await session.login({
+ token: expectedToken,
+ tokenMultimedia: expectedTokenMultimedia,
+ keepLogin,
});
- },
- {},
- );
+
+ const roles = state.getRoles();
+ const localToken = localStorage.getItem('token');
+ const sessionToken = sessionStorage.getItem('token');
+
+ expect(roles.value).toEqual(expectedRoles);
+ expect(localToken).toEqual(expectedToken);
+ expect(sessionToken).toBeNull();
+
+ await session.destroy(); // this clears token and user for any other test
+ });
+ });
describe('RenewToken', () => {
const expectedToken = 'myToken';
diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml
index 4f4d1d5f7..5f21ea15e 100644
--- a/src/i18n/locale/en.yml
+++ b/src/i18n/locale/en.yml
@@ -6,6 +6,7 @@ globals:
quantity: Quantity
entity: Entity
preview: Preview
+ scrollToTop: Go up
user: User
details: Details
collapseMenu: Collapse lateral menu
@@ -19,6 +20,7 @@ globals:
logOut: Log out
date: Date
dataSaved: Data saved
+ openDetail: Open detail
dataDeleted: Data deleted
delete: Delete
search: Search
@@ -160,6 +162,9 @@ globals:
department: Department
noData: No data available
vehicle: Vehicle
+ selectDocumentId: Select document id
+ document: Document
+ import: Import from existing
pageTitles:
logIn: Login
addressEdit: Update address
diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml
index 9c808e046..fcaac9790 100644
--- a/src/i18n/locale/es.yml
+++ b/src/i18n/locale/es.yml
@@ -6,6 +6,7 @@ globals:
quantity: Cantidad
entity: Entidad
preview: Vista previa
+ scrollToTop: Ir arriba
user: Usuario
details: Detalles
collapseMenu: Contraer menú lateral
@@ -20,10 +21,11 @@ globals:
date: Fecha
dataSaved: Datos guardados
dataDeleted: Datos eliminados
+ dataCreated: Datos creados
+ openDetail: Ver detalle
delete: Eliminar
search: Buscar
changes: Cambios
- dataCreated: Datos creados
add: Añadir
create: Crear
edit: Modificar
@@ -164,6 +166,9 @@ globals:
noData: Datos no disponibles
department: Departamento
vehicle: Vehículo
+ selectDocumentId: Seleccione el id de gestión documental
+ document: Documento
+ import: Importar desde existente
pageTitles:
logIn: Inicio de sesión
addressEdit: Modificar consignatario
diff --git a/src/pages/Claim/Card/ClaimPhoto.vue b/src/pages/Claim/Card/ClaimPhoto.vue
index 4ced7e862..f02038afe 100644
--- a/src/pages/Claim/Card/ClaimPhoto.vue
+++ b/src/pages/Claim/Card/ClaimPhoto.vue
@@ -23,7 +23,7 @@ const claimDms = ref([
]);
const client = ref({});
const inputFile = ref();
-const files = ref({});
+const files = ref([]);
const spinnerRef = ref();
const claimDmsRef = ref();
const dmsType = ref({});
@@ -255,9 +255,8 @@ function onDrag() {
icon="add"
color="primary"
>
-
{
expectedData,
{
signal: canceller.signal,
- }
+ },
);
});
});
@@ -69,7 +69,7 @@ describe('ClaimLines', () => {
expect.objectContaining({
message: 'Discount updated',
type: 'positive',
- })
+ }),
);
});
});
diff --git a/src/pages/Claim/Card/__tests__/ClaimLinesImport.spec.js b/src/pages/Claim/Card/__tests__/ClaimLinesImport.spec.js
index 2a5176d0a..cec4b1681 100644
--- a/src/pages/Claim/Card/__tests__/ClaimLinesImport.spec.js
+++ b/src/pages/Claim/Card/__tests__/ClaimLinesImport.spec.js
@@ -14,6 +14,9 @@ describe('ClaimLinesImport', () => {
fetch: vi.fn(),
},
},
+ propsData: {
+ ticketId: 1,
+ },
}).vm;
});
@@ -40,7 +43,7 @@ describe('ClaimLinesImport', () => {
expect.objectContaining({
message: 'Lines added to claim',
type: 'positive',
- })
+ }),
);
expect(vm.canceller).toEqual(null);
});
diff --git a/src/pages/Claim/Card/__tests__/ClaimPhoto.spec.js b/src/pages/Claim/Card/__tests__/ClaimPhoto.spec.js
index b14338b5c..bf3548af3 100644
--- a/src/pages/Claim/Card/__tests__/ClaimPhoto.spec.js
+++ b/src/pages/Claim/Card/__tests__/ClaimPhoto.spec.js
@@ -41,10 +41,10 @@ describe('ClaimPhoto', () => {
await vm.deleteDms({ index: 0 });
expect(axios.post).toHaveBeenCalledWith(
- `ClaimDms/${claimMock.claimDms[0].dmsFk}/removeFile`
+ `ClaimDms/${claimMock.claimDms[0].dmsFk}/removeFile`,
);
expect(vm.quasar.notify).toHaveBeenCalledWith(
- expect.objectContaining({ type: 'positive' })
+ expect.objectContaining({ type: 'positive' }),
);
});
});
@@ -63,7 +63,7 @@ describe('ClaimPhoto', () => {
data: { index: 1 },
promise: vm.deleteDms,
},
- })
+ }),
);
});
});
@@ -102,10 +102,10 @@ describe('ClaimPhoto', () => {
new FormData(),
expect.objectContaining({
params: expect.objectContaining({ hasFile: false }),
- })
+ }),
);
expect(vm.quasar.notify).toHaveBeenCalledWith(
- expect.objectContaining({ type: 'positive' })
+ expect.objectContaining({ type: 'positive' }),
);
expect(vm.claimDmsRef.fetch).toHaveBeenCalledOnce();
diff --git a/src/pages/Customer/Card/CustomerDescriptor.vue b/src/pages/Customer/Card/CustomerDescriptor.vue
index c7461f890..8b4e025a2 100644
--- a/src/pages/Customer/Card/CustomerDescriptor.vue
+++ b/src/pages/Customer/Card/CustomerDescriptor.vue
@@ -39,7 +39,7 @@ const route = useRoute();
const { t } = useI18n();
const entityId = computed(() => {
- return $props.id || route.params.id;
+ return Number($props.id || route.params.id);
});
const data = ref(useCardDescription());
diff --git a/src/pages/Customer/Card/CustomerDescriptorProxy.vue b/src/pages/Customer/Card/CustomerDescriptorProxy.vue
index 9f67d02ec..f1e4b42b8 100644
--- a/src/pages/Customer/Card/CustomerDescriptorProxy.vue
+++ b/src/pages/Customer/Card/CustomerDescriptorProxy.vue
@@ -11,7 +11,7 @@ const $props = defineProps({
-
+
diff --git a/src/pages/Customer/Card/CustomerFiscalData.vue b/src/pages/Customer/Card/CustomerFiscalData.vue
index baa728868..f4efd03b6 100644
--- a/src/pages/Customer/Card/CustomerFiscalData.vue
+++ b/src/pages/Customer/Card/CustomerFiscalData.vue
@@ -86,7 +86,7 @@ async function acceptPropagate({ isEqualizated }) {
:required="true"
:rules="validate('client.socialName')"
clearable
- uppercase="true"
+ :uppercase="true"
v-model="data.socialName"
>
diff --git a/src/pages/Customer/Card/CustomerSamples.vue b/src/pages/Customer/Card/CustomerSamples.vue
index 756ae4667..44fab8e72 100644
--- a/src/pages/Customer/Card/CustomerSamples.vue
+++ b/src/pages/Customer/Card/CustomerSamples.vue
@@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { QBtn, useQuasar } from 'quasar';
-
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import { toDateTimeFormat } from 'src/filters/date';
import VnTable from 'src/components/VnTable/VnTable.vue';
@@ -74,12 +73,11 @@ const tableRef = ref();
$props.id || route.params.id);
+const entityId = computed(() => Number($props.id || route.params.id));
const customer = computed(() => summary.value.entity);
const summary = ref();
const defaulterAmount = computed(() => customer.value.defaulters[0]?.amount);
diff --git a/src/pages/Customer/CustomerFilter.vue b/src/pages/Customer/CustomerFilter.vue
index c30b11528..48538aa2a 100644
--- a/src/pages/Customer/CustomerFilter.vue
+++ b/src/pages/Customer/CustomerFilter.vue
@@ -72,7 +72,7 @@ const exprBuilder = (param, value) => {
option-value="id"
option-label="name"
url="Departments"
- no-one="true"
+ :no-one="true"
/>
diff --git a/src/pages/Customer/Payments/__tests__/CustomerPayments.spec.js b/src/pages/Customer/Payments/__tests__/CustomerPayments.spec.js
index a9c845cec..238545050 100644
--- a/src/pages/Customer/Payments/__tests__/CustomerPayments.spec.js
+++ b/src/pages/Customer/Payments/__tests__/CustomerPayments.spec.js
@@ -32,7 +32,7 @@ describe('CustomerPayments', () => {
expect.objectContaining({
message: 'Payment confirmed',
type: 'positive',
- })
+ }),
);
});
});
diff --git a/src/pages/Customer/components/CustomerSamplesCreate.vue b/src/pages/Customer/components/CustomerSamplesCreate.vue
index 1294a5d25..dfa944748 100644
--- a/src/pages/Customer/components/CustomerSamplesCreate.vue
+++ b/src/pages/Customer/components/CustomerSamplesCreate.vue
@@ -41,7 +41,6 @@ const sampleType = ref({ hasPreview: false });
const initialData = reactive({});
const entityId = computed(() => route.params.id);
const customer = computed(() => useArrayData('Customer').store?.data);
-const filterEmailUsers = { where: { userFk: user.value.id } };
const filterClientsAddresses = {
include: [
{ relation: 'province', scope: { fields: ['name'] } },
@@ -73,7 +72,7 @@ onBeforeMount(async () => {
const setEmailUser = (data) => {
optionsEmailUsers.value = data;
- initialData.replyTo = data[0]?.email;
+ initialData.replyTo = data[0]?.notificationEmail;
};
const setClientsAddresses = (data) => {
@@ -182,10 +181,12 @@ const toCustomerSamples = () => {
diff --git a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue
index 53433c56b..6d6dd2f51 100644
--- a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue
+++ b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue
@@ -164,6 +164,7 @@ onMounted(async () => {
unelevated
filled
dense
+ data-cy="formSubmitBtn"
/>
{
filled
dense
@click="getStatus = 'stopping'"
+ data-cy="formStopBtn"
/>
diff --git a/src/pages/Item/Card/ItemTags.vue b/src/pages/Item/Card/ItemTags.vue
index 3522c8363..ede9ba9b5 100644
--- a/src/pages/Item/Card/ItemTags.vue
+++ b/src/pages/Item/Card/ItemTags.vue
@@ -96,7 +96,6 @@ const insertTag = (rows) => {
:default-remove="false"
:user-filter="{
fields: ['id', 'itemFk', 'tagFk', 'value', 'priority'],
- where: { itemFk: route.params.id },
include: {
relation: 'tag',
scope: {
@@ -104,6 +103,7 @@ const insertTag = (rows) => {
},
},
}"
+ :filter="{ where: { itemFk: route.params.id } }"
order="priority"
auto-load
@on-fetch="onItemTagsFetched"
diff --git a/src/pages/Item/components/ItemProposal.vue b/src/pages/Item/components/ItemProposal.vue
index d2dbea7b3..bd0fdc0c2 100644
--- a/src/pages/Item/components/ItemProposal.vue
+++ b/src/pages/Item/components/ItemProposal.vue
@@ -6,10 +6,12 @@ import { toCurrency } from 'filters/index';
import VnStockValueDisplay from 'src/components/ui/VnStockValueDisplay.vue';
import VnTable from 'src/components/VnTable/VnTable.vue';
import axios from 'axios';
-import notifyResults from 'src/utils/notifyResults';
+import { displayResults } from 'src/pages/Ticket/Negative/composables/notifyResults';
import FetchData from 'components/FetchData.vue';
+import { useState } from 'src/composables/useState';
const MATCH = 'match';
+const { notifyResults } = displayResults();
const { t } = useI18n();
const $props = defineProps({
@@ -18,14 +20,20 @@ const $props = defineProps({
required: true,
default: () => {},
},
+ filter: {
+ type: Object,
+ required: true,
+ default: () => {},
+ },
replaceAction: {
type: Boolean,
- required: false,
+ required: true,
default: false,
},
+
sales: {
type: Array,
- required: false,
+ required: true,
default: () => [],
},
});
@@ -36,6 +44,8 @@ const proposalTableRef = ref(null);
const sale = computed(() => $props.sales[0]);
const saleFk = computed(() => sale.value.saleFk);
const filter = computed(() => ({
+ where: $props.filter,
+
itemFk: $props.itemLack.itemFk,
sales: saleFk.value,
}));
@@ -228,11 +238,15 @@ async function handleTicketConfig(data) {
url="TicketConfigs"
:filter="{ fields: ['lackAlertPrice'] }"
@on-fetch="handleTicketConfig"
- auto-load
+ >
+
import ItemProposal from './ItemProposal.vue';
import { useDialogPluginComponent } from 'quasar';
-
const $props = defineProps({
itemLack: {
type: Object,
required: true,
default: () => {},
},
+ filter: {
+ type: Object,
+ required: true,
+ default: () => {},
+ },
replaceAction: {
type: Boolean,
required: false,
@@ -31,7 +35,7 @@ defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.h
- {{ $t('Item proposal') }}
+ {{ $t('itemProposal') }}
diff --git a/src/pages/Item/composables/cloneItem.js b/src/pages/Item/composables/cloneItem.js
index 2421c0808..4e19661ca 100644
--- a/src/pages/Item/composables/cloneItem.js
+++ b/src/pages/Item/composables/cloneItem.js
@@ -11,26 +11,19 @@ export function cloneItem() {
const router = useRouter();
const cloneItem = async (entityId) => {
const { id } = entityId;
- try {
- const { data } = await axios.post(`Items/${id ?? entityId}/clone`);
- router.push({ name: 'ItemTags', params: { id: data.id } });
- } catch (err) {
- console.error('Error cloning item');
- }
+ const { data } = await axios.post(`Items/${id ?? entityId}/clone`);
+ router.push({ name: 'ItemTags', params: { id: data.id } });
};
const openCloneDialog = async (entityId) => {
- quasar
- .dialog({
- component: VnConfirm,
- componentProps: {
- title: t('item.descriptor.clone.title'),
- message: t('item.descriptor.clone.subTitle'),
- },
- })
- .onOk(async () => {
- await cloneItem(entityId);
- });
+ quasar.dialog({
+ component: VnConfirm,
+ componentProps: {
+ title: t('item.descriptor.clone.title'),
+ message: t('item.descriptor.clone.subTitle'),
+ promise: () => cloneItem(entityId),
+ },
+ });
};
return { openCloneDialog };
}
diff --git a/src/pages/Monitor/MonitorClientsActions.vue b/src/pages/Monitor/MonitorClientsActions.vue
index 821773bbf..a6ac3ab0b 100644
--- a/src/pages/Monitor/MonitorClientsActions.vue
+++ b/src/pages/Monitor/MonitorClientsActions.vue
@@ -8,14 +8,14 @@ import VnRow from 'src/components/ui/VnRow.vue';
class="q-pa-md"
:style="{ 'flex-direction': $q.screen.lt.lg ? 'column' : 'row', gap: '0px' }"
>
-
+
-
+
useOpenURL(`#/order/${id}/summary`);
-
-
- {{ toDateFormat(row.date_send) }}
-
-
+
diff --git a/src/pages/Monitor/Ticket/MonitorTicketFilter.vue b/src/pages/Monitor/Ticket/MonitorTicketFilter.vue
index 1cadd4cb4..1bc194a5c 100644
--- a/src/pages/Monitor/Ticket/MonitorTicketFilter.vue
+++ b/src/pages/Monitor/Ticket/MonitorTicketFilter.vue
@@ -9,6 +9,7 @@ import VnInput from 'src/components/common/VnInput.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
import FetchData from 'src/components/FetchData.vue';
import { dateRange } from 'src/filters';
+import VnCheckbox from 'src/components/common/VnCheckbox.vue';
defineProps({ dataKey: { type: String, required: true } });
const { t, te } = useI18n();
@@ -209,7 +210,7 @@ const getLocale = (label) => {
- {
- {
-
import { ref, computed, onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
-import FetchData from 'components/FetchData.vue';
import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
@@ -168,9 +167,11 @@ const columns = computed(() => [
component: 'select',
name: 'provinceFk',
attrs: {
- options: provinceOpts.value,
- 'option-value': 'id',
- 'option-label': 'name',
+ url: 'Provinces',
+ fields: ['id', 'name'],
+ sortBy: ['name ASC'],
+ optionValue: 'id',
+ optionLabel: 'name',
dense: true,
},
},
@@ -183,9 +184,11 @@ const columns = computed(() => [
component: 'select',
name: 'stateFk',
attrs: {
- options: stateOpts.value,
- 'option-value': 'id',
- 'option-label': 'name',
+ sortBy: ['name ASC'],
+ url: 'States',
+ fields: ['id', 'name'],
+ optionValue: 'id',
+ optionLabel: 'name',
dense: true,
},
},
@@ -212,9 +215,12 @@ const columns = computed(() => [
component: 'select',
name: 'zoneFk',
attrs: {
- options: zoneOpts.value,
- 'option-value': 'id',
- 'option-label': 'name',
+ url: 'Zones',
+ fields: ['id', 'name'],
+ sortBy: ['name ASC'],
+
+ optionValue: 'id',
+ optionLabel: 'name',
dense: true,
},
},
@@ -225,11 +231,12 @@ const columns = computed(() => [
align: 'left',
columnFilter: {
component: 'select',
- url: 'PayMethods',
attrs: {
- options: PayMethodOpts.value,
- optionValue: 'id',
+ url: 'PayMethods',
+ fields: ['id', 'name'],
+ sortBy: ['id ASC'],
optionLabel: 'name',
+ optionValue: 'id',
dense: true,
},
},
@@ -254,7 +261,9 @@ const columns = computed(() => [
columnFilter: {
component: 'select',
attrs: {
- options: DepartmentOpts.value,
+ url: 'Departments',
+ fields: ['id', 'name'],
+ sortBy: ['id ASC'],
dense: true,
},
},
@@ -265,11 +274,12 @@ const columns = computed(() => [
align: 'left',
columnFilter: {
component: 'select',
- url: 'ItemPackingTypes',
attrs: {
- options: ItemPackingTypeOpts.value,
- 'option-value': 'code',
- 'option-label': 'code',
+ url: 'ItemPackingTypes',
+ fields: ['code'],
+ sortBy: ['code ASC'],
+ optionValue: 'code',
+ optionCode: 'code',
dense: true,
},
},
@@ -324,60 +334,6 @@ const totalPriceColor = (ticket) => {
const openTab = (id) => useOpenURL(`#/ticket/${id}/sale`);
- (provinceOpts = data)"
- />
- (stateOpts = data)"
- />
- (zoneOpts = data)"
- />
- (ItemPackingTypeOpts = data)"
- />
- (DepartmentOpts = data)"
- />
- (PayMethodOpts = data)"
- />
diff --git a/src/pages/Order/Card/OrderCatalog.vue b/src/pages/Order/Card/OrderCatalog.vue
index dbb66c0ec..df39fff3c 100644
--- a/src/pages/Order/Card/OrderCatalog.vue
+++ b/src/pages/Order/Card/OrderCatalog.vue
@@ -120,7 +120,6 @@ watch(
:data-key="dataKey"
:tag-value="tagValue"
:tags="tags"
- :initial-catalog-params="catalogParams"
:arrayData
/>
diff --git a/src/pages/Order/Card/OrderDescriptor.vue b/src/pages/Order/Card/OrderDescriptor.vue
index ee66bb57e..434dbb038 100644
--- a/src/pages/Order/Card/OrderDescriptor.vue
+++ b/src/pages/Order/Card/OrderDescriptor.vue
@@ -27,7 +27,7 @@ const getTotalRef = ref();
const total = ref(0);
const entityId = computed(() => {
- return $props.id || route.params.id;
+ return Number($props.id || route.params.id);
});
const orderTotal = computed(() => state.get('orderTotal') ?? 0);
diff --git a/src/pages/Route/Card/RouteSummary.vue b/src/pages/Route/Card/RouteSummary.vue
index 86bdbb5c5..7e345d69a 100644
--- a/src/pages/Route/Card/RouteSummary.vue
+++ b/src/pages/Route/Card/RouteSummary.vue
@@ -233,10 +233,10 @@ const ticketColumns = ref([
-
-
+
+
- {{ value }}
+ {{ row.clientFk }}
diff --git a/src/pages/Route/Vehicle/Card/VehicleDmsImportForm.vue b/src/pages/Route/Vehicle/Card/VehicleDmsImportForm.vue
new file mode 100644
index 000000000..ade3e6dc5
--- /dev/null
+++ b/src/pages/Route/Vehicle/Card/VehicleDmsImportForm.vue
@@ -0,0 +1,65 @@
+
+
+
+ (dmsOptions = data)"
+ />
+
+
+
+
+
+
diff --git a/src/pages/Route/Vehicle/VehicleDms.vue b/src/pages/Route/Vehicle/VehicleDms.vue
new file mode 100644
index 000000000..61f608d6c
--- /dev/null
+++ b/src/pages/Route/Vehicle/VehicleDms.vue
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+ {{ t('globals.import') }}
+
+
+
+
diff --git a/src/pages/Route/Vehicle/locale/en.yml b/src/pages/Route/Vehicle/locale/en.yml
index c92022f9d..af6f78fd1 100644
--- a/src/pages/Route/Vehicle/locale/en.yml
+++ b/src/pages/Route/Vehicle/locale/en.yml
@@ -18,3 +18,5 @@ vehicle:
params:
vehicleTypeFk: Type
vehicleStateFk: State
+ errors:
+ documentIdEmpty: The document identifier can't be empty
diff --git a/src/pages/Route/Vehicle/locale/es.yml b/src/pages/Route/Vehicle/locale/es.yml
index c878f97ac..9fd0d3e91 100644
--- a/src/pages/Route/Vehicle/locale/es.yml
+++ b/src/pages/Route/Vehicle/locale/es.yml
@@ -18,3 +18,5 @@ vehicle:
params:
vehicleTypeFk: Tipo
vehicleStateFk: Estado
+ errors:
+ documentIdEmpty: El número de documento no puede estar vacío
diff --git a/src/pages/Shelving/Parking/ParkingList.vue b/src/pages/Shelving/Parking/ParkingList.vue
index 7c5058a74..eb5be5747 100644
--- a/src/pages/Shelving/Parking/ParkingList.vue
+++ b/src/pages/Shelving/Parking/ParkingList.vue
@@ -80,7 +80,7 @@ const columns = computed(() => [
{
{
- const needle = val.toLowerCase();
- filteredBankEntitiesOptions.value = bankEntitiesOptions.value.filter(
- (bank) =>
- bank.bic.toLowerCase().startsWith(needle) ||
- bank.name.toLowerCase().includes(needle),
- );
- });
+function bankEntityFilter(val) {
+ const needle = val.toLowerCase();
+ filteredBankEntitiesOptions.value = bankEntitiesOptions.value.filter(
+ (bank) =>
+ bank.bic.toLowerCase().startsWith(needle) ||
+ bank.name.toLowerCase().includes(needle),
+ );
}
@@ -82,7 +80,8 @@ function bankEntityFilter(val, update) {
url="BankEntities"
@on-fetch="
(data) => {
- (bankEntitiesOptions = data), (filteredBankEntitiesOptions = data);
+ bankEntitiesOptions = data;
+ filteredBankEntitiesOptions = data;
}
"
auto-load
@@ -135,10 +134,8 @@ function bankEntityFilter(val, update) {
:label="t('worker.create.bankEntity')"
v-model="row.bankEntityFk"
:options="filteredBankEntitiesOptions"
- :default-filter="false"
- @filter="(val, update) => bankEntityFilter(val, update)"
+ :filter-fn="bankEntityFilter"
option-label="bic"
- option-value="id"
hide-selected
:required="true"
:roles-allowed-to-create="['financial']"
diff --git a/src/pages/Supplier/Card/SupplierDescriptorProxy.vue b/src/pages/Supplier/Card/SupplierDescriptorProxy.vue
index 6311939b8..e4d1d9a13 100644
--- a/src/pages/Supplier/Card/SupplierDescriptorProxy.vue
+++ b/src/pages/Supplier/Card/SupplierDescriptorProxy.vue
@@ -5,7 +5,7 @@ import SupplierSummary from './SupplierSummary.vue';
const $props = defineProps({
id: {
type: Number,
- required: true,
+ default: null,
},
});
diff --git a/src/pages/Supplier/Card/SupplierFiscalData.vue b/src/pages/Supplier/Card/SupplierFiscalData.vue
index 4293bd41a..2feb0e39a 100644
--- a/src/pages/Supplier/Card/SupplierFiscalData.vue
+++ b/src/pages/Supplier/Card/SupplierFiscalData.vue
@@ -11,10 +11,10 @@ import VnSelect from 'src/components/common/VnSelect.vue';
import VnLocation from 'src/components/common/VnLocation.vue';
import VnAccountNumber from 'src/components/common/VnAccountNumber.vue';
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
-
+import { useArrayData } from 'src/composables/useArrayData';
const route = useRoute();
const { t } = useI18n();
-
+const arrayData = useArrayData('Supplier');
const sageTaxTypesOptions = ref([]);
const sageWithholdingsOptions = ref([]);
const sageTransactionTypesOptions = ref([]);
@@ -89,6 +89,7 @@ function handleLocation(data, location) {
}"
auto-load
:clear-store-on-unmount="false"
+ @on-data-saved="arrayData.fetch({})"
>
diff --git a/src/pages/Ticket/Card/BasicData/TicketBasicDataView.vue b/src/pages/Ticket/Card/BasicData/TicketBasicDataView.vue
index 76191b099..a58c934f8 100644
--- a/src/pages/Ticket/Card/BasicData/TicketBasicDataView.vue
+++ b/src/pages/Ticket/Card/BasicData/TicketBasicDataView.vue
@@ -101,7 +101,7 @@ const onNextStep = async () => {
t('basicData.negativesConfirmMessage'),
submitWithNegatives,
);
- else submit();
+ else await submit();
}
};
diff --git a/src/pages/Ticket/Card/TicketDescriptorMenu.vue b/src/pages/Ticket/Card/TicketDescriptorMenu.vue
index f7389b592..30024fb26 100644
--- a/src/pages/Ticket/Card/TicketDescriptorMenu.vue
+++ b/src/pages/Ticket/Card/TicketDescriptorMenu.vue
@@ -28,6 +28,7 @@ const props = defineProps({
onMounted(() => {
restoreTicket();
+ hasDocuware();
});
watch(
diff --git a/src/pages/Ticket/Card/TicketDescriptorProxy.vue b/src/pages/Ticket/Card/TicketDescriptorProxy.vue
index 583ba35e7..8b872733d 100644
--- a/src/pages/Ticket/Card/TicketDescriptorProxy.vue
+++ b/src/pages/Ticket/Card/TicketDescriptorProxy.vue
@@ -1,7 +1,6 @@
-
+
diff --git a/src/pages/Ticket/Card/TicketDmsImportForm.vue b/src/pages/Ticket/Card/TicketDmsImportForm.vue
index 4b6b9c6cd..04cb3d75e 100644
--- a/src/pages/Ticket/Card/TicketDmsImportForm.vue
+++ b/src/pages/Ticket/Card/TicketDmsImportForm.vue
@@ -34,7 +34,7 @@ const importDms = async () => {
dmsId.value = null;
emit('onDataSaved');
} catch (e) {
- throw new Error(e.message);
+ throw e;
}
};
@@ -49,7 +49,7 @@ const importDms = async () => {
@@ -70,7 +70,6 @@ const importDms = async () => {
es:
- Select document id: Introduzca id de gestion documental
Document: Documento
The document indentifier can't be empty: El número de documento no puede estar vacío
diff --git a/src/pages/Ticket/Card/TicketSale.vue b/src/pages/Ticket/Card/TicketSale.vue
index feee8a48d..91e4f0320 100644
--- a/src/pages/Ticket/Card/TicketSale.vue
+++ b/src/pages/Ticket/Card/TicketSale.vue
@@ -774,6 +774,7 @@ watch(
v-model="row.itemFk"
:use-like="false"
@update:model-value="changeItem(row)"
+ autofocus
>
diff --git a/src/pages/Ticket/Card/TicketSplit.vue b/src/pages/Ticket/Card/TicketSplit.vue
index e79057266..462c22264 100644
--- a/src/pages/Ticket/Card/TicketSplit.vue
+++ b/src/pages/Ticket/Card/TicketSplit.vue
@@ -3,7 +3,9 @@ import { ref } from 'vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import split from './components/split';
-const emit = defineEmits(['ticketTransfered']);
+import { displayResults } from 'src/pages/Ticket/Negative/composables/notifyResults';
+const { notifyResults } = displayResults();
+const emit = defineEmits(['ticketTransferred']);
const $props = defineProps({
ticket: {
@@ -16,13 +18,20 @@ const splitDate = ref(Date.vnNew());
const splitSelectedRows = async () => {
const tickets = Array.isArray($props.ticket) ? $props.ticket : [$props.ticket];
- await split(tickets, splitDate.value);
- emit('ticketTransfered', tickets);
+ const results = await split(tickets, splitDate.value);
+ notifyResults(results, 'ticketFk');
+ emit('ticketTransferred', tickets);
};
-
+
-
es:
Search zone: Buscar zona
diff --git a/src/router/modules/route.js b/src/router/modules/route.js
index 0dd41c86e..2b7cfc5be 100644
--- a/src/router/modules/route.js
+++ b/src/router/modules/route.js
@@ -166,7 +166,11 @@ const vehicleCard = {
component: () => import('src/pages/Route/Vehicle/Card/VehicleCard.vue'),
redirect: { name: 'VehicleSummary' },
meta: {
- menu: ['VehicleBasicData', 'VehicleNotes'],
+ menu: [
+ 'VehicleBasicData',
+ 'VehicleNotes',
+ 'VehicleDms',
+ ],
},
children: [
{
@@ -195,7 +199,16 @@ const vehicleCard = {
icon: 'vn:notes',
},
component: () => import('src/pages/Route/Vehicle/Card/VehicleNotes.vue'),
- }
+ },
+ {
+ name: 'VehicleDms',
+ path: 'dms',
+ meta: {
+ title: 'dms',
+ icon: 'cloud_upload',
+ },
+ component: () => import('src/pages/Route/Vehicle/VehicleDms.vue'),
+ },
],
};
diff --git a/src/router/modules/ticket.js b/src/router/modules/ticket.js
index d80997257..b6b9f71a2 100644
--- a/src/router/modules/ticket.js
+++ b/src/router/modules/ticket.js
@@ -251,7 +251,7 @@ export default {
},
{
name: 'NegativeDetail',
- path: ':id',
+ path: ':itemFk',
meta: {
title: 'summary',
icon: 'launch',
diff --git a/src/stores/__tests__/useStateQueryStore.spec.js b/src/stores/__tests__/useStateQueryStore.spec.js
index ab3afb007..7bdb87ced 100644
--- a/src/stores/__tests__/useStateQueryStore.spec.js
+++ b/src/stores/__tests__/useStateQueryStore.spec.js
@@ -1,22 +1,23 @@
import { describe, expect, it, beforeEach, beforeAll } from 'vitest';
-import { createWrapper } from 'app/test/vitest/helper';
+import { setActivePinia, createPinia } from 'pinia';
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
describe('useStateQueryStore', () => {
- beforeAll(() => {
- createWrapper({}, {});
- });
-
- const stateQueryStore = useStateQueryStore();
- const { add, isLoading, remove, reset } = useStateQueryStore();
+ let stateQueryStore;
+ let add, isLoading, remove, reset;
const firstQuery = { url: 'myQuery' };
function getQueries() {
return stateQueryStore.queries;
}
+ beforeAll(() => {
+ setActivePinia(createPinia());
+ });
beforeEach(() => {
+ stateQueryStore = useStateQueryStore();
+ ({ add, isLoading, remove, reset } = useStateQueryStore());
reset();
expect(getQueries().size).toBeFalsy();
});
diff --git a/src/utils/notifyResults.js b/src/utils/notifyResults.js
deleted file mode 100644
index e87ad6c6f..000000000
--- a/src/utils/notifyResults.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import { Notify } from 'quasar';
-
-export default function (results, key) {
- results.forEach((result, index) => {
- if (result.status === 'fulfilled') {
- const data = JSON.parse(result.value.config.data);
- Notify.create({
- type: 'positive',
- message: `Operación (${index + 1}) ${data[key]} completada con éxito.`,
- });
- } else {
- const data = JSON.parse(result.reason.config.data);
- Notify.create({
- type: 'negative',
- message: `Operación (${index + 1}) ${data[key]} fallida: ${result.reason.message}`,
- });
- }
- });
-}
diff --git a/test/cypress/integration/claim/claimAction.spec.js b/test/cypress/integration/claim/claimAction.spec.js
index 6e916451c..674313a5a 100644
--- a/test/cypress/integration/claim/claimAction.spec.js
+++ b/test/cypress/integration/claim/claimAction.spec.js
@@ -1,5 +1,5 @@
///
-describe.skip('ClaimAction', () => {
+describe('ClaimAction', () => {
const claimId = 1;
const firstRow = 'tbody > :nth-child(1)';
@@ -15,13 +15,13 @@ describe.skip('ClaimAction', () => {
});
// https://redmine.verdnatura.es/issues/8756
- xit('should change destination', () => {
+ it.skip('should change destination', () => {
const rowData = [true, null, null, 'Bueno'];
cy.fillRow(firstRow, rowData);
});
// https://redmine.verdnatura.es/issues/8756
- xit('should change destination from other button', () => {
+ it.skip('should change destination from other button', () => {
const rowData = [true];
cy.fillRow(firstRow, rowData);
@@ -35,7 +35,7 @@ describe.skip('ClaimAction', () => {
});
// https://redmine.verdnatura.es/issues/8756
- xit('should remove the line', () => {
+ it.skip('should remove the line', () => {
cy.fillRow(firstRow, [true]);
cy.removeCard();
cy.clickConfirm();
diff --git a/test/cypress/integration/claim/claimDevelopment.spec.js b/test/cypress/integration/claim/claimDevelopment.spec.js
index 1fb77fe20..ed1e7c0a5 100755
--- a/test/cypress/integration/claim/claimDevelopment.spec.js
+++ b/test/cypress/integration/claim/claimDevelopment.spec.js
@@ -1,5 +1,5 @@
///
-describe.skip('ClaimDevelopment', () => {
+describe('ClaimDevelopment', () => {
const claimId = 1;
const firstLineReason = 'tbody > :nth-child(1) > :nth-child(2)';
const thirdRow = 'tbody > :nth-child(3)';
diff --git a/test/cypress/integration/customer/clientList.spec.js b/test/cypress/integration/customer/clientList.spec.js
index caf94b8bd..7b1da6d89 100644
--- a/test/cypress/integration/customer/clientList.spec.js
+++ b/test/cypress/integration/customer/clientList.spec.js
@@ -1,5 +1,5 @@
///
-describe.skip('Client list', () => {
+describe('Client list', () => {
beforeEach(() => {
cy.login('developer');
cy.visit('/#/customer/list', {
diff --git a/test/cypress/integration/entry/commands.js b/test/cypress/integration/entry/commands.js
index 4d4a8f980..87e3c3bfa 100644
--- a/test/cypress/integration/entry/commands.js
+++ b/test/cypress/integration/entry/commands.js
@@ -7,7 +7,7 @@ Cypress.Commands.add('selectTravel', (warehouse = '1') => {
});
Cypress.Commands.add('deleteEntry', () => {
- cy.get('[data-cy="descriptor-more-opts"]').should('be.visible').click();
+ cy.dataCy('descriptor-more-opts').should('be.visible').click();
cy.waitForElement('div[data-cy="delete-entry"]').click();
});
diff --git a/test/cypress/integration/entry/entryCard/entryBasicData.spec.js b/test/cypress/integration/entry/entryCard/entryBasicData.spec.js
index de8bc6bc9..11643c566 100644
--- a/test/cypress/integration/entry/entryCard/entryBasicData.spec.js
+++ b/test/cypress/integration/entry/entryCard/entryBasicData.spec.js
@@ -1,6 +1,6 @@
import '../commands.js';
-describe('EntryBasicData', () => {
+describe.skip('EntryBasicData', () => {
beforeEach(() => {
cy.login('buyer');
cy.visit(`/#/entry/list`);
diff --git a/test/cypress/integration/entry/entryCard/entryDescriptor.spec.js b/test/cypress/integration/entry/entryCard/entryDescriptor.spec.js
index d6f2b2543..2e121064c 100644
--- a/test/cypress/integration/entry/entryCard/entryDescriptor.spec.js
+++ b/test/cypress/integration/entry/entryCard/entryDescriptor.spec.js
@@ -1,5 +1,5 @@
import '../commands.js';
-describe('EntryDescriptor', () => {
+describe.skip('EntryDescriptor', () => {
beforeEach(() => {
cy.login('buyer');
cy.visit(`/#/entry/list`);
diff --git a/test/cypress/integration/entry/entryWasteRecalc.spec.js b/test/cypress/integration/entry/entryWasteRecalc.spec.js
index bd50e9c19..902d5bbc5 100644
--- a/test/cypress/integration/entry/entryWasteRecalc.spec.js
+++ b/test/cypress/integration/entry/entryWasteRecalc.spec.js
@@ -10,7 +10,7 @@ describe('EntryDms', () => {
cy.dataCy('recalc').should('be.disabled');
cy.dataCy('dateFrom').should('be.visible').click().type('01-01-2001');
- cy.dataCy('dateTo').should('be.visible').click().type('01-01-2001');
+ cy.dataCy('dateTo').should('be.visible').click().type('01-01-2001{enter}');
cy.dataCy('recalc').should('be.enabled').click();
cy.get('.q-notification__message').should(
diff --git a/test/cypress/integration/invoiceIn/invoiceInCorrective.spec.js b/test/cypress/integration/invoiceIn/invoiceInCorrective.spec.js
index 275fa1358..495e4d43b 100644
--- a/test/cypress/integration/invoiceIn/invoiceInCorrective.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInCorrective.spec.js
@@ -53,7 +53,7 @@ describe('invoiceInCorrective', () => {
it('should show/hide the section if it is a corrective invoice', () => {
cy.visit('/#/invoice-in/1/summary');
cy.get('[data-cy="InvoiceInCorrective-menu-item"]').should('not.exist');
- cy.clicDescriptorAction(4);
+ cy.clickDescriptorAction(4);
cy.get('[data-cy="InvoiceInCorrective-menu-item"]').should('exist');
});
});
diff --git a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js
index 9744486e0..fd6f1c238 100644
--- a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js
@@ -64,17 +64,17 @@ describe('InvoiceInDescriptor', () => {
beforeEach(() => cy.visit('/#/invoice-in/1/summary'));
it('should navigate to the supplier summary', () => {
- cy.clicDescriptorAction(1);
+ cy.clickDescriptorAction(1);
cy.url().should('to.match', /supplier\/\d+\/summary/);
});
it('should navigate to the entry summary', () => {
- cy.clicDescriptorAction(2);
+ cy.clickDescriptorAction(2);
cy.url().should('to.match', /entry\/\d+\/summary/);
});
it('should navigate to the invoiceIn list', () => {
- cy.clicDescriptorAction(3);
+ cy.clickDescriptorAction(3);
cy.url().should('to.match', /invoice-in\/list\?table=\{.*supplierFk.+\}/);
});
});
@@ -84,7 +84,7 @@ describe('InvoiceInDescriptor', () => {
beforeEach(() => cy.visit(`/#/invoice-in/${originalId}/summary`));
- it('should create a correcting invoice and redirect to original invoice', () => {
+ it.skip('should create a correcting invoice and redirect to original invoice', () => {
createCorrective();
redirect(originalId);
});
@@ -93,7 +93,7 @@ describe('InvoiceInDescriptor', () => {
createCorrective();
redirect(originalId);
- cy.clicDescriptorAction(4);
+ cy.clickDescriptorAction(4);
cy.validateVnTableRows({
cols: [
{
@@ -141,7 +141,7 @@ function createCorrective() {
function redirect(subtitle) {
const regex = new RegExp(`InvoiceIns/${subtitle}\\?filter=.*`);
cy.intercept('GET', regex).as('getOriginal');
- cy.clicDescriptorAction(4);
+ cy.clickDescriptorAction(4);
cy.wait('@getOriginal');
cy.validateDescriptor({ subtitle });
}
diff --git a/test/cypress/integration/invoiceOut/invoiceOutList.spec.js b/test/cypress/integration/invoiceOut/invoiceOutList.spec.js
index ba6f3e122..3059a974b 100644
--- a/test/cypress/integration/invoiceOut/invoiceOutList.spec.js
+++ b/test/cypress/integration/invoiceOut/invoiceOutList.spec.js
@@ -28,10 +28,10 @@ describe('InvoiceOut list', () => {
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
});
- it.skip('should open the invoice descriptor from table icon', () => {
+ it('should open the invoice descriptor from table icon', () => {
cy.get(firstSummaryIcon).click();
cy.get('.cardSummary').should('be.visible');
- cy.get('.summaryHeader > div').should('include.text', 'A1111111');
+ cy.get('.summaryHeader > div').should('include.text', 'V10100001');
});
it('should open the client descriptor', () => {
diff --git a/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js b/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js
index 029165bb8..49eed32c7 100644
--- a/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js
+++ b/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js
@@ -15,7 +15,7 @@ describe('InvoiceOut summary', () => {
cy.login('developer');
cy.visit(`/#/invoice-out/1/summary`);
});
- it.skip('open the descriptors', () => {
+ it('open the descriptors', () => {
cy.get(firstRowDescriptors(1)).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1');
@@ -30,7 +30,7 @@ describe('InvoiceOut summary', () => {
cy.get('.q-item > .q-item__label').should('include.text', '1101');
});
- it.skip('should open the ticket list', () => {
+ it('should open the ticket list', () => {
cy.get(toTicketList).click();
cy.get('[data-col-field="stateFk"]').each(($el) => {
cy.wrap($el).contains('T1111111');
diff --git a/test/cypress/integration/invoiceOut/invvoiceOutGlobal.spec.js b/test/cypress/integration/invoiceOut/invvoiceOutGlobal.spec.js
index 0170970a5..c6f75ef5f 100644
--- a/test/cypress/integration/invoiceOut/invvoiceOutGlobal.spec.js
+++ b/test/cypress/integration/invoiceOut/invvoiceOutGlobal.spec.js
@@ -22,6 +22,7 @@ describe('InvoiceOut global invoicing', () => {
cy.get('.q-date__years-content > :nth-child(2) > .q-btn').click();
cy.get('.q-date__calendar-days > :nth-child(6) > .q-btn').click();
cy.get('[label="Max date ticket"]').type('01-01-2001{enter}');
+ cy.dataCy('formSubmitBtn').click();
cy.get('.q-card').should('be.visible');
});
});
diff --git a/test/cypress/integration/item/itemList.spec.js b/test/cypress/integration/item/itemList.spec.js
index bd8108344..7950f2bda 100644
--- a/test/cypress/integration/item/itemList.spec.js
+++ b/test/cypress/integration/item/itemList.spec.js
@@ -1,6 +1,6 @@
///
-describe.skip('Item list', () => {
+describe('Item list', () => {
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/item/list`);
diff --git a/test/cypress/integration/login/logout.spec.js b/test/cypress/integration/login/logout.spec.js
index 9f022617d..b17e42794 100644
--- a/test/cypress/integration/login/logout.spec.js
+++ b/test/cypress/integration/login/logout.spec.js
@@ -1,5 +1,5 @@
///
-describe.skip('Logout', () => {
+describe('Logout', () => {
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/dashboard`);
diff --git a/test/cypress/integration/monitor/clientActions.spec.js b/test/cypress/integration/monitor/clientActions.spec.js
new file mode 100644
index 000000000..80f4de379
--- /dev/null
+++ b/test/cypress/integration/monitor/clientActions.spec.js
@@ -0,0 +1,47 @@
+///
+
+describe('Monitor Clients actions', () => {
+ beforeEach(() => {
+ cy.login('salesPerson');
+ cy.intercept('GET', '**/Departments**').as('departments');
+ cy.visit('/#/monitor/clients-actions');
+ cy.waitForElement('.q-page');
+ cy.wait('@departments').then((xhr) => {
+ cy.window().then((win) => {
+ const user = JSON.parse(win.sessionStorage.getItem('user'));
+ const { where } = JSON.parse(xhr.request.query.filter);
+ expect(where.id.like).to.include(user.departmentFk.toString());
+ });
+ });
+ cy.intercept('GET', '**/SalesMonitors/ordersFilter*').as('ordersFilter');
+ cy.intercept('GET', '**/SalesMonitors/clientsFilter*').as('clientsFilter');
+ });
+ it('Should filter by field', () => {
+ cy.get('.q-page').should('be.visible');
+ cy.dataCy('clientsOnWebsite')
+ .find('[data-cy="column-filter-departmentFk"] [data-cy="_select"]')
+ .click();
+ cy.dataCy('recentOrderActions').within(() => {
+ cy.getRowCol('clientFk').find('span').should('have.class', 'link').click();
+ });
+ cy.checkVisibleDescriptor('Customer');
+
+ cy.dataCy('recentOrderActions').within(() => {
+ cy.getRowCol('departmentFk', 2)
+ .find('span')
+ .should('have.class', 'link')
+ .click();
+ });
+
+ cy.checkVisibleDescriptor('Department');
+
+ cy.dataCy('clientsOnWebsite')
+ .find('.q-ml-md')
+ .should('have.text', 'Clients on website');
+ cy.dataCy('recentOrderActions')
+ .find('.q-ml-md')
+ .should('have.text', 'Recent order actions');
+ cy.dataCy('From_inputDate').should('have.value', '01/01/2001');
+ cy.dataCy('To_inputDate').should('have.value', '01/01/2001');
+ });
+});
diff --git a/test/cypress/integration/monitor/monitorTicket.spec.js b/test/cypress/integration/monitor/monitorTicket.spec.js
new file mode 100644
index 000000000..72c6bf936
--- /dev/null
+++ b/test/cypress/integration/monitor/monitorTicket.spec.js
@@ -0,0 +1,69 @@
+///
+describe('Monitor Tickets Table', () => {
+ beforeEach(() => {
+ cy.viewport(1920, 1080);
+ cy.login('salesPerson');
+ cy.visit('/#/monitor/tickets');
+ cy.waitForElement('.q-page');
+ cy.intercept('GET', '**/SalesMonitors/salesFilter*').as('filterRequest');
+ cy.openRightMenu();
+ });
+ it('should open new tab when ctrl+click on client link', () => {
+ cy.intercept('GET', '**/SalesMonitors/salesFilter*').as('filterRequest');
+
+ cy.window().then((win) => {
+ cy.stub(win, 'open').as('windowOpen');
+ });
+
+ cy.getRowCol('provinceFk').click({ ctrlKey: true });
+ cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
+ });
+ it('should open the descriptorProxy and SummaryPopup', () => {
+ cy.getRowCol('totalProblems');
+
+ cy.getRowCol('id').find('span').should('have.class', 'link').click();
+ cy.checkVisibleDescriptor('Ticket');
+
+ cy.getRowCol('zoneFk').find('span').should('have.class', 'link').click();
+ cy.checkVisibleDescriptor('Zone');
+
+ cy.getRowCol('clientFk').find('span').should('have.class', 'link').click();
+ cy.checkVisibleDescriptor('Customer');
+
+ cy.getRowCol('departmentFk').find('span').should('have.class', 'link').click();
+ cy.checkVisibleDescriptor('Department');
+
+ cy.getRowCol('shippedDate').find('.q-badge');
+ cy.tableActions().click({ ctrlKey: true });
+ cy.tableActions(1).click();
+ cy.get('.summaryHeader').should('exist');
+ });
+
+ it('clear scopeDays', () => {
+ cy.get('[data-cy="Days onward_input"]').clear().type('2');
+ cy.searchInFilterPanel();
+ cy.get('.q-chip__content > span').should('have.text', '"2"');
+ cy.waitSpinner();
+ checkScopeDays(2);
+ cy.get('[data-cy="Days onward_input"]').clear();
+ cy.searchInFilterPanel();
+ cy.get('.q-chip__content > span').should('have.text', '"0"');
+ cy.waitSpinner();
+ checkScopeDays(0);
+ });
+});
+
+function checkScopeDays(scopeDays) {
+ cy.url().then((url) => {
+ const urlParams = new URLSearchParams(url.split('?')[1]);
+ const saleMonitorTickets = JSON.parse(
+ decodeURIComponent(urlParams.get('saleMonitorTickets')),
+ );
+ expect(saleMonitorTickets.scopeDays).to.equal(scopeDays);
+ const fromDate = new Date(saleMonitorTickets.from);
+ const toDate = new Date(saleMonitorTickets.to);
+ expect(toDate.getDate() - fromDate.getDate()).to.equal(
+ saleMonitorTickets.scopeDays,
+ );
+ });
+}
diff --git a/test/cypress/integration/order/orderCatalog.spec.js b/test/cypress/integration/order/orderCatalog.spec.js
index 050dd396c..4f6371f32 100644
--- a/test/cypress/integration/order/orderCatalog.spec.js
+++ b/test/cypress/integration/order/orderCatalog.spec.js
@@ -2,7 +2,7 @@
describe('OrderCatalog', () => {
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 720);
+ cy.viewport(1920, 1080);
cy.visit('/#/order/8/catalog');
});
@@ -34,7 +34,7 @@ describe('OrderCatalog', () => {
searchByCustomTagInput('Silver');
});
- it.skip('filters by custom value dialog', () => {
+ it('filters by custom value dialog', () => {
Cypress.on('uncaught:exception', (err) => {
if (err.message.includes('canceled')) {
return false;
diff --git a/test/cypress/integration/order/orderList.spec.js b/test/cypress/integration/order/orderList.spec.js
index b77ef8fca..56c4b6a32 100644
--- a/test/cypress/integration/order/orderList.spec.js
+++ b/test/cypress/integration/order/orderList.spec.js
@@ -11,14 +11,15 @@ describe('OrderList', () => {
it('create order', () => {
cy.get('[data-cy="vnTableCreateBtn"]').click();
- cy.selectOption(clientCreateSelect, 1101);
- cy.get(addressCreateSelect).click();
+ cy.selectOption('[data-cy="Client_select"]', 1101);
+ cy.dataCy('landedDate').find('input').type('06/01/2001');
+ cy.get('[data-cy="Address_select"]').click();
cy.get(
'.q-menu > div> div.q-item:nth-child(1) >div.q-item__section--avatar > i',
).should('have.text', 'star');
- cy.dataCy('landedDate').find('input').type('06/01/2001');
- cy.selectOption(agencyCreateSelect, 1);
-
+ cy.get('.q-menu > div> .q-item:nth-child(1)').click();
+ cy.get('.q-card [data-cy="Agency_select"]').click();
+ cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale');
diff --git a/test/cypress/integration/route/routeAutonomous.spec.js b/test/cypress/integration/route/routeAutonomous.spec.js
index 6aaa2a85e..b61431bfb 100644
--- a/test/cypress/integration/route/routeAutonomous.spec.js
+++ b/test/cypress/integration/route/routeAutonomous.spec.js
@@ -1,11 +1,12 @@
-describe.skip('RouteAutonomous', () => {
- const getLinkSelector = (colField) =>
- `tr:first-child > [data-col-field="${colField}"] > .no-padding > .link`;
+describe('RouteAutonomous', () => {
+ const getLinkSelector = (colField, link = true) =>
+ `tr:first-child > [data-col-field="${colField}"] > .no-padding${link ? ' > .link' : ''}`;
const selectors = {
- reference: 'Reference_input',
- date: 'tr:first-child > [data-col-field="dated"]',
total: '.value > .text-h6',
+ routeId: getLinkSelector('routeFk', false),
+ agencyRoute: getLinkSelector('agencyModeName'),
+ agencyAgreement: getLinkSelector('agencyAgreement'),
received: getLinkSelector('invoiceInFk'),
autonomous: getLinkSelector('supplierName'),
firstRowCheckbox: '.q-virtual-scroll__content tr:first-child .q-checkbox__bg',
@@ -13,22 +14,30 @@ describe.skip('RouteAutonomous', () => {
createInvoiceBtn: '.q-card > .q-btn',
saveFormBtn: 'FormModelPopup_save',
summaryIcon: 'tableAction-0',
- summaryPopupBtn: '.header > :nth-child(2) > .q-btn__content > .q-icon',
- summaryHeader: '.summaryHeader > :nth-child(2)',
- descriptorHeader: '.summaryHeader > div',
- descriptorTitle: '.q-item__label--header > .title > span',
- summaryGoToSummaryBtn: '.header > .q-icon',
- descriptorGoToSummaryBtn: '.descriptor > .header > a[href] > .q-btn',
+ descriptorRouteSubtitle: '[data-cy="vnDescriptor_subtitle"]',
+ descriptorAgencyAndSupplierTitle: '[data-cy="vnDescriptor_description"]',
+ descriptorInvoiceInTitle: '[data-cy="vnDescriptor_title"]',
+ descriptorOpenSummaryBtn: '.q-menu > .descriptor [data-cy="openSummaryBtn"]',
+ descriptorGoToSummaryBtn: '.q-menu > .descriptor [data-cy="goToSummaryBtn"]',
+ summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
};
- const data = {
- reference: 'Test invoice',
- total: '€206.40',
- supplier: 'PLANTS SL',
- route: 'first route',
+ const newInvoice = {
+ Reference: { val: 'Test invoice' },
+ Company: { val: 'VNL', type: 'select' },
+ Warehouse: { val: 'Warehouse One', type: 'select' },
+ Type: { val: 'Vehiculos', type: 'select' },
+ Description: { val: 'Test description' },
};
- const summaryUrl = '/summary';
+ const total = '€206.40';
+
+ const urls = {
+ summaryAgencyUrlRegex: /agency\/\d+\/summary/,
+ summaryInvoiceInUrlRegex: /invoice-in\/\d+\/summary/,
+ summarySupplierUrlRegex: /supplier\/\d+\/summary/,
+ summaryRouteUrlRegex: /route\/\d+\/summary/,
+ };
const dataSaved = 'Data saved';
beforeEach(() => {
@@ -44,10 +53,10 @@ describe.skip('RouteAutonomous', () => {
.should('have.length.greaterThan', 0);
});
- it('Should create invoice in to selected route', () => {
+ it.skip('Should create invoice in to selected route', () => {
cy.get(selectors.firstRowCheckbox).click();
cy.get(selectors.createInvoiceBtn).click();
- cy.dataCy(selectors.reference).type(data.reference);
+ cy.fillInForm(newInvoice);
cy.dataCy('attachFile').click();
cy.get('.q-file').selectFile('test/cypress/fixtures/image.jpg', {
force: true,
@@ -59,62 +68,120 @@ describe.skip('RouteAutonomous', () => {
it('Should display the total price of the selected rows', () => {
cy.get(selectors.firstRowCheckbox).click();
cy.get(selectors.secondRowCheckbox).click();
- cy.validateContent(selectors.total, data.total);
+ cy.validateContent(selectors.total, total);
});
it('Should redirect to the summary when clicking a route', () => {
- cy.get(selectors.date).click();
- cy.get(selectors.summaryHeader).should('contain', data.route);
- cy.url().should('include', summaryUrl);
+ cy.checkRedirectionFromPopUp({
+ selectorToClick: selectors.routeId,
+ expectedUrlRegex: urls.summaryRouteUrlRegex,
+ expectedTextSelector: selectors.descriptorRouteSubtitle,
+ });
+ });
+
+ describe('Agency route pop-ups', () => {
+ it('Should redirect to the agency route summary from the agency route descriptor pop-up', () => {
+ cy.checkRedirectionFromPopUp({
+ selectorToClick: selectors.agencyRoute,
+ steps: [selectors.descriptorGoToSummaryBtn],
+ expectedUrlRegex: urls.summaryAgencyUrlRegex,
+ expectedTextSelector: selectors.descriptorAgencyAndSupplierTitle,
+ });
+ });
+
+ it('Should redirect to the agency route summary from summary pop-up from the agency route descriptor pop-up', () => {
+ cy.checkRedirectionFromPopUp({
+ selectorToClick: selectors.agencyRoute,
+ steps: [
+ selectors.descriptorOpenSummaryBtn,
+ selectors.summaryGoToSummaryBtn,
+ ],
+ expectedUrlRegex: urls.summaryAgencyUrlRegex,
+ expectedTextSelector: selectors.descriptorAgencyAndSupplierTitle,
+ });
+ });
+ });
+
+ describe('Agency route pop-ups', () => {
+ it('Should redirect to the agency agreement summary from the agency agreement descriptor pop-up', () => {
+ cy.checkRedirectionFromPopUp({
+ selectorToClick: selectors.agencyAgreement,
+ steps: [selectors.descriptorGoToSummaryBtn],
+ expectedUrlRegex: urls.summaryAgencyUrlRegex,
+ expectedTextSelector: selectors.descriptorAgencyAndSupplierTitle,
+ });
+ });
+
+ it('Should redirect to the agency agreement summary from summary pop-up from the agency agreement descriptor pop-up', () => {
+ cy.checkRedirectionFromPopUp({
+ selectorToClick: selectors.agencyAgreement,
+ steps: [
+ selectors.descriptorOpenSummaryBtn,
+ selectors.summaryGoToSummaryBtn,
+ ],
+ expectedUrlRegex: urls.summaryAgencyUrlRegex,
+ expectedTextSelector: selectors.descriptorAgencyAndSupplierTitle,
+ });
+ });
});
describe('Received pop-ups', () => {
- it('Should redirect to invoice in summary from the received descriptor pop-up', () => {
- cy.get(selectors.received).click();
- cy.validateContent(selectors.descriptorTitle, data.reference);
- cy.get(selectors.descriptorGoToSummaryBtn).click();
- cy.get(selectors.descriptorHeader).should('contain', data.supplier);
- cy.url().should('include', summaryUrl);
+ it('Should redirect to the invoice in summary from the received descriptor pop-up', () => {
+ cy.checkRedirectionFromPopUp({
+ selectorToClick: selectors.received,
+ steps: [selectors.descriptorGoToSummaryBtn],
+ expectedUrlRegex: urls.summaryInvoiceInUrlRegex,
+ expectedTextSelector: selectors.descriptorInvoiceInTitle,
+ });
});
it('Should redirect to the invoiceIn summary from summary pop-up from the received descriptor pop-up', () => {
- cy.get(selectors.received).click();
- cy.validateContent(selectors.descriptorTitle, data.reference);
- cy.get(selectors.summaryPopupBtn).click();
- cy.get(selectors.descriptorHeader).should('contain', data.supplier);
- cy.get(selectors.summaryGoToSummaryBtn).click();
- cy.get(selectors.descriptorHeader).should('contain', data.supplier);
- cy.url().should('include', summaryUrl);
+ cy.checkRedirectionFromPopUp({
+ selectorToClick: selectors.received,
+ steps: [
+ selectors.descriptorOpenSummaryBtn,
+ selectors.summaryGoToSummaryBtn,
+ ],
+ expectedUrlRegex: urls.summaryInvoiceInUrlRegex,
+ expectedTextSelector: selectors.descriptorInvoiceInTitle,
+ });
});
});
describe('Autonomous pop-ups', () => {
it('Should redirect to the supplier summary from the received descriptor pop-up', () => {
- cy.get(selectors.autonomous).click();
- cy.validateContent(selectors.descriptorTitle, data.supplier);
- cy.get(selectors.descriptorGoToSummaryBtn).click();
- cy.get(selectors.summaryHeader).should('contain', data.supplier);
- cy.url().should('include', summaryUrl);
+ cy.checkRedirectionFromPopUp({
+ selectorToClick: selectors.autonomous,
+ steps: [selectors.descriptorGoToSummaryBtn],
+ expectedUrlRegex: urls.summarySupplierUrlRegex,
+ expectedTextSelector: selectors.descriptorAgencyAndSupplierTitle,
+ });
});
it('Should redirect to the supplier summary from summary pop-up from the autonomous descriptor pop-up', () => {
- cy.get(selectors.autonomous).click();
- cy.get(selectors.descriptorTitle).should('contain', data.supplier);
- cy.get(selectors.summaryPopupBtn).click();
- cy.get(selectors.summaryHeader).should('contain', data.supplier);
- cy.get(selectors.summaryGoToSummaryBtn).click();
- cy.get(selectors.summaryHeader).should('contain', data.supplier);
- cy.url().should('include', summaryUrl);
+ cy.checkRedirectionFromPopUp({
+ selectorToClick: selectors.autonomous,
+ steps: [
+ selectors.descriptorOpenSummaryBtn,
+ selectors.summaryGoToSummaryBtn,
+ ],
+ expectedUrlRegex: urls.summarySupplierUrlRegex,
+ expectedTextSelector: selectors.descriptorAgencyAndSupplierTitle,
+ });
});
});
describe('Route pop-ups', () => {
it('Should redirect to the summary from the route summary pop-up', () => {
- cy.dataCy(selectors.summaryIcon).first().click();
- cy.get(selectors.summaryHeader).should('contain', data.route);
- cy.get(selectors.summaryGoToSummaryBtn).click();
- cy.get(selectors.summaryHeader).should('contain', data.route);
- cy.url().should('include', summaryUrl);
+ cy.get(selectors.routeId)
+ .invoke('text')
+ .then((routeId) => {
+ routeId = routeId.trim();
+ cy.dataCy(selectors.summaryIcon).first().click();
+ cy.get(selectors.summaryGoToSummaryBtn).click();
+ cy.url().should('match', urls.summaryRouteUrlRegex);
+ cy.containContent(selectors.descriptorRouteSubtitle, routeId);
+ });
});
});
});
diff --git a/test/cypress/integration/route/routeExtendedList.spec.js b/test/cypress/integration/route/routeExtendedList.spec.js
index 83ecac122..d2b4e2108 100644
--- a/test/cypress/integration/route/routeExtendedList.spec.js
+++ b/test/cypress/integration/route/routeExtendedList.spec.js
@@ -69,7 +69,8 @@ describe.skip('Route extended list', () => {
.type(`{selectall}{backspace}${value}`);
break;
case 'checkbox':
- cy.get(selector).should('be.visible').click().click();
+ cy.get(selector).should('be.visible').click()
+ cy.get(selector).click();
break;
}
}
diff --git a/test/cypress/integration/route/vehicle/vehicleDms.spec.js b/test/cypress/integration/route/vehicle/vehicleDms.spec.js
new file mode 100644
index 000000000..4d9250e0f
--- /dev/null
+++ b/test/cypress/integration/route/vehicle/vehicleDms.spec.js
@@ -0,0 +1,147 @@
+describe('Vehicle DMS', () => {
+ const getSelector = (btnPosition) =>
+ `tr:last-child > .text-right > .no-wrap > :nth-child(${btnPosition}) > .q-btn > .q-btn__content > .q-icon`;
+
+ const selectors = {
+ lastRowDownloadBtn: getSelector(1),
+ lastRowEditBtn: getSelector(2),
+ lastRowDeleteBtn: getSelector(3),
+ lastRowReference: 'tr:last-child > :nth-child(5) > .q-tr > :nth-child(1) > span',
+ firstRowReference:
+ 'tr:first-child > :nth-child(5) > .q-tr > :nth-child(1) > span',
+ firstRowId: 'tr:first-child > :nth-child(2) > .q-tr > :nth-child(1) > span',
+ lastRowWorkerLink: 'tr:last-child > :nth-child(8) > .q-tr > .link',
+ descriptorTitle: '.descriptor .title',
+ descriptorOpenSummaryBtn: '.q-menu .descriptor [data-cy="openSummaryBtn"]',
+ descriptorGoToSummaryBtn: '.q-menu .descriptor [data-cy="goToSummaryBtn"]',
+ summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
+ summaryTitle: '.summaryHeader',
+ referenceInput: 'Reference_input',
+ companySelect: 'Company_select',
+ warehouseSelect: 'Warehouse_select',
+ typeSelect: 'Type_select',
+ fileInput: 'VnDms_inputFile',
+ importBtn: '[data-cy="importBtn"]',
+ addBtn: '[data-cy="addButton"]',
+ saveFormBtn: 'FormModelPopup_save',
+ };
+
+ const data = {
+ Reference: { val: 'Vehicle:1234-ABC' },
+ Company: { val: 'VNL', type: 'select' },
+ Warehouse: { val: 'Warehouse One', type: 'select' },
+ Type: { val: 'Vehiculos', type: 'select' },
+ };
+
+ const updateData = {
+ Reference: { val: 'Vehicle:4598-FGH' },
+ Company: { val: 'CCs', type: 'select' },
+ Warehouse: { val: 'Warehouse Two', type: 'select' },
+ Type: { val: 'Facturas Recibidas', type: 'select' },
+ };
+
+ const workerSummaryUrlRegex = /worker\/\d+\/summary/;
+
+ beforeEach(() => {
+ cy.viewport(1920, 1080);
+ cy.login('developer');
+ cy.visit(`/#/route/vehicle/1/dms`);
+ });
+
+ it('should display vehicle DMS', () => {
+ cy.get('.q-table')
+ .children()
+ .should('be.visible')
+ .should('have.length.greaterThan', 0);
+ });
+
+ it.skip('Should download DMS', () => {
+ const fileName = '11.jpg';
+ cy.intercept('GET', /\/api\/dms\/11\/downloadFile/).as('download');
+ cy.get(selectors.lastRowDownloadBtn).click();
+
+ cy.wait('@download').then((interception) => {
+ expect(interception.response.statusCode).to.equal(200);
+ expect(interception.response.headers['content-disposition']).to.contain(
+ fileName,
+ );
+ });
+ });
+
+ it('Should create new DMS', () => {
+ const formSelectors = {
+ actionBtn: selectors.addBtn,
+ fileInput: selectors.fileInput,
+ saveFormBtn: selectors.saveFormBtn,
+ };
+
+ cy.testDmsAction('create', formSelectors, data, 'Data saved');
+ });
+
+ it('Should import DMS', () => {
+ const data = {
+ Document: { val: '10', type: 'select' },
+ };
+ const formSelectors = {
+ actionBtn: selectors.importBtn,
+ selectorContentToCheck: selectors.lastRowReference,
+ saveFormBtn: selectors.saveFormBtn,
+ };
+
+ cy.testDmsAction('import', formSelectors, data, 'Data saved', '1');
+ });
+
+ it('Should edit DMS', () => {
+ const formSelectors = {
+ actionBtn: selectors.lastRowEditBtn,
+ selectorContentToCheck: selectors.lastRowReference,
+ saveFormBtn: selectors.saveFormBtn,
+ };
+
+ cy.testDmsAction(
+ 'edit',
+ formSelectors,
+ updateData,
+ 'Data saved',
+ updateData.Reference.val,
+ );
+ });
+
+ it('Should delete DMS', () => {
+ const formSelectors = {
+ actionBtn: selectors.lastRowDeleteBtn,
+ selectorContentToCheck: selectors.lastRowReference,
+ };
+
+ cy.testDmsAction(
+ 'delete',
+ formSelectors,
+ null,
+ 'Data deleted',
+ 'Vehicle:3333-BAT',
+ );
+ });
+
+ describe('Worker pop-ups', () => {
+ it('Should redirect to worker summary from worker descriptor pop-up', () => {
+ cy.checkRedirectionFromPopUp({
+ selectorToClick: selectors.lastRowWorkerLink,
+ steps: [selectors.descriptorGoToSummaryBtn],
+ expectedUrlRegex: workerSummaryUrlRegex,
+ expectedTextSelector: selectors.descriptorTitle,
+ });
+ });
+
+ it('Should redirect to worker summary from summary pop-up from worker descriptor pop-up', () => {
+ cy.checkRedirectionFromPopUp({
+ selectorToClick: selectors.lastRowWorkerLink,
+ steps: [
+ selectors.descriptorOpenSummaryBtn,
+ selectors.summaryGoToSummaryBtn,
+ ],
+ expectedUrlRegex: workerSummaryUrlRegex,
+ expectedTextSelector: selectors.descriptorTitle,
+ });
+ });
+ });
+});
diff --git a/test/cypress/integration/shelving/parking/parkingBasicData.spec.js b/test/cypress/integration/shelving/parking/parkingBasicData.spec.js
index 81c158684..e3f454058 100644
--- a/test/cypress/integration/shelving/parking/parkingBasicData.spec.js
+++ b/test/cypress/integration/shelving/parking/parkingBasicData.spec.js
@@ -6,9 +6,7 @@ describe('ParkingBasicData', () => {
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/shelving/parking/1/basic-data`);
- cy.get('[data-cy="loading-spinner"]', { timeout: 10000 }).should(
- 'not.be.visible',
- );
+ cy.get('[data-cy="navBar-spinner"]', { timeout: 10000 }).should('not.be.visible');
});
it('should give an error if the code aldready exists', () => {
diff --git a/test/cypress/integration/ticket/ticketSale.spec.js b/test/cypress/integration/ticket/ticketSale.spec.js
index 0ae599e15..b87dfab71 100644
--- a/test/cypress/integration/ticket/ticketSale.spec.js
+++ b/test/cypress/integration/ticket/ticketSale.spec.js
@@ -2,7 +2,7 @@
const firstRow = 'tbody > :nth-child(1)';
describe('TicketSale', () => {
- describe.skip('#23', () => {
+ describe('Ticket #23', () => {
beforeEach(() => {
cy.login('claimManager');
cy.viewport(1920, 1080);
diff --git a/test/cypress/integration/vnComponent/VnDescriptor.commands.js b/test/cypress/integration/vnComponent/VnDescriptor.commands.js
new file mode 100644
index 000000000..f03db8244
--- /dev/null
+++ b/test/cypress/integration/vnComponent/VnDescriptor.commands.js
@@ -0,0 +1,6 @@
+Cypress.Commands.add('checkVisibleDescriptor', (alias) =>
+ cy
+ .get(`[data-cy="${alias}Descriptor"] [data-cy="vnDescriptor"] > .header`)
+ .should('exist')
+ .and('be.visible'),
+);
diff --git a/test/cypress/integration/vnComponent/VnShortcut.spec.js b/test/cypress/integration/vnComponent/VnShortcut.spec.js
index cc5cacbe4..83249d15e 100644
--- a/test/cypress/integration/vnComponent/VnShortcut.spec.js
+++ b/test/cypress/integration/vnComponent/VnShortcut.spec.js
@@ -1,6 +1,6 @@
///
// https://redmine.verdnatura.es/issues/8848
-describe.skip('VnShortcuts', () => {
+describe('VnShortcuts', () => {
const modules = {
item: 'a',
customer: 'c',
diff --git a/test/cypress/integration/vnComponent/vnTable.commands.js b/test/cypress/integration/vnComponent/vnTable.commands.js
index 6c7e71e13..316fc12f1 100644
--- a/test/cypress/integration/vnComponent/vnTable.commands.js
+++ b/test/cypress/integration/vnComponent/vnTable.commands.js
@@ -2,9 +2,7 @@ Cypress.Commands.add('getRow', (index = 1) =>
cy.get(`.vnTable .q-virtual-scroll__content tr:nth-child(${index})`),
);
Cypress.Commands.add('getRowCol', (field, index = 1) =>
- cy.get(
- `.vnTable .q-virtual-scroll__content > :nth-child(${index}) > [data-col-field="${field}"]`,
- ),
+ cy.getRow(index).find(`[data-col-field="${field}"]`),
);
Cypress.Commands.add('vnTableCreateBtn', () =>
@@ -14,3 +12,9 @@ Cypress.Commands.add('vnTableCreateBtn', () =>
Cypress.Commands.add('waitTableScrollLoad', () =>
cy.waitForElement('[data-q-vs-anchor]'),
);
+
+Cypress.Commands.add('tableActions', (n = 0, child = 1) =>
+ cy.get(
+ `:nth-child(${child}) > .q-table--col-auto-width > [data-cy="tableAction-${n}"] > .q-btn__content > .q-icon`,
+ ),
+);
diff --git a/test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js b/test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js
index d82f9a10d..b185b61b4 100644
--- a/test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js
+++ b/test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js
@@ -10,7 +10,7 @@ describe('WagonTypeEdit', () => {
cy.get('.q-card');
cy.get('input').first().type(' changed');
cy.get('div.q-checkbox__bg').first().click();
- cy.get('.q-btn--standard').click();
+ cy.dataCy('saveDefaultBtn').click();
});
it('should delete a tray', () => {
diff --git a/test/cypress/integration/worker/workerBusiness.spec.js b/test/cypress/integration/worker/workerBusiness.spec.js
index 46da28cd6..1650b66c7 100644
--- a/test/cypress/integration/worker/workerBusiness.spec.js
+++ b/test/cypress/integration/worker/workerBusiness.spec.js
@@ -1,4 +1,4 @@
-describe.skip('WorkerBusiness', () => {
+describe('WorkerBusiness', () => {
const saveBtn = '.q-mt-lg > .q-btn--standard';
const contributionCode = `Representantes de comercio`;
const contractType = `INDEFINIDO A TIEMPO COMPLETO`;
diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js
index 41f91e855..f990c1774 100755
--- a/test/cypress/support/commands.js
+++ b/test/cypress/support/commands.js
@@ -78,20 +78,21 @@ Cypress.Commands.add('waitForElement', (element) => {
Cypress.Commands.add('getValue', (selector) => {
cy.get(selector).then(($el) => {
if ($el.find('.q-checkbox__inner').length > 0) {
- return cy.get(selector + '.q-checkbox__inner');
+ return cy.get(`${selector}.q-checkbox__inner`);
}
// Si es un QSelect
if ($el.find('.q-select__dropdown-icon').length) {
return cy
.get(
- selector +
- '> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input',
+ `${
+ selector
+ }> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input`,
)
.invoke('val');
}
// Si es un QSelect
if ($el.find('span').length) {
- return cy.get(selector + ' span').then(($span) => {
+ return cy.get(`${selector} span`).then(($span) => {
return $span[0].innerText;
});
}
@@ -100,10 +101,15 @@ Cypress.Commands.add('getValue', (selector) => {
});
});
-Cypress.Commands.add('waitSpinner', () => {
+Cypress.Commands.add('waitSpinner', (_spinner = 'navBar') => {
+ const spinners = {
+ navBar: '[data-cy="navBar-spinner"]',
+ filterPanel: '[data-cy="filterPanel-spinner"]',
+ };
+ const spinner = spinners[_spinner];
cy.get('body').then(($body) => {
- if ($body.find('[data-cy="loading-spinner"]').length) {
- cy.get('[data-cy="loading-spinner"]').should('not.be.visible');
+ if ($body.find(spinner).length) {
+ cy.get(spinner).should('not.be.visible');
}
});
});
@@ -142,7 +148,7 @@ function selectItem(selector, option, ariaControl, hasWrite = true) {
function getItems(ariaControl, startTime = Cypress._.now(), timeout = 2500) {
// Se intenta obtener la lista de opciones del desplegable de manera recursiva
return cy
- .get('#' + ariaControl, { timeout })
+ .get(`#${ariaControl}`, { timeout })
.should('exist')
.find('.q-item')
.should('exist')
@@ -189,8 +195,8 @@ Cypress.Commands.add('fillInForm', (obj, opts = {}) => {
break;
case 'date':
cy.get(el).type(
- `{selectall}{backspace}${val.split('-').join('')}`,
- );
+ `{selectall}{backspace}${val}`,
+ ).blur();
break;
case 'time':
cy.get(el).click();
@@ -352,11 +358,21 @@ Cypress.Commands.add('openListSummary', (row) => {
cy.get('.card-list-body .actions .q-btn:nth-child(2)').eq(row).click();
});
-Cypress.Commands.add('openRightMenu', (element) => {
- if (element) cy.waitForElement(element);
- cy.get('[data-cy="toggle-right-drawer"]').click();
+Cypress.Commands.add('openRightMenu', (element = 'toggle-right-drawer') => {
+ if (element) cy.waitForElement(`[data-cy="${element}"]`);
+ cy.dataCy(element).click();
});
+Cypress.Commands.add('cleanFilterPanel', (element = 'clearFilters') => {
+ cy.get('#filterPanelForm').scrollIntoView();
+ if (element) cy.waitForElement(`[data-cy="${element}"]`);
+ cy.dataCy(element).click();
+});
+
+Cypress.Commands.add('searchInFilterPanel', (element = 'vnFilterPanel_search') => {
+ if (element) cy.waitForElement(`[data-cy="${element}"]`);
+ cy.dataCy(element).click();
+});
Cypress.Commands.add('openLeftMenu', (element) => {
if (element) cy.waitForElement(element);
cy.get('.q-toolbar > .q-btn--round.q-btn--dense > .q-btn__content > .q-icon').click();
@@ -454,9 +470,9 @@ Cypress.Commands.add('clickButtonWith', (type, value) => {
Cypress.Commands.add('clickButtonWithIcon', (iconClass) => {
cy.waitForElement('[data-cy="descriptor_actions"]');
- cy.get('[data-cy="loading-spinner"]', { timeout: 10000 }).should('not.be.visible');
+ cy.waitSpinner();
cy.get('.q-btn')
- .filter((index, el) => Cypress.$(el).find('.q-icon.' + iconClass).length > 0)
+ .filter((index, el) => Cypress.$(el).find(`.q-icon.${iconClass}`).length > 0)
.then(($btn) => {
cy.wrap($btn).click();
});
@@ -591,7 +607,7 @@ Cypress.Commands.add('validatePdfDownload', (match, trigger) => {
});
});
-Cypress.Commands.add('clicDescriptorAction', (index = 1) => {
+Cypress.Commands.add('clickDescriptorAction', (index = 1) => {
cy.get(`[data-cy="descriptor_actions"] .q-btn:nth-of-type(${index})`).click();
});
@@ -619,3 +635,41 @@ Cypress.Commands.add('validateScrollContent', (validations) => {
);
});
});
+
+Cypress.Commands.add(
+ 'checkRedirectionFromPopUp',
+ ({ selectorToClick, steps = [], expectedUrlRegex, expectedTextSelector }) => {
+ cy.get(selectorToClick)
+ .click()
+ .invoke('text')
+ .then((label) => {
+ label = label.trim();
+
+ steps.forEach((stepSelector) => {
+ cy.get(stepSelector).should('be.visible').click();
+ });
+
+ cy.location().should('match', expectedUrlRegex);
+ cy.containContent(expectedTextSelector, label);
+ });
+ },
+);
+
+Cypress.Commands.add('testDmsAction', (action, selectors, data, message, content) => {
+ cy.get(selectors.actionBtn).click();
+
+ if (action === 'create') {
+ cy.dataCy(selectors.fileInput).selectFile('test/cypress/fixtures/image.jpg', {
+ force: true,
+ });
+ }
+
+ if (action !== 'delete') {
+ cy.fillInForm(data);
+ cy.dataCy(selectors.saveFormBtn).click();
+ } else cy.clickConfirm();
+
+ cy.checkNotification(message);
+
+ if (action !== 'create') cy.containContent(selectors.selectorContentToCheck, content);
+});
diff --git a/test/cypress/support/index.js b/test/cypress/support/index.js
index b0f0fb3b1..e9042c8fc 100644
--- a/test/cypress/support/index.js
+++ b/test/cypress/support/index.js
@@ -68,6 +68,7 @@ const waitForApiReady = (url, maxRetries = 20, delay = 1000) => {
};
before(() => {
+ cy.viewport(1920, 1080);
waitForApiReady('/api/Applications/status');
});
diff --git a/test/vitest/helper.js b/test/vitest/helper.js
index be0029ee8..f70325254 100644
--- a/test/vitest/helper.js
+++ b/test/vitest/helper.js
@@ -4,6 +4,7 @@ import { createTestingPinia } from '@pinia/testing';
import { vi } from 'vitest';
import { i18n } from 'src/boot/i18n';
import { Notify, Dialog } from 'quasar';
+import keyShortcut from 'src/boot/keyShortcut';
import * as useValidator from 'src/composables/useValidator';
installQuasarPlugin({
@@ -16,6 +17,26 @@ const pinia = createTestingPinia({ createSpy: vi.fn, stubActions: false });
const mockPush = vi.fn();
const mockReplace = vi.fn();
+vi.mock('vue', async (importOriginal) => {
+ const actual = await importOriginal();
+ return {
+ ...actual,
+ inject: vi.fn((key) => {
+ if (key === 'app') {
+ return {};
+ }
+ return actual.inject(key);
+ }),
+ onMounted: vi.fn((fn) => (fn && typeof fn === 'function' ? fn() : undefined)),
+ onBeforeMount: vi.fn((fn) => (fn && typeof fn === 'function' ? fn() : undefined)),
+ onUpdated: vi.fn((fn) => (fn && typeof fn === 'function' ? fn() : undefined)),
+ onUnmounted: vi.fn((fn) => (fn && typeof fn === 'function' ? fn() : undefined)),
+ onBeforeUnmount: vi.fn((fn) =>
+ fn && typeof fn === 'function' ? fn() : undefined,
+ ),
+ };
+});
+
vi.mock('vue-router', () => ({
useRouter: () => ({
push: mockPush,
@@ -87,6 +108,10 @@ export function createWrapper(component, options) {
const defaultOptions = {
global: {
plugins: [i18n, pinia],
+ directives: {
+ shortcut: keyShortcut,
+ },
+ stubs: ['useState', 'arrayData', 'useStateStore', 'vue-i18n', 'RouterLink'],
},
mocks: {
t: (tKey) => tKey,
@@ -94,15 +119,11 @@ export function createWrapper(component, options) {
},
};
- const mountOptions = Object.assign({}, defaultOptions);
-
- if (options instanceof Object) {
- Object.assign(mountOptions, options);
-
- if (options.global) {
- mountOptions.global.plugins = defaultOptions.global.plugins;
- }
- }
+ const mountOptions = {
+ ...defaultOptions,
+ ...options,
+ global: { ...defaultOptions.global, ...options?.global },
+ };
const wrapper = mount(component, mountOptions);
const vm = wrapper.vm;
diff --git a/test/vitest/setup-file.js b/test/vitest/setup-file.js
index 0ba9e53c2..6b49d958f 100644
--- a/test/vitest/setup-file.js
+++ b/test/vitest/setup-file.js
@@ -1,5 +1,26 @@
-// This file will be run before each test file, don't delete or vitest will not work.
-import { vi } from 'vitest';
+import { afterAll, beforeAll, vi } from 'vitest';
+
+let vueWarnings = [];
+
+const originalConsoleWarn = console.warn;
+
+beforeAll(() => {
+ console.warn = (...args) => {
+ vueWarnings.push(args.join(' '));
+ };
+});
+
+afterEach(() => {
+ if (vueWarnings.length > 0) {
+ const allWarnings = vueWarnings.join('\n');
+ vueWarnings = [];
+ throw new Error(`Vue warnings detected during test:\n${allWarnings}`);
+ }
+});
+
+afterAll(() => {
+ console.warn = originalConsoleWarn;
+});
vi.mock('axios');
vi.mock('vue-router', () => ({