0
0
Fork 0

refs #5673 test(claimDevelopment): e2e

This commit is contained in:
Alex Moreno 2023-10-13 09:04:14 +02:00
parent ff347db37a
commit 46bb1d86db
2 changed files with 9 additions and 16 deletions

View File

@ -13,16 +13,17 @@ describe('ClaimDevelopment', () => {
it('should reset line', () => { it('should reset line', () => {
cy.selectOption(firstLineReason, 'Novato'); cy.selectOption(firstLineReason, 'Novato');
cy.resetCard(); cy.resetCard();
cy.getValue(firstLineReason).should('have.text', 'Prisas'); cy.getValue(firstLineReason).should('have.value', 'Prisas');
}); });
it('should edit line', () => { it('should edit line', () => {
cy.selectOption(firstLineReason, 'Novato'); cy.selectOption(firstLineReason, 'Novato');
cy.saveCard();
cy.saveCard();
cy.login('developer'); cy.login('developer');
cy.visit(`/#/claim/${claimId}/development`); cy.visit(`/#/claim/${claimId}/development`);
cy.getValue(firstLineReason).should('have.text', 'Novato');
cy.getValue(firstLineReason).should('have.value', 'Novato');
//Restart data //Restart data
cy.selectOption(firstLineReason, 'Prisas'); cy.selectOption(firstLineReason, 'Prisas');
@ -30,16 +31,16 @@ describe('ClaimDevelopment', () => {
}); });
it('should add and remove new line', () => { it('should add and remove new line', () => {
cy.login('developer');
cy.visit(`/#/claim/${claimId}/development`);
//add row
cy.addCard(); cy.addCard();
cy.get(thirdRow).should('exist'); cy.get(thirdRow).should('exist');
const rowData = [false, 'Novato', 'Roces', 'Compradores', 'employeeNick', 'Tour']; const rowData = [false, 'Novato', 'Roces', 'Compradores', 'employeeNick', 'Tour'];
cy.fillRow(thirdRow, rowData); cy.fillRow(thirdRow, rowData);
cy.saveCard();
cy.login('developer'); cy.login('developer');
cy.visit(`/#/claim/${claimId}/development`); cy.visit(`/#/claim/${claimId}/development`);
cy.validateRow(thirdRow, rowData); cy.validateRow(thirdRow, rowData);
cy.reload(); cy.reload();

View File

@ -52,16 +52,9 @@ Cypress.Commands.add('getValue', (selector) => {
} }
// Si es un QSelect // Si es un QSelect
else if ($el.find('.q-select__dropdown-icon').length) { 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( return cy.get(
selector + 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 { } else {
// Puedes añadir un log o lanzar un error si el elemento no es reconocido // 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 // Global buttons
Cypress.Commands.add('saveCard', () => { Cypress.Commands.add('saveCard', () => {
cy.get('[title="Save"]').click(); cy.get('[title="Save"]').click();
cy.get('[title="Save"]').should('have.class', 'disabled');
}); });
Cypress.Commands.add('resetCard', () => { Cypress.Commands.add('resetCard', () => {
cy.get('[title="Reset"]').click(); 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`); cy.getValue(`:nth-child(${index + 1})`).should(`${prefix}be.checked`);
continue; continue;
} }
cy.getValue(`:nth-child(${index + 1})`).should('have.text', value); cy.getValue(`:nth-child(${index + 1})`).should('have.value', value);
} }
}); });
}); });