test: refs #8717 add integration test for agencyModes #1545

Merged
jtubau merged 27 commits from 8717-reviewAndFixAgencySection into dev 2025-04-01 05:19:07 +00:00
9 changed files with 48 additions and 22 deletions

View File

@ -55,6 +55,8 @@ const $props = defineProps({
}, },
}); });
const label = $props.showLabel && $props.column.label ? $props.column.label : '';
const defaultSelect = { const defaultSelect = {
attrs: { attrs: {
row: $props.row, row: $props.row,
@ -62,7 +64,7 @@ const defaultSelect = {
class: 'fit', class: 'fit',
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label,
}, },
}; };
@ -74,7 +76,7 @@ const defaultComponents = {
class: 'fit', class: 'fit',
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label,
}, },
}, },
number: { number: {
@ -84,7 +86,7 @@ const defaultComponents = {
class: 'fit', class: 'fit',
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label,
}, },
}, },
date: { date: {
@ -96,7 +98,7 @@ const defaultComponents = {
class: 'fit', class: 'fit',
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label,
}, },
}, },
time: { time: {
@ -105,7 +107,7 @@ const defaultComponents = {
disable: !$props.isEditable, disable: !$props.isEditable,
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label,
}, },
}, },
checkbox: { checkbox: {
@ -125,7 +127,7 @@ const defaultComponents = {
return defaultAttrs; return defaultAttrs;
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label,
autofocus: true, autofocus: true,
}, },
events: { events: {

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onBeforeMount, computed } from 'vue'; import { onBeforeMount, computed, markRaw } from 'vue';
import { useRoute, useRouter, onBeforeRouteUpdate, onBeforeRouteLeave } from 'vue-router'; import { useRoute, useRouter, onBeforeRouteUpdate, onBeforeRouteLeave } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
@ -37,7 +37,7 @@ onBeforeRouteLeave(() => {
}); });
onBeforeMount(async () => { onBeforeMount(async () => {
stateStore.cardDescriptorChangeValue(props.descriptor); stateStore.cardDescriptorChangeValue(markRaw(props.descriptor));
const route = router.currentRoute.value; const route = router.currentRoute.value;
try { try {

View File

@ -30,7 +30,7 @@ const $props = defineProps({
default: null, default: null,
}, },
toModule: { toModule: {
type: String, type: Object,
default: null, default: null,
}, },
}); });

View File

@ -3,5 +3,5 @@ import AgencyDescriptor from 'pages/Route/Agency/Card/AgencyDescriptor.vue';
import VnCard from 'src/components/common/VnCard.vue'; import VnCard from 'src/components/common/VnCard.vue';
</script> </script>
<template> <template>
<VnCard data-key="Agency" url="Agencies" :descriptor="AgencyDescriptor" /> <VnCard data-key="Agency" url="Agencies" :descriptor="AgencyDescriptor" :filter="{ where: { id: $route.params.id } }" />
</template> </template>

View File

@ -50,7 +50,7 @@ route:
agencyAgreement: Agency agreement agencyAgreement: Agency agreement
agencyModeName: Agency route agencyModeName: Agency route
isOwn: Own isOwn: Own
isAnyVolumeallowed: Any volume allowed isAnyVolumeAllowed: Any volume allowed
Worker: Worker Worker: Worker
Agency: Agency Agency: Agency
Vehicle: Vehicle Vehicle: Vehicle

View File

@ -238,6 +238,7 @@ export default {
title: 'list', title: 'list',
icon: 'view_list', icon: 'view_list',
}, },
component: () => import('src/pages/Route/RouteList.vue'),
}, },
routeCard, routeCard,
], ],
@ -286,6 +287,7 @@ export default {
title: 'list', title: 'list',
icon: 'view_list', icon: 'view_list',
}, },
component: () => import('src/pages/Route/RouteRoadmap.vue'),
}, },
roadmapCard, roadmapCard,
], ],
@ -316,6 +318,8 @@ export default {
title: 'list', title: 'list',
icon: 'view_list', icon: 'view_list',
}, },
component: () =>
import('src/pages/Route/Agency/AgencyList.vue'),
}, },
agencyCard, agencyCard,
], ],
@ -337,6 +341,8 @@ export default {
title: 'vehicleList', title: 'vehicleList',
icon: 'directions_car', icon: 'directions_car',
}, },
component: () =>
import('src/pages/Route/Vehicle/VehicleList.vue'),
}, },
vehicleCard, vehicleCard,
], ],

