diff --git a/test/cypress/integration/vnSearchBar.spec.js b/test/cypress/integration/vnSearchBar.spec.js index 6a769c9d9..d6dea0780 100644 --- a/test/cypress/integration/vnSearchBar.spec.js +++ b/test/cypress/integration/vnSearchBar.spec.js @@ -7,14 +7,13 @@ describe('VnSearchBar', () => { it('should redirect to new customer', () => { cy.visit('#/customer/1112/basic-data') - cy.get('.q-toolbar > .q-btn--round.q-btn--dense > .q-btn__content > .q-icon').click(); + cy.openLeftMenu(); cy.get('.q-item > .q-item__label').should('have.text',' #1112') - cy.get('.fullscreen').click(); - cy.get('#searchbar > form > label > div:nth-child(1) input').clear(); - cy.get('#searchbar > form > label > div:nth-child(1) input').type('1{enter}'); - cy.get('.q-toolbar > .q-btn--round.q-btn--dense > .q-btn__content > .q-icon').click(); + cy.closeLeftMenu(); + cy.clearSearchbar(); + cy.writeSearchbar('1{enter}'); + cy.openLeftMenu(); cy.get('.q-item > .q-item__label').should('have.text',' #1') + cy.closeLeftMenu(); }); - - - }); +}); diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 4dfde6e21..7effb94a6 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -166,6 +166,23 @@ Cypress.Commands.add('openRightMenu', (element) => { cy.get('#actions-append').click(); }); +Cypress.Commands.add('openLeftMenu', (element) => { + if (element) cy.waitForElement(element); + cy.get('.q-toolbar > .q-btn--round.q-btn--dense > .q-btn__content > .q-icon').click(); +}); +Cypress.Commands.add('closeLeftMenu', (element) => { + if (element) cy.waitForElement(element); + cy.get('.fullscreen').click(); +}); + +Cypress.Commands.add('clearSearchbar', (element) => { + if (element) cy.waitForElement(element); + cy.get('#searchbar > form > label > div:nth-child(1) input').clear(); +}); + +Cypress.Commands.add('writeSearchbar', (value) => { + cy.get('#searchbar > form > label > div:nth-child(1) input').type(value); +}); Cypress.Commands.add('validateContent', (selector, expectedValue) => { cy.get(selector).should('have.text', expectedValue); });