diff --git a/src/components/FormModelPopup.vue b/src/components/FormModelPopup.vue
index 34aec96d8..d8f9868d7 100644
--- a/src/components/FormModelPopup.vue
+++ b/src/components/FormModelPopup.vue
@@ -2,6 +2,7 @@
import { ref, computed, useAttrs, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import { useState } from 'src/composables/useState';
+import { tMobile } from 'src/composables/tMobile';
import FormModel from 'components/FormModel.vue';
@@ -93,12 +94,25 @@ defineExpose({
z-max
@click="emit('onDataCanceled')"
/>
+
{
const firstRow = 'tr.cursor-pointer > :nth-child(1)';
const ticketId = 1000000;
+const itemId = '88';
const clickNotificationAction = () => {
const notification = '.q-notification';
cy.waitForElement(notification);
@@ -18,7 +19,7 @@ describe.skip('Ticket Lack detail', { testIsolation: true }, () => {
cy.viewport(1980, 1020);
cy.login('developer');
cy.intercept('GET', /\/api\/Tickets\/itemLack\/88.*$/).as('getItemLack');
- cy.visit('/#/ticket/negative/88');
+ cy.visit(`/#/ticket/negative/${itemId}`);
cy.window().then((win) => {
cy.stub(win, 'open').as('open');
});
@@ -105,7 +106,7 @@ describe.skip('Ticket Lack detail', { testIsolation: true }, () => {
cy.dataCy('New item_select').should('be.visible');
cy.selectOption('[data-cy="New item_select"]', 'Palito rojo');
cy.get('.q-btn--unelevated > .q-btn__content > .block').click();
- cy.checkNotification('Ticket 1000000: price retrieval failed');
+ cy.checkNotification(`Ticket ${ticketId}: price retrieval failed`);
cy.dataCy('changeItem').click();
cy.selectOption('[data-cy="New item_select"]', 'Ranged weapon longbow 200cm');
cy.get('.q-btn--unelevated > .q-btn__content > .block').click();
@@ -113,20 +114,22 @@ describe.skip('Ticket Lack detail', { testIsolation: true }, () => {
clickNotificationAction();
});
after(() => {
+ cy.intercept('GET', /\/api\/Tickets\/\d+/).as('sale');
cy.visit(`/#/ticket/${ticketId}/sale`);
+ cy.wait('@sale');
const quantity = Math.floor(Math.random() * 100) + 1;
- const rowIndex = 1;
+ cy.findRowIndexByColValue('itemFk', itemId, (rowIndex) => {
+ cy.dataCy('ticketSaleQuantityInput')
+ .find('input')
+ .eq(rowIndex)
+ .clear()
+ .type(`${quantity}{enter}`);
- cy.dataCy('ticketSaleQuantityInput')
- .find('input')
- .eq(rowIndex)
- .clear()
- .type(`${quantity}{enter}`);
-
- cy.dataCy('ticketSaleQuantityInput')
- .find('input')
- .eq(rowIndex)
- .should('have.value', `${quantity}`);
+ cy.dataCy('ticketSaleQuantityInput')
+ .find('input')
+ .eq(rowIndex)
+ .should('have.value', `${quantity}`);
+ });
});
});
diff --git a/test/cypress/integration/vnComponent/vnTable.commands.js b/test/cypress/integration/vnComponent/vnTable.commands.js
index fabffd4e2..e22e8f085 100644
--- a/test/cypress/integration/vnComponent/vnTable.commands.js
+++ b/test/cypress/integration/vnComponent/vnTable.commands.js
@@ -48,6 +48,31 @@ Cypress.Commands.add('validateVnTableRows', (opts = {}) => {
});
});
});
+Cypress.Commands.add('findRowIndexByColValue', (colField, value, cb) => {
+ return cy
+ .get('[data-cy="vnTable"] .q-virtual-scroll__content')
+ .children()
+ .then(($rows) => {
+ let foundIndex = -1;
+
+ Cypress._.some($rows, (row, index) => {
+ const cell = row.querySelector(`[data-col-field="${colField}"]`);
+ const text = cell?.textContent?.trim();
+ if (text === value) {
+ foundIndex = index;
+ return true;
+ }
+ });
+
+ if (foundIndex === -1) {
+ throw new Error(
+ `No se encontrĂ³ ninguna fila con ${colField} = "${value}"`,
+ );
+ }
+
+ cb(foundIndex);
+ });
+});
Cypress.Commands.add('colField', (name, index = null, key = 'data-col-field') => {
if (index) {