Merge branch '8626-addTestCasesInRouteListTest' into 8621-createCmrListE2eTest
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
commit
54bfd9f384
|
@ -180,6 +180,7 @@ const toModule = computed(() => {
|
|||
color="white"
|
||||
class="link"
|
||||
v-if="summary"
|
||||
data-cy="openSummaryBtn"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('components.smartCard.openSummary') }}
|
||||
|
@ -194,6 +195,7 @@ const toModule = computed(() => {
|
|||
icon="launch"
|
||||
round
|
||||
size="md"
|
||||
data-cy="goToSummaryBtn"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('components.cardDescriptor.summary') }}
|
||||
|
|
|
@ -81,6 +81,7 @@ async function fetch() {
|
|||
name: `${moduleName ?? route.meta.moduleName}Summary`,
|
||||
params: { id: entityId || entity.id },
|
||||
}"
|
||||
data-cy="goToSummaryBtn"
|
||||
>
|
||||
<QIcon name="open_in_new" color="white" size="sm" />
|
||||
</router-link>
|
||||
|
|
|
@ -17,7 +17,7 @@ const props = defineProps({
|
|||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const entityId = computed(() => props.id || route.params.id);
|
||||
const { store } = useArrayData('Parking');
|
||||
const { store } = useArrayData();
|
||||
const card = computed(() => store.data);
|
||||
</script>
|
||||
<template>
|
||||
|
|
|
@ -332,6 +332,7 @@ const openTicketsDialog = (id) => {
|
|||
<QBtn
|
||||
icon="vn:clone"
|
||||
color="primary"
|
||||
flat
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="confirmationDialog = true"
|
||||
|
@ -341,6 +342,7 @@ const openTicketsDialog = (id) => {
|
|||
<QBtn
|
||||
icon="cloud_download"
|
||||
color="primary"
|
||||
flat
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="showRouteReport"
|
||||
|
@ -352,6 +354,7 @@ const openTicketsDialog = (id) => {
|
|||
<QBtn
|
||||
icon="check"
|
||||
color="primary"
|
||||
flat
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="markAsServed()"
|
||||
|
|
|
@ -3,6 +3,7 @@ import { computed, ref, markRaw } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { toHour } from 'src/filters';
|
||||
import { useRouter } from 'vue-router';
|
||||
import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
|
||||
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
|
@ -11,9 +12,9 @@ import AgencyDescriptorProxy from 'src/pages/Route/Agency/Card/AgencyDescriptorP
|
|||
import VehicleDescriptorProxy from 'src/pages/Route/Vehicle/Card/VehicleDescriptorProxy.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||
import RouteTickets from './RouteTickets.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const tableRef = ref([]);
|
||||
const dataKey = 'RouteList';
|
||||
|
@ -29,8 +30,10 @@ const routeFilter = {
|
|||
};
|
||||
|
||||
function redirectToTickets(id) {
|
||||
const url = `#/route/${id}/tickets`;
|
||||
window.open(url, '_blank');
|
||||
router.push({
|
||||
name: 'RouteTickets',
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
const columns = computed(() => [
|
||||
|
@ -59,7 +62,7 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
name: 'agencyModeFk',
|
||||
label: t('globals.agency'),
|
||||
format: (row) => row?.agencyName,
|
||||
format: ({ agencyName }) => agencyName,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
|
@ -82,7 +85,7 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
name: 'vehicleFk',
|
||||
label: t('globals.vehicle'),
|
||||
format: (row) => row?.vehiclePlateNumber,
|
||||
format: ({ vehiclePlateNumber }) => vehiclePlateNumber,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
|
@ -194,7 +197,7 @@ const columns = computed(() => [
|
|||
<WorkerDescriptorProxy :id="row?.workerFk" v-if="row?.workerFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-agencyName="{ row }">
|
||||
<template #column-agencyModeFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row?.agencyName }}
|
||||
<AgencyDescriptorProxy
|
||||
|
@ -203,7 +206,7 @@ const columns = computed(() => [
|
|||
/>
|
||||
</span>
|
||||
</template>
|
||||
<template #column-vehiclePlateNumber="{ row }">
|
||||
<template #column-vehicleFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row?.vehiclePlateNumber }}
|
||||
<VehicleDescriptorProxy
|
||||
|
|
|
@ -39,6 +39,7 @@ onBeforeMount(async () => {
|
|||
url="Workers/summary"
|
||||
:user-filter="{ where: { id: entityId } }"
|
||||
data-key="Worker"
|
||||
module-name="Worker"
|
||||
>
|
||||
<template #header="{ entity }">
|
||||
<div>{{ entity.id }} - {{ entity.firstName }} {{ entity.lastName }}</div>
|
||||
|
|
|
@ -220,6 +220,7 @@ export default {
|
|||
path: '',
|
||||
name: 'RouteIndexMain',
|
||||
redirect: { name: 'RouteList' },
|
||||
component: () => import('src/pages/Route/RouteList.vue'),
|
||||
children: [
|
||||
{
|
||||
name: 'RouteList',
|
||||
|
@ -228,7 +229,6 @@ export default {
|
|||
title: 'list',
|
||||
icon: 'view_list',
|
||||
},
|
||||
component: () => import('src/pages/Route/RouteList.vue'),
|
||||
},
|
||||
routeCard,
|
||||
],
|
||||
|
@ -264,6 +264,7 @@ export default {
|
|||
path: 'roadmap',
|
||||
name: 'RouteRoadmap',
|
||||
redirect: { name: 'RoadmapList' },
|
||||
component: () => import('src/pages/Route/RouteRoadmap.vue'),
|
||||
meta: {
|
||||
title: 'RouteRoadmap',
|
||||
icon: 'vn:troncales',
|
||||
|
@ -276,7 +277,6 @@ export default {
|
|||
title: 'list',
|
||||
icon: 'view_list',
|
||||
},
|
||||
component: () => import('src/pages/Route/RouteRoadmap.vue'),
|
||||
},
|
||||
roadmapCard,
|
||||
],
|
||||
|
@ -294,6 +294,7 @@ export default {
|
|||
path: 'agency',
|
||||
name: 'RouteAgency',
|
||||
redirect: { name: 'AgencyList' },
|
||||
component: () => import('src/pages/Route/Agency/AgencyList.vue'),
|
||||
meta: {
|
||||
title: 'agency',
|
||||
icon: 'garage_home',
|
||||
|
@ -306,8 +307,6 @@ export default {
|
|||
title: 'list',
|
||||
icon: 'view_list',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/Route/Agency/AgencyList.vue'),
|
||||
},
|
||||
agencyCard,
|
||||
],
|
||||
|
@ -316,6 +315,7 @@ export default {
|
|||
path: 'vehicle',
|
||||
name: 'RouteVehicle',
|
||||
redirect: { name: 'VehicleList' },
|
||||
component: () => import('src/pages/Route/Vehicle/VehicleList.vue'),
|
||||
meta: {
|
||||
title: 'vehicle',
|
||||
icon: 'directions_car',
|
||||
|
@ -328,8 +328,6 @@ export default {
|
|||
title: 'vehicleList',
|
||||
icon: 'directions_car',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/Route/Vehicle/VehicleList.vue'),
|
||||
},
|
||||
vehicleCard,
|
||||
],
|
||||
|
|
|
@ -1,8 +1,26 @@
|
|||
describe('Route', () => {
|
||||
const getSelector = (colField) =>
|
||||
`tr:last-child > [data-col-field="${colField}"] > .no-padding > .link`;
|
||||
|
||||
const selectors = {
|
||||
worker: 'tr:last-child > [data-col-field="workerFk"]',
|
||||
workerLink: 'tr:last-child > [data-col-field="workerFk"] > .no-padding > .link',
|
||||
rowSummaryBtn: 'tableAction-0',
|
||||
lastRow: 'tr:last-child > [data-col-field="workerFk"]',
|
||||
workerLink: getSelector('workerFk'),
|
||||
agencyLink: getSelector('agencyModeFk'),
|
||||
vehicleLink: getSelector('vehicleFk'),
|
||||
assignedTicketsBtn: 'tableAction-0',
|
||||
rowSummaryBtn: 'tableAction-1',
|
||||
summaryTitle: '.summaryHeader',
|
||||
descriptorTitle: '.descriptor .title',
|
||||
descriptorOpenSummaryBtn: '.descriptor [data-cy="openSummaryBtn"]',
|
||||
descriptorGoToSummaryBtn: '.descriptor [data-cy="goToSummaryBtn"]',
|
||||
SummaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
|
||||
};
|
||||
|
||||
const data = {
|
||||
Worker: { val: 'logistic', type: 'select' },
|
||||
Agency: { val: 'Walking', type: 'select' },
|
||||
Vehicle: { val: '3333-BAT', type: 'select' },
|
||||
Description: { val: 'routeTest' },
|
||||
};
|
||||
|
||||
const summaryUrl = '/summary';
|
||||
|
@ -24,39 +42,164 @@ describe('Route', () => {
|
|||
it('Should create new route', () => {
|
||||
cy.addBtnClick();
|
||||
|
||||
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);
|
||||
cy.get(selectors.summaryTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Description.val);
|
||||
});
|
||||
});
|
||||
|
||||
it('Should open summary by clicking a route', () => {
|
||||
cy.get(selectors.worker).should('be.visible').click();
|
||||
it('Should open route summary by clicking a route', () => {
|
||||
cy.get(selectors.lastRow).should('be.visible').click();
|
||||
cy.url().should('include', summaryUrl);
|
||||
cy.get(selectors.summaryTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Description.val);
|
||||
});
|
||||
});
|
||||
|
||||
it('Should open the route summary pop-up', () => {
|
||||
it('Should redirect to the summary from the route pop-up summary', () => {
|
||||
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');
|
||||
cy.get(selectors.summaryTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Description.val);
|
||||
});
|
||||
cy.get(selectors.SummaryGoToSummaryBtn).click();
|
||||
cy.get(selectors.summaryTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Description.val);
|
||||
});
|
||||
});
|
||||
|
||||
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 redirect to the route assigned tickets from the row assignedTicketsBtn', () => {
|
||||
cy.dataCy(selectors.assignedTicketsBtn).first().should('be.visible').click();
|
||||
cy.url().should('include', '1/tickets');
|
||||
cy.get('.q-table')
|
||||
.children()
|
||||
.should('be.visible')
|
||||
.should('have.length.greaterThan', 0);
|
||||
});
|
||||
|
||||
it('Should open the worker summary pop-up', () => {
|
||||
cy.get(selectors.workerLink).click();
|
||||
cy.get(':nth-child(1) > .value > span').should('contain', 'logistic');
|
||||
describe('Worker pop-ups', () => {
|
||||
it('Should redirect to summary from the worker pop-up descriptor', () => {
|
||||
cy.get(selectors.workerLink).click();
|
||||
cy.get(selectors.descriptorTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Worker.val);
|
||||
});
|
||||
cy.get(selectors.descriptorGoToSummaryBtn).click();
|
||||
cy.get(selectors.summaryTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Worker.val);
|
||||
});
|
||||
});
|
||||
|
||||
it('Should redirect to the summary from the worker pop-up summary', () => {
|
||||
cy.get(selectors.workerLink).click();
|
||||
cy.get(selectors.descriptorTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Worker.val);
|
||||
});
|
||||
cy.get(selectors.descriptorOpenSummaryBtn).click();
|
||||
cy.get(selectors.summaryTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Worker.val);
|
||||
});
|
||||
cy.get(selectors.SummaryGoToSummaryBtn).click();
|
||||
cy.get(selectors.summaryTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Worker.val);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Agency pop-ups', () => {
|
||||
it('Should redirect to summary from the agency pop-up descriptor', () => {
|
||||
cy.get(selectors.agencyLink).click();
|
||||
cy.get(selectors.descriptorTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Agency.val);
|
||||
});
|
||||
cy.get(selectors.descriptorGoToSummaryBtn).click();
|
||||
cy.get(selectors.summaryTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Agency.val);
|
||||
});
|
||||
});
|
||||
|
||||
it('Should redirect to the summary from the agency pop-up summary', () => {
|
||||
cy.get(selectors.agencyLink).click();
|
||||
cy.get(selectors.descriptorTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Agency.val);
|
||||
});
|
||||
cy.get(selectors.descriptorOpenSummaryBtn).click();
|
||||
cy.get(selectors.summaryTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Agency.val);
|
||||
});
|
||||
cy.get(selectors.SummaryGoToSummaryBtn).click();
|
||||
cy.get(selectors.summaryTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Agency.val);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Vehicle pop-ups', () => {
|
||||
it('Should redirect to summary from the vehicle pop-up descriptor', () => {
|
||||
cy.get(selectors.vehicleLink).click();
|
||||
cy.get(selectors.descriptorTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Vehicle.val);
|
||||
});
|
||||
cy.get(selectors.descriptorGoToSummaryBtn).click();
|
||||
cy.get(selectors.summaryTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Vehicle.val);
|
||||
});
|
||||
});
|
||||
|
||||
it('Should redirect to the summary from the vehicle pop-up summary', () => {
|
||||
cy.get(selectors.vehicleLink).click();
|
||||
cy.get(selectors.descriptorTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Vehicle.val);
|
||||
});
|
||||
cy.get(selectors.descriptorOpenSummaryBtn).click();
|
||||
cy.get(selectors.summaryTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Vehicle.val);
|
||||
});
|
||||
cy.get(selectors.SummaryGoToSummaryBtn).click();
|
||||
cy.get(selectors.summaryTitle)
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.include(data.Vehicle.val);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue