From 7fb1a9e6b5b90ddf97267a4ee2271910e0e9de00 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 26 Nov 2024 12:24:02 +0100 Subject: [PATCH 001/139] 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 018/139] 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 019/139] 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 020/139] 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 021/139] 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 022/139] 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 023/139] 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 024/139] 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 @@ \ No newline at end of file diff --git a/src/pages/Worker/WorkerList.vue b/src/pages/Worker/WorkerList.vue index 365ea94de..6883a149f 100644 --- a/src/pages/Worker/WorkerList.vue +++ b/src/pages/Worker/WorkerList.vue @@ -189,7 +189,7 @@ async function autofillBic(worker) { + [ name: 'itemFk', ...defaultColumnAttrs, isId: true, - cardVisible: true, columnField: { component: 'input', type: 'number', @@ -65,14 +64,12 @@ const columns = computed(() => [ name: 'name', ...defaultColumnAttrs, create: true, - cardVisible: true, }, { label: t('item.fixedPrice.groupingPrice'), field: 'rate2', name: 'rate2', ...defaultColumnAttrs, - cardVisible: true, component: 'input', type: 'number', }, @@ -81,7 +78,6 @@ const columns = computed(() => [ field: 'rate3', name: 'rate3', ...defaultColumnAttrs, - cardVisible: true, component: 'input', type: 'number', }, @@ -91,7 +87,6 @@ const columns = computed(() => [ field: 'minPrice', name: 'minPrice', ...defaultColumnAttrs, - cardVisible: true, component: 'input', type: 'number', }, @@ -100,7 +95,6 @@ const columns = computed(() => [ field: 'started', name: 'started', format: ({ started }) => toDate(started), - cardVisible: true, ...defaultColumnAttrs, columnField: { component: 'date', @@ -116,7 +110,6 @@ const columns = computed(() => [ field: 'ended', name: 'ended', ...defaultColumnAttrs, - cardVisible: true, columnField: { component: 'date', class: 'shrink', @@ -251,11 +244,14 @@ const upsertPrice = async (props, resetMinPrice = false) => { } if (!changes.updates && !changes.creates) return; const data = await upsertFixedPrice(row); - tableRef.value.CrudModelRef.formData[props.rowIndex] = data; + Object.assign(tableRef.value.CrudModelRef.formData[props.rowIndex], data); + notify(t('globals.dataSaved'), 'positive'); + tableRef.value.reload(); }; async function upsertFixedPrice(row) { const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row); + data.hasMinPrice = data.hasMinPrice ? 1 : 0; return data; } @@ -395,18 +391,11 @@ function handleOnDataSave({ CrudModelRef }) { From 60f3ea838aadd04ecc609a1f8a9b82fab1a6e400 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 3 Jan 2025 08:18:11 +0100 Subject: [PATCH 082/139] fix: refs #7699 fix component --- src/components/common/VnChangePassword.vue | 2 +- src/pages/Login/LoginMain.vue | 7 +++---- test/cypress/integration/outLogin/login.spec.js | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/common/VnChangePassword.vue b/src/components/common/VnChangePassword.vue index acc895f0e..780cdc17b 100644 --- a/src/components/common/VnChangePassword.vue +++ b/src/components/common/VnChangePassword.vue @@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n'; import VnRow from '../ui/VnRow.vue'; import FetchData from '../FetchData.vue'; import useNotify from 'src/composables/useNotify'; -import VnInputPassword from './VnInputPassword.vue'; +import VnInputPassword from 'VnInputPassword.vue'; const props = defineProps({ submitFn: { type: Function, default: () => {} }, diff --git a/src/pages/Login/LoginMain.vue b/src/pages/Login/LoginMain.vue index 44b868ebd..a4c3566a9 100644 --- a/src/pages/Login/LoginMain.vue +++ b/src/pages/Login/LoginMain.vue @@ -3,7 +3,7 @@ import { ref } from 'vue'; import { Notify } from 'quasar'; import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; - +import VnInputPassword from 'src/components/common/VnInputPassword.vue'; import { useSession } from 'src/composables/useSession'; import { useLogin } from 'src/composables/useLogin'; @@ -63,11 +63,10 @@ async function onSubmit() { :rules="[(val) => (val && val.length > 0) || t('login.fieldRequired')]" color="primary" /> - diff --git a/test/cypress/integration/outLogin/login.spec.js b/test/cypress/integration/outLogin/login.spec.js index 3db223cdb..2bd5a8c3b 100755 --- a/test/cypress/integration/outLogin/login.spec.js +++ b/test/cypress/integration/outLogin/login.spec.js @@ -19,6 +19,7 @@ describe('Login', () => { it('should fail to log in using wrong password', () => { cy.get('input[aria-label="Username"]').type('employee'); cy.get('input[aria-label="Password"]').type('wrongPassword'); + cy.get('.q-field__append > .q-icon'); cy.get('button[type="submit"]').click(); cy.get('.q-notification__message').should( 'have.text', From d1466746de4eca3920f10103b814d3d95f4bfd46 Mon Sep 17 00:00:00 2001 From: provira Date: Fri, 3 Jan 2025 08:33:38 +0100 Subject: [PATCH 083/139] feat: refs #7078 created test for VnJsonValue --- .../common/__tests__/VnJsonValue.spec.js | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 src/components/common/__tests__/VnJsonValue.spec.js diff --git a/src/components/common/__tests__/VnJsonValue.spec.js b/src/components/common/__tests__/VnJsonValue.spec.js new file mode 100644 index 000000000..19e563a1f --- /dev/null +++ b/src/components/common/__tests__/VnJsonValue.spec.js @@ -0,0 +1,87 @@ +import { mount } from '@vue/test-utils'; +import { describe, it, expect } from 'vitest'; +import VnJsonValue from 'src/components/common/VnJsonValue.vue'; + +const createWrapper = (props) => { + return mount(VnJsonValue, { + props, + }); +}; + +describe('VnJsonValue', () => { + it('renders null value correctly', async () => { + const wrapper = createWrapper({ value: null }); + const span = wrapper.find('span'); + expect(span.text()).toBe('∅'); + expect(span.classes()).toContain('json-null'); + }); + + it('renders boolean true correctly', async () => { + const wrapper = createWrapper({ value: true }); + const span = wrapper.find('span'); + expect(span.text()).toBe('✓'); + expect(span.classes()).toContain('json-true'); + }); + + it('renders boolean false correctly', async () => { + const wrapper = createWrapper({ value: false }); + const span = wrapper.find('span'); + expect(span.text()).toBe('✗'); + expect(span.classes()).toContain('json-false'); + }); + + it('renders a short string correctly', async () => { + const wrapper = createWrapper({ value: 'Hello' }); + const span = wrapper.find('span'); + expect(span.text()).toBe('Hello'); + expect(span.classes()).toContain('json-string'); + }); + + it('renders a long string correctly with ellipsis', async () => { + const longString = 'a'.repeat(600); + const wrapper = createWrapper({ value: longString }); + const span = wrapper.find('span'); + expect(span.text()).toContain('...'); + expect(span.text().length).toBeLessThanOrEqual(515); + expect(span.attributes('title')).toBe(longString); + expect(span.classes()).toContain('json-string'); + }); + + it('renders a number correctly', async () => { + const wrapper = createWrapper({ value: 123.4567 }); + const span = wrapper.find('span'); + expect(span.text()).toBe('123.457'); + expect(span.classes()).toContain('json-number'); + }); + + it('renders an integer correctly', async () => { + const wrapper = createWrapper({ value: 42 }); + const span = wrapper.find('span'); + expect(span.text()).toBe('42'); + expect(span.classes()).toContain('json-number'); + }); + + it('renders a date correctly', async () => { + const date = new Date('2023-01-01'); + const wrapper = createWrapper({ value: date }); + const span = wrapper.find('span'); + expect(span.text()).toBe('2023-01-01'); + expect(span.classes()).toContain('json-object'); + }); + + it('renders an object correctly', async () => { + const obj = { key: 'value' }; + const wrapper = createWrapper({ value: obj }); + const span = wrapper.find('span'); + expect(span.text()).toBe(obj.toString()); + expect(span.classes()).toContain('json-object'); + }); + + it('updates value when prop changes', async () => { + const wrapper = createWrapper({ value: true }); + await wrapper.setProps({ value: 123 }); + const span = wrapper.find('span'); + expect(span.text()).toBe('123'); + expect(span.classes()).toContain('json-number'); + }); +}); From cd6cc5c865dbf2cd963bf4ed6abf69e4fb4941c1 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 3 Jan 2025 08:46:22 +0100 Subject: [PATCH 084/139] fix: refs #7699 fix vnInputPassword --- src/pages/Account/AccountCreate.vue | 5 +++-- src/pages/Account/AccountLdap.vue | 4 ++-- src/pages/Account/AccountList.vue | 4 ++-- src/pages/Account/AccountSamba.vue | 5 +++-- src/pages/Account/Card/AccountDescriptorMenu.vue | 4 ++-- src/pages/Login/ResetPassword.vue | 11 +++++------ 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/pages/Account/AccountCreate.vue b/src/pages/Account/AccountCreate.vue index 6b7c049c8..b925ff06a 100644 --- a/src/pages/Account/AccountCreate.vue +++ b/src/pages/Account/AccountCreate.vue @@ -6,6 +6,7 @@ import FormModelPopup from 'components/FormModelPopup.vue'; import VnSelect from 'src/components/common/VnSelect.vue'; import FetchData from 'components/FetchData.vue'; import VnInput from 'src/components/common/VnInput.vue'; +import VnInputPassword from 'src/components/common/VnInputPassword.vue'; const { t } = useI18n(); const router = useRouter(); @@ -61,10 +62,10 @@ const redirectToAccountBasicData = (_, { id }) => { hide-selected :rules="validate('VnUser.roleFk')" /> - await getInitialLdapConfig()); :required="true" :rules="validate('LdapConfig.rdn')" /> - diff --git a/src/pages/Login/ResetPassword.vue b/src/pages/Login/ResetPassword.vue index 2751f1ceb..081801e0e 100644 --- a/src/pages/Login/ResetPassword.vue +++ b/src/pages/Login/ResetPassword.vue @@ -7,6 +7,7 @@ import axios from 'axios'; import VnInput from 'components/common/VnInput.vue'; import VnOutForm from 'components/ui/VnOutForm.vue'; +import VnInputPassword from 'src/components/common/VnInputPassword.vue'; const quasar = useQuasar(); const router = useRouter(); @@ -54,8 +55,7 @@ async function onSubmit() { - + - + diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index 4e284d8e4..a2d3b9ee1 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -126,6 +126,7 @@ async function search() { delete filter.params.search; } await arrayData.applyFilter(filter); + searchText.value = undefined; }