diff --git a/src/pages/Route/Card/RouteDescriptor.vue b/src/pages/Route/Card/RouteDescriptor.vue index 01fb9c4ba..c57e51473 100644 --- a/src/pages/Route/Card/RouteDescriptor.vue +++ b/src/pages/Route/Card/RouteDescriptor.vue @@ -2,11 +2,11 @@ import { ref, computed, onMounted } from 'vue'; import { useRoute } from 'vue-router'; import CardDescriptor from 'components/ui/CardDescriptor.vue'; +import useCardDescription from 'composables/useCardDescription'; import VnLv from 'components/ui/VnLv.vue'; import { dashIfEmpty, toDate } from 'src/filters'; import RouteDescriptorMenu from 'pages/Route/Card/RouteDescriptorMenu.vue'; import filter from './RouteFilter.js'; -import useCardDescription from 'src/composables/useCardDescription'; import axios from 'axios'; const $props = defineProps({ diff --git a/src/pages/Route/RouteList.vue b/src/pages/Route/RouteList.vue index 8e674c7d7..b99cb8227 100644 --- a/src/pages/Route/RouteList.vue +++ b/src/pages/Route/RouteList.vue @@ -160,7 +160,6 @@ const columns = computed(() => [ :data-key ref="tableRef" :columns="columns" - ref="tableRef" :right-search="false" redirect="route" :create="{ @@ -180,4 +179,4 @@ const columns = computed(() => [ - \ No newline at end of file + diff --git a/test/cypress/integration/route/routeExtendedList.spec.js b/test/cypress/integration/route/routeExtendedList.spec.js index 5fda93b25..237729107 100644 --- a/test/cypress/integration/route/routeExtendedList.spec.js +++ b/test/cypress/integration/route/routeExtendedList.spec.js @@ -1,4 +1,4 @@ -describe.skip('Route extended list', () => { +describe('Route extended list', () => { const getSelector = (colField) => `tr:last-child > [data-col-field="${colField}"]`; const selectors = { @@ -120,7 +120,7 @@ describe.skip('Route extended list', () => { it('Should clone selected route', () => { cy.get(selectors.lastRowSelectCheckBox).click(); cy.get(selectors.cloneBtn).click(); - cy.dataCy('route.Starting date_inputDate').type('10-05-2001').click(); + cy.dataCy('route.Starting date_inputDate').type('10-05-2001'); cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click(); cy.validateContent(selectors.date, '05/10/2001'); }); @@ -153,7 +153,7 @@ describe.skip('Route extended list', () => { }); it('Should add ticket to route', () => { - cy.dataCy('tableAction-0').last().click(); + cy.dataCy('tableAction-0').first().click(); cy.get(selectors.firstTicketsRowSelectCheckBox).click(); cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click(); cy.checkNotification(dataSaved); diff --git a/test/cypress/integration/route/routeList.spec.js b/test/cypress/integration/route/routeList.spec.js index 04278cfc5..2471fc5c7 100644 --- a/test/cypress/integration/route/routeList.spec.js +++ b/test/cypress/integration/route/routeList.spec.js @@ -1,37 +1,62 @@ 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', + }; + + const summaryUrl = '/summary'; + beforeEach(() => { cy.viewport(1920, 1080); cy.login('developer'); - cy.visit(`/#/route/extended-list`); + cy.visit(`/#/route/list`); + cy.typeSearchbar('{enter}'); }); - it('Route list create route', () => { + it('Should list routes', () => { + cy.get('.q-table') + .children() + .should('be.visible') + .should('have.length.greaterThan', 0); + }); + + it('Should create new route', () => { cy.addBtnClick(); - cy.get('.q-card input[name="description"]').type('routeTestOne{enter}'); - cy.get('.q-notification__message').should('have.text', 'Data created'); - cy.url().should('include', '/summary'); + + const data = { + Worker: { val: 'logistic', type: 'select' }, + Agency: { val: 'Walking', type: 'select' }, + Vehicle: { val: '3333-BAT', type: 'select' }, + Description: { val: 'routeTest' }, + }; + cy.fillInForm(data); + + cy.dataCy('FormModelPopup_save').should('be.visible').click(); + + cy.checkNotification('Data created'); + cy.url().should('include', summaryUrl); }); - it('Route list search and edit', () => { - cy.get('#searchbar input').type('{enter}'); - cy.get('[data-col-field="description"][data-row-index="0"]') - .click() - .type('routeTestOne{enter}'); - cy.get('.q-table tr') - .its('length') - .then((rowCount) => { - expect(rowCount).to.be.greaterThan(0); - }); - cy.get('[data-col-field="workerFk"][data-row-index="0"]') - .click() - .type('{downArrow}{enter}'); - cy.get('[data-col-field="agencyModeFk"][data-row-index="0"]') - .click() - .type('{downArrow}{enter}'); - cy.get('[data-col-field="vehicleFk"][data-row-index="0"]') - .click() - .type('{downArrow}{enter}'); - cy.get('button[title="Save"]').click(); - cy.get('.q-notification__message').should('have.text', 'Data saved'); + it('Should open summary by clicking a route', () => { + cy.get(selectors.worker).should('be.visible').click(); + cy.url().should('include', summaryUrl); + }); + + it('Should open the route summary pop-up', () => { + 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.dataCy(selectors.rowSummaryBtn).last().should('be.visible').click(); + cy.get('.header > .q-icon').should('be.visible').click(); + cy.url().should('include', summaryUrl); + }); + + it('Should open the worker summary pop-up', () => { + cy.get(selectors.workerLink).click(); + cy.get(':nth-child(1) > .value > span').should('contain', 'logistic'); }); });