From 2678ac5defb11c7602efed0a35da21d75df7cd9a Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 11 Apr 2025 08:01:46 +0200 Subject: [PATCH] feat: refs #8647 unskipp e2e to test which of them are really failling and fixed VnDms --- src/components/common/VnDms.vue | 3 +- .../common/__tests__/VnInput.spec.js | 34 +++++++-------- src/composables/useArrayData.js | 43 +++++++++++-------- .../integration/claim/claimAction.spec.js | 8 ++-- .../claim/claimDevelopment.spec.js | 2 +- .../integration/customer/clientList.spec.js | 2 +- .../invoiceIn/invoiceInDescriptor.spec.js | 2 +- .../invoiceOutNegativeBases.spec.js | 2 +- .../cypress/integration/item/itemList.spec.js | 2 +- test/cypress/integration/login/logout.spec.js | 2 +- .../integration/order/orderCatalog.spec.js | 2 +- .../integration/route/routeAutonomous.spec.js | 2 +- .../route/routeExtendedList.spec.js | 2 +- .../vnComponent/VnShortcut.spec.js | 2 +- .../integration/worker/workerBusiness.spec.js | 2 +- .../integration/zone/zoneWarehouse.spec.js | 2 +- 16 files changed, 60 insertions(+), 52 deletions(-) diff --git a/src/components/common/VnDms.vue b/src/components/common/VnDms.vue index c713ac5ec..aa62a1467 100644 --- a/src/components/common/VnDms.vue +++ b/src/components/common/VnDms.vue @@ -62,7 +62,8 @@ function onFileChange(files) { function mapperDms(data) { const formData = new FormData(); 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 = { hasFile: !!data.hasFile, diff --git a/src/components/common/__tests__/VnInput.spec.js b/src/components/common/__tests__/VnInput.spec.js index 13f9ed804..1064276ab 100644 --- a/src/components/common/__tests__/VnInput.spec.js +++ b/src/components/common/__tests__/VnInput.spec.js @@ -2,7 +2,6 @@ import { createWrapper } from 'app/test/vitest/helper'; import { vi, describe, expect, it } from 'vitest'; import VnInput from 'src/components/common/VnInput.vue'; - describe('VnInput', () => { let vm; let wrapper; @@ -11,26 +10,28 @@ describe('VnInput', () => { function generateWrapper(value, isOutlined, emptyToNull, insertable) { wrapper = createWrapper(VnInput, { props: { - modelValue: value, - isOutlined, emptyToNull, insertable, - maxlength: 101 + modelValue: value, + isOutlined, + emptyToNull, + insertable, + maxlength: 101, }, attrs: { label: 'test', required: true, maxlength: 101, maxLength: 10, - 'max-length':20 + 'max-length': 20, }, }); wrapper = wrapper.wrapper; vm = wrapper.vm; input = wrapper.find('[data-cy="test_input"]'); - }; + } describe('value', () => { it('should emit update:modelValue when value changes', async () => { - generateWrapper('12345', false, false, true) + generateWrapper('12345', false, false, true); await input.setValue('123'); expect(wrapper.emitted('update:modelValue')).toBeTruthy(); expect(wrapper.emitted('update:modelValue')[0]).toEqual(['123']); @@ -46,37 +47,36 @@ describe('VnInput', () => { describe('styleAttrs', () => { it('should return empty styleAttrs when isOutlined is false', async () => { 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); expect(vm.styleAttrs.outlined).toBe(true); }); }); - describe('handleKeydown', () => { + describe('handleKeydown', () => { it('should do nothing when "Backspace" key is pressed', async () => { generateWrapper('12345', false, false, true); await input.trigger('keydown', { key: 'Backspace' }); expect(wrapper.emitted('update:modelValue')).toBeUndefined(); const spyhandler = vi.spyOn(vm, 'handleInsertMode'); expect(spyhandler).not.toHaveBeenCalled(); - }); - + /* TODO: #8399 REDMINE */ - it.skip('handleKeydown respects insertable behavior', async () => { + it('handleKeydown respects insertable behavior', async () => { const expectedValue = '12345'; generateWrapper('1234', false, false, true); - vm.focus() + vm.focus(); await input.trigger('keydown', { key: '5' }); await vm.$nextTick(); expect(wrapper.emitted('update:modelValue')).toBeTruthy(); - expect(wrapper.emitted('update:modelValue')[0]).toEqual([expectedValue ]); - expect(vm.value).toBe( expectedValue); + expect(wrapper.emitted('update:modelValue')[0]).toEqual([expectedValue]); + expect(vm.value).toBe(expectedValue); }); }); @@ -86,6 +86,6 @@ describe('VnInput', () => { const focusSpy = vi.spyOn(input.element, 'focus'); vm.focus(); expect(focusSpy).toHaveBeenCalled(); - }); + }); }); }); diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index d5eea2b38..f41bbb492 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -6,37 +6,44 @@ import { buildFilter } from 'filters/filterPanel'; import { isDialogOpened } from 'src/filters'; export function useArrayData(key, userOptions) { - let route = null; - let router = null; + // let route = 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'); const arrayDataStore = useArrayDataStore(); // Move inside function if (!arrayDataStore.get(key)) arrayDataStore.set(key); const store = arrayDataStore.get(key); + const route = useRoute(); + const router = useRouter(); let canceller = null; - const { route: initialRoute, router: initialRouter } = (() => { - if (!route) route = useRoute(); - if (!router) router = useRouter(); - return { route, router }; - })(); + // const { route: initialRoute, router: initialRouter } = (() => { + // if (!route) route = useRoute(); + // if (!router) router = useRouter(); + // return { route, router }; + // })(); onMounted(() => { setOptions(); reset(['skip']); - route = initialRoute; - router = initialRouter; + // route = initialRoute; + // router = initialRouter; + const query = route.query; const searchUrl = store.searchUrl; - const query = route.query[searchUrl]; - if (query) { - const params = JSON.parse(query); + // const query = route.query[searchUrl]; + // if (query) { + if (query[searchUrl]) { + const params = JSON.parse(query[searchUrl]); + // const params = JSON.parse(query); const filter = params?.filter && typeof params?.filter == 'object' ? params?.filter diff --git a/test/cypress/integration/claim/claimAction.spec.js b/test/cypress/integration/claim/claimAction.spec.js index 8f406ad2f..7b5c3e101 100644 --- a/test/cypress/integration/claim/claimAction.spec.js +++ b/test/cypress/integration/claim/claimAction.spec.js @@ -1,5 +1,5 @@ /// -describe.skip('ClaimAction', () => { +describe('ClaimAction', () => { const claimId = 1; const firstRow = 'tbody > :nth-child(1)'; @@ -16,13 +16,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 +36,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..ddb3f82ad 100755 --- a/test/cypress/integration/claim/claimDevelopment.spec.js +++ b/test/cypress/integration/claim/claimDevelopment.spec.js @@ -1,5 +1,5 @@ /// -describe.skip('ClaimDevelopment', () => { +describe('ClaimDevelopment', () => { const claimId = 1; const firstLineReason = 'tbody > :nth-child(1) > :nth-child(2)'; const thirdRow = 'tbody > :nth-child(3)'; diff --git a/test/cypress/integration/customer/clientList.spec.js b/test/cypress/integration/customer/clientList.spec.js index caf94b8bd..7b1da6d89 100644 --- a/test/cypress/integration/customer/clientList.spec.js +++ b/test/cypress/integration/customer/clientList.spec.js @@ -1,5 +1,5 @@ /// -describe.skip('Client list', () => { +describe('Client list', () => { beforeEach(() => { cy.login('developer'); cy.visit('/#/customer/list', { diff --git a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js index 9744486e0..09923e798 100644 --- a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js +++ b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js @@ -54,7 +54,7 @@ describe('InvoiceInDescriptor', () => { }); }); // 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.validateDownload(() => cy.selectDescriptorOption(5)); }); diff --git a/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js b/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js index 9c6eef2ed..68ae96128 100644 --- a/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js +++ b/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js @@ -9,7 +9,7 @@ describe('InvoiceOut 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('.descriptor').should('be.visible'); cy.get('.q-item > .q-item__label').should('include.text', '1101'); diff --git a/test/cypress/integration/item/itemList.spec.js b/test/cypress/integration/item/itemList.spec.js index 10e388580..63eb130e7 100644 --- a/test/cypress/integration/item/itemList.spec.js +++ b/test/cypress/integration/item/itemList.spec.js @@ -1,6 +1,6 @@ /// -describe.skip('Item list', () => { +describe('Item list', () => { beforeEach(() => { cy.viewport(1920, 1080); cy.login('developer'); 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/order/orderCatalog.spec.js b/test/cypress/integration/order/orderCatalog.spec.js index 050dd396c..d087f3058 100644 --- a/test/cypress/integration/order/orderCatalog.spec.js +++ b/test/cypress/integration/order/orderCatalog.spec.js @@ -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/route/routeAutonomous.spec.js b/test/cypress/integration/route/routeAutonomous.spec.js index d77584c04..11d591bdd 100644 --- a/test/cypress/integration/route/routeAutonomous.spec.js +++ b/test/cypress/integration/route/routeAutonomous.spec.js @@ -1,4 +1,4 @@ -describe.skip('RouteAutonomous', () => { +describe('RouteAutonomous', () => { const getLinkSelector = (colField) => `tr:first-child > [data-col-field="${colField}"] > .no-padding > .link`; diff --git a/test/cypress/integration/route/routeExtendedList.spec.js b/test/cypress/integration/route/routeExtendedList.spec.js index 97735ca4b..e6c873d5e 100644 --- a/test/cypress/integration/route/routeExtendedList.spec.js +++ b/test/cypress/integration/route/routeExtendedList.spec.js @@ -1,4 +1,4 @@ -describe.skip('Route extended list', () => { +describe('Route extended list', () => { const getSelector = (colField) => `tr:last-child > [data-col-field="${colField}"]`; const selectors = { 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/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/zone/zoneWarehouse.spec.js b/test/cypress/integration/zone/zoneWarehouse.spec.js index d7a9854bb..bca5ced22 100644 --- a/test/cypress/integration/zone/zoneWarehouse.spec.js +++ b/test/cypress/integration/zone/zoneWarehouse.spec.js @@ -18,7 +18,7 @@ describe('ZoneWarehouse', () => { cy.checkNotification(dataError); }); - it.skip('should create & remove a warehouse', () => { + it('should create & remove a warehouse', () => { cy.addBtnClick(); cy.fillInForm(data); cy.get(saveBtn).click();