From 46bb1d86db8dc5bf2177c94f93b7771fc6ccd86f Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 13 Oct 2023 09:04:14 +0200 Subject: [PATCH] refs #5673 test(claimDevelopment): e2e --- test/cypress/integration/claimDevelopment.spec.js | 13 +++++++------ test/cypress/support/commands.js | 12 ++---------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/test/cypress/integration/claimDevelopment.spec.js b/test/cypress/integration/claimDevelopment.spec.js index 4ab4ee981..88ccbfab8 100755 --- a/test/cypress/integration/claimDevelopment.spec.js +++ b/test/cypress/integration/claimDevelopment.spec.js @@ -13,16 +13,17 @@ describe('ClaimDevelopment', () => { it('should reset line', () => { cy.selectOption(firstLineReason, 'Novato'); cy.resetCard(); - cy.getValue(firstLineReason).should('have.text', 'Prisas'); + cy.getValue(firstLineReason).should('have.value', 'Prisas'); }); it('should edit line', () => { cy.selectOption(firstLineReason, 'Novato'); - cy.saveCard(); + cy.saveCard(); cy.login('developer'); cy.visit(`/#/claim/${claimId}/development`); - cy.getValue(firstLineReason).should('have.text', 'Novato'); + + cy.getValue(firstLineReason).should('have.value', 'Novato'); //Restart data cy.selectOption(firstLineReason, 'Prisas'); @@ -30,16 +31,16 @@ describe('ClaimDevelopment', () => { }); it('should add and remove new line', () => { - cy.login('developer'); - cy.visit(`/#/claim/${claimId}/development`); - //add row cy.addCard(); cy.get(thirdRow).should('exist'); const rowData = [false, 'Novato', 'Roces', 'Compradores', 'employeeNick', 'Tour']; cy.fillRow(thirdRow, rowData); + + cy.saveCard(); cy.login('developer'); cy.visit(`/#/claim/${claimId}/development`); + cy.validateRow(thirdRow, rowData); cy.reload(); diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 725aa0669..a725837a1 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -52,16 +52,9 @@ Cypress.Commands.add('getValue', (selector) => { } // Si es un QSelect else if ($el.find('.q-select__dropdown-icon').length) { - cy.log( - selector, - cy.get( - selector + - '> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native' - ) - ); return cy.get( selector + - '> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > span' + '> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input' ); } else { // Puedes aƱadir un log o lanzar un error si el elemento no es reconocido @@ -83,7 +76,6 @@ Cypress.Commands.add('checkOption', (selector) => { // Global buttons Cypress.Commands.add('saveCard', () => { cy.get('[title="Save"]').click(); - cy.get('[title="Save"]').should('have.class', 'disabled'); }); Cypress.Commands.add('resetCard', () => { cy.get('[title="Reset"]').click(); @@ -130,7 +122,7 @@ Cypress.Commands.add('validateRow', (rowSelector, expectedValues) => { cy.getValue(`:nth-child(${index + 1})`).should(`${prefix}be.checked`); continue; } - cy.getValue(`:nth-child(${index + 1})`).should('have.text', value); + cy.getValue(`:nth-child(${index + 1})`).should('have.value', value); } }); });