feat: refs #8647 unskipp e2e to test which of them are really failling and fixed VnDms
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jon Elias 2025-04-11 08:01:46 +02:00
parent 85fa1543c1
commit 2678ac5def
16 changed files with 60 additions and 52 deletions

View File

@ -62,7 +62,8 @@ function onFileChange(files) {
function mapperDms(data) { function mapperDms(data) {
const formData = new FormData(); const formData = new FormData();
const { files } = data; const { files } = data;
if (files) files.forEach((file) => formData.append(file?.name, file)); if (files) formData.append(files?.name, files);
// if (files) files.forEach((file) => formData.append(file?.name, file));
const dms = { const dms = {
hasFile: !!data.hasFile, hasFile: !!data.hasFile,

View File

@ -2,7 +2,6 @@ import { createWrapper } from 'app/test/vitest/helper';
import { vi, describe, expect, it } from 'vitest'; import { vi, describe, expect, it } from 'vitest';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
describe('VnInput', () => { describe('VnInput', () => {
let vm; let vm;
let wrapper; let wrapper;
@ -11,26 +10,28 @@ describe('VnInput', () => {
function generateWrapper(value, isOutlined, emptyToNull, insertable) { function generateWrapper(value, isOutlined, emptyToNull, insertable) {
wrapper = createWrapper(VnInput, { wrapper = createWrapper(VnInput, {
props: { props: {
modelValue: value, modelValue: value,
isOutlined, emptyToNull, insertable, isOutlined,
maxlength: 101 emptyToNull,
insertable,
maxlength: 101,
}, },
attrs: { attrs: {
label: 'test', label: 'test',
required: true, required: true,
maxlength: 101, maxlength: 101,
maxLength: 10, maxLength: 10,
'max-length':20 'max-length': 20,
}, },
}); });
wrapper = wrapper.wrapper; wrapper = wrapper.wrapper;
vm = wrapper.vm; vm = wrapper.vm;
input = wrapper.find('[data-cy="test_input"]'); input = wrapper.find('[data-cy="test_input"]');
}; }
describe('value', () => { describe('value', () => {
it('should emit update:modelValue when value changes', async () => { it('should emit update:modelValue when value changes', async () => {
generateWrapper('12345', false, false, true) generateWrapper('12345', false, false, true);
await input.setValue('123'); await input.setValue('123');
expect(wrapper.emitted('update:modelValue')).toBeTruthy(); expect(wrapper.emitted('update:modelValue')).toBeTruthy();
expect(wrapper.emitted('update:modelValue')[0]).toEqual(['123']); expect(wrapper.emitted('update:modelValue')[0]).toEqual(['123']);
@ -46,37 +47,36 @@ describe('VnInput', () => {
describe('styleAttrs', () => { describe('styleAttrs', () => {
it('should return empty styleAttrs when isOutlined is false', async () => { it('should return empty styleAttrs when isOutlined is false', async () => {
generateWrapper('123', false, false, false); generateWrapper('123', false, false, false);
expect(vm.styleAttrs).toEqual({}); expect(vm.styleAttrs).toEqual({});
}); });
it('should set styleAttrs when isOutlined is true', async () => { it('should set styleAttrs when isOutlined is true', async () => {
generateWrapper('123', true, false, false); generateWrapper('123', true, false, false);
expect(vm.styleAttrs.outlined).toBe(true); expect(vm.styleAttrs.outlined).toBe(true);
}); });
}); });
describe('handleKeydown', () => { describe('handleKeydown', () => {
it('should do nothing when "Backspace" key is pressed', async () => { it('should do nothing when "Backspace" key is pressed', async () => {
generateWrapper('12345', false, false, true); generateWrapper('12345', false, false, true);
await input.trigger('keydown', { key: 'Backspace' }); await input.trigger('keydown', { key: 'Backspace' });
expect(wrapper.emitted('update:modelValue')).toBeUndefined(); expect(wrapper.emitted('update:modelValue')).toBeUndefined();
const spyhandler = vi.spyOn(vm, 'handleInsertMode'); const spyhandler = vi.spyOn(vm, 'handleInsertMode');
expect(spyhandler).not.toHaveBeenCalled(); expect(spyhandler).not.toHaveBeenCalled();
}); });
/* /*
TODO: #8399 REDMINE TODO: #8399 REDMINE
*/ */
it.skip('handleKeydown respects insertable behavior', async () => { it('handleKeydown respects insertable behavior', async () => {
const expectedValue = '12345'; const expectedValue = '12345';
generateWrapper('1234', false, false, true); generateWrapper('1234', false, false, true);
vm.focus() vm.focus();
await input.trigger('keydown', { key: '5' }); await input.trigger('keydown', { key: '5' });
await vm.$nextTick(); await vm.$nextTick();
expect(wrapper.emitted('update:modelValue')).toBeTruthy(); expect(wrapper.emitted('update:modelValue')).toBeTruthy();
expect(wrapper.emitted('update:modelValue')[0]).toEqual([expectedValue ]); expect(wrapper.emitted('update:modelValue')[0]).toEqual([expectedValue]);
expect(vm.value).toBe( expectedValue); expect(vm.value).toBe(expectedValue);
}); });
}); });
@ -86,6 +86,6 @@ describe('VnInput', () => {
const focusSpy = vi.spyOn(input.element, 'focus'); const focusSpy = vi.spyOn(input.element, 'focus');
vm.focus(); vm.focus();
expect(focusSpy).toHaveBeenCalled(); expect(focusSpy).toHaveBeenCalled();
}); });
}); });
}); });

View File

@ -6,37 +6,44 @@ import { buildFilter } from 'filters/filterPanel';
import { isDialogOpened } from 'src/filters'; import { isDialogOpened } from 'src/filters';
export function useArrayData(key, userOptions) { export function useArrayData(key, userOptions) {
let route = null; // let route = null;
let router = null; // let router = null;
// // Si no hay key, intentamos obtenerla del route
// if (!key) {
// key = initialRoute?.meta?.moduleName;
// route = initialRoute;
// router = initialRouter;
// }
key ??= useRoute().meta.moduleName;
// Si no hay key, intentamos obtenerla del route
if (!key) {
key = initialRoute?.meta?.moduleName;
route = initialRoute;
router = initialRouter;
}
if (!key) throw new Error('ArrayData: A key is required to use this composable'); if (!key) throw new Error('ArrayData: A key is required to use this composable');
const arrayDataStore = useArrayDataStore(); // Move inside function const arrayDataStore = useArrayDataStore(); // Move inside function
if (!arrayDataStore.get(key)) arrayDataStore.set(key); if (!arrayDataStore.get(key)) arrayDataStore.set(key);
const store = arrayDataStore.get(key); const store = arrayDataStore.get(key);
const route = useRoute();
const router = useRouter();
let canceller = null; let canceller = null;
const { route: initialRoute, router: initialRouter } = (() => { // const { route: initialRoute, router: initialRouter } = (() => {
if (!route) route = useRoute(); // if (!route) route = useRoute();
if (!router) router = useRouter(); // if (!router) router = useRouter();
return { route, router }; // return { route, router };
})(); // })();
onMounted(() => { onMounted(() => {
setOptions(); setOptions();
reset(['skip']); reset(['skip']);
route = initialRoute; // route = initialRoute;
router = initialRouter; // router = initialRouter;
const query = route.query;
const searchUrl = store.searchUrl; const searchUrl = store.searchUrl;
const query = route.query[searchUrl]; // const query = route.query[searchUrl];
if (query) { // if (query) {
const params = JSON.parse(query); if (query[searchUrl]) {
const params = JSON.parse(query[searchUrl]);
// const params = JSON.parse(query);
const filter = const filter =
params?.filter && typeof params?.filter == 'object' params?.filter && typeof params?.filter == 'object'
? params?.filter ? params?.filter

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe.skip('ClaimAction', () => { describe('ClaimAction', () => {
const claimId = 1; const claimId = 1;
const firstRow = 'tbody > :nth-child(1)'; const firstRow = 'tbody > :nth-child(1)';
@ -16,13 +16,13 @@ describe.skip('ClaimAction', () => {
}); });
// https://redmine.verdnatura.es/issues/8756 // https://redmine.verdnatura.es/issues/8756
xit('should change destination', () => { it.skip('should change destination', () => {
const rowData = [true, null, null, 'Bueno']; const rowData = [true, null, null, 'Bueno'];
cy.fillRow(firstRow, rowData); cy.fillRow(firstRow, rowData);
}); });
// https://redmine.verdnatura.es/issues/8756 // https://redmine.verdnatura.es/issues/8756
xit('should change destination from other button', () => { it.skip('should change destination from other button', () => {
const rowData = [true]; const rowData = [true];
cy.fillRow(firstRow, rowData); cy.fillRow(firstRow, rowData);
@ -36,7 +36,7 @@ describe.skip('ClaimAction', () => {
}); });
// https://redmine.verdnatura.es/issues/8756 // https://redmine.verdnatura.es/issues/8756
xit('should remove the line', () => { it.skip('should remove the line', () => {
cy.fillRow(firstRow, [true]); cy.fillRow(firstRow, [true]);
cy.removeCard(); cy.removeCard();
cy.clickConfirm(); cy.clickConfirm();

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe.skip('ClaimDevelopment', () => { describe('ClaimDevelopment', () => {
const claimId = 1; const claimId = 1;
const firstLineReason = 'tbody > :nth-child(1) > :nth-child(2)'; const firstLineReason = 'tbody > :nth-child(1) > :nth-child(2)';
const thirdRow = 'tbody > :nth-child(3)'; const thirdRow = 'tbody > :nth-child(3)';

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe.skip('Client list', () => { describe('Client list', () => {
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
cy.visit('/#/customer/list', { cy.visit('/#/customer/list', {

View File

@ -54,7 +54,7 @@ describe('InvoiceInDescriptor', () => {
}); });
}); });
// https://redmine.verdnatura.es/issues/8767 // https://redmine.verdnatura.es/issues/8767
it.skip('should download the file properly', () => { it('should download the file properly', () => {
cy.visit('/#/invoice-in/1/summary'); cy.visit('/#/invoice-in/1/summary');
cy.validateDownload(() => cy.selectDescriptorOption(5)); cy.validateDownload(() => cy.selectDescriptorOption(5));
}); });

View File

@ -9,7 +9,7 @@ describe('InvoiceOut negative bases', () => {
cy.visit(`/#/invoice-out/negative-bases`); cy.visit(`/#/invoice-out/negative-bases`);
}); });
it.skip('should open the posible descriptors', () => { it('should open the posible descriptors', () => {
cy.get(getDescriptors('clientId')).click(); cy.get(getDescriptors('clientId')).click();
cy.get('.descriptor').should('be.visible'); cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1101'); cy.get('.q-item > .q-item__label').should('include.text', '1101');

View File

@ -1,6 +1,6 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe.skip('Item list', () => { describe('Item list', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1920, 1080); cy.viewport(1920, 1080);
cy.login('developer'); cy.login('developer');

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe.skip('Logout', () => { describe('Logout', () => {
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
cy.visit(`/#/dashboard`); cy.visit(`/#/dashboard`);

View File

@ -34,7 +34,7 @@ describe('OrderCatalog', () => {
searchByCustomTagInput('Silver'); searchByCustomTagInput('Silver');
}); });
it.skip('filters by custom value dialog', () => { it('filters by custom value dialog', () => {
Cypress.on('uncaught:exception', (err) => { Cypress.on('uncaught:exception', (err) => {
if (err.message.includes('canceled')) { if (err.message.includes('canceled')) {
return false; return false;

View File

@ -1,4 +1,4 @@
describe.skip('RouteAutonomous', () => { describe('RouteAutonomous', () => {
const getLinkSelector = (colField) => const getLinkSelector = (colField) =>
`tr:first-child > [data-col-field="${colField}"] > .no-padding > .link`; `tr:first-child > [data-col-field="${colField}"] > .no-padding > .link`;

View File

@ -1,4 +1,4 @@
describe.skip('Route extended list', () => { describe('Route extended list', () => {
const getSelector = (colField) => `tr:last-child > [data-col-field="${colField}"]`; const getSelector = (colField) => `tr:last-child > [data-col-field="${colField}"]`;
const selectors = { const selectors = {

View File

@ -1,6 +1,6 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
// https://redmine.verdnatura.es/issues/8848 // https://redmine.verdnatura.es/issues/8848
describe.skip('VnShortcuts', () => { describe('VnShortcuts', () => {
const modules = { const modules = {
item: 'a', item: 'a',
customer: 'c', customer: 'c',

View File

@ -1,4 +1,4 @@
describe.skip('WorkerBusiness', () => { describe('WorkerBusiness', () => {
const saveBtn = '.q-mt-lg > .q-btn--standard'; const saveBtn = '.q-mt-lg > .q-btn--standard';
const contributionCode = `Representantes de comercio`; const contributionCode = `Representantes de comercio`;
const contractType = `INDEFINIDO A TIEMPO COMPLETO`; const contractType = `INDEFINIDO A TIEMPO COMPLETO`;

View File

@ -18,7 +18,7 @@ describe('ZoneWarehouse', () => {
cy.checkNotification(dataError); cy.checkNotification(dataError);
}); });
it.skip('should create & remove a warehouse', () => { it('should create & remove a warehouse', () => {
cy.addBtnClick(); cy.addBtnClick();
cy.fillInForm(data); cy.fillInForm(data);
cy.get(saveBtn).click(); cy.get(saveBtn).click();