diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 83f6eaab7..8f20ab899 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -92,18 +92,20 @@ Cypress.Commands.add('selectOption', (selector, option, timeout = 10000) => { cy.get(selector).click().invoke('data', 'url').as('dataUrl'); // Escribir la opción deseada - cy.get(selector).clear().type(option); - cy.get('.q-menu', { timeout }).should('be.visible').and('exist'); - - // Si hay una URL, espera a que el menú desaparezca y vuelva a aparecer + let hasUrl; cy.get('@dataUrl').then((url) => { - if (url) { - cy.get('.q-menu').should('be.visible').and('exist'); - - cy.get('.q-menu').should('not.be.visible'); - cy.get('.q-menu').should('be.visible').and('exist'); - } + hasUrl = url; + cy.intercept('GET', url).as('dataRequest'); // Ajusta el método y la URL según sea necesario }); + cy.get(selector).clear().type(option); + + if (hasUrl) { + cy.wait('@dataRequest').then(() => { + cy.get('.q-menu').should('be.visible').and('exist'); + cy.get('.q-menu').should('not.be.visible'); // Esperar que el menú desaparezca + cy.get('.q-menu').should('be.visible').and('exist'); // Esperar que reaparezca + }); + } // Finalmente, seleccionar la opción deseada cy.get('.q-menu:visible').find('.q-item').contains(option).click();