diff --git a/test/cypress/integration/route/routeList.spec.js b/test/cypress/integration/route/routeList.spec.js index ad1a56fd3..8eed1275c 100644 --- a/test/cypress/integration/route/routeList.spec.js +++ b/test/cypress/integration/route/routeList.spec.js @@ -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'); + }); });