From 421b68a03101ab8b5f2a526474d2568f25affaaf Mon Sep 17 00:00:00 2001
From: alexm <alexm@verdnatura.es>
Date: Wed, 26 Mar 2025 09:16:32 +0100
Subject: [PATCH] test: refs #8449 refactor e2e vnLog

---
 src/components/common/VnLog.vue               |  2 ++
 src/components/common/VnLogFilter.vue         |  2 ++
 .../integration/vnComponent/VnLog.spec.js     | 21 ++++++++-----------
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/components/common/VnLog.vue b/src/components/common/VnLog.vue
index e9805815e..2550cb05e 100644
--- a/src/components/common/VnLog.vue
+++ b/src/components/common/VnLog.vue
@@ -362,6 +362,7 @@ watch(
                                             backgroundColor: useColor(modelLog.model),
                                         }"
                                         :title="`${modelLog.model} #${modelLog.id}`"
+                                        data-cy="vnLog-model-chip"
                                     >
                                         {{ t(modelLog.modelI18n) }}
                                     </QChip>
@@ -477,6 +478,7 @@ watch(
                                                             }`,
                                                         )
                                                     "
+                                                    data-cy="vnLog-action-icon"
                                                 />
                                             </div>
                                         </QItem>
diff --git a/src/components/common/VnLogFilter.vue b/src/components/common/VnLogFilter.vue
index dd34d5c99..cab52a633 100644
--- a/src/components/common/VnLogFilter.vue
+++ b/src/components/common/VnLogFilter.vue
@@ -125,6 +125,7 @@ function getActions() {
                 @update:model-value="() => searchFn()"
                 dense
                 filled
+                data-cy="vnLog-entity"
             />
         </template>
         <template #filter-userType="{ params, columnName, searchFn }">
@@ -188,6 +189,7 @@ function getActions() {
                     @update:model-value="
                         () => searchFn(undefined, 'action', getActions())
                     "
+                    data-cy="vnLog-checkbox"
                 />
             </div>
         </template>
diff --git a/test/cypress/integration/vnComponent/VnLog.spec.js b/test/cypress/integration/vnComponent/VnLog.spec.js
index 8ca32b681..57faeac85 100644
--- a/test/cypress/integration/vnComponent/VnLog.spec.js
+++ b/test/cypress/integration/vnComponent/VnLog.spec.js
@@ -1,26 +1,23 @@
 /// <reference types="cypress" />
 describe('VnLog', () => {
-    const chips = [
-        ':nth-child(1) > :nth-child(1) > .q-item__label > .q-chip > .q-chip__content',
-        ':nth-child(2) > :nth-child(1) > .q-item__label > .q-chip > .q-chip__content',
-    ];
     beforeEach(() => {
         cy.login('developer');
         cy.visit(`/#/claim/${1}/log`);
-        cy.openRightMenu();
     });
 
     it('should filter by insert actions', () => {
-        cy.checkOption(':nth-child(7) > .q-checkbox');
-        cy.get('.q-page').click();
-        cy.validateContent(chips[0], 'Document');
-        cy.validateContent(chips[1], 'Beginning');
+        cy.get('[data-cy="vnLog-checkbox"]').eq(0).click();
+        cy.get('[data-cy="vnLog-action-icon"]').each(($el) => {
+            cy.wrap($el).should('have.attr', 'title', 'Creates');
+        });
     });
 
     it('should filter by entity', () => {
-        cy.selectOption('.q-drawer--right .q-item > .q-select', 'Claim');
-        cy.get('.q-page').click();
-        cy.validateContent(chips[0], 'Beginning');
+        const entity = 'Document';
+        cy.selectOption('[data-cy="vnLog-entity"]', entity);
+        cy.get('[data-cy="vnLog-model-chip"]').each(($el) => {
+            cy.wrap($el).should('have.text', entity);
+        });
     });
 
     it('should show claimDescriptor', () => {