From 7fb1a9e6b5b90ddf97267a4ee2271910e0e9de00 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 26 Nov 2024 12:24:02 +0100 Subject: [PATCH 001/105] feat: refs #8219 added invoice out e2e tests --- src/i18n/locale/en.yml | 1 + src/pages/InvoiceOut/InvoiceOutFilter.vue | 1 + src/pages/InvoiceOut/InvoiceOutGlobalForm.vue | 5 ++ src/pages/InvoiceOut/InvoiceOutList.vue | 33 ++++++----- .../invoiceOut/invoiceOutList.spec.js | 51 +++++++++++++++++ .../invoiceOut/invoiceOutMakeInvoice.spec.js | 27 +++++++++ .../invoiceOutNegativeBases.spec.js | 18 ++++++ .../invoiceOut/invoiceOutSummary.spec.js | 56 +++++++++++++++++++ .../invoiceOutglobalInvoicing.spec.js | 23 ++++++++ 9 files changed, 198 insertions(+), 17 deletions(-) create mode 100644 test/cypress/integration/invoiceOut/invoiceOutList.spec.js create mode 100644 test/cypress/integration/invoiceOut/invoiceOutMakeInvoice.spec.js create mode 100644 test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js create mode 100644 test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js create mode 100644 test/cypress/integration/invoiceOut/invoiceOutglobalInvoicing.spec.js diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index e0d6bec64..242089d91 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -485,6 +485,7 @@ invoiceOut: card: issued: Issued customerCard: Customer card + ticketList: Ticket List summary: issued: Issued dued: Due diff --git a/src/pages/InvoiceOut/InvoiceOutFilter.vue b/src/pages/InvoiceOut/InvoiceOutFilter.vue index 9ce8cc254..377bca178 100644 --- a/src/pages/InvoiceOut/InvoiceOutFilter.vue +++ b/src/pages/InvoiceOut/InvoiceOutFilter.vue @@ -47,6 +47,7 @@ const states = ref(); :label="t('Amount')" v-model="params.amount" is-outlined + data-cy="InvoiceOutFilterAmountBtn" /> diff --git a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue index 3fd3104bf..b64745369 100644 --- a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue +++ b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue @@ -101,6 +101,7 @@ onMounted(async () => { dense outlined rounded + data-cy="InvoiceOutGlobalClientSelect" > diff --git a/src/pages/Monitor/locale/en.yml b/src/pages/Monitor/locale/en.yml index e61a24979..fd15a5eb9 100644 --- a/src/pages/Monitor/locale/en.yml +++ b/src/pages/Monitor/locale/en.yml @@ -41,5 +41,5 @@ salesTicketsTable: packing: ITP searchBar: label: Search tickets - info: Search tickets by id or alias + info: Up to 5 characters search by client id, more than 5 search by ticket id or alias refreshInfo: Toggle auto-refresh every 2 minutes diff --git a/src/pages/Monitor/locale/es.yml b/src/pages/Monitor/locale/es.yml index 30afb1904..2e1ec7a51 100644 --- a/src/pages/Monitor/locale/es.yml +++ b/src/pages/Monitor/locale/es.yml @@ -41,5 +41,5 @@ salesTicketsTable: packing: ITP searchBar: label: Buscar tickets - info: Buscar tickets por identificador o alias + info: Hasta 5 caracteres busca por id de cliente, más de 5 busca por id de ticket o alias refreshInfo: Conmuta el refresco automático cada 2 minutos From 0cce5b93cd94b246282b844c768832c2ff68c9a6 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 13 Dec 2024 17:20:28 +0100 Subject: [PATCH 016/105] refactor: refs #7957 remove blank --- src/components/ui/VnSearchbar.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index 830029e8e..148e8b684 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -122,7 +122,6 @@ async function search() { }; delete filter.params.search; } - await arrayData.applyFilter(filter); } From a4062f188becaaf41567acb8d6ff157f072b30b0 Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 16 Dec 2024 07:46:36 +0100 Subject: [PATCH 017/105] refactor: refs #8219 requested changes --- .../invoiceOut/invoiceOutList.spec.js | 6 ++--- .../invoiceOutNegativeBases.spec.js | 4 +-- .../invoiceOut/invoiceOutSummary.spec.js | 25 +++++++------------ .../vnComponent/VnSearchBar.spec.js | 6 ++--- test/cypress/support/commands.js | 2 +- 5 files changed, 17 insertions(+), 26 deletions(-) diff --git a/test/cypress/integration/invoiceOut/invoiceOutList.spec.js b/test/cypress/integration/invoiceOut/invoiceOutList.spec.js index 3db4d89ca..7de481e66 100644 --- a/test/cypress/integration/invoiceOut/invoiceOutList.spec.js +++ b/test/cypress/integration/invoiceOut/invoiceOutList.spec.js @@ -14,14 +14,14 @@ describe('InvoiceOut list', () => { cy.viewport(1920, 1080); cy.login('developer'); cy.visit(`/#/invoice-out/list`); - cy.dataCy('vnSearchBar').find('input').type('{enter}'); + cy.typeSearchbar('{enter}'); }); it('should search and filter an invoice and enter to the summary', () => { - cy.dataCy('vnSearchBar').find('input').type('1{enter}'); + cy.typeSearchbar('1{enter}'); cy.get('.q-virtual-scroll__content > :nth-child(2) > :nth-child(7)').click(); cy.get('.header > a.q-btn > .q-btn__content').click(); - cy.dataCy('vnSearchBar').find('input').type('{enter}'); + cy.typeSearchbar('{enter}'); cy.dataCy('InvoiceOutFilterAmountBtn').find('input').type('8.88{enter}'); }); diff --git a/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js b/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js index 8f5835e56..5f629df0b 100644 --- a/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js +++ b/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js @@ -1,7 +1,5 @@ /// describe('InvoiceOut negative bases', () => { - const notification = '.q-notification__message'; - beforeEach(() => { cy.viewport(1920, 1080); cy.login('developer'); @@ -13,6 +11,6 @@ describe('InvoiceOut negative bases', () => { ':nth-child(7) > .full-width > :nth-child(1) > .column > div.q-px-xs > .q-field > .q-field__inner > .q-field__control' ).type('23{enter}'); cy.get('#subToolbar > .q-btn').click(); - cy.get(notification).should('contains.text', 'CSV downloaded successfully'); + cy.checkNotification('CSV downloaded successfully'); }); }); diff --git a/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js b/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js index 14f53fdfa..b7fd11307 100644 --- a/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js +++ b/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js @@ -1,6 +1,5 @@ /// describe('InvoiceOut summary', () => { - const notification = '.q-notification__message'; const transferInvoice = { Client: { val: 'employee', type: 'select' }, Type: { val: 'Error in customer data', type: 'select' }, @@ -10,45 +9,39 @@ describe('InvoiceOut summary', () => { cy.viewport(1920, 1080); cy.login('developer'); cy.visit(`/#/invoice-out/list`); - cy.get('#searchbar input').type('{enter}'); + cy.typeSearchbar('{enter}'); }); it('should generate the invoice PDF', () => { - cy.get('#searchbar input').type('T1111111{enter}'); + cy.typeSearchbar('T1111111{enter}'); cy.dataCy('descriptor-more-opts').click(); cy.get('.q-menu > .q-list > :nth-child(6)').click(); cy.dataCy('VnConfirm_confirm').click(); - cy.get(notification).should( - 'contains.text', - 'The invoice PDF document has been regenerated' - ); + cy.checkNotification('The invoice PDF document has been regenerated'); }); it('should refund the invoice ', () => { - cy.get('#searchbar input').type('T1111111{enter}'); + cy.typeSearchbar('T1111111{enter}'); cy.dataCy('descriptor-more-opts').click(); cy.get('.q-menu > .q-list > :nth-child(7)').click(); cy.get('#q-portal--menu--3 > .q-menu > .q-list > :nth-child(2)').click(); - cy.get(notification).should( - 'contains.text', - 'The following refund ticket have been created 1000000' - ); + cy.checkNotification('The following refund ticket have been created 1000000'); }); it('should delete an invoice ', () => { - cy.get('#searchbar input').type('T2222222{enter}'); + cy.typeSearchbar('T2222222{enter}'); cy.dataCy('descriptor-more-opts').click(); cy.get('.q-menu > .q-list > :nth-child(4)').click(); cy.dataCy('VnConfirm_confirm').click(); - cy.get(notification).should('contains.text', 'InvoiceOut deleted'); + cy.checkNotification('InvoiceOut deleted'); }); it('should transfer the invoice ', () => { - cy.get('#searchbar input').type('T1111111{enter}'); + cy.typeSearchbar('T1111111{enter}'); cy.dataCy('descriptor-more-opts').click(); cy.get('.q-menu > .q-list > :nth-child(1)').click(); cy.fillInForm(transferInvoice); cy.get('.q-mt-lg > .q-btn').click(); - cy.get(notification).should('contains.text', 'Transferred invoice'); + cy.checkNotification('Transferred invoice'); }); }); diff --git a/test/cypress/integration/vnComponent/VnSearchBar.spec.js b/test/cypress/integration/vnComponent/VnSearchBar.spec.js index b8621118c..c8f6b3c19 100644 --- a/test/cypress/integration/vnComponent/VnSearchBar.spec.js +++ b/test/cypress/integration/vnComponent/VnSearchBar.spec.js @@ -16,18 +16,18 @@ describe('VnSearchBar', () => { }); it('should stay on the list page if there are several results or none', () => { - cy.writeSearchbar('salesA{enter}'); + cy.typeSearchbar('salesA{enter}'); checkTableLength(2); cy.clearSearchbar(); - cy.writeSearchbar('0{enter}'); + cy.typeSearchbar('0{enter}'); checkTableLength(0); }); const searchAndCheck = (searchTerm, expectedText) => { cy.clearSearchbar(); - cy.writeSearchbar(`${searchTerm}{enter}`); + cy.typeSearchbar(`${searchTerm}{enter}`); cy.get(idGap).should('have.text', expectedText); }; diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 91ce0348e..88589e8d4 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -255,7 +255,7 @@ Cypress.Commands.add('clearSearchbar', (element) => { ).clear(); }); -Cypress.Commands.add('writeSearchbar', (value) => { +Cypress.Commands.add('typeSearchbar', (value) => { cy.get('#searchbar > form > div:nth-child(1) > label > div:nth-child(1) input').type( value ); From a6815f4e3d8c677508d8120398d27ff9071146af Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 16 Dec 2024 10:21:20 +0100 Subject: [PATCH 018/105] fix: refs #7957 rollback --- src/pages/Monitor/Ticket/MonitorTicketSearchbar.vue | 1 - src/pages/Monitor/locale/en.yml | 2 +- src/pages/Monitor/locale/es.yml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/Monitor/Ticket/MonitorTicketSearchbar.vue b/src/pages/Monitor/Ticket/MonitorTicketSearchbar.vue index 9116a6449..f1c347588 100644 --- a/src/pages/Monitor/Ticket/MonitorTicketSearchbar.vue +++ b/src/pages/Monitor/Ticket/MonitorTicketSearchbar.vue @@ -8,6 +8,5 @@ import VnSearchbar from 'components/ui/VnSearchbar.vue'; :redirect="false" :label="$t('searchBar.label')" :info="$t('searchBar.info')" - :new-tab="true" /> diff --git a/src/pages/Monitor/locale/en.yml b/src/pages/Monitor/locale/en.yml index fd15a5eb9..e61a24979 100644 --- a/src/pages/Monitor/locale/en.yml +++ b/src/pages/Monitor/locale/en.yml @@ -41,5 +41,5 @@ salesTicketsTable: packing: ITP searchBar: label: Search tickets - info: Up to 5 characters search by client id, more than 5 search by ticket id or alias + info: Search tickets by id or alias refreshInfo: Toggle auto-refresh every 2 minutes diff --git a/src/pages/Monitor/locale/es.yml b/src/pages/Monitor/locale/es.yml index 2e1ec7a51..30afb1904 100644 --- a/src/pages/Monitor/locale/es.yml +++ b/src/pages/Monitor/locale/es.yml @@ -41,5 +41,5 @@ salesTicketsTable: packing: ITP searchBar: label: Buscar tickets - info: Hasta 5 caracteres busca por id de cliente, más de 5 busca por id de ticket o alias + info: Buscar tickets por identificador o alias refreshInfo: Conmuta el refresco automático cada 2 minutos From 6e655b37a1379e843ede24a944ea42d65c2f0f69 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 16 Dec 2024 10:22:01 +0100 Subject: [PATCH 019/105] fix: refs #7957 rollback --- src/components/ui/VnSearchbar.vue | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index 148e8b684..ccf87c6d6 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -67,10 +67,6 @@ const props = defineProps({ type: Function, default: undefined, }, - newTab: { - type: Boolean, - default: false, - }, }); const searchText = ref(); @@ -113,7 +109,6 @@ async function search() { search: searchText.value, }, ...{ filter: props.filter }, - newTab: props.newTab, }; if (props.whereFilter) { From a2b3a493fd930b5e55c1ca3acafb22e698a72d9e Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 16 Dec 2024 10:24:31 +0100 Subject: [PATCH 020/105] perf: refs #8220 use searchbar selector in e2e tests --- test/cypress/integration/item/itemBarcodes.spec.js | 2 +- test/cypress/integration/item/itemBotanical.spec.js | 2 +- test/cypress/integration/item/itemList.spec.js | 2 +- test/cypress/integration/item/itemSummary.spec.js | 2 +- test/cypress/integration/item/itemTag.spec.js | 3 +-- test/cypress/integration/item/itemTax.spec.js | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/test/cypress/integration/item/itemBarcodes.spec.js b/test/cypress/integration/item/itemBarcodes.spec.js index d9add4d4c..a3fadfa16 100644 --- a/test/cypress/integration/item/itemBarcodes.spec.js +++ b/test/cypress/integration/item/itemBarcodes.spec.js @@ -4,7 +4,7 @@ describe('Item shelving', () => { cy.viewport(1920, 1080); cy.login('developer'); cy.visit(`/#/item/list`); - cy.get('#searchbar input').type('1{enter}'); + cy.typeSearchbar('1{enter}'); }); it('should throw an error if the barcode exists', () => { diff --git a/test/cypress/integration/item/itemBotanical.spec.js b/test/cypress/integration/item/itemBotanical.spec.js index e726fb8c3..a98040f88 100644 --- a/test/cypress/integration/item/itemBotanical.spec.js +++ b/test/cypress/integration/item/itemBotanical.spec.js @@ -4,7 +4,7 @@ describe('Item botanical', () => { cy.viewport(1920, 1080); cy.login('developer'); cy.visit(`/#/item/list`); - cy.get('#searchbar input').type('1{enter}'); + cy.typeSearchbar('1{enter}'); }); it('should modify the botanical', () => { diff --git a/test/cypress/integration/item/itemList.spec.js b/test/cypress/integration/item/itemList.spec.js index 0a1f803aa..4706093e6 100644 --- a/test/cypress/integration/item/itemList.spec.js +++ b/test/cypress/integration/item/itemList.spec.js @@ -5,7 +5,7 @@ describe('Item list', () => { cy.viewport(1920, 1080); cy.login('developer'); cy.visit(`/#/item/list`); - cy.get('#searchbar input').type('{enter}'); + cy.typeSearchbar('{enter}'); }); it('should filter the items and redirect to the summary', () => { diff --git a/test/cypress/integration/item/itemSummary.spec.js b/test/cypress/integration/item/itemSummary.spec.js index 24b689686..0da9b1643 100644 --- a/test/cypress/integration/item/itemSummary.spec.js +++ b/test/cypress/integration/item/itemSummary.spec.js @@ -4,7 +4,7 @@ describe('Item summary', () => { cy.viewport(1920, 1080); cy.login('developer'); cy.visit(`/#/item/list`); - cy.get('#searchbar input').type('1{enter}'); + cy.typeSearchbar('1{enter}'); }); it('should clone the item', () => { diff --git a/test/cypress/integration/item/itemTag.spec.js b/test/cypress/integration/item/itemTag.spec.js index 07cd21aef..a3bd152d8 100644 --- a/test/cypress/integration/item/itemTag.spec.js +++ b/test/cypress/integration/item/itemTag.spec.js @@ -4,10 +4,9 @@ describe('Item tag', () => { cy.viewport(1920, 1080); cy.login('developer'); cy.visit(`/#/item/list`); - cy.get('#searchbar input').type('1{enter}'); + cy.typeSearchbar('1{enter}'); }); - // falla la notificacion it('should throw an error adding an existent tag', () => { cy.get('[href="#/item/1/tags"]').click(); cy.get('.q-page-sticky > div').click(); diff --git a/test/cypress/integration/item/itemTax.spec.js b/test/cypress/integration/item/itemTax.spec.js index 1de0183d7..9bb79f40f 100644 --- a/test/cypress/integration/item/itemTax.spec.js +++ b/test/cypress/integration/item/itemTax.spec.js @@ -4,7 +4,7 @@ describe('Item tax', () => { cy.viewport(1920, 1080); cy.login('developer'); cy.visit(`/#/item/list`); - cy.get('#searchbar input').type('1{enter}'); + cy.typeSearchbar('1{enter}'); }); it('should modify the tax for Spain', () => { From 4cf13a83a45f68a589f1b4952cbc90e4d8bda382 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 16 Dec 2024 11:54:57 +0100 Subject: [PATCH 021/105] fix: refs #7957 rollback --- src/composables/useArrayData.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 098991fe8..b37fa1377 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -3,8 +3,6 @@ import { useRouter, useRoute } from 'vue-router'; import axios from 'axios'; import { useArrayDataStore } from 'stores/useArrayDataStore'; import { buildFilter } from 'filters/filterPanel'; -import { isDialogOpened } from 'src/filters'; -import useOpenURL from './useOpenURL'; const arrayDataStore = useArrayDataStore(); @@ -66,7 +64,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } } - async function fetch({ append = false, updateRouter = true, newTab = false }) { + async function fetch({ append = false, updateRouter = true }) { if (!store.url) return; cancelRequest(); @@ -111,8 +109,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { params.filter.where = { ...params.filter.where, ...exprFilter }; params.filter = JSON.stringify(params.filter); - if (newTab) return updateStateParams(true); - store.isLoading = true; const response = await axios.get(store.url, { signal: canceller.signal, @@ -127,7 +123,8 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { for (const row of response.data) store.data.push(row); } else { store.data = response.data; - if (!isDialogOpened()) updateRouter && updateStateParams(); + if (!document.querySelectorAll('[role="dialog"][aria-modal="true"]').length) + updateRouter && updateStateParams(); } store.isLoading = false; @@ -157,12 +154,12 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } } - async function applyFilter({ filter, params, newTab }) { + async function applyFilter({ filter, params }) { if (filter) store.userFilter = filter; store.filter = {}; if (params) store.userParams = { ...params }; - const response = await fetch({ newTab }); + const response = await fetch({}); return response; } @@ -258,14 +255,12 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { if (Object.values(store.userParams).length) await fetch({}); } - function updateStateParams(newTab) { + function updateStateParams() { if (!route?.path) return; const newUrl = { path: route.path, query: { ...(route.query ?? {}) } }; if (store?.searchUrl) newUrl.query[store.searchUrl] = JSON.stringify(store.currentFilter); - if (newTab) useOpenURL(router.resolve(newUrl).href); - if (store.navigate) { const { customRouteRedirectName, searchText } = store.navigate; if (customRouteRedirectName) From 4a4cb1cf3f84238382147f444f1ebcb86c62c05d Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 16 Dec 2024 16:02:43 +0100 Subject: [PATCH 022/105] feat: refs #7957 enhance search functionality and improve data filtering logic --- src/components/ui/VnSearchbar.vue | 70 +++++++++++++++++++++++-------- src/composables/useArrayData.js | 49 ++++++++++++---------- 2 files changed, 80 insertions(+), 39 deletions(-) diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index ccf87c6d6..89a587b31 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -1,14 +1,16 @@