This commit is contained in:
parent
bbaca64cc9
commit
8b9408d0fb
|
@ -1,11 +1,14 @@
|
|||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
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 axios from 'axios';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
|
|
@ -56,7 +56,7 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'agencyName',
|
||||
name: 'agencyModeFk',
|
||||
label: t('route.Agency'),
|
||||
cardVisible: true,
|
||||
component: 'select',
|
||||
|
@ -74,7 +74,7 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'vehiclePlateNumber',
|
||||
name: 'vehicleFk',
|
||||
label: t('route.Vehicle'),
|
||||
cardVisible: true,
|
||||
component: 'select',
|
||||
|
@ -155,6 +155,7 @@ const columns = computed(() => [
|
|||
<template #body>
|
||||
<VnTable
|
||||
:data-key
|
||||
ref="tableRef"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
redirect="route"
|
||||
|
@ -172,6 +173,16 @@ const columns = computed(() => [
|
|||
<WorkerDescriptorProxy :id="row?.workerFk" v-if="row?.workerFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-agencyModeFk="{ row }">
|
||||
<span>
|
||||
{{ row?.agencyName }}
|
||||
</span>
|
||||
</template>
|
||||
<template #column-vehicleFk="{ row }">
|
||||
<span>
|
||||
{{ row?.vehiclePlateNumber }}
|
||||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
</VnSection>
|
||||
|
|
|
@ -2,36 +2,60 @@ describe('Route', () => {
|
|||
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('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');
|
||||
});
|
||||
|
||||
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(':nth-child(1) > [data-col-field="vehicleFk"]')
|
||||
.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.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.get('.header > .q-icon').should('be.visible').click();
|
||||
cy.url().should('include', '/summary');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue