diff --git a/test/cypress/integration/invoiceIn/invoiceInList.spec.js b/test/cypress/integration/invoiceIn/invoiceInList.spec.js index 4e2b8f9cc..aa9af5120 100644 --- a/test/cypress/integration/invoiceIn/invoiceInList.spec.js +++ b/test/cypress/integration/invoiceIn/invoiceInList.spec.js @@ -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', () => { diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 6a436c1eb..e1f6b3651 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -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'); });