View File

@ -0,0 +1,15 @@
describe('Agency modes', () => {
const name = 'inhouse pickup';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/agency/1/modes`);
});
it('should display the agency modes page', () => {
cy.get('.flex > .title').should('have.text', name);
cy.get('.flex > .q-chip > .q-chip__content').should('have.text', 'ID: 1');
cy.get('.list-items > :nth-child(1) > .value').should('have.text', name);
});
});

View File

@ -49,12 +49,12 @@ describe.skip('RouteAutonomous', () => {
cy.get(selectors.firstRowCheckbox).click(); cy.get(selectors.firstRowCheckbox).click();
cy.get(selectors.createInvoiceBtn).click(); cy.get(selectors.createInvoiceBtn).click();
cy.dataCy(selectors.reference).type(data.reference); cy.dataCy(selectors.reference).type(data.reference);
cy.dataCy('attachFile').click();
cy.get('.q-file').selectFile('test/cypress/fixtures/image.jpg', { cy.get('.q-file').selectFile('test/cypress/fixtures/image.jpg', {
force: true, force: true,
}); });
cy.dataCy(selectors.saveFormBtn).click(); cy.dataCy(selectors.saveFormBtn).should('be.visible').click();
cy.checkNotification(dataSaved); cy.checkNotification(dataSaved);
cy.typeSearchbar('{enter}');
}); });
it('Should display the total price of the selected rows', () => { it('Should display the total price of the selected rows', () => {

View File

@ -53,17 +53,20 @@ describe('Route extended list', () => {
function fillField(selector, type, value) { function fillField(selector, type, value) {
switch (type) { switch (type) {
case 'select': case 'select':
cy.get(selector).should('be.visible').click(); cy.get(selector).should('be.visible').click().clear().type(value);
cy.dataCy('null_select').clear().type(value);
cy.get('.q-item').contains(value).click(); cy.get('.q-item').contains(value).click();
break; break;
case 'input': case 'input':
cy.get(selector).should('be.visible').click(); cy.get(selector)
cy.dataCy('null_input').clear().type(`${value}`); .should('be.visible')
.click()
.type(`{selectall}{backspace}${value}`);
break; break;
case 'date': case 'date':
cy.get(selector).should('be.visible').click(); cy.get(selector)
cy.dataCy('null_inputDate').clear().type(`${value}`); .should('be.visible')
.click()
.type(`{selectall}{backspace}${value}`);
break; break;
case 'checkbox': case 'checkbox':
cy.get(selector).should('be.visible').click().click(); cy.get(selector).should('be.visible').click().click();
@ -103,8 +106,8 @@ describe('Route extended list', () => {
cy.fillInForm(data); cy.fillInForm(data);
cy.dataCy(selectors.saveFormBtn).click(); cy.dataCy(selectors.saveFormBtn).click();
cy.checkNotification(dataCreated);
cy.url().should('include', '/summary'); cy.url().should('include', '/summary');
cy.checkNotification(dataCreated);
}); });
it('Should reset changed values when click reset button', () => { it('Should reset changed values when click reset button', () => {
@ -140,7 +143,7 @@ describe('Route extended list', () => {
const downloadsFolder = Cypress.config('downloadsFolder'); const downloadsFolder = Cypress.config('downloadsFolder');
cy.get(selectors.lastRowSelectCheckBox).click(); cy.get(selectors.lastRowSelectCheckBox).click();
cy.get(selectors.downloadBtn).click(); cy.get(selectors.downloadBtn).click();
cy.wait(5000); cy.wait(3000);
const fileName = 'download.zip'; const fileName = 'download.zip';
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist'); cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
@ -177,7 +180,7 @@ describe('Route extended list', () => {
const [month, day, year] = value.split('/'); const [month, day, year] = value.split('/');
value = `${day}/${month}/${year}`; value = `${day}/${month}/${year}`;
} }
cy.validateContent(selector, value); cy.get(selector).should('contain', value);
}); });
}); });