This commit is contained in:
parent
bbaca64cc9
commit
8b9408d0fb
|
@ -1,11 +1,14 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import { ref, computed, onMounted } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
|
import useCardDescription from 'composables/useCardDescription';
|
||||||
import VnLv from 'components/ui/VnLv.vue';
|
import VnLv from 'components/ui/VnLv.vue';
|
||||||
import { dashIfEmpty, toDate } from 'src/filters';
|
import { dashIfEmpty, toDate } from 'src/filters';
|
||||||
import RouteDescriptorMenu from 'pages/Route/Card/RouteDescriptorMenu.vue';
|
import RouteDescriptorMenu from 'pages/Route/Card/RouteDescriptorMenu.vue';
|
||||||
import filter from './RouteFilter.js';
|
import filter from './RouteFilter.js';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
|
|
@ -56,7 +56,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'agencyName',
|
name: 'agencyModeFk',
|
||||||
label: t('route.Agency'),
|
label: t('route.Agency'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
component: 'select',
|
component: 'select',
|
||||||
|
@ -74,7 +74,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'vehiclePlateNumber',
|
name: 'vehicleFk',
|
||||||
label: t('route.Vehicle'),
|
label: t('route.Vehicle'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
component: 'select',
|
component: 'select',
|
||||||
|
@ -155,6 +155,7 @@ const columns = computed(() => [
|
||||||
<template #body>
|
<template #body>
|
||||||
<VnTable
|
<VnTable
|
||||||
:data-key
|
:data-key
|
||||||
|
ref="tableRef"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
redirect="route"
|
redirect="route"
|
||||||
|
@ -172,6 +173,16 @@ const columns = computed(() => [
|
||||||
<WorkerDescriptorProxy :id="row?.workerFk" v-if="row?.workerFk" />
|
<WorkerDescriptorProxy :id="row?.workerFk" v-if="row?.workerFk" />
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template #column-agencyModeFk="{ row }">
|
||||||
|
<span>
|
||||||
|
{{ row?.agencyName }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<template #column-vehicleFk="{ row }">
|
||||||
|
<span>
|
||||||
|
{{ row?.vehiclePlateNumber }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
</VnSection>
|
</VnSection>
|
||||||
|
|
|
@ -2,36 +2,60 @@ describe('Route', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.login('developer');
|
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.addBtnClick();
|
||||||
cy.get('input[name="description"]').type('routeTestOne{enter}');
|
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data created');
|
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.get('.q-notification__message')
|
||||||
|
.should('be.visible')
|
||||||
|
.should('have.text', 'Data created');
|
||||||
cy.url().should('include', '/summary');
|
cy.url().should('include', '/summary');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Route list search and edit', () => {
|
it('Should open summary by clicking a route', () => {
|
||||||
cy.get('#searchbar input').type('{enter}');
|
cy.get(':nth-child(1) > [data-col-field="vehicleFk"]')
|
||||||
cy.get('[data-col-field="description"][data-row-index="0"]')
|
.should('be.visible')
|
||||||
.click()
|
.click();
|
||||||
.type('routeTestOne{enter}');
|
cy.url().should('include', '/summary');
|
||||||
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()
|
it('Should open the route summary pop-up', () => {
|
||||||
.type('{downArrow}{enter}');
|
cy.get(
|
||||||
cy.get('[data-col-field="agencyModeFk"][data-row-index="0"]')
|
':nth-child(1) > .q-table--col-auto-width > [data-cy="tableAction-0"] > .q-btn__content > .q-icon',
|
||||||
.click()
|
)
|
||||||
.type('{downArrow}{enter}');
|
.should('be.visible')
|
||||||
cy.get('[data-col-field="vehicleFk"][data-row-index="0"]')
|
.click();
|
||||||
.click()
|
cy.validateContent('.summaryHeader > :nth-child(2)', '1 - first route');
|
||||||
.type('{downArrow}{enter}');
|
cy.validateContent(':nth-child(2) > :nth-child(3) > .value > span', '3333-BAT');
|
||||||
cy.get('button[title="Save"]').click();
|
});
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
|
||||||
|
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.get('.header > .q-icon').should('be.visible').click();
|
||||||
|
cy.url().should('include', '/summary');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue