-import { ref } from 'vue';
-import { useI18n } from 'vue-i18n';
-
-const { t } = useI18n();
-const props = defineProps({
- usesMana: {
- type: Boolean,
- required: true,
- },
- manaCode: {
- type: String,
- required: true,
- },
- manaVal: {
- type: String,
- default: 'mana',
- },
- manaLabel: {
- type: String,
- default: 'Promotion mana',
- },
- manaClaimVal: {
- type: String,
- default: 'manaClaim',
- },
- claimLabel: {
- type: String,
- default: 'Claim mana',
- },
-});
-
-const manaCode = ref(props.manaCode);
-
-
-
-
-
-
-
-
-
- es:
- Promotion mana: Maná promoción
- Claim mana: Maná reclamación
-
diff --git a/src/components/ui/__tests__/CardSummary.spec.js b/src/components/ui/__tests__/CardSummary.spec.js
index ff6f60697..16b903eba 100644
--- a/src/components/ui/__tests__/CardSummary.spec.js
+++ b/src/components/ui/__tests__/CardSummary.spec.js
@@ -23,10 +23,15 @@ describe('CardSummary', () => {
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/composables/getValueFromPath.js b/src/composables/getValueFromPath.js
new file mode 100644
index 000000000..2c94379cc
--- /dev/null
+++ b/src/composables/getValueFromPath.js
@@ -0,0 +1,11 @@
+export function getValueFromPath(root, path) {
+ if (!root || !path) return;
+ const keys = path.toString().split('.');
+ let current = root;
+
+ for (const key of keys) {
+ if (current[key] === undefined) return undefined;
+ else current = current[key];
+ }
+ return current;
+}
\ No newline at end of file
diff --git a/src/composables/updateMinPriceBeforeSave.js b/src/composables/updateMinPriceBeforeSave.js
new file mode 100644
index 000000000..d2895eeff
--- /dev/null
+++ b/src/composables/updateMinPriceBeforeSave.js
@@ -0,0 +1,51 @@
+import axios from 'axios';
+
+export async function beforeSave(data, getChanges, modelOrigin) {
+ try {
+ const changes = data.updates;
+ if (!changes) return data;
+ const patchPromises = [];
+
+ for (const change of changes) {
+ let patchData = {};
+
+ if ('hasMinPrice' in change.data) {
+ patchData.hasMinPrice = change.data?.hasMinPrice;
+ delete change.data.hasMinPrice;
+ }
+ if ('minPrice' in change.data) {
+ patchData.minPrice = change.data?.minPrice;
+ delete change.data.minPrice;
+ }
+
+ if (Object.keys(patchData).length > 0) {
+ const promise = axios
+ .get(`${modelOrigin}/findOne`, {
+ params: {
+ filter: {
+ fields: ['itemFk'],
+ where: { id: change.where.id },
+ },
+ },
+ })
+ .then((row) => {
+ return axios.patch(`Items/${row.data.itemFk}`, patchData);
+ })
+ .catch((error) => {
+ console.error('Error processing change: ', change, error);
+ });
+
+ patchPromises.push(promise);
+ }
+ }
+
+ await Promise.all(patchPromises);
+
+ data.updates = changes.filter((change) => Object.keys(change.data).length > 0);
+
+ return data;
+ } catch (error) {
+ console.error('Error in beforeSave:', error);
+ throw error;
+ }
+}
diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js
index 2e880a16d..9828b35ae 100644
--- a/src/composables/useArrayData.js
+++ b/src/composables/useArrayData.js
@@ -1,4 +1,4 @@
-import { onMounted, computed } from 'vue';
+import { onMounted, computed, ref } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import axios from 'axios';
import { useArrayDataStore } from 'stores/useArrayDataStore';
@@ -346,7 +346,7 @@ export function useArrayData(key, userOptions) {
}
const totalRows = computed(() => (store.data && store.data.length) || 0);
- const isLoading = computed(() => store.isLoading || false);
+ const isLoading = ref(store.isLoading || false);
return {
fetch,
diff --git a/src/composables/useValidator.js b/src/composables/useValidator.js
index 7a7032608..ae6c47d91 100644
--- a/src/composables/useValidator.js
+++ b/src/composables/useValidator.js
@@ -78,7 +78,8 @@ export function useValidator() {
if (min >= 0)
if (Math.floor(value) < min) return t('inputMin', { value: min });
},
- custom: (value) => validation.bindedFunction(value) || 'Invalid value',
+ custom: (value) =>
+ eval(`(${validation.bindedFunction})`)(value) || 'Invalid value',
};
};
diff --git a/src/css/app.scss b/src/css/app.scss
index b299973d1..dd5dbe247 100644
--- a/src/css/app.scss
+++ b/src/css/app.scss
@@ -340,3 +340,6 @@ input::-webkit-inner-spin-button {
.containerShrinked {
width: 70%;
}
+.q-item__section--main ~ .q-item__section--side {
+ padding-inline: 0;
+}
diff --git a/src/css/quasar.variables.scss b/src/css/quasar.variables.scss
index 45d18af7e..c443c5826 100644
--- a/src/css/quasar.variables.scss
+++ b/src/css/quasar.variables.scss
@@ -18,6 +18,7 @@ $positive: #c8e484;
$negative: #fb5252;
$info: #84d0e2;
$warning: #f4b974;
+$neutral: #b0b0b0;
// Pendiente de cuadrar con la base de datos
$success: $positive;
$alert: $negative;
@@ -51,3 +52,6 @@ $width-xl: 1600px;
.bg-alert {
background-color: $negative;
}
+.bg-neutral {
+ background-color: $neutral;
+}
diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml
index 7bcf90793..3c1c80954 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
@@ -341,6 +346,7 @@ globals:
parking: Parking
vehicleList: Vehicles
vehicle: Vehicle
+ entryPreAccount: Pre-account
unsavedPopup:
title: Unsaved changes will be lost
subtitle: Are you sure exit without saving?
@@ -877,6 +883,11 @@ components:
active: Is active
floramondo: Is floramondo
showBadDates: Show future items
+ name: Nombre
+ rate2: Grouping price
+ rate3: Packing price
+ minPrice: Min. Price
+ itemFk: Item id
userPanel:
copyToken: Token copied to clipboard
settings: Settings
diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml
index b2512193d..518985831 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
@@ -344,6 +349,7 @@ globals:
parking: Parking
vehicleList: Vehículos
vehicle: Vehículo
+ entryPreAccount: Precontabilizar
unsavedPopup:
title: Los cambios que no haya guardado se perderán
subtitle: ¿Seguro que quiere salir sin guardar?
@@ -961,6 +967,11 @@ components:
to: Hasta
floramondo: Floramondo
showBadDates: Ver items a futuro
+ name: Nombre
+ rate2: Precio grouping
+ rate3: Precio packing
+ minPrice: Precio mínimo
+ itemFk: Id item
userPanel:
copyToken: Token copiado al portapapeles
settings: Configuración
diff --git a/src/pages/Claim/Card/ClaimDescriptor.vue b/src/pages/Claim/Card/ClaimDescriptor.vue
index 76ede81ed..3728a18c0 100644
--- a/src/pages/Claim/Card/ClaimDescriptor.vue
+++ b/src/pages/Claim/Card/ClaimDescriptor.vue
@@ -28,14 +28,8 @@ const entityId = computed(() => {
return $props.id || route.params.id;
});
-const STATE_COLOR = {
- pending: 'warning',
- incomplete: 'info',
- resolved: 'positive',
- canceled: 'negative',
-};
-function stateColor(code) {
- return STATE_COLOR[code];
+function stateColor(entity) {
+ return entity?.claimState?.classColor;
}
onMounted(async () => {
@@ -57,9 +51,8 @@ onMounted(async () => {
{{ entity.claimState.description }}
diff --git a/src/pages/Claim/Card/ClaimLines.vue b/src/pages/Claim/Card/ClaimLines.vue
index 7c948bb2f..4331b026d 100644
--- a/src/pages/Claim/Card/ClaimLines.vue
+++ b/src/pages/Claim/Card/ClaimLines.vue
@@ -123,8 +123,8 @@ async function fetchMana() {
async function updateDiscount({ saleFk, discount, canceller }) {
const body = { salesIds: [saleFk], newDiscount: discount };
- const claimId = claim.value.ticketFk;
- const query = `Tickets/${claimId}/updateDiscount`;
+ const ticketFk = claim.value.ticketFk;
+ const query = `Tickets/${ticketFk}/updateDiscount`;
await axios.post(query, body, {
signal: canceller.signal,
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"
>
- state.code === code);
+ return claimState?.classColor;
}
const developmentColumns = ref([
@@ -188,7 +182,7 @@ function claimUrl(section) {
(claimStates = data)"
auto-load
/>
@@ -346,17 +340,18 @@ function claimUrl(section) {
- {{
- t(col.value)
- }}
- {{
- t(col.value)
- }}
-
+
+ {{
+ dashIfEmpty(col.field(props.row))
+ }}
+
+
+
+ {{ dashIfEmpty(col.field(props.row)) }}
+
diff --git a/src/pages/Claim/Card/ClaimSummaryAction.vue b/src/pages/Claim/Card/ClaimSummaryAction.vue
index 577ac2a65..be3b9e896 100644
--- a/src/pages/Claim/Card/ClaimSummaryAction.vue
+++ b/src/pages/Claim/Card/ClaimSummaryAction.vue
@@ -88,13 +88,13 @@ const columns = [
auto-load
>
-
+
{{ row.itemFk }}
-
+
{{ row.ticketFk }}
diff --git a/src/pages/Claim/Card/__tests__/ClaimLines.spec.js b/src/pages/Claim/Card/__tests__/ClaimLines.spec.js
index d975fb514..1ed5cccab 100644
--- a/src/pages/Claim/Card/__tests__/ClaimLines.spec.js
+++ b/src/pages/Claim/Card/__tests__/ClaimLines.spec.js
@@ -52,7 +52,7 @@ describe('ClaimLines', () => {
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/Claim/ClaimList.vue b/src/pages/Claim/ClaimList.vue
index e0d9928f9..d6a77bafe 100644
--- a/src/pages/Claim/ClaimList.vue
+++ b/src/pages/Claim/ClaimList.vue
@@ -101,7 +101,10 @@ const columns = computed(() => [
name: 'stateCode',
chip: {
condition: () => true,
- color: ({ stateCode }) => STATE_COLOR[stateCode] ?? 'bg-grey',
+ color: ({ stateCode }) => {
+ const state = states.value?.find(({ code }) => code === stateCode);
+ return `bg-${state.classColor}`;
+ },
},
columnFilter: {
name: 'claimStateFk',
@@ -131,12 +134,6 @@ const columns = computed(() => [
],
},
]);
-
-const STATE_COLOR = {
- pending: 'bg-warning',
- loses: 'bg-negative',
- resolved: 'bg-positive',
-};
diff --git a/src/pages/Customer/Card/CustomerBalance.vue b/src/pages/Customer/Card/CustomerBalance.vue
index 4855fadc0..13c337ab0 100644
--- a/src/pages/Customer/Card/CustomerBalance.vue
+++ b/src/pages/Customer/Card/CustomerBalance.vue
@@ -131,6 +131,7 @@ const columns = computed(() => [
name: 'isConciliate',
label: t('Conciliated'),
cardVisible: true,
+ component: 'checkbox',
},
{
align: 'left',
diff --git a/src/pages/Customer/Card/CustomerBillingData.vue b/src/pages/Customer/Card/CustomerBillingData.vue
index cc894d01e..e4b6f8365 100644
--- a/src/pages/Customer/Card/CustomerBillingData.vue
+++ b/src/pages/Customer/Card/CustomerBillingData.vue
@@ -9,6 +9,7 @@ import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
+import VnInputBic from 'src/components/common/VnInputBic.vue';
const { t } = useI18n();
const route = useRoute();
@@ -17,7 +18,7 @@ const bankEntitiesRef = ref(null);
const filter = {
fields: ['id', 'bic', 'name'],
- order: 'bic ASC'
+ order: 'bic ASC',
};
const getBankEntities = (data, formData) => {
@@ -43,13 +44,11 @@ const getBankEntities = (data, formData) => {
-
-
-
- {{ t('components.iban_tooltip') }}
-
-
-
+ (data.bankEntityFk = bankEntityFk)"
+ />
{
:label="t('globals.campaign')"
:filled="true"
class="q-px-sm q-pt-none fit"
- :option-label="(opt) => t(opt.code)"
+ :option-label="(opt) => t(opt.code ?? '')"
:fields="['id', 'code', 'dated', 'scopeDays']"
@update:model-value="(data) => updateDateParams(data, params)"
dense
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 93909eb9c..f4efd03b6 100644
--- a/src/pages/Customer/Card/CustomerFiscalData.vue
+++ b/src/pages/Customer/Card/CustomerFiscalData.vue
@@ -79,14 +79,14 @@ async function acceptPropagate({ isEqualizated }) {
observe-form-changes
@on-data-saved="checkEtChanges"
>
-
+
@@ -112,6 +112,7 @@ async function acceptPropagate({ isEqualizated }) {
v-model="data.sageTaxTypeFk"
data-cy="sageTaxTypeFk"
:required="data.isTaxDataChecked"
+ :rules="[(val) => validations.required(data.isTaxDataChecked, val)]"
/>
diff --git a/src/pages/Customer/Card/CustomerSamples.vue b/src/pages/Customer/Card/CustomerSamples.vue
index 19a7f8759..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';
@@ -34,7 +33,7 @@ const columns = computed(() => [
},
{
align: 'left',
- format: (row) => row.type.description,
+ format: (row) => row?.type?.description,
label: t('Description'),
name: 'description',
},
@@ -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);
@@ -181,11 +181,11 @@ const sumRisk = ({ clientRisks }) => {
@@ -208,7 +208,8 @@ const sumRisk = ({ clientRisks }) => {
:text="t('customer.summary.consignee')"
/>
{
/>
{
/>
@@ -289,7 +292,7 @@ const sumRisk = ({ clientRisks }) => {
@@ -318,8 +321,9 @@ const sumRisk = ({ clientRisks }) => {
/>
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/CustomerList.vue b/src/pages/Customer/CustomerList.vue
index b721a6ad9..f5e7485a2 100644
--- a/src/pages/Customer/CustomerList.vue
+++ b/src/pages/Customer/CustomerList.vue
@@ -111,14 +111,11 @@ const columns = computed(() => [
component: 'number',
},
columnField: {
- component: null,
- after: {
- component: markRaw(VnLinkPhone),
- attrs: ({ model }) => {
- return {
- 'phone-number': model,
- };
- },
+ component: markRaw(VnLinkPhone),
+ attrs: ({ model }) => {
+ return {
+ 'phone-number': model,
+ };
},
},
},
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 = () => {
0) {
- const promise = axios
- .get('Buys/findOne', {
- params: {
- filter: {
- fields: ['itemFk'],
- where: { id: change.where.id },
- },
- },
- })
- .then((buy) => {
- return axios.patch(`Items/${buy.data.itemFk}`, patchData);
- })
- .catch((error) => {
- console.error('Error processing change: ', change, error);
- });
-
- patchPromises.push(promise);
- }
- }
-
- await Promise.all(patchPromises);
-
- data.updates = changes.filter((change) => Object.keys(change.data).length > 0);
-
- return data;
- } catch (error) {
- console.error('Error in beforeSave:', error);
- throw error;
- }
-}
-
function invertQuantitySign(rows, sign) {
for (const row of rows) {
if (sign > 0) row.quantity = Math.abs(row.quantity);
@@ -697,7 +648,7 @@ onMounted(() => {
:right-search="false"
:row-click="false"
:columns="columns"
- :beforeSaveFn="beforeSave"
+ :beforeSaveFn="(data, getChanges) => beforeSave(data, getChanges, 'Buys')"
class="buyList"
:table-height="$props.tableHeight ?? '84vh'"
auto-load
@@ -787,7 +738,7 @@ onMounted(() => {
{{ footer?.amount }} /
{{ footer?.checkedAmount }}
-
+
{
await setBuyUltimate(value, data);
}
"
- :required="true"
+ required
+ :rules="[(val) => validations.required(true, val)]"
data-cy="itemFk-create-popup"
sort-by="nickname DESC"
>
diff --git a/src/pages/Entry/EntryPreAccount.vue b/src/pages/Entry/EntryPreAccount.vue
new file mode 100644
index 000000000..cda2ffd5e
--- /dev/null
+++ b/src/pages/Entry/EntryPreAccount.vue
@@ -0,0 +1,477 @@
+
+
+ (countries = data)"
+ auto-load
+ />
+ (companies = data)"
+ auto-load
+ />
+ (warehouses = data)"
+ auto-load
+ />
+ (entryTypes = data)"
+ auto-load
+ />
+
+ (supplierFiscalTypes = data.map((x) => ({ locale: t(x.code), ...x })))
+ "
+ auto-load
+ />
+ (defaultDmsDescription = data?.defaultDmsDescription)"
+ auto-load
+ />
+ (dmsTypeId = data?.id)"
+ auto-load
+ />
+
+ (totalAmount = data?.reduce((acc, entry) => acc + entry.amount, 0))
+ "
+ auto-load
+ >
+
+
+ {{ t('entry.preAccount.btn') }}
+
+
+
+
+
+ {{ row.id }}
+
+
+
+
+
+
+
+
+ {{ row.gestDocFk }}
+
+
+
+
+ {{ row.supplier }}
+
+
+
+
+
+ {{ row.invoiceInFk }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+en:
+ IntraCommunity: Intra-community
+ NonCommunity: Non-community
+ CanaryIslands: Canary Islands
+es:
+ IntraCommunity: Intracomunitaria
+ NonCommunity: Extracomunitaria
+ CanaryIsland: Islas Canarias
+ National: Nacional
+
diff --git a/src/pages/Entry/__tests__/EntryPreAccount.spec.js b/src/pages/Entry/__tests__/EntryPreAccount.spec.js
new file mode 100644
index 000000000..0140a5f1e
--- /dev/null
+++ b/src/pages/Entry/__tests__/EntryPreAccount.spec.js
@@ -0,0 +1,63 @@
+import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
+import { createWrapper } from 'app/test/vitest/helper';
+import EntryPreAccount from '../EntryPreAccount.vue';
+import axios from 'axios';
+
+describe('EntryPreAccount', () => {
+ let wrapper;
+ let vm;
+
+ beforeAll(() => {
+ vi.spyOn(axios, 'get').mockImplementation((url) => {
+ if (url == 'EntryConfigs/findOne')
+ return { data: { maxDays: 90, defaultDays: 30 } };
+ return { data: [] };
+ });
+ wrapper = createWrapper(EntryPreAccount);
+ vm = wrapper.vm;
+ });
+
+ afterEach(() => {
+ vi.clearAllMocks();
+ });
+
+ describe('filterByDaysAgo()', () => {
+ it('should set daysAgo to defaultDays if no value is provided', () => {
+ vm.filterByDaysAgo();
+ expect(vm.daysAgo).toBe(vm.defaultDays);
+ expect(vm.arrayData.store.userParams.daysAgo).toBe(vm.defaultDays);
+ });
+
+ it('should set daysAgo to maxDays if the value exceeds maxDays', () => {
+ vm.filterByDaysAgo(500);
+ expect(vm.daysAgo).toBe(vm.maxDays);
+ expect(vm.arrayData.store.userParams.daysAgo).toBe(vm.maxDays);
+ });
+
+ it('should set daysAgo to the provided value if it is valid', () => {
+ vm.filterByDaysAgo(30);
+ expect(vm.daysAgo).toBe(30);
+ expect(vm.arrayData.store.userParams.daysAgo).toBe(30);
+ });
+ });
+
+ describe('Dialog behavior when adding a new row', () => {
+ it('should open the dialog if the new row has invoiceInFk', async () => {
+ const dialogSpy = vi.spyOn(vm.quasar, 'dialog');
+ const selectedRows = [{ id: 1, invoiceInFk: 123 }];
+ vm.selectedRows = selectedRows;
+ await vm.$nextTick();
+ expect(dialogSpy).toHaveBeenCalledWith({
+ component: vm.VnConfirm,
+ componentProps: { title: vm.t('entry.preAccount.hasInvoice') },
+ });
+ });
+
+ it('should not open the dialog if the new row does not have invoiceInFk', async () => {
+ const dialogSpy = vi.spyOn(vm.quasar, 'dialog');
+ vm.selectedRows = [{ id: 1, invoiceInFk: null }];
+ await vm.$nextTick();
+ expect(dialogSpy).not.toHaveBeenCalled();
+ });
+ });
+});
diff --git a/src/pages/Entry/locale/en.yml b/src/pages/Entry/locale/en.yml
index 0bc92a5ea..3c0f078fe 100644
--- a/src/pages/Entry/locale/en.yml
+++ b/src/pages/Entry/locale/en.yml
@@ -118,6 +118,33 @@ entry:
searchInfo: You can search by entry reference
descriptorMenu:
showEntryReport: Show entry report
+ preAccount:
+ gestDocFk: Gestdoc
+ dmsType: Gestdoc type
+ invoiceNumber: Entry ref.
+ reference: Gestdoc ref.
+ shipped: Shipped
+ landed: Landed
+ id: Entry
+ invoiceInFk: Invoice in
+ supplierFk: Supplier
+ country: Country
+ description: Entry type
+ payDem: Payment term
+ isBooked: B
+ isReceived: R
+ entryType: Entry type
+ isAgricultural: Agricultural
+ fiscalCode: Account type
+ daysAgo: Max 365 days
+ search: Search
+ searchInfo: You can search by supplier name or nickname
+ btn: Pre-account
+ hasInvoice: This entry has already an invoice in
+ success: It has been successfully pre-accounted
+ dialog:
+ title: Pre-account entries
+ message: Do you want the invoice to inherit the entry document?
entryFilter:
params:
isExcludedFromAvailable: Excluded from available
diff --git a/src/pages/Entry/locale/es.yml b/src/pages/Entry/locale/es.yml
index 2c80299bc..0addbca94 100644
--- a/src/pages/Entry/locale/es.yml
+++ b/src/pages/Entry/locale/es.yml
@@ -69,6 +69,33 @@ entry:
observationType: Tipo de observación
search: Buscar entradas
searchInfo: Puedes buscar por referencia de entrada
+ preAccount:
+ gestDocFk: Gestdoc
+ dmsType: Tipo gestdoc
+ invoiceNumber: Ref. Entrada
+ reference: Ref. GestDoc
+ shipped: F. envío
+ landed: F. llegada
+ id: Entrada
+ invoiceInFk: Recibida
+ supplierFk: Proveedor
+ country: País
+ description: Tipo de Entrada
+ payDem: Plazo de pago
+ isBooked: C
+ isReceived: R
+ entryType: Tipo de entrada
+ isAgricultural: Agricultural
+ fiscalCode: Tipo de cuenta
+ daysAgo: Máximo 365 días
+ search: Buscar
+ searchInfo: Puedes buscar por nombre o alias de proveedor
+ btn: Precontabilizar
+ hasInvoice: Esta entrada ya tiene una f. recibida
+ success: Se ha precontabilizado correctamente
+ dialog:
+ title: Precontabilizar entradas
+ message: ¿Desea que la factura herede el documento de la entrada?
params:
entryFk: Entrada
observationTypeFk: Tipo de observación
diff --git a/src/pages/InvoiceIn/Card/InvoiceInDescriptorProxy.vue b/src/pages/InvoiceIn/Card/InvoiceInDescriptorProxy.vue
index e9ca762ed..2c8cab84f 100644
--- a/src/pages/InvoiceIn/Card/InvoiceInDescriptorProxy.vue
+++ b/src/pages/InvoiceIn/Card/InvoiceInDescriptorProxy.vue
@@ -5,7 +5,7 @@ import InvoiceInSummary from './InvoiceInSummary.vue';
const $props = defineProps({
id: {
type: Number,
- required: true,
+ default: null,
},
});
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/InvoiceOut/InvoiceOutList.vue b/src/pages/InvoiceOut/InvoiceOutList.vue
index 3390ef33a..c87428a94 100644
--- a/src/pages/InvoiceOut/InvoiceOutList.vue
+++ b/src/pages/InvoiceOut/InvoiceOutList.vue
@@ -79,6 +79,30 @@ const columns = computed(() => [
inWhere: true,
},
},
+ {
+ align: 'left',
+ name: 'issued',
+ label: t('invoiceOut.summary.issued'),
+ component: 'date',
+ format: (row) => toDate(row.issued),
+ columnField: { component: null },
+ },
+ {
+ align: 'left',
+ name: 'created',
+ label: t('globals.created'),
+ component: 'date',
+ columnField: { component: null },
+ format: (row) => toDate(row.created),
+ },
+ {
+ align: 'left',
+ name: 'dued',
+ label: t('invoiceOut.summary.expirationDate'),
+ component: 'date',
+ columnField: { component: null },
+ format: (row) => toDate(row.dued),
+ },
{
align: 'left',
name: 'clientFk',
@@ -132,22 +156,6 @@ const columns = computed(() => [
cardVisible: true,
format: (row) => toCurrency(row.amount),
},
- {
- align: 'left',
- name: 'created',
- label: t('globals.created'),
- component: 'date',
- columnField: { component: null },
- format: (row) => toDate(row.created),
- },
- {
- align: 'left',
- name: 'dued',
- label: t('invoiceOut.summary.dued'),
- component: 'date',
- columnField: { component: null },
- format: (row) => toDate(row.dued),
- },
{
align: 'left',
name: 'customsAgentFk',
diff --git a/src/pages/Item/Card/ItemDescriptorProxy.vue b/src/pages/Item/Card/ItemDescriptorProxy.vue
index f686e8221..6e1f6d71f 100644
--- a/src/pages/Item/Card/ItemDescriptorProxy.vue
+++ b/src/pages/Item/Card/ItemDescriptorProxy.vue
@@ -22,7 +22,7 @@ const $props = defineProps({
});
-
+
{
:default-remove="false"
:user-filter="{
fields: ['id', 'itemFk', 'tagFk', 'value', 'priority'],
- where: { itemFk: route.params.id },
include: {
relation: 'tag',
scope: {
@@ -97,6 +96,7 @@ const insertTag = (rows) => {
},
},
}"
+ :filter="{ where: { itemFk: route.params.id } }"
order="priority"
auto-load
@on-fetch="onItemTagsFetched"
diff --git a/src/pages/Item/ItemFixedPrice.vue b/src/pages/Item/ItemFixedPrice.vue
index fdfa1d3d1..eb156ce9f 100644
--- a/src/pages/Item/ItemFixedPrice.vue
+++ b/src/pages/Item/ItemFixedPrice.vue
@@ -1,574 +1,386 @@
- (warehousesOptions = data)"
- auto-load
- url="Warehouses"
- :filter="{ fields: ['id', 'name'], order: 'name ASC' }"
- />
-
+
-
-
+
+
+
{{ t('Edit fixed price(s)') }}
- confirmRemove(row, true)"
- :title="t('globals.remove')"
- />
-
-
+
+
-
-
+
+
-
- {{ scope }}
-
+
+
+ {{ row.name }}
+
+
+ {{ row.subName }}
+
-
-
+
+
+
+ {{ toDate(row?.started) }}
+
+
+
+
+
+
+ {{ toDate(row?.ended) }}
+
+
+
+
- #{{ scope.opt?.id }}
- {{ scope.opt?.name }}
+
+ {{ scope.opt.name }}
+
+ #{{ scope.opt.id }}
-
-
- {{ row.name }}
-
- {{ row.subName }}
-
-
-
-
-
-
- €
-
-
-
-
-
-
- €
-
-
-
-
-
-
-
-
- €
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- removePrice(row.id, rowIndex)
- )
- "
+
+
-
- {{ t('globals.delete') }}
-
-
+
+
+
+
+ {{ scope.opt.name }}
+
+ #{{ scope.opt.id }}
+
+
+
+
-
-
-
+
@@ -623,8 +435,17 @@ tbody tr.highlight .q-td {
color: var(--vn-label-color);
}
+
+
+
es:
Add fixed price: Añadir precio fijado
Edit fixed price(s): Editar precio(s) fijado(s)
+ Create fixed price: Crear precio fijado
+ Clone fixed price: Clonar precio fijado
diff --git a/src/pages/Item/ItemFixedPriceFilter.vue b/src/pages/Item/ItemFixedPriceFilter.vue
index d68b966c6..9c11a2e69 100644
--- a/src/pages/Item/ItemFixedPriceFilter.vue
+++ b/src/pages/Item/ItemFixedPriceFilter.vue
@@ -29,6 +29,7 @@ const props = defineProps({
dense
filled
use-input
+ :use-like="false"
@update:model-value="searchFn()"
sort-by="nickname ASC"
/>
@@ -50,21 +51,19 @@ const props = defineProps({
/>
-
+
-
-
diff --git a/src/pages/Item/ItemListFilter.vue b/src/pages/Item/ItemListFilter.vue
index f4500d5fa..ab9b91d06 100644
--- a/src/pages/Item/ItemListFilter.vue
+++ b/src/pages/Item/ItemListFilter.vue
@@ -7,7 +7,7 @@ import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
-import { QCheckbox } from 'quasar';
+import VnCheckbox from 'src/components/common/VnCheckbox.vue';
import { useArrayData } from 'composables/useArrayData';
import { useValidator } from 'src/composables/useValidator';
@@ -250,10 +250,9 @@ onMounted(async () => {
-
-
- {{ t('params.tags') }}
-
+
+ {{ t('params.tags') }}
+
{
color="primary"
@click="tagValues.push({})"
/>
-
+
{
>
{
/>
-
-
- {{ t('More fields') }}
-
+ {{ t('More fields') }}
-
-
+ />
+
{
/>
- {
@keydown.enter="applyFieldFilters(params, searchFn)"
/>
-
+
diff --git a/src/components/EditTableCellValueForm.vue b/src/pages/Item/components/EditFixedPriceForm.vue
similarity index 81%
rename from src/components/EditTableCellValueForm.vue
rename to src/pages/Item/components/EditFixedPriceForm.vue
index 172866191..9c6a63893 100644
--- a/src/components/EditTableCellValueForm.vue
+++ b/src/pages/Item/components/EditFixedPriceForm.vue
@@ -8,11 +8,6 @@ import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnRow from 'components/ui/VnRow.vue';
import { QCheckbox } from 'quasar';
-import axios from 'axios';
-import useNotify from 'src/composables/useNotify.js';
-
-const emit = defineEmits(['onDataSaved']);
-
const $props = defineProps({
rows: {
type: Array,
@@ -26,10 +21,14 @@ const $props = defineProps({
type: String,
default: '',
},
+ beforeSave: {
+ type: Function,
+ default: () => {},
+ },
});
const { t } = useI18n();
-const { notify } = useNotify();
+const emit = defineEmits(['onDataSaved']);
const inputs = {
input: markRaw(VnInput),
@@ -44,24 +43,13 @@ const selectedField = ref(null);
const closeButton = ref(null);
const isLoading = ref(false);
-const onDataSaved = () => {
- notify('globals.dataSaved', 'positive');
- emit('onDataSaved');
- closeForm();
-};
-
const onSubmit = async () => {
isLoading.value = true;
- const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk }));
- const payload = {
- field: selectedField.value.field,
- newValue: newValue.value,
- lines: rowsToEdit,
- };
-
- await axios.post($props.editUrl, payload);
- onDataSaved();
- isLoading.value = false;
+ $props.rows.forEach((row) => {
+ row[selectedField.value.name] = newValue.value;
+ });
+ emit('onDataSaved', $props.rows);
+ closeForm();
};
const closeForm = () => {
@@ -78,21 +66,24 @@ const closeForm = () => {
{{ t('Edit') }}
{{ ` ${rows.length} ` }}
{{ t('buy(s)') }}
-
+
@@ -140,6 +131,15 @@ const closeForm = () => {
}
+
+
es:
Edit: Editar
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/components/__tests__/EditFixedPriceForm.spec.js b/src/pages/Item/components/__tests__/EditFixedPriceForm.spec.js
new file mode 100644
index 000000000..6ac8f372d
--- /dev/null
+++ b/src/pages/Item/components/__tests__/EditFixedPriceForm.spec.js
@@ -0,0 +1,46 @@
+import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest';
+import { createWrapper } from 'app/test/vitest/helper';
+import EditFixedPriceForm from 'src/pages/Item/components/EditFixedPriceForm.vue';
+
+describe('EditFixedPriceForm.vue', () => {
+ let wrapper;
+ let vm;
+
+ const mockRows = [
+ { id: 1, itemFk: 101 },
+ { id: 2, itemFk: 102 },
+ ];
+
+ const mockFieldsOptions = [
+ {
+ name: 'price',
+ label: 'Price',
+ component: 'input',
+ attrs: { type: 'number' },
+ },
+ ];
+
+ beforeEach(() => {
+ wrapper = createWrapper(EditFixedPriceForm, {
+ props: {
+ rows: JSON.parse(JSON.stringify(mockRows)),
+ fieldsOptions: mockFieldsOptions,
+ },
+ });
+ wrapper = wrapper.wrapper;
+ vm = wrapper.vm;
+ });
+
+ afterEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it('should emit "onDataSaved" with updated rows on submit', async () => {
+ vm.selectedField = mockFieldsOptions[0];
+ vm.newValue = 199.99;
+
+ await vm.onSubmit();
+
+ expect(wrapper.emitted('onDataSaved')).toBeTruthy();
+ });
+});
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/Item/locale/en.yml b/src/pages/Item/locale/en.yml
index ff8df26d4..017f6b11f 100644
--- a/src/pages/Item/locale/en.yml
+++ b/src/pages/Item/locale/en.yml
@@ -167,6 +167,8 @@ item:
started: Started
ended: Ended
warehouse: Warehouse
+ MP: MP
+ itemName: Item
create:
name: Name
tag: Tag
diff --git a/src/pages/Item/locale/es.yml b/src/pages/Item/locale/es.yml
index 7b768d0cb..a06695fe9 100644
--- a/src/pages/Item/locale/es.yml
+++ b/src/pages/Item/locale/es.yml
@@ -173,6 +173,8 @@ item:
started: Inicio
ended: Fin
warehouse: Almacén
+ MP: PM
+ itemName: Nombre
create:
name: Nombre
tag: Etiqueta
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/Order/Card/OrderLines.vue b/src/pages/Order/Card/OrderLines.vue
index 1b864de6f..231efbcd9 100644
--- a/src/pages/Order/Card/OrderLines.vue
+++ b/src/pages/Order/Card/OrderLines.vue
@@ -295,13 +295,11 @@ watch(
:user-filter="lineFilter"
>
-
-
-
+
@@ -361,12 +359,6 @@ watch(
}
}
-.image-wrapper {
- height: 50px;
- width: 50px;
- margin-left: 30%;
-}
-
.header {
color: $primary;
font-weight: bold;
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/RouteTickets.vue b/src/pages/Route/RouteTickets.vue
index 5e28bb689..1b9545905 100644
--- a/src/pages/Route/RouteTickets.vue
+++ b/src/pages/Route/RouteTickets.vue
@@ -141,7 +141,7 @@ const setOrderedPriority = async () => {
};
const sortRoutes = async () => {
- await axios.patch(`Routes/${route.params?.id}/guessPriority/`);
+ await axios.patch(`Routes/${route.params?.id}/optimizePriority`);
refreshKey.value++;
};
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/TicketBasicData.vue b/src/pages/Ticket/Card/BasicData/TicketBasicData.vue
index 055c9a0ff..83c621b20 100644
--- a/src/pages/Ticket/Card/BasicData/TicketBasicData.vue
+++ b/src/pages/Ticket/Card/BasicData/TicketBasicData.vue
@@ -91,7 +91,7 @@ const totalPrice = computed(() => {
const totalNewPrice = computed(() => {
return rows.value.reduce(
(acc, item) => acc + item.component.newPrice * item.quantity,
- 0
+ 0,
);
});
@@ -210,18 +210,18 @@ onMounted(async () => {
flat
>
-
-
+
+
{{ row.itemFk }}
-
+
{{ row.item.name }}
-
+
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/TicketCreateTracking.vue b/src/pages/Ticket/Card/TicketCreateTracking.vue
deleted file mode 100644
index 5c1e916f2..000000000
--- a/src/pages/Ticket/Card/TicketCreateTracking.vue
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
- (statesOptions = data)"
- />
- emit('onRequestCreated')"
- >
-
-
-
-
-
-
-
-
-
-
- es:
- Create tracking: Crear estado
-
diff --git a/src/pages/Ticket/Card/TicketDescriptor.vue b/src/pages/Ticket/Card/TicketDescriptor.vue
index 96920231c..c6c6e6c6b 100644
--- a/src/pages/Ticket/Card/TicketDescriptor.vue
+++ b/src/pages/Ticket/Card/TicketDescriptor.vue
@@ -46,7 +46,7 @@ async function getClaims() {
originalTicket.value = data[0]?.originalTicketFk;
}
async function getProblems() {
- const { data } = await axios.get(`Tickets/${entityId.value}/getTicketProblems`);
+ const { data } = await axios.get(`Tickets/getTicketProblems`, {params: { ids: [entityId.value] }});
if (!data) return;
problems.value = data[0];
}
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/TicketEditMana.vue b/src/pages/Ticket/Card/TicketEditMana.vue
index 266c82ccd..f8a72caf3 100644
--- a/src/pages/Ticket/Card/TicketEditMana.vue
+++ b/src/pages/Ticket/Card/TicketEditMana.vue
@@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
import { computed, ref } from 'vue';
import { useRoute } from 'vue-router';
import { toCurrency } from 'src/filters';
-import VnUsesMana from 'components/ui/VnUsesMana.vue';
const $props = defineProps({
newPrice: {
@@ -15,23 +14,36 @@ const $props = defineProps({
type: Object,
default: null,
},
+ componentId: {
+ type: Number,
+ default: null,
+ },
});
+const emit = defineEmits(['save', 'cancel', 'update:componentId']);
+
const route = useRoute();
const mana = ref(null);
-const usesMana = ref(false);
-
-const emit = defineEmits(['save', 'cancel']);
+const usesMana = ref([]);
const { t } = useI18n();
const QPopupProxyRef = ref(null);
-const manaCode = ref($props.manaCode);
+
+const componentId = computed({
+ get: () => $props.componentId,
+ set: (val) => emit('update:componentId', val),
+});
const save = (sale = $props.sale) => {
emit('save', sale);
QPopupProxyRef.value.hide();
};
+const cancel = () => {
+ emit('cancel');
+ QPopupProxyRef.value.hide();
+};
+
const getMana = async () => {
const { data } = await axios.get(`Tickets/${route.params.id}/getDepartmentMana`);
mana.value = data;
@@ -39,15 +51,12 @@ const getMana = async () => {
};
const getUsesMana = async () => {
- const { data } = await axios.get('Sales/usesMana');
+ const { data } = await axios.get('Sales/getComponents');
usesMana.value = data;
};
-const cancel = () => {
- emit('cancel');
- QPopupProxyRef.value.hide();
-};
const hasMana = computed(() => typeof mana.value === 'number');
+
defineExpose({ save });
@@ -59,17 +68,29 @@ defineExpose({ save });
>
-
+
+
+
-
-
+
+
+
+
{{ t('New price') }}
-
- {{ toCurrency($props.newPrice) }}
-
+ {{ toCurrency(newPrice) }}
@@ -77,7 +98,6 @@ defineExpose({ save });
@@ -86,7 +106,6 @@ defineExpose({ save });
-
-
-es:
- New price: Nuevo precio
-
diff --git a/src/pages/Ticket/Card/TicketNotes.vue b/src/pages/Ticket/Card/TicketNotes.vue
index feb88bf84..a3e25d63e 100644
--- a/src/pages/Ticket/Card/TicketNotes.vue
+++ b/src/pages/Ticket/Card/TicketNotes.vue
@@ -38,7 +38,9 @@ function handleDelete(row) {
ticketNotesCrudRef.value.remove([row]);
}
-async function handleSave() {
+async function handleSave(e) {
+ if (e.shiftKey && e.key === 'Enter') return;
+ e.preventDefault();
if (!isSaving.value) {
isSaving.value = true;
await ticketNotesCrudRef.value?.saveChanges();
@@ -70,7 +72,7 @@ async function handleSave() {
store.data?.ticketState?.state?.code);
const transfer = ref({
lastActiveTickets: [],
@@ -99,6 +99,7 @@ const columns = computed(() => [
align: 'left',
label: t('globals.quantity'),
name: 'quantity',
+ class: 'shrink',
format: (row) => toCurrency(row.quantity),
},
{
@@ -186,7 +187,7 @@ const getRowUpdateInputEvents = (sale) => {
};
const resetChanges = async () => {
- arrayData.fetch({ append: false });
+ await arrayData.fetch({ append: false });
tableRef.value.CrudModelRef.hasChanges = false;
await tableRef.value.reload();
@@ -307,14 +308,15 @@ const changePrice = async (sale) => {
if (newPrice != null && newPrice != sale.price) {
if (await isSalePrepared(sale)) {
await confirmUpdate(() => updatePrice(sale, newPrice));
- } else updatePrice(sale, newPrice);
+ } else await updatePrice(sale, newPrice);
}
};
const updatePrice = async (sale, newPrice) => {
try {
- await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
- sale.price = newPrice;
- edit.value = { ...DEFAULT_EDIT };
+ await axios.post(`Sales/${sale.id}/updatePrice`, {
+ newPrice: newPrice,
+ componentId: componentId.value,
+ });
notify('globals.dataSaved', 'positive');
resetChanges();
} catch (e) {
@@ -326,28 +328,31 @@ const changeDiscount = async (sale) => {
const newDiscount = edit.value.discount;
if (newDiscount != null && newDiscount != sale.discount) {
if (await isSalePrepared(sale))
- await confirmUpdate(() => updateDiscount([sale], newDiscount));
- else await updateDiscount([sale], newDiscount);
+ await confirmUpdate(() =>
+ updateDiscount([sale], newDiscount, componentId.value),
+ );
+ else await updateDiscount([sale], newDiscount, componentId.value);
}
};
-const updateDiscounts = async (sales, newDiscount) => {
+const updateDiscounts = async (sales, newDiscount, componentId) => {
const salesTracking = await fetchSalesTracking();
const someSaleIsPrepared = salesTracking.some((sale) =>
matchSale(salesTracking, sale),
);
- if (someSaleIsPrepared) await confirmUpdate(() => updateDiscount(sales, newDiscount));
- else updateDiscount(sales, newDiscount);
+ if (someSaleIsPrepared)
+ await confirmUpdate(() => updateDiscount(sales, newDiscount, componentId));
+ else updateDiscount(sales, newDiscount, componentId);
};
-const updateDiscount = async (sales, newDiscount = 0) => {
+const updateDiscount = async (sales, newDiscount, componentId) => {
try {
const salesIds = sales.map(({ id }) => id);
const params = {
salesIds,
- newDiscount,
- manaCode: manaCode.value,
+ newDiscount: newDiscount ?? 0,
+ componentId,
};
await axios.post(`Tickets/${route.params.id}/updateDiscount`, params);
notify('globals.dataSaved', 'positive');
@@ -768,6 +773,7 @@ watch(
v-model="row.itemFk"
:use-like="false"
@update:model-value="changeItem(row)"
+ autofocus
>
@@ -791,7 +797,7 @@ watch(
{{ row?.item?.subName.toUpperCase() }}
-
+
editManaProxyRef.save(row)"
+ @keyup.enter.stop="() => editPriceProxyRef.save(row)"
v-model.number="edit.price"
:label="t('basicData.price')"
type="number"
@@ -842,7 +849,7 @@ watch(
ref="editManaProxyRef"
:sale="row"
:new-price="getNewPrice"
- :mana-code="manaCode"
+ v-model:component-id="componentId"
@save="changeDiscount"
>
{
});
if (newDiscount.value != null && hasChanges)
- emit('updateDiscounts', props.sales, newDiscount.value);
+ emit('updateDiscounts', props.sales, newDiscount.value, componentId.value);
btnDropdownRef.value.hide();
};
@@ -206,6 +207,7 @@ const createRefund = async (withWarehouse) => {
ref="editManaProxyRef"
:sale="row"
@save="changeMultipleDiscount"
+ v-model:component-id="componentId"
>
{
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);
};
-
+
diff --git a/src/pages/Ticket/Card/TicketTracking.vue b/src/pages/Ticket/Card/TicketTracking.vue
index 00610de44..06171366d 100644
--- a/src/pages/Ticket/Card/TicketTracking.vue
+++ b/src/pages/Ticket/Card/TicketTracking.vue
@@ -1,27 +1,23 @@
-
-
-
-
-
-
-
- {{ row.user?.name }}
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
- {{ t('tracking.addState') }}
-
-
-
+
+
+
+
+ {{ row.user.name }}
+
+
+
+
+
+ es:
+ Create tracking: Crear estado
+
diff --git a/src/pages/Ticket/Card/TicketTransfer.vue b/src/pages/Ticket/Card/TicketTransfer.vue
index ffa964c92..c096dee21 100644
--- a/src/pages/Ticket/Card/TicketTransfer.vue
+++ b/src/pages/Ticket/Card/TicketTransfer.vue
@@ -5,7 +5,7 @@ import VnInput from 'src/components/common/VnInput.vue';
import TicketTransferForm from './TicketTransferForm.vue';
import { toDateFormat } from 'src/filters/date.js';
-const emit = defineEmits(['ticketTransfered']);
+const emit = defineEmits(['ticketTransferred']);
const $props = defineProps({
mana: {
diff --git a/src/pages/Ticket/Card/TicketTransferProxy.vue b/src/pages/Ticket/Card/TicketTransferProxy.vue
index 7d5d82f85..af3b13990 100644
--- a/src/pages/Ticket/Card/TicketTransferProxy.vue
+++ b/src/pages/Ticket/Card/TicketTransferProxy.vue
@@ -1,8 +1,8 @@
-
+
route.params.id);
@@ -84,6 +85,7 @@ function reloadData() {
initialData.value.deviceProductionFk = null;
initialData.value.simFk = null;
tableRef.value.reload();
+ getAvailablePdaRef.value.fetch();
}
async function fetchDocuware() {
@@ -135,6 +137,7 @@ async function deallocatePDA(deviceProductionFk) {
);
delete tableRef.value.CrudModelRef.formData[index];
notify(t('PDA deallocated'), 'positive');
+ await getAvailablePdaRef.value.fetch();
}
function isSigned(row) {
@@ -144,6 +147,7 @@ function isSigned(row) {
(deviceProductions = data)"
auto-load
@@ -234,7 +238,7 @@ function isSigned(row) {
data-cy="workerPda-download"
>
- {{ t('worker.pda.download') }}
+ {{ t('globals.downloadPdf') }}
@@ -307,4 +311,5 @@ es:
This PDA is already assigned to another user: Este PDA ya está asignado a otro usuario
Are you sure you want to send it?: ¿Seguro que quieres enviarlo?
Sign PDA: Firmar PDA
+ PDF sended to signed: PDF enviado para firmar
diff --git a/src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue b/src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue
index c793e9319..de3b5d585 100644
--- a/src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue
+++ b/src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue
@@ -11,7 +11,7 @@ const $props = defineProps({
-
+
!val && delete data.payMethodFk
"
/>
-
-
-
- {{
- t('components.iban_tooltip')
- }}
-
-
-
+ @update-bic="
+ (bankEntityFk) => (data.bankEntityFk = bankEntityFk)
+ "
+ />
diff --git a/src/pages/Zone/Card/ZoneDescriptor.vue b/src/pages/Zone/Card/ZoneDescriptor.vue
index f2bcc1247..a6ec86355 100644
--- a/src/pages/Zone/Card/ZoneDescriptor.vue
+++ b/src/pages/Zone/Card/ZoneDescriptor.vue
@@ -27,7 +27,7 @@ const entityId = computed(() => {
-
+
diff --git a/src/pages/Zone/Card/ZoneDescriptorProxy.vue b/src/pages/Zone/Card/ZoneDescriptorProxy.vue
index 27102ac07..a16d231e6 100644
--- a/src/pages/Zone/Card/ZoneDescriptorProxy.vue
+++ b/src/pages/Zone/Card/ZoneDescriptorProxy.vue
@@ -11,7 +11,7 @@ const $props = defineProps({
-
+
diff --git a/src/pages/Zone/Card/ZoneEventExclusionForm.vue b/src/pages/Zone/Card/ZoneEventExclusionForm.vue
index 582a8bbad..89a6e02f8 100644
--- a/src/pages/Zone/Card/ZoneEventExclusionForm.vue
+++ b/src/pages/Zone/Card/ZoneEventExclusionForm.vue
@@ -68,7 +68,7 @@ const arrayData = useArrayData('ZoneEvents');
const exclusionGeoCreate = async () => {
const params = {
zoneFk: parseInt(route.params.id),
- date: dated,
+ date: dated.value,
geoIds: tickedNodes.value,
};
await axios.post('Zones/exclusionGeo', params);
@@ -101,9 +101,17 @@ const exclusionCreate = async () => {
const existsEvent = data.events.find(
(event) => toDateFormat(event.dated) === toDateFormat(dated.value),
);
+ const existsGeoEvent = data.geoExclusions.find(
+ (event) => toDateFormat(event.dated) === toDateFormat(dated.value),
+ );
if (existsEvent) {
await axios.delete(`Zones/${existsEvent?.zoneFk}/events/${existsEvent?.id}`);
}
+ if (existsGeoEvent) {
+ await axios.delete(
+ `Zones/${existsGeoEvent?.zoneFk}/exclusions/${existsGeoEvent?.zoneExclusionFk}`,
+ );
+ }
if (isNew.value || props.event?.type) await axios.post(`${url}`, [body]);
else await axios.put(`${url}/${props.event?.id}`, body);
@@ -122,8 +130,21 @@ const onSubmit = async () => {
const deleteEvent = async () => {
if (!props.event) return;
- const exclusionId = props.event?.zoneExclusionFk || props.event?.id;
- await axios.delete(`Zones/${route.params.id}/exclusions/${exclusionId}`);
+ if (!props.event.created) {
+ const filter = {
+ where: {
+ dated: dated.value,
+ },
+ };
+ const params = { filter: JSON.stringify(filter) };
+ const { data: res } = await axios.get(`Zones/${route.params.id}/exclusions`, {
+ params,
+ });
+ if (res) await axios.delete(`Zones/${route.params.id}/exclusions/${res[0].id}`);
+ } else {
+ const exclusionId = props.event?.zoneExclusionFk || props.event?.id;
+ await axios.delete(`Zones/${route.params.id}/exclusions/${exclusionId}`);
+ }
await refetchEvents();
};
@@ -135,7 +156,7 @@ const refetchEvents = async () => {
};
onMounted(() => {
- if (props.event) {
+ if (props.event && props.event.dated) {
dated.value = props.event?.dated;
excludeType.value =
props.eventType === 'geoExclusion' ? 'specificLocations' : 'all';
diff --git a/src/pages/Zone/Card/ZoneEventInclusionForm.vue b/src/pages/Zone/Card/ZoneEventInclusionForm.vue
index 8b02c2d84..fad51765c 100644
--- a/src/pages/Zone/Card/ZoneEventInclusionForm.vue
+++ b/src/pages/Zone/Card/ZoneEventInclusionForm.vue
@@ -56,6 +56,7 @@ const isNew = computed(() => props.isNewMode);
const eventInclusionFormData = ref({ wdays: [] });
const dated = ref(props.date || Date.vnNew());
const _inclusionType = ref('indefinitely');
+const hasDeletedEvent = ref(false);
const inclusionType = computed({
get: () => _inclusionType.value,
set: (val) => {
@@ -84,7 +85,7 @@ const createEvent = async () => {
}
const zoneIds = props.zoneIds?.length ? props.zoneIds : [route.params.id];
- for (const id of zoneIds) {
+ for (const zoneId of zoneIds) {
let today = eventInclusionFormData.value.dated
? moment(eventInclusionFormData.value.dated)
: moment(dated.value);
@@ -92,7 +93,7 @@ const createEvent = async () => {
const { data } = await axios.get(`Zones/getEventsFiltered`, {
params: {
- zoneFk: id,
+ zoneFk: zoneId,
started: today,
ended: lastDay,
},
@@ -106,15 +107,19 @@ const createEvent = async () => {
await axios.delete(
`Zones/${existsExclusion?.zoneFk}/exclusions/${existsExclusion?.id}`,
);
+ await refetchEvents();
+ hasDeletedEvent.value = true;
}
- if (isNew.value)
- await axios.post(`Zones/${id}/events`, eventInclusionFormData.value);
+ delete eventInclusionFormData.value.id;
+ if (isNew.value || hasDeletedEvent.value)
+ await axios.post(`Zones/${zoneId}/events`, eventInclusionFormData.value);
else
await axios.put(
- `Zones/${id}/events/${props.event?.id}`,
+ `Zones/${zoneId}/events/${props.event?.id}`,
eventInclusionFormData.value,
);
+ hasDeletedEvent.value = false;
}
quasar.notify({
message: t('globals.dataSaved'),
diff --git a/src/pages/Zone/ZoneList.vue b/src/pages/Zone/ZoneList.vue
index 8d7c4a165..355eb900e 100644
--- a/src/pages/Zone/ZoneList.vue
+++ b/src/pages/Zone/ZoneList.vue
@@ -93,6 +93,7 @@ const columns = computed(() => [
optionLabel: 'name',
optionValue: 'id',
},
+ columnClass: 'expand',
},
{
align: 'left',
@@ -247,74 +248,70 @@ const closeEventForm = () => {
-
-
-
-
- {{ dashIfEmpty(formatRow(row)) }}
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ {{ dashIfEmpty(formatRow(row)) }}
+
+
+
+
+
+
+
+
+
+
+
@@ -333,24 +330,6 @@ const closeEventForm = () => {
/>
-
-
-
es:
Search zone: Buscar zona
diff --git a/src/router/modules/entry.js b/src/router/modules/entry.js
index 02eea8c6c..da380313b 100644
--- a/src/router/modules/entry.js
+++ b/src/router/modules/entry.js
@@ -85,6 +85,7 @@ export default {
'EntryLatestBuys',
'EntryStockBought',
'EntryWasteRecalc',
+ 'EntryPreAccount',
],
},
component: RouterView,
@@ -94,6 +95,7 @@ export default {
name: 'EntryMain',
path: '',
component: () => import('src/components/common/VnModule.vue'),
+ props: (route) => ({ leftDrawer: route.name !== 'EntryPreAccount' }),
redirect: { name: 'EntryIndexMain' },
children: [
{
@@ -150,6 +152,15 @@ export default {
},
component: () => import('src/pages/Entry/EntryWasteRecalc.vue'),
},
+ {
+ path: 'pre-account',
+ name: 'EntryPreAccount',
+ meta: {
+ title: 'entryPreAccount',
+ icon: 'account_balance',
+ },
+ component: () => import('src/pages/Entry/EntryPreAccount.vue'),
+ },
],
},
],
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 bfcb78787..b6b9f71a2 100644
--- a/src/router/modules/ticket.js
+++ b/src/router/modules/ticket.js
@@ -113,7 +113,7 @@ const ticketCard = {
name: 'TicketExpedition',
meta: {
title: 'expedition',
- icon: 'vn:package',
+ icon: 'view_in_ar',
},
component: () => import('src/pages/Ticket/Card/TicketExpedition.vue'),
},
@@ -168,7 +168,7 @@ const ticketCard = {
name: 'TicketBoxing',
meta: {
title: 'boxing',
- icon: 'view_in_ar',
+ icon: 'videocam',
},
component: () => import('src/pages/Ticket/Card/TicketBoxing.vue'),
},
@@ -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/docker/find/find-imports.js b/test/cypress/docker/find/find-imports.js
index 39c3ac3eb..622049c9f 100644
--- a/test/cypress/docker/find/find-imports.js
+++ b/test/cypress/docker/find/find-imports.js
@@ -44,7 +44,7 @@ export async function findImports(targetFile, visited = new Set(), identation =
];
}
- return getUniques(fullTree); // Remove duplicates
+ return getUniques([...fullTree, targetFile]); // Remove duplicates
}
function getUniques(array) {
diff --git a/test/cypress/docker/find/find.js b/test/cypress/docker/find/find.js
index b89aab230..4f8063c86 100644
--- a/test/cypress/docker/find/find.js
+++ b/test/cypress/docker/find/find.js
@@ -25,7 +25,7 @@ async function getChangedModules() {
if (change.startsWith(E2E_PATH)) changedArray.push(change);
changedModules = new Set(changedArray);
}
- return [...changedModules].join('\n');
+ return cleanSpecs(changedModules).join('\n');
}
getChangedModules()
@@ -34,3 +34,20 @@ getChangedModules()
console.error(e);
process.exit(1);
});
+
+function cleanSpecs(changedModules) {
+ let specifics = [];
+ const modules = [];
+ for (const changed of changedModules) {
+ if (changed.endsWith('*.spec.js')) {
+ modules.push(changed);
+ continue;
+ }
+ specifics.push(changed);
+ }
+ specifics = specifics.filter(
+ (spec) => !modules.some((module) => spec.startsWith(module.split('**')[0])),
+ );
+
+ return [...modules, ...specifics];
+}
diff --git a/test/cypress/integration/claim/claimAction.spec.js b/test/cypress/integration/claim/claimAction.spec.js
index 8f406ad2f..674313a5a 100644
--- a/test/cypress/integration/claim/claimAction.spec.js
+++ b/test/cypress/integration/claim/claimAction.spec.js
@@ -1,12 +1,11 @@
///
-describe.skip('ClaimAction', () => {
+describe('ClaimAction', () => {
const claimId = 1;
const firstRow = 'tbody > :nth-child(1)';
const destinationRow = '.q-item__section > .q-field';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/claim/${claimId}/action`);
});
@@ -16,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);
@@ -36,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 097d870df..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)';
@@ -7,7 +7,6 @@ describe.skip('ClaimDevelopment', () => {
const newReason = 'Calor';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/claim/${claimId}/development`);
cy.waitForElement('tbody');
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 ba689b8c7..11643c566 100644
--- a/test/cypress/integration/entry/entryCard/entryBasicData.spec.js
+++ b/test/cypress/integration/entry/entryCard/entryBasicData.spec.js
@@ -1,8 +1,7 @@
import '../commands.js';
-describe('EntryBasicData', () => {
+describe.skip('EntryBasicData', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
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 8185866db..2e121064c 100644
--- a/test/cypress/integration/entry/entryCard/entryDescriptor.spec.js
+++ b/test/cypress/integration/entry/entryCard/entryDescriptor.spec.js
@@ -1,7 +1,6 @@
import '../commands.js';
-describe('EntryDescriptor', () => {
+describe.skip('EntryDescriptor', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('buyer');
cy.visit(`/#/entry/list`);
});
diff --git a/test/cypress/integration/entry/entryCard/entryDms.spec.js b/test/cypress/integration/entry/entryCard/entryDms.spec.js
index f3f0ef20b..640b70907 100644
--- a/test/cypress/integration/entry/entryCard/entryDms.spec.js
+++ b/test/cypress/integration/entry/entryCard/entryDms.spec.js
@@ -1,7 +1,6 @@
import '../commands.js';
describe('EntryDms', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('buyer');
cy.visit(`/#/entry/list`);
});
diff --git a/test/cypress/integration/entry/entryCard/entryLock.spec.js b/test/cypress/integration/entry/entryCard/entryLock.spec.js
index 6ba4392ae..957c67cc6 100644
--- a/test/cypress/integration/entry/entryCard/entryLock.spec.js
+++ b/test/cypress/integration/entry/entryCard/entryLock.spec.js
@@ -1,7 +1,6 @@
import '../commands.js';
describe('EntryLock', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('buyer');
cy.visit(`/#/entry/list`);
});
diff --git a/test/cypress/integration/entry/entryCard/entryNotes.spec.js b/test/cypress/integration/entry/entryCard/entryNotes.spec.js
index 544ac23b0..80c9fd38d 100644
--- a/test/cypress/integration/entry/entryCard/entryNotes.spec.js
+++ b/test/cypress/integration/entry/entryCard/entryNotes.spec.js
@@ -2,7 +2,6 @@ import '../commands.js';
describe('EntryNotes', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('buyer');
cy.visit(`/#/entry/list`);
});
diff --git a/test/cypress/integration/entry/entryList.spec.js b/test/cypress/integration/entry/entryList.spec.js
index bad47615f..fc76f6d87 100644
--- a/test/cypress/integration/entry/entryList.spec.js
+++ b/test/cypress/integration/entry/entryList.spec.js
@@ -2,7 +2,6 @@ import './commands';
describe('EntryList', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('buyer');
cy.visit(`/#/entry/list`);
});
diff --git a/test/cypress/integration/entry/entryPreAccount.spec.js b/test/cypress/integration/entry/entryPreAccount.spec.js
new file mode 100644
index 000000000..59fa4ee45
--- /dev/null
+++ b/test/cypress/integration/entry/entryPreAccount.spec.js
@@ -0,0 +1,48 @@
+///
+describe('Entry PreAccount Functionality', () => {
+ beforeEach(() => {
+ cy.login('administrative');
+ cy.visit('/#/entry/pre-account');
+ });
+
+ it("should pre-account without questions if it's agricultural", () => {
+ selectRowsByCol('id', [2]);
+ cy.dataCy('preAccount_btn').click();
+ cy.checkNotification('It has been successfully pre-accounted');
+ });
+
+ it("should ask to upload a doc. if it's not agricultural and doesn't have doc. ", () => {
+ selectRowsByCol('id', [3]);
+ cy.dataCy('preAccount_btn').click();
+ cy.dataCy('Reference_input').type('{selectall}234343fh', { delay: 0 });
+ cy.dataCy('VnDms_inputFile').selectFile('test/cypress/fixtures/image.jpg', {
+ force: true,
+ });
+ cy.dataCy('FormModelPopup_save').click();
+ cy.checkNotification('It has been successfully pre-accounted');
+ });
+
+ it('should ask to inherit the doc. and open VnDms popup if user choose "no"', () => {
+ selectRowsByCol('id', [101]);
+ cy.dataCy('preAccount_btn').click();
+ cy.dataCy('updateFileNo').click();
+ cy.get('#formModel').should('be.visible');
+ });
+
+ it('should ask to inherit the doc. and open VnDms popup if user choose "yes" and pre-account', () => {
+ selectRowsByCol('id', [101]);
+ cy.dataCy('preAccount_btn').click();
+ cy.dataCy('updateFileYes').click();
+ cy.checkNotification('It has been successfully pre-accounted');
+ });
+});
+
+function selectRowsByCol(col = 'id', vals = []) {
+ for (const val of vals) {
+ const regex = new RegExp(`^\\s*(${val})\\s*$`);
+ cy.contains(`[data-col-field="${col}"]`, regex)
+ .parent()
+ .find('td > .q-checkbox')
+ .click();
+ }
+}
diff --git a/test/cypress/integration/entry/entryStockBought.spec.js b/test/cypress/integration/entry/entryStockBought.spec.js
index 3fad44d91..60019c9f4 100644
--- a/test/cypress/integration/entry/entryStockBought.spec.js
+++ b/test/cypress/integration/entry/entryStockBought.spec.js
@@ -1,6 +1,5 @@
describe('EntryStockBought', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('buyer');
cy.visit(`/#/entry/stock-Bought`);
});
diff --git a/test/cypress/integration/entry/entrySupplier.spec.js b/test/cypress/integration/entry/entrySupplier.spec.js
index 83deecea5..df90d00d7 100644
--- a/test/cypress/integration/entry/entrySupplier.spec.js
+++ b/test/cypress/integration/entry/entrySupplier.spec.js
@@ -1,6 +1,5 @@
describe('EntrySupplier when is supplier', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('supplier');
cy.visit(`/#/entry/my`, {
onBeforeLoad(win) {
diff --git a/test/cypress/integration/entry/entryWasteRecalc.spec.js b/test/cypress/integration/entry/entryWasteRecalc.spec.js
index 1b358676c..902d5bbc5 100644
--- a/test/cypress/integration/entry/entryWasteRecalc.spec.js
+++ b/test/cypress/integration/entry/entryWasteRecalc.spec.js
@@ -1,7 +1,6 @@
import './commands';
describe('EntryDms', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('buyerBoss');
cy.visit(`/#/entry/waste-recalc`);
});
@@ -11,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/invoiceIn/invoiceInList.spec.js b/test/cypress/integration/invoiceIn/invoiceInList.spec.js
index 7254e8909..ef3e33000 100644
--- a/test/cypress/integration/invoiceIn/invoiceInList.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInList.spec.js
@@ -3,7 +3,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 invoiceId = '6';
const summaryHeaders = (opt) => `.summaryBody > .${opt} > .q-pb-lg > .header-link`;
const mockInvoiceRef = `createMockInvoice${Math.floor(Math.random() * 100)}`;
const mock = {
@@ -31,7 +31,13 @@ describe('InvoiceInList', () => {
});
it('should open the details', () => {
- cy.get(firstDetailBtn).click();
+ cy.get('[data-col-field="id"]').then(($cells) => {
+ const exactMatch = [...$cells].find(
+ (cell) => cell.textContent.trim() === invoiceId,
+ );
+ expect(exactMatch).to.exist;
+ cy.wrap(exactMatch).closest('tr').find('.q-btn:nth-child(1)').click();
+ });
cy.get(summaryHeaders('max-width')).contains('Basic data');
cy.get(summaryHeaders('vat')).contains('Vat');
});
diff --git a/test/cypress/integration/invoiceOut/invoiceOutList.spec.js b/test/cypress/integration/invoiceOut/invoiceOutList.spec.js
index b8b42fa4b..3059a974b 100644
--- a/test/cypress/integration/invoiceOut/invoiceOutList.spec.js
+++ b/test/cypress/integration/invoiceOut/invoiceOutList.spec.js
@@ -31,7 +31,7 @@ describe('InvoiceOut list', () => {
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/invoiceOutMakeInvoice.spec.js b/test/cypress/integration/invoiceOut/invoiceOutMakeInvoice.spec.js
index e93326f1d..d58eb4a1f 100644
--- a/test/cypress/integration/invoiceOut/invoiceOutMakeInvoice.spec.js
+++ b/test/cypress/integration/invoiceOut/invoiceOutMakeInvoice.spec.js
@@ -1,7 +1,6 @@
///
describe.skip('InvoiceOut manual invoice', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/ticket/list`);
cy.get('#searchbar input').type('{enter}');
diff --git a/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js b/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js
index 9c6eef2ed..89f71e940 100644
--- a/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js
+++ b/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js
@@ -4,7 +4,6 @@ describe('InvoiceOut negative bases', () => {
`:nth-child(1) > [data-col-field="${opt}"] > .no-padding > .link`;
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/negative-bases`);
});
diff --git a/test/cypress/integration/invoiceOut/invvoiceOutGlobal.spec.js b/test/cypress/integration/invoiceOut/invvoiceOutGlobal.spec.js
index 06e132b39..c6f75ef5f 100644
--- a/test/cypress/integration/invoiceOut/invvoiceOutGlobal.spec.js
+++ b/test/cypress/integration/invoiceOut/invvoiceOutGlobal.spec.js
@@ -1,7 +1,6 @@
///
describe('InvoiceOut global invoicing', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('administrative');
cy.visit(`/#/invoice-out/global-invoicing`);
});
@@ -17,12 +16,13 @@ describe('InvoiceOut global invoicing', () => {
cy.dataCy('InvoiceOutGlobalPrinterSelect').type('printer1');
cy.get('.q-menu .q-item').contains('printer1').click();
cy.get(
- '[label="Invoice date"] > .q-field > .q-field__inner > .q-field__control'
+ '[label="Invoice date"] > .q-field > .q-field__inner > .q-field__control',
).click();
cy.get(':nth-child(5) > div > .q-btn > .q-btn__content > .block').click();
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/ItemFixedPrice.spec.js b/test/cypress/integration/item/ItemFixedPrice.spec.js
index 404e8e365..41230f570 100644
--- a/test/cypress/integration/item/ItemFixedPrice.spec.js
+++ b/test/cypress/integration/item/ItemFixedPrice.spec.js
@@ -1,9 +1,14 @@
///
-function goTo(n = 1) {
- return `.q-virtual-scroll__content > :nth-child(${n})`;
-}
-const firstRow = goTo();
describe('Handle Items FixedPrice', () => {
+ const grouping = 'Grouping price';
+ const saveEditBtn = '.q-mt-lg > .q-btn--standard';
+ const createForm = {
+ 'Grouping price': { val: '5' },
+ 'Packing price': { val: '5' },
+ Started: { val: '01-01-2001', type: 'date' },
+ Ended: { val: '15-01-2001', type: 'date' },
+ };
+
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
@@ -13,50 +18,57 @@ describe('Handle Items FixedPrice', () => {
'.q-header > .q-toolbar > :nth-child(1) > .q-btn__content > .q-icon',
).click();
});
- it.skip('filter', function () {
+
+ it('filter by category', () => {
cy.get('.category-filter > :nth-child(1) > .q-btn__content > .q-icon').click();
- cy.selectOption('.list > :nth-child(2)', 'Alstroemeria');
- cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
-
- cy.addBtnClick();
- cy.selectOption(`${firstRow} > :nth-child(2)`, '#13');
- cy.get(`${firstRow} > :nth-child(4)`).find('input').type(1);
- cy.get(`${firstRow} > :nth-child(5)`).find('input').type('2');
- cy.selectOption(`${firstRow} > :nth-child(9)`, 'Warehouse One');
- cy.get('.q-notification__message').should('have.text', 'Data saved');
- /* ==== End Cypress Studio ==== */
- });
- it.skip('Create and delete ', function () {
- cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
- cy.addBtnClick();
- cy.selectOption(`${firstRow} > :nth-child(2)`, '#11');
- cy.get(`${firstRow} > :nth-child(4)`).type('1');
- cy.get(`${firstRow} > :nth-child(5)`).type('2');
- cy.selectOption(`${firstRow} > :nth-child(9)`, 'Warehouse One');
- cy.get('.q-notification__message').should('have.text', 'Data saved');
- cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
- cy.get(`${firstRow} > .text-right > .q-btn > .q-btn__content > .q-icon`).click();
- cy.get(
- '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
- ).click();
- cy.get('.q-notification__message').should('have.text', 'Data saved');
+ cy.get('.q-table__middle').should('be.visible').should('have.length', 1);
});
- it.skip('Massive edit', function () {
- cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
- cy.get('#subToolbar > .q-btn--standard').click();
- cy.selectOption("[data-cy='field-to-edit']", 'Min price');
- cy.dataCy('value-to-edit').find('input').type('1');
- cy.get('.countLines').should('have.text', ' 1 ');
- cy.get('.q-mt-lg > .q-btn--standard').click();
- cy.get('.q-notification__message').should('have.text', 'Data saved');
+ it('should create a new fixed price, then delete it', () => {
+ cy.dataCy('vnTableCreateBtn').click();
+ cy.dataCy('FixedPriceCreateNameSelect').type('Melee weapon combat fist 15cm');
+ cy.get('.q-menu .q-item').contains('Melee weapon combat fist 15cm').click();
+ cy.dataCy('FixedPriceCreateWarehouseSelect').type('Warehouse One');
+ cy.get('.q-menu .q-item').contains('Warehouse One').click();
+ cy.get('.q-menu').then(($menu) => {
+ if ($menu.is(':visible')) {
+ cy.dataCy('FixedPriceCreateWarehouseSelect').as('focusedElement').focus();
+ cy.dataCy('FixedPriceCreateWarehouseSelect').blur();
+ }
+ });
+ cy.fillInForm(createForm);
+ cy.dataCy('FormModelPopup_save').click();
+ cy.checkNotification('Data created');
+ cy.get('[data-col-field="name"]').each(($el) => {
+ cy.wrap($el)
+ .invoke('text')
+ .then((text) => {
+ if (text.includes('Melee weapon combat fist 15cm')) {
+ cy.wrap($el).parent().find('.q-checkbox').click();
+ cy.get('[data-cy="crudModelDefaultRemoveBtn"]').click();
+ cy.dataCy('VnConfirm_confirm').click().click();
+ cy.checkNotification('Data saved');
+ }
+ });
+ });
});
- it.skip('Massive remove', function () {
- cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
- cy.get('#subToolbar > .q-btn--flat').click();
- cy.get(
- '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
- ).click();
- cy.get('.q-notification__message').should('have.text', 'Data saved');
+
+ it('should edit all items', () => {
+ cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
+ cy.dataCy('FixedPriceToolbarEditBtn').should('not.be.disabled');
+ cy.dataCy('FixedPriceToolbarEditBtn').click();
+ cy.dataCy('EditFixedPriceSelectOption').type(grouping);
+ cy.get('.q-menu .q-item').contains(grouping).click();
+ cy.dataCy('EditFixedPriceValueOption').type('5');
+ cy.get(saveEditBtn).click();
+ cy.checkNotification('Data saved');
+ });
+
+ it('should remove all items', () => {
+ cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
+ cy.dataCy('crudModelDefaultRemoveBtn').should('not.be.disabled');
+ cy.dataCy('crudModelDefaultRemoveBtn').click();
+ cy.dataCy('VnConfirm_confirm').click();
+ cy.checkNotification('Data saved');
});
});
diff --git a/test/cypress/integration/item/itemBarcodes.spec.js b/test/cypress/integration/item/itemBarcodes.spec.js
index 1f6698f9c..746cfa0f1 100644
--- a/test/cypress/integration/item/itemBarcodes.spec.js
+++ b/test/cypress/integration/item/itemBarcodes.spec.js
@@ -1,7 +1,6 @@
///
describe('ItemBarcodes', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/1/barcode`);
});
diff --git a/test/cypress/integration/item/itemBotanical.spec.js b/test/cypress/integration/item/itemBotanical.spec.js
index 6105ef179..420181b0d 100644
--- a/test/cypress/integration/item/itemBotanical.spec.js
+++ b/test/cypress/integration/item/itemBotanical.spec.js
@@ -1,7 +1,6 @@
///
describe('Item botanical', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/1/botanical`);
});
diff --git a/test/cypress/integration/item/itemList.spec.js b/test/cypress/integration/item/itemList.spec.js
index 10e388580..7950f2bda 100644
--- a/test/cypress/integration/item/itemList.spec.js
+++ b/test/cypress/integration/item/itemList.spec.js
@@ -1,8 +1,7 @@
///
-describe.skip('Item list', () => {
+describe('Item list', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/list`);
cy.typeSearchbar('{enter}');
diff --git a/test/cypress/integration/item/itemSummary.spec.js b/test/cypress/integration/item/itemSummary.spec.js
index ad8267ecf..65b4c8629 100644
--- a/test/cypress/integration/item/itemSummary.spec.js
+++ b/test/cypress/integration/item/itemSummary.spec.js
@@ -1,7 +1,6 @@
///
describe('Item summary', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/1/summary`);
});
@@ -19,6 +18,7 @@ describe('Item summary', () => {
cy.get('.q-menu > .q-list > :nth-child(1) > .q-item__section').click();
cy.dataCy('regularizeStockInput').type('10');
cy.dataCy('Warehouse_select').type('Warehouse One{enter}');
+ cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data created');
});
});
diff --git a/test/cypress/integration/item/itemTag.spec.js b/test/cypress/integration/item/itemTag.spec.js
index 425eaffe6..65d339151 100644
--- a/test/cypress/integration/item/itemTag.spec.js
+++ b/test/cypress/integration/item/itemTag.spec.js
@@ -1,6 +1,5 @@
describe('Item tag', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/1/tags`);
cy.get('.q-page').should('be.visible');
diff --git a/test/cypress/integration/item/itemTax.spec.js b/test/cypress/integration/item/itemTax.spec.js
index 6ff147135..10c3ee889 100644
--- a/test/cypress/integration/item/itemTax.spec.js
+++ b/test/cypress/integration/item/itemTax.spec.js
@@ -1,13 +1,12 @@
///
describe('Item tax', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/1/tax`);
});
it('should modify the tax for Spain', () => {
- cy.dataCy('Class_select').eq(1).type('General VAT{enter}');
+ cy.dataCy('Class_select').eq(1).type('IVA General{enter}');
cy.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification('Data saved');
});
diff --git a/test/cypress/integration/item/itemType.spec.js b/test/cypress/integration/item/itemType.spec.js
index 466a49708..180a12a0f 100644
--- a/test/cypress/integration/item/itemType.spec.js
+++ b/test/cypress/integration/item/itemType.spec.js
@@ -6,7 +6,6 @@ describe('Item type', () => {
const type = 'Flower';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/item-type`);
});
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 ee011ea05..56c4b6a32 100644
--- a/test/cypress/integration/order/orderList.spec.js
+++ b/test/cypress/integration/order/orderList.spec.js
@@ -6,20 +6,20 @@ describe('OrderList', () => {
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
cy.visit('/#/order/list');
});
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/agency/agencyModes.spec.js b/test/cypress/integration/route/agency/agencyModes.spec.js
index 3f5784997..edf7f8819 100644
--- a/test/cypress/integration/route/agency/agencyModes.spec.js
+++ b/test/cypress/integration/route/agency/agencyModes.spec.js
@@ -2,7 +2,6 @@ describe('Agency modes', () => {
const name = 'inhouse pickup';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/agency/1/modes`);
});
diff --git a/test/cypress/integration/route/agency/agencyWorkCenter.spec.js b/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
index 79dcd6f70..d73ba1491 100644
--- a/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
+++ b/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
@@ -13,7 +13,6 @@ describe('AgencyWorkCenter', () => {
};
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/agency/11/workCenter`);
});
diff --git a/test/cypress/integration/route/cmr/cmrList.spec.js b/test/cypress/integration/route/cmr/cmrList.spec.js
index d33508e3a..a25a0c10a 100644
--- a/test/cypress/integration/route/cmr/cmrList.spec.js
+++ b/test/cypress/integration/route/cmr/cmrList.spec.js
@@ -24,7 +24,6 @@ describe('Cmr list', () => {
};
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit('/#/route/cmr');
cy.typeSearchbar('{enter}');
diff --git a/test/cypress/integration/route/roadMap/roadmapList.spec.js b/test/cypress/integration/route/roadMap/roadmapList.spec.js
index 35c0c2b02..bacf130a7 100644
--- a/test/cypress/integration/route/roadMap/roadmapList.spec.js
+++ b/test/cypress/integration/route/roadMap/roadmapList.spec.js
@@ -27,7 +27,6 @@ describe('RoadMap', () => {
const summaryUrl = '/summary';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/roadmap`);
cy.typeSearchbar('{enter}');
diff --git a/test/cypress/integration/route/routeAutonomous.spec.js b/test/cypress/integration/route/routeAutonomous.spec.js
index d77584c04..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,26 +14,33 @@ 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(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/agency-term`);
cy.typeSearchbar('{enter}');
@@ -45,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,
@@ -60,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 e6c873d5e..d2b4e2108 100644
--- a/test/cypress/integration/route/routeExtendedList.spec.js
+++ b/test/cypress/integration/route/routeExtendedList.spec.js
@@ -1,4 +1,4 @@
-describe('Route extended list', () => {
+describe.skip('Route extended list', () => {
const getSelector = (colField) => `tr:last-child > [data-col-field="${colField}"]`;
const selectors = {
@@ -69,13 +69,13 @@ describe('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;
}
}
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(url);
cy.typeSearchbar('{enter}');
diff --git a/test/cypress/integration/route/routeList.spec.js b/test/cypress/integration/route/routeList.spec.js
index f08c267a4..309f8d023 100644
--- a/test/cypress/integration/route/routeList.spec.js
+++ b/test/cypress/integration/route/routeList.spec.js
@@ -26,8 +26,8 @@ describe('Route', () => {
const summaryUrl = '/summary';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
+ cy.viewport(1920, 1080);
cy.visit(`/#/route/list`);
cy.typeSearchbar('{enter}');
});
diff --git a/test/cypress/integration/route/vehicle/vehicleDescriptor.spec.js b/test/cypress/integration/route/vehicle/vehicleDescriptor.spec.js
index 3e9c816c4..39332b2e0 100644
--- a/test/cypress/integration/route/vehicle/vehicleDescriptor.spec.js
+++ b/test/cypress/integration/route/vehicle/vehicleDescriptor.spec.js
@@ -1,6 +1,5 @@
describe('Vehicle', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('deliveryAssistant');
cy.visit(`/#/route/vehicle/7/summary`);
});
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/route/vehicle/vehicleList.spec.js b/test/cypress/integration/route/vehicle/vehicleList.spec.js
index 2b3c9cdbc..c30f87c6d 100644
--- a/test/cypress/integration/route/vehicle/vehicleList.spec.js
+++ b/test/cypress/integration/route/vehicle/vehicleList.spec.js
@@ -21,7 +21,6 @@ describe('Vehicle list', () => {
const summaryUrl = '/summary';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/vehicle/list`);
cy.typeSearchbar('{enter}');
diff --git a/test/cypress/integration/route/vehicle/vehicleNotes.spec.js b/test/cypress/integration/route/vehicle/vehicleNotes.spec.js
index cd92cc4af..17b870305 100644
--- a/test/cypress/integration/route/vehicle/vehicleNotes.spec.js
+++ b/test/cypress/integration/route/vehicle/vehicleNotes.spec.js
@@ -10,7 +10,6 @@ describe('Vehicle Notes', () => {
const newNoteText = 'probando';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/vehicle/1/notes`);
});
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/shelving/parking/parkingList.spec.js b/test/cypress/integration/shelving/parking/parkingList.spec.js
index 7372da164..44b5fd9bc 100644
--- a/test/cypress/integration/shelving/parking/parkingList.spec.js
+++ b/test/cypress/integration/shelving/parking/parkingList.spec.js
@@ -5,7 +5,6 @@ describe('ParkingList', () => {
const summaryHeader = '.header-link';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/shelving/parking/list`);
});
diff --git a/test/cypress/integration/shelving/shelvingBasicData.spec.js b/test/cypress/integration/shelving/shelvingBasicData.spec.js
index d7b0dc692..e9ff7f696 100644
--- a/test/cypress/integration/shelving/shelvingBasicData.spec.js
+++ b/test/cypress/integration/shelving/shelvingBasicData.spec.js
@@ -3,7 +3,6 @@ describe('ShelvingList', () => {
const parking =
'.q-card > :nth-child(1) > .q-select > .q-field__inner > .q-field__control > .q-field__control-container';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/shelving/1/basic-data`);
});
diff --git a/test/cypress/integration/shelving/shelvingList.spec.js b/test/cypress/integration/shelving/shelvingList.spec.js
index 20b72e419..7a878141a 100644
--- a/test/cypress/integration/shelving/shelvingList.spec.js
+++ b/test/cypress/integration/shelving/shelvingList.spec.js
@@ -1,7 +1,6 @@
///
describe('ShelvingList', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/shelving/list`);
});
diff --git a/test/cypress/integration/supplier/SupplierBalance.spec.js b/test/cypress/integration/supplier/SupplierBalance.spec.js
index e4a3ee65c..575624283 100644
--- a/test/cypress/integration/supplier/SupplierBalance.spec.js
+++ b/test/cypress/integration/supplier/SupplierBalance.spec.js
@@ -1,6 +1,5 @@
describe('Supplier Balance', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/supplier/1/balance`);
});
diff --git a/test/cypress/integration/ticket/ticketBasicData.spec.js b/test/cypress/integration/ticket/ticketBasicData.spec.js
new file mode 100644
index 000000000..443e9569b
--- /dev/null
+++ b/test/cypress/integration/ticket/ticketBasicData.spec.js
@@ -0,0 +1,46 @@
+///
+describe('TicketBasicData', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ cy.visit('/#/ticket/31/basic-data');
+ });
+
+ it('Should redirect to customer basic data', () => {
+ cy.get('.q-page').should('be.visible');
+ cy.get(':nth-child(2) > div > .text-primary').click();
+ cy.dataCy('Address_select').click();
+ cy.get('.q-btn-group ').find('.q-btn__content > .q-icon').click();
+ cy.get(
+ '[data-cy="CustomerBasicData-menu-item"] > .q-item__section--main',
+ ).click();
+ cy.url().should('include', '/customer/1104/basic-data');
+ });
+ it.only('stepper', () => {
+ cy.get('.q-stepper__tab--active').should('have.class', 'q-stepper__tab--active');
+
+ cy.get('.q-stepper__nav > .q-btn--standard').click();
+ cy.get('.q-stepper__tab--done').should('have.class', 'q-stepper__tab--done');
+ cy.get('.q-stepper__tab--active').should('have.class', 'q-stepper__tab--active');
+ cy.get('tr:nth-child(1)>:nth-child(1)>span').should('have.class', 'link').click();
+ cy.dataCy('ItemDescriptor').should('exist');
+
+ cy.get('.q-drawer__content > :nth-child(1)').each(() => {
+ cy.get('span').should('contain.text', 'Price: €');
+ cy.get('span').should('contain.text', 'New price: €');
+ cy.get('span').should('contain.text', 'Difference: €');
+ });
+ cy.get(
+ ':nth-child(3) > .q-radio > .q-radio__inner > .q-radio__bg > .q-radio__check',
+ ).should('have.class', 'q-radio__check');
+ cy.get(
+ '.q-stepper__step-inner > .q-drawer-container > .q-drawer > .q-drawer__content',
+ ).click();
+ cy.get(':nth-child(2) > :nth-child(1) > .text-weight-bold').click();
+ cy.get(':nth-child(3) > .q-radio > .q-radio__inner').should(
+ 'have.class',
+ 'q-radio__inner--truthy',
+ );
+ cy.get('.q-drawer__content > :nth-child(2)').click();
+ });
+});
diff --git a/test/cypress/integration/ticket/ticketComponents.spec.js b/test/cypress/integration/ticket/ticketComponents.spec.js
new file mode 100644
index 000000000..23dbf8bcd
--- /dev/null
+++ b/test/cypress/integration/ticket/ticketComponents.spec.js
@@ -0,0 +1,30 @@
+///
+
+describe('TicketComponents', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ cy.visit('/#/ticket/1/components');
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ cy.validateScrollContent([
+ { row: 2, col: 2, text: 'Base to commission: €799.20' },
+ { row: 2, col: 3, text: 'Total without VAT: €807.20' },
+ { row: 3, col: 2, text: 'valor de compra: €425.000' },
+ { row: 3, col: 4, text: 'maná auto: €7.998' },
+ { row: 4, col: 2, text: 'Price: €5.00' },
+ { row: 4, col: 3, text: 'Bonus: €1.00' },
+ { row: 4, col: 5, text: 'Packages: 6' },
+ { row: 4, col: 4, text: 'Zone: Zone pickup A ' },
+ { row: 5, col: 2, text: 'Total price: €16.00' },
+ ]);
+ cy.get(':nth-child(4) > .link').click();
+
+ cy.dataCy('ZoneDescriptor').should('exist');
+ cy.getRowCol('total').should('have.text', '€250.000€247.000€4.970');
+ cy.getRowCol('import').should('have.text', '€50.000€49.400€0.994');
+ cy.getRowCol('components').should('have.text', 'valor de compramargenmaná auto');
+ cy.getRowCol('serie').should('have.text', 'costeempresacartera_comercial');
+ });
+});
diff --git a/test/cypress/integration/ticket/ticketDescriptor.spec.js b/test/cypress/integration/ticket/ticketDescriptor.spec.js
index b5c95c463..6c3ad704e 100644
--- a/test/cypress/integration/ticket/ticketDescriptor.spec.js
+++ b/test/cypress/integration/ticket/ticketDescriptor.spec.js
@@ -9,7 +9,6 @@ describe('Ticket descriptor', () => {
const weightValue = '[data-cy="vnLvWeight"]';
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
});
it('should clone the ticket without warehouse', () => {
diff --git a/test/cypress/integration/ticket/ticketExpedition.spec.js b/test/cypress/integration/ticket/ticketExpedition.spec.js
index 95ec330dc..c6b633de8 100644
--- a/test/cypress/integration/ticket/ticketExpedition.spec.js
+++ b/test/cypress/integration/ticket/ticketExpedition.spec.js
@@ -5,7 +5,6 @@ describe('Ticket expedtion', () => {
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
});
it('should change the state', () => {
diff --git a/test/cypress/integration/ticket/ticketFilter.spec.js b/test/cypress/integration/ticket/ticketFilter.spec.js
index 2e5a3f3ce..60ad7f287 100644
--- a/test/cypress/integration/ticket/ticketFilter.spec.js
+++ b/test/cypress/integration/ticket/ticketFilter.spec.js
@@ -2,7 +2,6 @@
describe('TicketFilter', () => {
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
cy.visit('/#/ticket/list');
});
diff --git a/test/cypress/integration/ticket/ticketList.spec.js b/test/cypress/integration/ticket/ticketList.spec.js
index 5613a5854..302707601 100644
--- a/test/cypress/integration/ticket/ticketList.spec.js
+++ b/test/cypress/integration/ticket/ticketList.spec.js
@@ -1,17 +1,14 @@
///
describe('TicketList', () => {
- const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
-
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
cy.visit('/#/ticket/list', false);
});
const searchResults = (search) => {
if (search) cy.typeSearchbar().type(search);
cy.dataCy('vn-searchbar').find('input').type('{enter}');
- cy.get(firstRow).should('exist');
+ cy.getRow().should('exist');
};
it('should search results', () => {
@@ -24,13 +21,13 @@ describe('TicketList', () => {
cy.window().then((win) => {
cy.stub(win, 'open').as('windowOpen');
});
- cy.get(firstRow).should('be.visible').find('.q-btn:first').click();
+ cy.getRow().should('be.visible').find('.q-btn:first').click();
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
});
it('should open ticket summary', () => {
searchResults();
- cy.get(firstRow).find('.q-btn:last').click();
+ cy.getRow().find('.q-btn:last').click();
cy.get('.summaryHeader').should('exist');
cy.get('.summaryBody').should('exist');
});
@@ -43,8 +40,9 @@ describe('TicketList', () => {
cy.dataCy('Customer ID_input').clear('1');
cy.dataCy('Customer ID_input').type('1101{enter}');
- cy.get('[data-cy="vnTableCreateBtn"] > .q-btn__content > .q-icon').click();
- cy.waitSpinner();
+ cy.intercept('GET', /\/api\/Clients\?filter/).as('clientFilter');
+ cy.vnTableCreateBtn();
+ cy.wait('@clientFilter');
cy.dataCy('Customer_select').should('have.value', 'Bruce Wayne');
cy.dataCy('Address_select').click();
@@ -52,8 +50,7 @@ describe('TicketList', () => {
cy.dataCy('Address_select').should('have.value', 'Bruce Wayne');
});
it('Client list create new ticket', () => {
- cy.dataCy('vnTableCreateBtn').should('exist');
- cy.dataCy('vnTableCreateBtn').click();
+ cy.vnTableCreateBtn();
const data = {
Customer: { val: 1, type: 'select' },
Warehouse: { val: 'Warehouse One', type: 'select' },
diff --git a/test/cypress/integration/ticket/ticketNotes.spec.js b/test/cypress/integration/ticket/ticketNotes.spec.js
index 5b44f9e1f..f1bd48f61 100644
--- a/test/cypress/integration/ticket/ticketNotes.spec.js
+++ b/test/cypress/integration/ticket/ticketNotes.spec.js
@@ -2,7 +2,6 @@
describe('TicketNotes', () => {
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
cy.visit('/#/ticket/31/observation');
});
@@ -19,7 +18,7 @@ describe('TicketNotes', () => {
cy.checkNotification('Data saved');
cy.dataCy('ticketNotesRemoveNoteBtn').should('exist');
cy.dataCy('ticketNotesRemoveNoteBtn').click();
- cy.dataCy('VnConfirm_confirm').click();
+ cy.confirmVnConfirm();
cy.checkNotification('Data saved');
});
});
diff --git a/test/cypress/integration/ticket/ticketPackage.spec.js b/test/cypress/integration/ticket/ticketPackage.spec.js
new file mode 100644
index 000000000..992efd53b
--- /dev/null
+++ b/test/cypress/integration/ticket/ticketPackage.spec.js
@@ -0,0 +1,21 @@
+///
+describe('TicketPackages', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ cy.visit('/#/ticket/31/package');
+ });
+
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ cy.get('.vn-row > .q-btn > .q-btn__content > .q-icon').click();
+ cy.dataCy('Package_select').click();
+ cy.get('.q-menu :nth-child(1) >.q-item__section').click();
+ cy.dataCy('Quantity_input').clear().type('5');
+ cy.saveCrudModel();
+ cy.checkNotification('Data saved');
+ cy.get('.q-mb-md > .text-primary').click();
+ cy.confirmVnConfirm();
+ cy.checkNotification('Data saved');
+ });
+});
diff --git a/test/cypress/integration/ticket/ticketPictures.spec.js b/test/cypress/integration/ticket/ticketPictures.spec.js
new file mode 100644
index 000000000..1165b54bf
--- /dev/null
+++ b/test/cypress/integration/ticket/ticketPictures.spec.js
@@ -0,0 +1,18 @@
+///
+describe('TicketPictures', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ cy.visit('/#/ticket/31/picture');
+ });
+ it('Should load layout', () => {
+ cy.get(':nth-child(1) > .q-card > .content').should('be.visible');
+ cy.get('.content > .link').should('be.visible').click();
+ cy.dataCy('ItemDescriptor').should('exist');
+ cy.dataCy('vnLvColor:');
+ cy.dataCy('vnLvColor:');
+ cy.dataCy('vnLvTallos:');
+ cy.get('.q-mt-md').should('be.visible');
+ cy.get(':nth-child(1) > .q-card > .img-wrapper').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/ticket/ticketRequest.spec.js b/test/cypress/integration/ticket/ticketRequest.spec.js
index b9dc509ef..dc408c3a1 100644
--- a/test/cypress/integration/ticket/ticketRequest.spec.js
+++ b/test/cypress/integration/ticket/ticketRequest.spec.js
@@ -2,13 +2,11 @@
describe('TicketRequest', () => {
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
cy.visit('/#/ticket/31/request');
});
it('Creates a new request', () => {
- cy.dataCy('vnTableCreateBtn').should('exist');
- cy.dataCy('vnTableCreateBtn').click();
+ cy.vnTableCreateBtn();
const data = {
Description: { val: 'Purchase description' },
Atender: { val: 'buyerNick', type: 'select' },
diff --git a/test/cypress/integration/ticket/ticketSale.spec.js b/test/cypress/integration/ticket/ticketSale.spec.js
index 6d84f214c..b87dfab71 100644
--- a/test/cypress/integration/ticket/ticketSale.spec.js
+++ b/test/cypress/integration/ticket/ticketSale.spec.js
@@ -4,7 +4,7 @@ const firstRow = 'tbody > :nth-child(1)';
describe('TicketSale', () => {
describe('Ticket #23', () => {
beforeEach(() => {
- cy.login('developer');
+ cy.login('claimManager');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/23/sale');
});
@@ -15,11 +15,15 @@ describe('TicketSale', () => {
cy.get('[data-col-field="price"]').find('.q-btn').click();
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
cy.dataCy('ticketEditManaProxy').should('exist');
+ cy.get('[data-cy="componentOption-37"]').click();
+
cy.waitForElement('[data-cy="Price_input"]');
- cy.dataCy('Price_input').clear();
- cy.dataCy('Price_input').type(price);
+ cy.dataCy('Price_input').clear().type(price);
+ cy.intercept('POST', /\/api\/Sales\/\d+\/updatePrice/).as('updatePrice');
+
cy.dataCy('saveManaBtn').click();
handleVnConfirm();
+ cy.wait('@updatePrice').its('response.statusCode').should('eq', 200);
cy.get('[data-col-field="price"]')
.find('.q-btn > .q-btn__content')
@@ -31,11 +35,16 @@ describe('TicketSale', () => {
cy.get('[data-col-field="discount"]').find('.q-btn').click();
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
cy.dataCy('ticketEditManaProxy').should('exist');
+ cy.get('[data-cy="componentOption-37"]').click();
cy.waitForElement('[data-cy="Disc_input"]');
- cy.dataCy('Disc_input').clear();
- cy.dataCy('Disc_input').type(discount);
+ cy.dataCy('Disc_input').clear().type(discount);
+ cy.intercept('POST', /\/api\/Tickets\/\d+\/updateDiscount/).as(
+ 'updateDiscount',
+ );
+
cy.dataCy('saveManaBtn').click();
handleVnConfirm();
+ cy.wait('@updateDiscount').its('response.statusCode').should('eq', 204);
cy.get('[data-col-field="discount"]')
.find('.q-btn > .q-btn__content')
@@ -46,6 +55,8 @@ describe('TicketSale', () => {
const concept = Math.floor(Math.random() * 100) + 1;
cy.waitForElement(firstRow);
cy.get('[data-col-field="item"]').click();
+ cy.intercept('POST', '**/api').as('postRequest');
+
cy.get('.q-menu')
.find('[data-cy="undefined_input"]')
.type(concept)
@@ -58,6 +69,8 @@ describe('TicketSale', () => {
const quantity = Math.floor(Math.random() * 100) + 1;
cy.waitForElement(firstRow);
cy.dataCy('ticketSaleQuantityInput').find('input').clear();
+ cy.intercept('POST', '**/api').as('postRequest');
+
cy.dataCy('ticketSaleQuantityInput')
.find('input')
.type(quantity)
@@ -71,10 +84,9 @@ describe('TicketSale', () => {
.should('have.value', `${quantity}`);
});
});
- describe('Ticket to add claim #24', () => {
+ describe('#24 add claim', () => {
beforeEach(() => {
- cy.login('developer');
- cy.viewport(1920, 1080);
+ cy.login('salesPerson');
cy.visit('/#/ticket/24/sale');
});
@@ -82,18 +94,17 @@ describe('TicketSale', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.dataCy('createClaimItem').click();
- cy.dataCy('VnConfirm_confirm').click();
+ cy.confirmVnConfirm();
cy.url().should('contain', 'claim/');
// Delete created claim to avoid cluttering the database
cy.dataCy('descriptor-more-opts').click();
cy.dataCy('deleteClaim').click();
- cy.dataCy('VnConfirm_confirm').click();
+ cy.confirmVnConfirm();
});
});
- describe('Free ticket #31', () => {
+ describe('#31 free ticket', () => {
beforeEach(() => {
- cy.login('developer');
- cy.viewport(1920, 1080);
+ cy.login('claimManager');
cy.visit('/#/ticket/31/sale');
});
@@ -130,16 +141,23 @@ describe('TicketSale', () => {
});
it('should update discount when "Update discount" is clicked', () => {
+ const discount = Number((Math.random() * 99 + 1).toFixed(2));
+
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.waitForElement('[data-cy="updateDiscountItem"]');
- cy.dataCy('updateDiscountItem').should('exist');
cy.dataCy('updateDiscountItem').click();
+ cy.waitForElement('[data-cy="componentOption-37"]');
+ cy.get('[data-cy="componentOption-37"]').click();
cy.waitForElement('[data-cy="ticketSaleDiscountInput"]');
cy.dataCy('ticketSaleDiscountInput').find('input').focus();
- cy.dataCy('ticketSaleDiscountInput').find('input').type('10');
+ cy.intercept('POST', /\/api\/Tickets\/\d+\/updateDiscount/).as(
+ 'updateDiscount',
+ );
+ cy.dataCy('ticketSaleDiscountInput').find('input').type(discount);
+
cy.dataCy('saveManaBtn').click();
- cy.waitForElement('.q-notification__message');
+ cy.wait('@updateDiscount').its('response.statusCode').should('eq', 204);
cy.checkNotification('Data saved');
cy.dataCy('ticketSaleMoreActionsDropdown').should('be.disabled');
});
@@ -148,7 +166,7 @@ describe('TicketSale', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.dataCy('createClaimItem').click();
- cy.dataCy('VnConfirm_confirm').click();
+ cy.confirmVnConfirm();
cy.checkNotification('Future ticket date not allowed');
});
@@ -173,10 +191,9 @@ describe('TicketSale', () => {
cy.url().should('match', /\/ticket\/31\/log/);
});
});
- describe('Ticket to transfer #32', () => {
+ describe('#32 transfer', () => {
beforeEach(() => {
- cy.login('developer');
- cy.viewport(1920, 1080);
+ cy.login('salesPerson');
cy.visit('/#/ticket/32/sale');
});
it('transfer sale to a new ticket', () => {
@@ -194,9 +211,7 @@ function selectFirstRow() {
cy.get(firstRow).find('.q-checkbox__inner').click();
}
function handleVnConfirm() {
- cy.get('[data-cy="VnConfirm_confirm"]').click();
- cy.waitForElement('.q-notification__message');
+ cy.confirmVnConfirm();
- cy.get('.q-notification__message').should('be.visible');
cy.checkNotification('Data saved');
}
diff --git a/test/cypress/integration/ticket/ticketSaleTracking.spec.js b/test/cypress/integration/ticket/ticketSaleTracking.spec.js
new file mode 100644
index 000000000..9ee9f8824
--- /dev/null
+++ b/test/cypress/integration/ticket/ticketSaleTracking.spec.js
@@ -0,0 +1,53 @@
+///
+function uncheckedSVG(className, state) {
+ cy.get(`${className} .q-checkbox__svg`).should(
+ state === 'checked' ? 'not.have.attr' : 'have.attr',
+ 'fill',
+ 'none',
+ );
+}
+function checkedSVG(className, state) {
+ cy.get(`${className} .q-checkbox__svg> .q-checkbox__truthy`).should(
+ state === 'checked' ? 'not.have.attr' : 'have.attr',
+ 'fill',
+ 'none',
+ );
+}
+
+function clickIconAndCloseDialog(n) {
+ cy.get(
+ `:nth-child(1) > :nth-child(6) > :nth-child(${n}) > .q-btn__content > .q-icon`,
+ ).click();
+}
+
+describe('TicketSaleTracking', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ cy.visit('/#/ticket/1/sale-tracking');
+ });
+
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ // Check checkbox states
+ uncheckedSVG('.pink', 'checked');
+ uncheckedSVG('.cyan', 'checked');
+ uncheckedSVG('.warning', 'checked');
+ uncheckedSVG('.info', 'checked');
+ checkedSVG('.yellow', 'unchecked');
+
+ cy.get('.q-page').click();
+ cy.get(
+ ':nth-child(1) > :nth-child(6) > :nth-child(2) > .q-btn__content > .q-icon',
+ ).click();
+ cy.get('body').type('{esc}');
+ cy.get(
+ ':nth-child(1) > :nth-child(6) > :nth-child(1) > .q-btn__content > .q-icon',
+ ).click();
+ cy.get(
+ '.q-dialog__inner > .q-table__container :nth-child(1) > :nth-child(2) .link.q-btn',
+ ).click();
+
+ cy.dataCy('WorkerDescriptor').should('exist');
+ });
+});
diff --git a/test/cypress/integration/ticket/ticketService.spec.js b/test/cypress/integration/ticket/ticketService.spec.js
new file mode 100644
index 000000000..5bf8e2aab
--- /dev/null
+++ b/test/cypress/integration/ticket/ticketService.spec.js
@@ -0,0 +1,23 @@
+///
+describe('TicketService', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ cy.visit('/#/ticket/31/service');
+ });
+
+ it('Add and remove service', () => {
+ cy.get('.q-page').should('be.visible');
+ cy.addBtnClick();
+ cy.dataCy('Description_icon').click();
+ cy.dataCy('Description_input').clear().type('test');
+ cy.saveFormModel();
+ cy.selectOption('[data-cy="Description_select"]', 'test');
+
+ cy.dataCy('Quantity_input').clear().type('1');
+ cy.dataCy('Price_input').clear().type('2');
+ cy.saveCrudModel();
+ cy.checkNotification('Data saved');
+ cy.get(':nth-child(5) > .q-icon').click();
+ });
+});
diff --git a/test/cypress/integration/ticket/ticketSms.spec.js b/test/cypress/integration/ticket/ticketSms.spec.js
new file mode 100644
index 000000000..feafb2157
--- /dev/null
+++ b/test/cypress/integration/ticket/ticketSms.spec.js
@@ -0,0 +1,22 @@
+///
+describe('TicketSms', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ cy.visit('/#/ticket/32/sms');
+ });
+
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ cy.get('.q-infinite-scroll > :nth-child(1)').should(
+ 'contain.text',
+ '0004 444444444Lorem ipsum dolor sit amet, consectetur adipiscing elit.2001-01-01 00:00:00OK',
+ );
+ cy.get(
+ ':nth-child(1) > .q-item > .q-item__section--top > .column > .q-avatar',
+ ).should('be.visible');
+ cy.get(
+ ':nth-child(1) > .q-item > .q-item__section--side.justify-center > .center > .q-chip > .q-chip__content',
+ ).should('have.class', 'q-chip__content');
+ });
+});
diff --git a/test/cypress/integration/ticket/ticketTracking.spec.js b/test/cypress/integration/ticket/ticketTracking.spec.js
new file mode 100644
index 000000000..f351ee0a1
--- /dev/null
+++ b/test/cypress/integration/ticket/ticketTracking.spec.js
@@ -0,0 +1,25 @@
+///
+describe('Ticket tracking', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ cy.visit('/#/ticket/31/tracking');
+ });
+
+ it('Add new tracking', () => {
+ cy.get('.q-page').should('be.visible');
+
+ cy.getRowCol('worker').find('span').should('have.class', 'link').click();
+ cy.dataCy('WorkerDescriptor').should('exist');
+ cy.vnTableCreateBtn();
+ cy.selectOption('.q-field--float [data-cy="State_select"]', 'OK').click();
+ cy.saveFormModel();
+ cy.get(
+ ':last-child > [data-col-field="state"] > [data-cy="vnTableCell_state"]',
+ ).should('have.text', 'OK');
+ cy.get(':last-child > [data-col-field="worker"]').should(
+ 'have.text',
+ 'developer ',
+ );
+ });
+});
diff --git a/test/cypress/integration/ticket/ticketVolume.spec.js b/test/cypress/integration/ticket/ticketVolume.spec.js
new file mode 100644
index 000000000..59ff6dcb2
--- /dev/null
+++ b/test/cypress/integration/ticket/ticketVolume.spec.js
@@ -0,0 +1,27 @@
+///
+function checkRightLabel(index, value, tag = 'Volume: ') {
+ cy.get(`.q-scrollarea__content > :nth-child(${index}) > :nth-child(2) > span`)
+ .should('be.visible')
+ .should('have.text', `${tag}${value}`);
+}
+describe('TicketVolume', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ cy.visit('/#/ticket/1/volume');
+ });
+
+ it('Check right panel info', () => {
+ cy.get('.q-page').should('be.visible');
+ checkRightLabel(2, '0.028');
+ checkRightLabel(3, '0.014');
+ checkRightLabel(4, '1.526');
+ });
+ it('Descriptors', () => {
+ cy.get(':nth-child(1) > [data-col-field="itemFk"]')
+ .find('span')
+ .should('have.class', 'link')
+ .click();
+ cy.dataCy('ItemDescriptor').should('exist');
+ });
+});
diff --git a/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js b/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js
index 8e37d8c9c..347dae7df 100644
--- a/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js
+++ b/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js
@@ -2,7 +2,6 @@
describe('VnBreadcrumbs', () => {
const lastBreadcrumb = '.q-breadcrumbs--last > .q-breadcrumbs__el';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit('/');
});
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/crudModel.commands.js b/test/cypress/integration/vnComponent/crudModel.commands.js
new file mode 100644
index 000000000..9d08f064a
--- /dev/null
+++ b/test/cypress/integration/vnComponent/crudModel.commands.js
@@ -0,0 +1,3 @@
+Cypress.Commands.add('saveCrudModel', () =>
+ cy.dataCy('crudModelDefaultSaveBtn').should('exist').click(),
+);
diff --git a/test/cypress/integration/vnComponent/formModel.commands.js b/test/cypress/integration/vnComponent/formModel.commands.js
new file mode 100644
index 000000000..2814b0091
--- /dev/null
+++ b/test/cypress/integration/vnComponent/formModel.commands.js
@@ -0,0 +1,3 @@
+Cypress.Commands.add('saveFormModel', () =>
+ cy.dataCy('FormModelPopup_save').should('exist').click(),
+);
diff --git a/test/cypress/integration/vnComponent/vnConfirm.commands.js b/test/cypress/integration/vnComponent/vnConfirm.commands.js
new file mode 100644
index 000000000..9f93967d6
--- /dev/null
+++ b/test/cypress/integration/vnComponent/vnConfirm.commands.js
@@ -0,0 +1,3 @@
+Cypress.Commands.add('confirmVnConfirm', () =>
+ cy.dataCy('VnConfirm_confirm').should('exist').click(),
+);
diff --git a/test/cypress/integration/vnComponent/vnSelect.commands.js b/test/cypress/integration/vnComponent/vnSelect.commands.js
new file mode 100644
index 000000000..017b6e7ea
--- /dev/null
+++ b/test/cypress/integration/vnComponent/vnSelect.commands.js
@@ -0,0 +1,3 @@
+Cypress.Commands.add('clickOption', (index = 1) =>
+ cy.get(`.q-menu :nth-child(${index}) >.q-item__section`).click(),
+);
diff --git a/test/cypress/integration/vnComponent/vnTable.commands.js b/test/cypress/integration/vnComponent/vnTable.commands.js
new file mode 100644
index 000000000..316fc12f1
--- /dev/null
+++ b/test/cypress/integration/vnComponent/vnTable.commands.js
@@ -0,0 +1,20 @@
+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.getRow(index).find(`[data-col-field="${field}"]`),
+);
+
+Cypress.Commands.add('vnTableCreateBtn', () =>
+ cy.dataCy('vnTableCreateBtn').should('exist').click(),
+);
+
+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/wagonTypeCreate.spec.js b/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js
index 915927a6d..3b5d05c6f 100644
--- a/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js
+++ b/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js
@@ -1,6 +1,5 @@
describe('WagonTypeCreate', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit('/#/wagon/type/list');
cy.waitForElement('.q-page', 6000);
diff --git a/test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js b/test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js
index 36dd83411..b185b61b4 100644
--- a/test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js
+++ b/test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js
@@ -2,7 +2,6 @@ describe('WagonTypeEdit', () => {
const trayColorRow =
'.q-select > .q-field__inner > .q-field__control > .q-field__control-container';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit('/#/wagon/type/1/edit');
});
@@ -11,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/integration/worker/workerPit.spec.js b/test/cypress/integration/worker/workerPit.spec.js
index 04f232648..cee4560dc 100644
--- a/test/cypress/integration/worker/workerPit.spec.js
+++ b/test/cypress/integration/worker/workerPit.spec.js
@@ -4,7 +4,6 @@ describe('WorkerPit', () => {
const savePIT = '#st-actions > .q-btn-group > .q-btn--standard';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/worker/1107/pit`);
});
diff --git a/test/cypress/integration/zone/zoneDeliveryDays.spec.js b/test/cypress/integration/zone/zoneDeliveryDays.spec.js
index a89def12d..6d19edb77 100644
--- a/test/cypress/integration/zone/zoneDeliveryDays.spec.js
+++ b/test/cypress/integration/zone/zoneDeliveryDays.spec.js
@@ -4,7 +4,6 @@ describe('ZoneDeliveryDays', () => {
const submitForm = '.q-form > .q-btn > .q-btn__content';
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
cy.visit(`/#/zone/delivery-days`);
});
diff --git a/test/cypress/integration/zone/zoneUpcomingDeliveries.spec.js b/test/cypress/integration/zone/zoneUpcomingDeliveries.spec.js
index 576b2ea70..1c28e732c 100644
--- a/test/cypress/integration/zone/zoneUpcomingDeliveries.spec.js
+++ b/test/cypress/integration/zone/zoneUpcomingDeliveries.spec.js
@@ -4,7 +4,6 @@ describe('ZoneUpcomingDeliveries', () => {
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
cy.visit(`/#/zone/upcoming-deliveries`);
});
diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js
index 7f5203547..f990c1774 100755
--- a/test/cypress/support/commands.js
+++ b/test/cypress/support/commands.js
@@ -29,7 +29,12 @@
// import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress';
import moment from 'moment';
import waitUntil from './waitUntil';
+// Importar dinámicamente todos los archivos con el sufijo .commands.js dentro de la carpeta src/test/cypress/integration
+const requireCommands = require.context('../integration', true, /\.commands\.js$/);
+// Iterar sobre cada archivo y requerirlo
+requireCommands.keys().forEach(requireCommands);
+// Common comma
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, waitUntil);
Cypress.Commands.add('resetDB', () => {
@@ -73,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;
});
}
@@ -95,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');
}
});
});
@@ -137,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')
@@ -184,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();
@@ -347,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();
@@ -449,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();
});
@@ -586,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();
});
@@ -606,6 +627,49 @@ Cypress.Commands.add('checkQueryParams', (expectedParams = {}) => {
});
});
-Cypress.Commands.add('waitTableScrollLoad', () =>
- cy.waitForElement('[data-q-vs-anchor]'),
+Cypress.Commands.add('validateScrollContent', (validations) => {
+ validations.forEach(({ row, col, text }) => {
+ cy.get(`.q-scrollarea__content > :nth-child(${row}) > :nth-child(${col})`).should(
+ 'have.text',
+ text,
+ );
+ });
+});
+
+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', () => ({
diff --git a/vitest.config.js b/vitest.config.js
index 331d21ef9..c2c3661a9 100644
--- a/vitest.config.js
+++ b/vitest.config.js
@@ -17,6 +17,7 @@ if (process.env.CI) {
// https://vitejs.dev/config/
export default defineConfig({
test: {
+ globals: true,
reporters,
outputFile,
environment: 'happy-dom',