test: refs #8626 refactor routeList.spec.js to use selectors and improve readability
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jose Antonio Tubau 2025-02-20 10:30:32 +01:00
parent 4a8bc0c478
commit 073dadd7a2
1 changed files with 16 additions and 15 deletions

View File

@ -1,4 +1,10 @@
describe('Route', () => {
const selectors = {
worker: 'tr:last-child > [data-col-field="workerFk"]',
workerLink: 'tr:last-child > [data-col-field="workerFk"] > .no-padding > .link',
rowSummaryBtn: 'tableAction-0',
};
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
@ -26,34 +32,29 @@ describe('Route', () => {
cy.dataCy('FormModelPopup_save').should('be.visible').click();
cy.checkNotification('.q-notification__message', 'Data created');
cy.checkNotification('Data created');
cy.url().should('include', '/summary');
});
it('Should open summary by clicking a route', () => {
cy.get(':nth-child(1) > [data-col-field="vehicleFk"]')
.should('be.visible')
.click();
cy.get(selectors.worker).should('be.visible').click();
cy.url().should('include', '/summary');
});
it('Should open the route summary pop-up', () => {
cy.get(
':nth-child(1) > .q-table--col-auto-width > [data-cy="tableAction-0"] > .q-btn__content > .q-icon',
)
.should('be.visible')
.click();
cy.validateContent('.summaryHeader > :nth-child(2)', '1 - first route');
cy.dataCy(selectors.rowSummaryBtn).last().should('be.visible').click();
cy.get('.summaryHeader > :nth-child(2').should('contain', 'routeTest');
cy.validateContent(':nth-child(2) > :nth-child(3) > .value > span', '3333-BAT');
});
it('Should redirect to the summary from the route summary pop-up', () => {
cy.get(
':nth-child(1) > .q-table--col-auto-width > [data-cy="tableAction-0"] > .q-btn__content > .q-icon',
)
.should('be.visible')
.click();
cy.dataCy(selectors.rowSummaryBtn).last().should('be.visible').click();
cy.get('.header > .q-icon').should('be.visible').click();
cy.url().should('include', '/summary');
});
it('Should open the worker summary pop-up', () => {
cy.get(selectors.workerLink).click();
cy.validateContent(':nth-child(1) > .value > span', 'logistic');
});
});