diff --git a/test/cypress/integration/client/clientAddress.spec.js b/test/cypress/integration/client/clientAddress.spec.js index 434180047..4d6186679 100644 --- a/test/cypress/integration/client/clientAddress.spec.js +++ b/test/cypress/integration/client/clientAddress.spec.js @@ -18,7 +18,7 @@ describe('Client consignee', () => { const addressName = 'test'; cy.dataCy('Consignee_input').type(addressName); cy.dataCy('Location_select').click(); - cy.get('[role="listbox"] .q-item:nth-child(1)').click(); + cy.getOption(); cy.dataCy('Street address_input').type('TEST ADDRESS'); cy.get('.q-btn-group > .q-btn--standard').click(); cy.location('href').should('contain', '#/customer/1107/address'); diff --git a/test/cypress/integration/ticket/tickeFilter.spec.js b/test/cypress/integration/ticket/tickeFilter.spec.js index 408c5a19f..59abb0164 100644 --- a/test/cypress/integration/ticket/tickeFilter.spec.js +++ b/test/cypress/integration/ticket/tickeFilter.spec.js @@ -7,7 +7,7 @@ describe('TicketFilter', () => { cy.domContentLoad(); }); - it.only('use search button', function () { + it('use search button', function () { cy.waitForElement('.q-page'); cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter'); cy.searchBtnFilterPanel(); diff --git a/test/cypress/integration/ticket/ticketList.spec.js b/test/cypress/integration/ticket/ticketList.spec.js index e6ddc2fa1..d0ea14779 100644 --- a/test/cypress/integration/ticket/ticketList.spec.js +++ b/test/cypress/integration/ticket/ticketList.spec.js @@ -60,7 +60,7 @@ describe('TicketList', () => { cy.dataCy('Customer_select').should('have.value', 'Bruce Wayne'); cy.dataCy('Address_select').click(); - cy.selectOptionBeta().click(); + cy.getOption().click(); cy.dataCy('Address_select').should('have.value', 'Bruce Wayne'); }); it('Client list create new client', () => { diff --git a/test/cypress/integration/vnComponent/UserPanel.spec.js b/test/cypress/integration/vnComponent/UserPanel.spec.js index e83d07954..25724e873 100644 --- a/test/cypress/integration/vnComponent/UserPanel.spec.js +++ b/test/cypress/integration/vnComponent/UserPanel.spec.js @@ -18,7 +18,7 @@ describe('UserPanel', () => { cy.get(userWarehouse).should('have.value', 'VNL').click(); // Actualizo la opción - getOption(3); + cy.getOption(3); //Compruebo la notificación cy.get('.q-notification').should('be.visible'); @@ -26,7 +26,7 @@ describe('UserPanel', () => { //Restauro el valor cy.get(userWarehouse).click(); - getOption(2); + cy.getOption(2); }); it('should notify when update user company', () => { const userCompany = @@ -39,7 +39,7 @@ describe('UserPanel', () => { cy.get(userCompany).should('have.value', 'Warehouse One').click(); //Actualizo la opción - getOption(2); + cy.getOption(2); //Compruebo la notificación cy.get('.q-notification').should('be.visible'); @@ -47,12 +47,6 @@ describe('UserPanel', () => { //Restauro el valor cy.get(userCompany).click(); - getOption(1); + cy.getOption(1); }); }); - -function getOption(index) { - cy.waitForElement('[role="listbox"]'); - const option = `[role="listbox"] .q-item:nth-child(${index})`; - cy.get(option).click(); -} diff --git a/test/cypress/integration/vnComponent/VnLocation.spec.js b/test/cypress/integration/vnComponent/VnLocation.spec.js index 751b3a065..9074fc089 100644 --- a/test/cypress/integration/vnComponent/VnLocation.spec.js +++ b/test/cypress/integration/vnComponent/VnLocation.spec.js @@ -40,7 +40,7 @@ describe('VnLocation', () => { cy.selectOption(countrySelector, country); cy.dataCy('locationProvince').type(`${province}{enter}`); cy.get( - `${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) ` + `${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) `, ).click(); cy.dataCy('locationProvince').should('have.value', province); }); @@ -87,9 +87,9 @@ describe('VnLocation', () => { .get(':nth-child(1)') .should('have.length.at.least', 2); cy.get( - firstOption.concat(' > .q-item__section > .q-item__label--caption') + firstOption.concat(' > .q-item__section > .q-item__label--caption'), ).should('have.text', postCodeLabel); - cy.get(firstOption).click(); + cy.getOption(); cy.get('.q-btn-group > .q-btn--standard > .q-btn__content > .q-icon').click(); cy.reload(); cy.waitForElement('.q-form'); @@ -103,7 +103,7 @@ describe('VnLocation', () => { cy.get('.q-card > h1').should('have.text', 'New postcode'); cy.selectOption( `${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`, - province + province, ); cy.get(dialogInputs).eq(0).clear(); cy.get(dialogInputs).eq(0).type(postCode); @@ -156,7 +156,7 @@ describe('VnLocation', () => { cy.get(createLocationButton).click(); cy.selectOption( `${createForm.prefix} > :nth-child(5) > :nth-child(3) `, - 'España' + 'España', ); cy.dataCy('Province_icon').click(); diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 4606ea56c..fab881620 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -362,12 +362,16 @@ Cypress.Commands.add('clickButtonWith', (type, value) => { Cypress.Commands.add('clickButtonWithIcon', (iconClass) => { cy.get(`.q-icon.${iconClass}`).parent().click(); }); + Cypress.Commands.add('clickButtonWithText', (buttonText) => { cy.get('.q-btn').contains(buttonText).click(); }); -Cypress.Commands.add('selectOptionBeta', (index = 1) => { + +Cypress.Commands.add('getOption', (index = 1) => { + cy.waitForElement('[role="listbox"]'); cy.get(`[role="listbox"] .q-item:nth-child(${index})`).click(); }); + Cypress.Commands.add('searchBtnFilterPanel', () => { cy.get( '.q-scrollarea__content > .q-btn--standard > .q-btn__content > .q-icon',