refactor: refs #8484 improve search input behavior and enhance visit command with DOM content load
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jose Antonio Tubau 2025-01-31 12:41:16 +01:00
parent f6439ed356
commit 98363c2197
2 changed files with 12 additions and 3 deletions

View File

@ -9,7 +9,7 @@ describe('InvoiceInList', () => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-in/list`);
cy.get('#searchbar input').should('be.visible').type('{enter}');
cy.get('#searchbar input').type('{enter}');
});
it('should redirect on clicking a invoice', () => {

View File

@ -54,9 +54,18 @@ Cypress.Commands.add('login', (user) => {
});
});
Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => {
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
Cypress.Commands.add('domContentLoad', (timeout = 5000) => {
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'), {
timeout,
interval: 5000,
});
});
Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
originalFn(url, options);
cy.domContentLoad();
});
Cypress.Commands.add('waitForElement', (element, timeout = 5000) => {
cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
});