From 8fd4448aab0e0a497114d41bc7f2763239e2f159 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Wed, 27 Nov 2024 20:09:44 -0300 Subject: [PATCH 01/29] Translate basket catalog button --- src/pages/Ecomerce/BasketView.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/Ecomerce/BasketView.vue b/src/pages/Ecomerce/BasketView.vue index 55f21cba..aa160649 100644 --- a/src/pages/Ecomerce/BasketView.vue +++ b/src/pages/Ecomerce/BasketView.vue @@ -109,12 +109,12 @@ const fetchData = async () => { - {{ t('catalog') }} + {{ t('titles.Catalog') }} Date: Wed, 27 Nov 2024 20:14:58 -0300 Subject: [PATCH 02/29] Adjust right drawer scroll --- src/layouts/MainLayout.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 3e9b3430..0353e96d 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -47,7 +47,7 @@ const logoutSupplantedUser = async () => { diff --git a/src/pages/Login/LoginView.vue b/src/pages/Login/LoginView.vue index d16f9b8c..8606dbc0 100644 --- a/src/pages/Login/LoginView.vue +++ b/src/pages/Login/LoginView.vue @@ -136,8 +136,11 @@ const loginAsGuest = async () => { outline /> -

- +

+ {{ $t('haveForgottenPassword') }}

diff --git a/src/pages/Login/RecoverPassword.vue b/src/pages/Login/RecoverPassword.vue new file mode 100644 index 00000000..98114f16 --- /dev/null +++ b/src/pages/Login/RecoverPassword.vue @@ -0,0 +1,99 @@ + + + + + + + +en-US: + inputEmail: Input email + rememberPassword: Rememeber password + weSendEmail: We will sent you an email to recover your password + weHaveSentEmailToRecover: We've sent you an email where you can recover your password +es-ES: + inputEmail: Introduce el correo electrónico + rememberPassword: Recordar contraseña + weSendEmail: Te enviaremos un correo para restablecer tu contraseña + weHaveSentEmailToRecover: Te hemos enviado un correo donde podrás recuperar tu contraseña +ca-ES: + inputEmail: Introdueix el correu electrònic + rememberPassword: Recordar contrasenya + weSendEmail: T'enviarem un correu per restablir la teva contrasenya + weHaveSentEmailToRecover: T'hem enviat un correu on podràs recuperar la teva contrasenya +fr-FR: + inputEmail: Entrez l'email + rememberPassword: Se souvenir du mot de passe + weSendEmail: Nous vous enverrons un e-mail pour récupérer votre mot de passe + weHaveSentEmailToRecover: Nous vous avons envoyé un e-mail où vous pouvez récupérer votre mot de passe +pr-BR: + inputEmail: Digite o e-mail + rememberPassword: Lembrar senha + weSendEmail: Enviaremos um e-mail para recuperar sua senha + weHaveSentEmailToRecover: Enviamos um e-mail onde você pode recuperar sua senha + diff --git a/src/pages/Login/RememberPassword.vue b/src/pages/Login/RememberPassword.vue deleted file mode 100644 index 3a6d781e..00000000 --- a/src/pages/Login/RememberPassword.vue +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - -en-US: - user: User - inputEmail: Input email - rememberPassword: Rememeber password - dontWorry: Don't worry! - fillData: Fill the data - weSendEmail: We will sent you an email to recover your password - weHaveSentEmailToRecover: We've sent you an email where you can recover your password - send: Send - return: Return -es-ES: - user: Usuario - inputEmail: Introduce el correo electrónico - rememberPassword: Recordar contraseña - dontWorry: ¡No te preocupes! - fillData: Rellena los datos - weSendEmail: Te enviaremos un correo para restablecer tu contraseña - weHaveSentEmailToRecover: Te hemos enviado un correo donde podrás recuperar tu contraseña - send: Enviar - return: Volver - diff --git a/src/router/index.js b/src/router/index.js index 4568f378..ab2967a8 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -39,10 +39,11 @@ export default route(function (/* { store, ssrContext } */) { Router.beforeEach((to, from, next) => { const userStore = useUserStore(); + const allowedRoutes = ['login', 'recoverPassword']; if ( !userStore.storage.getItem('token') && - to.name !== 'login' && + !allowedRoutes.includes(to.name) && !userStore.isGuest ) { return next({ name: 'login' }); diff --git a/src/router/routes.js b/src/router/routes.js index 1a632381..59ceee1c 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -5,17 +5,17 @@ const routes = [ children: [ { name: 'login', - path: '/login/:email?', + path: '', component: () => import('pages/Login/LoginView.vue') }, { - name: 'rememberPassword', - path: '/remember-password', - component: () => import('pages/Login/RememberPassword.vue') + name: 'recoverPassword', + path: 'recover', + component: () => import('pages/Login/RecoverPassword.vue') }, { name: 'resetPassword', - path: '/reset-password', + path: 'reset', component: () => import('pages/Login/ResetPassword.vue') } ] diff --git a/src/test/cypress/integration/login/RecoverPassword.spec.js b/src/test/cypress/integration/login/RecoverPassword.spec.js new file mode 100644 index 00000000..e78a20ff --- /dev/null +++ b/src/test/cypress/integration/login/RecoverPassword.spec.js @@ -0,0 +1,18 @@ +describe('Login Tests', () => { + beforeEach(() => { + cy.visit('/#/login'); + }); + + it('should ssend recover email', () => { + cy.dataCy('recoverPasswordViewLink').should('exist'); + cy.dataCy('recoverPasswordViewLink').click(); + cy.dataCy('recoverPasswordUserInput').find('input').should('exist'); + cy.dataCy('recoverPasswordUserInput').find('input').type('developer'); + cy.dataCy('recoverPasswordSubmitButton').should('exist'); + cy.dataCy('recoverPasswordSubmitButton').click(); + cy.checkNotify( + 'positive', + 'Te hemos enviado un correo donde podrás recuperar tu contraseña' + ); + }); +}); From 9fb67992aed8d381f50778890999b50d6a796894 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Tue, 3 Dec 2024 11:07:34 -0300 Subject: [PATCH 19/29] Make locale dates a getter --- src/stores/app.js | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/stores/app.js b/src/stores/app.js index 573995bf..c7b374d4 100644 --- a/src/stores/app.js +++ b/src/stores/app.js @@ -20,12 +20,7 @@ export const useAppStore = defineStore('hedera', { menuEssentialLinks: [], hiddenMenuLinks: new Set(['Reports']), basketOrderId: null, - localeDates: { - days: [], - months: [], - daysShort: [], - monthsShort: [] - }, + siteLang: null, localeOptions: [ { label: t('langs.en'), lang: 'en-US', value: 'en' }, @@ -66,20 +61,9 @@ export const useAppStore = defineStore('hedera', { this.$patch({ imageUrl }); }, - getLocaleDates() { - const { messages, locale } = i18n.global; - this.localeDates = { - days: messages.value[locale.value].date.days, - months: messages.value[locale.value].date.months, - daysShort: messages.value[locale.value].date.daysShort, - monthsShort: messages.value[locale.value].date.monthsShort - }; - }, - async init() { this.updateSiteLocale(localStorage.getItem('siteLang') || 'es-ES'); this.getBasketOrderId(); - this.getLocaleDates(); }, getBasketOrderId() { @@ -187,6 +171,15 @@ export const useAppStore = defineStore('hedera', { isDesktop() { const $q = useQuasar(); return $q?.screen?.width > 1024; + }, + localeDates() { + const { messages, locale } = i18n.global; + return { + days: messages.value[locale.value].date.days, + months: messages.value[locale.value].date.months, + daysShort: messages.value[locale.value].date.daysShort, + monthsShort: messages.value[locale.value].date.monthsShort + }; } } }); From e7289b05e943fcfd455813d436b45d2f13d45a45 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Tue, 3 Dec 2024 12:36:34 -0300 Subject: [PATCH 20/29] Emit search error when not typing search term --- src/components/ui/VnSearchBar.vue | 5 +++++ src/pages/Ecomerce/CatalogView.vue | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/ui/VnSearchBar.vue b/src/components/ui/VnSearchBar.vue index be15f6c9..214a8cff 100644 --- a/src/components/ui/VnSearchBar.vue +++ b/src/components/ui/VnSearchBar.vue @@ -40,6 +40,11 @@ const search = async () => { query: searchTerm.value ? { search: searchTerm.value } : {} }); + if (!searchTerm.value) { + emit('onSearchError'); + return; + } + if (props.sqlQuery) { data = await jApi.query(props.sqlQuery, { [props.searchField]: searchTerm.value diff --git a/src/pages/Ecomerce/CatalogView.vue b/src/pages/Ecomerce/CatalogView.vue index 4243775f..eea285cb 100644 --- a/src/pages/Ecomerce/CatalogView.vue +++ b/src/pages/Ecomerce/CatalogView.vue @@ -1,7 +1,14 @@ + diff --git a/src/pages/Ecomerce/CatalogView.vue b/src/pages/Ecomerce/CatalogView.vue index eea285cb..831d79dc 100644 --- a/src/pages/Ecomerce/CatalogView.vue +++ b/src/pages/Ecomerce/CatalogView.vue @@ -760,7 +760,8 @@ const getSubcategories = async () => { DROP TEMPORARY TABLE tmp.itemAvailable;`, { orderId: basketOrderId.value } ); - itemSubcategories.value = res.results[1].data; + const filtered = res.results[1].data.filter(item => item.category); + itemSubcategories.value = filtered.map(i => i.category); } catch (error) { console.error('Error getting subcategories:', error); } From 09866f5b418989596568f60656f691ef0d645ad2 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Thu, 5 Dec 2024 18:39:33 -0300 Subject: [PATCH 25/29] Add promise all in catalog --- src/pages/Ecomerce/CatalogView.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/Ecomerce/CatalogView.vue b/src/pages/Ecomerce/CatalogView.vue index 831d79dc..114b48e0 100644 --- a/src/pages/Ecomerce/CatalogView.vue +++ b/src/pages/Ecomerce/CatalogView.vue @@ -771,8 +771,10 @@ const showItem = async item => { if (checkGuest()) return; showItemDialog.value = true; - const itemLots = await calcItem(item.id); - const tags = await getItemTags(item.id); + const [itemLots, tags] = await Promise.all([ + calcItem(item.id), + getItemTags(item.id) + ]); item.lots = itemLots; item.tags = tags; selectedItem.value = item; From d913eba277e1dfd136ceff037fa074e553259a40 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Mon, 9 Dec 2024 15:18:45 -0300 Subject: [PATCH 26/29] Tests adjustments --- .../integration/admin/PhotosView.spec.js | 1 + .../checkout/CheckoutStepper.commands.js | 2 +- .../integration/config/AccountConfig.spec.js | 1 + src/test/cypress/reports/index.html | 17 +++++++++++++++++ src/test/cypress/support/commands.js | 2 +- 5 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 src/test/cypress/reports/index.html diff --git a/src/test/cypress/integration/admin/PhotosView.spec.js b/src/test/cypress/integration/admin/PhotosView.spec.js index 3df15fb6..f5253b4e 100644 --- a/src/test/cypress/integration/admin/PhotosView.spec.js +++ b/src/test/cypress/integration/admin/PhotosView.spec.js @@ -15,6 +15,7 @@ describe('Photo Uploader Component', () => { it('should allow selecting a photo collection', () => { // Simular la selección de una colección de fotos + cy.wait(500); cy.selectOption('[data-testid="photoCollectionSelect"]', 'Enlace'); cy.getValue('[data-testid="photoCollectionSelect"]').should( 'equal', diff --git a/src/test/cypress/integration/checkout/CheckoutStepper.commands.js b/src/test/cypress/integration/checkout/CheckoutStepper.commands.js index f9ae426c..827bab94 100644 --- a/src/test/cypress/integration/checkout/CheckoutStepper.commands.js +++ b/src/test/cypress/integration/checkout/CheckoutStepper.commands.js @@ -1,5 +1,5 @@ const checkoutNextStep = () => { - cy.dataCy('checkoutStepperRightButton').should('be.visible').click(); + cy.dataCy('checkoutStepperRightButton').last().should('be.visible').click(); }; Cypress.Commands.add('createOrderReceive', () => { diff --git a/src/test/cypress/integration/config/AccountConfig.spec.js b/src/test/cypress/integration/config/AccountConfig.spec.js index 97cd10dc..c2309589 100644 --- a/src/test/cypress/integration/config/AccountConfig.spec.js +++ b/src/test/cypress/integration/config/AccountConfig.spec.js @@ -11,6 +11,7 @@ describe('Changes user nickname', () => { it('changes site lang when changing user lang', () => { cy.dataCy('configViewLang').should('exist'); + cy.wait(500); cy.selectOption('[data-testid="configViewLang"]', 'Español'); cy.dataCy('headerTitle').should('contain', 'Configuración'); cy.selectOption('[data-testid="configViewLang"]', 'English'); diff --git a/src/test/cypress/reports/index.html b/src/test/cypress/reports/index.html new file mode 100644 index 00000000..785bb0d1 --- /dev/null +++ b/src/test/cypress/reports/index.html @@ -0,0 +1,17 @@ + +Hedera-Web E2E Reporter
\ No newline at end of file diff --git a/src/test/cypress/support/commands.js b/src/test/cypress/support/commands.js index b4ec3d42..b5befaf4 100644 --- a/src/test/cypress/support/commands.js +++ b/src/test/cypress/support/commands.js @@ -80,7 +80,7 @@ Cypress.Commands.add('setSessionStorage', (key, value) => { }); Cypress.Commands.add('resetDB', () => { - cy.exec('npm run resetDatabase'); + cy.exec('pnpm run db'); }); Cypress.Commands.add('setConfirmDialog', () => { From 99c13866275529b44c5d081fc6fe25214f9be44a Mon Sep 17 00:00:00 2001 From: wbuezas Date: Mon, 9 Dec 2024 15:30:51 -0300 Subject: [PATCH 27/29] Small changes --- src/test/cypress/integration/admin/PhotosView.spec.js | 1 - src/test/cypress/integration/config/AccountConfig.spec.js | 1 - src/test/cypress/support/commands.js | 1 + 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/cypress/integration/admin/PhotosView.spec.js b/src/test/cypress/integration/admin/PhotosView.spec.js index f5253b4e..3df15fb6 100644 --- a/src/test/cypress/integration/admin/PhotosView.spec.js +++ b/src/test/cypress/integration/admin/PhotosView.spec.js @@ -15,7 +15,6 @@ describe('Photo Uploader Component', () => { it('should allow selecting a photo collection', () => { // Simular la selección de una colección de fotos - cy.wait(500); cy.selectOption('[data-testid="photoCollectionSelect"]', 'Enlace'); cy.getValue('[data-testid="photoCollectionSelect"]').should( 'equal', diff --git a/src/test/cypress/integration/config/AccountConfig.spec.js b/src/test/cypress/integration/config/AccountConfig.spec.js index c2309589..97cd10dc 100644 --- a/src/test/cypress/integration/config/AccountConfig.spec.js +++ b/src/test/cypress/integration/config/AccountConfig.spec.js @@ -11,7 +11,6 @@ describe('Changes user nickname', () => { it('changes site lang when changing user lang', () => { cy.dataCy('configViewLang').should('exist'); - cy.wait(500); cy.selectOption('[data-testid="configViewLang"]', 'Español'); cy.dataCy('headerTitle').should('contain', 'Configuración'); cy.selectOption('[data-testid="configViewLang"]', 'English'); diff --git a/src/test/cypress/support/commands.js b/src/test/cypress/support/commands.js index b5befaf4..2f182661 100644 --- a/src/test/cypress/support/commands.js +++ b/src/test/cypress/support/commands.js @@ -36,6 +36,7 @@ requireCommands.keys().forEach(requireCommands); // Common commands Cypress.Commands.add('selectOption', (selector, option) => { cy.waitForElement(selector); + cy.wait(400); cy.get(selector).click(); cy.get('.q-menu .q-item').contains(option).click(); }); From 3aad2eaeec5010bee7b618ebc8aad7909dae72f3 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Tue, 10 Dec 2024 08:57:57 -0300 Subject: [PATCH 28/29] Fix tests and add new test to Catalog --- src/pages/Ecomerce/CatalogCard.vue | 2 ++ src/pages/Ecomerce/CatalogView.vue | 1 + .../cypress/integration/catalog/CatalogView.spec.js | 10 ++++++++++ src/test/cypress/reports/index.html | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/pages/Ecomerce/CatalogCard.vue b/src/pages/Ecomerce/CatalogCard.vue index 611ad1a2..66287664 100644 --- a/src/pages/Ecomerce/CatalogCard.vue +++ b/src/pages/Ecomerce/CatalogCard.vue @@ -28,6 +28,7 @@ const { t } = useI18n(); height="190px" rounded="bottom" zoom-size="1600x900" + data-testid="catalogCardImage" />