From 8b3a9db78143f19136a619b8043d4744c4a90fab Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 3 Dec 2024 13:00:16 +0100 Subject: [PATCH 01/64] feat: refs #8220 created items e2e --- src/components/RegularizeStockForm.vue | 1 + src/components/common/VnSelectDialog.vue | 1 + src/pages/Item/Card/ItemBotanical.vue | 2 +- src/pages/Item/Card/ItemTags.vue | 2 +- src/pages/Item/ItemListFilter.vue | 2 + src/pages/Item/ItemTypeList.vue | 4 +- .../integration/item/itemBotanical.spec.js | 35 ++++++++++++++++ .../integration/item/itemSummary.spec.js | 25 ++++++++++++ test/cypress/integration/item/itemTag.spec.js | 37 +++++++++++++++++ test/cypress/integration/item/itemTax.spec.js | 18 +++++++++ .../cypress/integration/item/itemType.spec.js | 40 +++++++++++++++++++ 11 files changed, 162 insertions(+), 5 deletions(-) create mode 100644 test/cypress/integration/item/itemBotanical.spec.js create mode 100644 test/cypress/integration/item/itemSummary.spec.js create mode 100644 test/cypress/integration/item/itemTag.spec.js create mode 100644 test/cypress/integration/item/itemTax.spec.js create mode 100644 test/cypress/integration/item/itemType.spec.js diff --git a/src/components/RegularizeStockForm.vue b/src/components/RegularizeStockForm.vue index f34386fc4..3cd18d1c8 100644 --- a/src/components/RegularizeStockForm.vue +++ b/src/components/RegularizeStockForm.vue @@ -55,6 +55,7 @@ const onDataSaved = (data) => { v-model.number="data.quantity" type="number" autofocus + data-cy="regularizeStockInput" /> diff --git a/src/components/common/VnSelectDialog.vue b/src/components/common/VnSelectDialog.vue index 350aa9272..a19c3e30c 100644 --- a/src/components/common/VnSelectDialog.vue +++ b/src/components/common/VnSelectDialog.vue @@ -50,6 +50,7 @@ const isAllowedToCreate = computed(() => { :style="{ 'font-variation-settings': `'FILL' ${1}`, }" + :data-cy="`SelectDialogAddIcon-${$attrs.label || 'default'}`" > {{ tooltip }} diff --git a/src/pages/Item/Card/ItemBotanical.vue b/src/pages/Item/Card/ItemBotanical.vue index c4b561772..57774f75e 100644 --- a/src/pages/Item/Card/ItemBotanical.vue +++ b/src/pages/Item/Card/ItemBotanical.vue @@ -1,5 +1,5 @@ + diff --git a/test/cypress/integration/item/itemList.spec.js b/test/cypress/integration/item/itemList.spec.js new file mode 100644 index 000000000..0a1f803aa --- /dev/null +++ b/test/cypress/integration/item/itemList.spec.js @@ -0,0 +1,34 @@ +/// + +describe('Item list', () => { + beforeEach(() => { + cy.viewport(1920, 1080); + cy.login('developer'); + cy.visit(`/#/item/list`); + cy.get('#searchbar input').type('{enter}'); + }); + + it('should filter the items and redirect to the summary', () => { + cy.dataCy('ItemFilterCategorySelect').type('Plant'); + cy.get('.q-menu .q-item').contains('Plant').click(); + cy.dataCy('ItemFilterTypeSelect').type('Anthurium'); + cy.get('.q-menu .q-item').contains('Anthurium').click(); + cy.get('.q-virtual-scroll__content > :nth-child(4) > :nth-child(4)').click(); + }); + + it('should create an item', () => { + const data = { + Description: { val: `Test item` }, + Type: { val: `Crisantemo`, type: 'select' }, + Intrastat: { val: `Coral y materiales similares`, type: 'select' }, + Origin: { val: `SPA`, type: 'select' }, + }; + cy.dataCy('vnTableCreateBtn').click(); + cy.fillInForm(data); + cy.dataCy('FormModelPopup_save').click(); + cy.checkNotification('Data created'); + cy.get( + ':nth-child(2) > .q-drawer > .q-drawer__content > .q-scrollarea > .q-scrollarea__container > .q-scrollarea__content' + ).should('be.visible'); + }); +}); From cb0422d83f8b0cf17175f6be948bba1f5ea4684a Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 13 Dec 2024 14:16:27 +0100 Subject: [PATCH 06/64] feat: refs #7957 open in new tab --- src/components/ui/VnSearchbar.vue | 6 ++++++ src/composables/useArrayData.js | 13 +++++++++---- src/pages/Monitor/Ticket/MonitorTicketSearchbar.vue | 1 + src/pages/Monitor/locale/en.yml | 2 +- src/pages/Monitor/locale/es.yml | 2 +- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index ccf87c6d6..830029e8e 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -67,6 +67,10 @@ const props = defineProps({ type: Function, default: undefined, }, + newTab: { + type: Boolean, + default: false, + }, }); const searchText = ref(); @@ -109,6 +113,7 @@ async function search() { search: searchText.value, }, ...{ filter: props.filter }, + newTab: props.newTab, }; if (props.whereFilter) { @@ -117,6 +122,7 @@ async function search() { }; delete filter.params.search; } + await arrayData.applyFilter(filter); } diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index da62eee3e..098991fe8 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -4,6 +4,7 @@ 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(); @@ -65,7 +66,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } } - async function fetch({ append = false, updateRouter = true }) { + async function fetch({ append = false, updateRouter = true, newTab = false }) { if (!store.url) return; cancelRequest(); @@ -110,6 +111,8 @@ 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, @@ -154,12 +157,12 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } } - async function applyFilter({ filter, params }) { + async function applyFilter({ filter, params, newTab }) { if (filter) store.userFilter = filter; store.filter = {}; if (params) store.userParams = { ...params }; - const response = await fetch({}); + const response = await fetch({ newTab }); return response; } @@ -255,12 +258,14 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { if (Object.values(store.userParams).length) await fetch({}); } - function updateStateParams() { + function updateStateParams(newTab) { 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) diff --git a/src/pages/Monitor/Ticket/MonitorTicketSearchbar.vue b/src/pages/Monitor/Ticket/MonitorTicketSearchbar.vue index f1c347588..9116a6449 100644 --- a/src/pages/Monitor/Ticket/MonitorTicketSearchbar.vue +++ b/src/pages/Monitor/Ticket/MonitorTicketSearchbar.vue @@ -8,5 +8,6 @@ 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 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 07/64] 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 a6815f4e3d8c677508d8120398d27ff9071146af Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 16 Dec 2024 10:21:20 +0100 Subject: [PATCH 08/64] 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 09/64] 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 10/64] 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 11/64] 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 12/64] 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 @@