From aa0ac3fc267a7a7f06c51af86863bcb8940dcdb9 Mon Sep 17 00:00:00 2001 From: jtubau Date: Tue, 18 Feb 2025 07:32:54 +0100 Subject: [PATCH] fix: add data-cy attribute to card button for improved testing --- src/components/VnTable/VnTable.vue | 1 + test/cypress/integration/entry/myEntry.spec.js | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 2559452e4..33bcb533a 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -861,6 +861,7 @@ function cardClick(_, row) { :key="index" :title="btn.title" :icon="btn.icon" + data-cy="cardBtn" class="q-pa-xs" flat :class=" diff --git a/test/cypress/integration/entry/myEntry.spec.js b/test/cypress/integration/entry/myEntry.spec.js index 49d75cf39..ed469d9e2 100644 --- a/test/cypress/integration/entry/myEntry.spec.js +++ b/test/cypress/integration/entry/myEntry.spec.js @@ -8,11 +8,9 @@ describe('EntryMy when is supplier', () => { }, }); }); - + it('should open buyLabel when is supplier', () => { - cy.get( - '[to="/null/3"] > .q-card > :nth-child(2) > .q-btn > .q-btn__content > .q-icon' - ).click(); + cy.dataCy('cardBtn').eq(2).click(); cy.dataCy('printLabelsBtn').click(); cy.window().its('open').should('be.called'); }); -- 2.40.1