From 7f1be98b742358db329772eabf29908d7b180992 Mon Sep 17 00:00:00 2001
From: Jon <jon@verdnatura.es>
Date: Mon, 24 Feb 2025 16:20:28 +0100
Subject: [PATCH] fix: fixed account descriptor menu and created e2e

---
 src/i18n/locale/en.yml                        |  1 +
 src/i18n/locale/es.yml                        |  1 +
 .../Account/Card/AccountDescriptorMenu.vue    |  5 ++--
 .../account/accountDescriptorMenu.spec.js     | 24 +++++++++++++++++++
 4 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 test/cypress/integration/account/accountDescriptorMenu.spec.js

diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml
index 9a60e9da138..9e46c54e36a 100644
--- a/src/i18n/locale/en.yml
+++ b/src/i18n/locale/en.yml
@@ -153,6 +153,7 @@ globals:
     maxTemperature: Max
     minTemperature: Min
     changePass: Change password
+    setPass: Set password
     deleteConfirmTitle: Delete selected elements
     changeState: Change state
     raid: 'Raid {daysInForward} days'
diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml
index 846c442ea51..6e43e0882c3 100644
--- a/src/i18n/locale/es.yml
+++ b/src/i18n/locale/es.yml
@@ -157,6 +157,7 @@ globals:
     maxTemperature: Máx
     minTemperature: Mín
     changePass: Cambiar contraseña
+    setPass: Establecer contraseña
     deleteConfirmTitle: Eliminar los elementos seleccionados
     changeState: Cambiar estado
     raid: 'Redada {daysInForward} días'
diff --git a/src/pages/Account/Card/AccountDescriptorMenu.vue b/src/pages/Account/Card/AccountDescriptorMenu.vue
index 30584c61f46..95ad7ed63c3 100644
--- a/src/pages/Account/Card/AccountDescriptorMenu.vue
+++ b/src/pages/Account/Card/AccountDescriptorMenu.vue
@@ -25,12 +25,13 @@ const $props = defineProps({
 const { t } = useI18n();
 const { hasAccount } = toRefs($props);
 const { openConfirmationModal } = useVnConfirm();
+const arrayData = useArrayData('Account');
 const route = useRoute();
 const router = useRouter();
 const state = useState();
 const user = state.getUser();
 const { notify } = useQuasar();
-const account = computed(() => useArrayData('Account').store.data[0]);
+const account = computed(() => arrayData.store.data);
 account.value.hasAccount = hasAccount.value;
 const entityId = computed(() => +route.params.id);
 const hasitManagementAccess = ref();
@@ -39,7 +40,7 @@ const isHimself = computed(() => user.value.id === account.value.id);
 const url = computed(() =>
     isHimself.value
         ? 'Accounts/change-password'
-        : `Accounts/${entityId.value}/setPassword`
+        : `Accounts/${entityId.value}/setPassword`,
 );
 
 async function updateStatusAccount(active) {
diff --git a/test/cypress/integration/account/accountDescriptorMenu.spec.js b/test/cypress/integration/account/accountDescriptorMenu.spec.js
new file mode 100644
index 00000000000..67a7d8ef66d
--- /dev/null
+++ b/test/cypress/integration/account/accountDescriptorMenu.spec.js
@@ -0,0 +1,24 @@
+describe('ClaimNotes', () => {
+    const descriptorOptions = '[data-cy="descriptor-more-opts-menu"] > .q-list';
+    const url = '/#/account/1/summary';
+
+    it('should see all the account options', () => {
+        cy.login('itManagement');
+        cy.visit(url);
+        cy.dataCy('descriptor-more-opts').click();
+        cy.get(descriptorOptions)
+            .find('.q-item')
+            .its('length')
+            .then((count) => {
+                cy.log('Número de opciones:', count);
+                expect(count).to.equal(5);
+            });
+    });
+
+    it('should not see any option', () => {
+        cy.login('salesPerson');
+        cy.visit(url);
+        cy.dataCy('descriptor-more-opts').click();
+        cy.get(descriptorOptions).should('not.be.visible');
+    });
+});