diff --git a/test/cypress/integration/client/clientList.spec.js b/test/cypress/integration/client/clientList.spec.js index 21fc0f2ea..195987539 100644 --- a/test/cypress/integration/client/clientList.spec.js +++ b/test/cypress/integration/client/clientList.spec.js @@ -59,10 +59,10 @@ describe('Client list', () => { cy.checkValueForm(1, search); cy.checkValueForm(2, search); }); - it('Client founded create order', () => { + it.only('Client founded create order', () => { const search = 'Jessica Jones'; cy.searchByLabel('Name', search); - cy.clickButtonDescriptor(3); + cy.clickButtonWith('icon', 'icon-basketadd'); cy.waitForElement('#formModel'); cy.waitForElement('.q-form'); cy.checkValueForm(1, search); diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 9bfa2c03e..23963125e 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -71,7 +71,7 @@ Cypress.Commands.add('getValue', (selector) => { return cy .get( selector + - '> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input' + '> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input', ) .invoke('val'); } @@ -303,7 +303,7 @@ Cypress.Commands.add('clickButtonDescriptor', (id) => { Cypress.Commands.add('openUserPanel', () => { cy.get( - '.column > .q-avatar > .q-avatar__content > .q-img > .q-img__container > .q-img__image' + '.column > .q-avatar > .q-avatar__content > .q-img > .q-img__container > .q-img__image', ).click(); }); @@ -329,7 +329,7 @@ Cypress.Commands.add('checkValueForm', (id, search) => { Cypress.Commands.add('checkValueSelectForm', (id, search) => { cy.get( - `.grid-create > :nth-child(${id}) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > .q-field__input` + `.grid-create > :nth-child(${id}) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > .q-field__input`, ).should('have.value', search); }); @@ -347,3 +347,21 @@ Cypress.Commands.add('addBtnClick', () => { .and('be.visible') .click(); }); + +Cypress.Commands.add('clickButtonWith', (type, value) => { + switch (type) { + case 'icon': + cy.clickButtonWithIcon(value); + break; + + default: + cy.clickButtonWithText(value); + break; + } +}); +Cypress.Commands.add('clickButtonWithIcon', (iconClass) => { + cy.get(`.q-icon.${iconClass}`).parent().click(); +}); +Cypress.Commands.add('clickButtonWithText', (buttonText) => { + cy.get('.q-btn').contains(buttonText).click(); +});