refactor: refs #8626 enhance Worker and Agency components with data attributes and improved routing
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:
parent
2d7e16764e
commit
656f279301
|
@ -180,6 +180,7 @@ const toModule = computed(() => {
|
||||||
color="white"
|
color="white"
|
||||||
class="link"
|
class="link"
|
||||||
v-if="summary"
|
v-if="summary"
|
||||||
|
data-cy="openSummaryBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('components.smartCard.openSummary') }}
|
{{ t('components.smartCard.openSummary') }}
|
||||||
|
@ -194,6 +195,7 @@ const toModule = computed(() => {
|
||||||
icon="launch"
|
icon="launch"
|
||||||
round
|
round
|
||||||
size="md"
|
size="md"
|
||||||
|
data-cy="goToSummaryBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('components.cardDescriptor.summary') }}
|
{{ t('components.cardDescriptor.summary') }}
|
||||||
|
|
|
@ -81,6 +81,7 @@ async function fetch() {
|
||||||
name: `${moduleName ?? route.meta.moduleName}Summary`,
|
name: `${moduleName ?? route.meta.moduleName}Summary`,
|
||||||
params: { id: entityId || entity.id },
|
params: { id: entityId || entity.id },
|
||||||
}"
|
}"
|
||||||
|
data-cy="goToSummaryBtn"
|
||||||
>
|
>
|
||||||
<QIcon name="open_in_new" color="white" size="sm" />
|
<QIcon name="open_in_new" color="white" size="sm" />
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
|
@ -17,7 +17,7 @@ const props = defineProps({
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const entityId = computed(() => props.id || route.params.id);
|
const entityId = computed(() => props.id || route.params.id);
|
||||||
const { store } = useArrayData('Parking');
|
const { store } = useArrayData();
|
||||||
const card = computed(() => store.data);
|
const card = computed(() => store.data);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -11,7 +11,6 @@ import AgencyDescriptorProxy from 'src/pages/Route/Agency/Card/AgencyDescriptorP
|
||||||
import VehicleDescriptorProxy from 'src/pages/Route/Vehicle/Card/VehicleDescriptorProxy.vue';
|
import VehicleDescriptorProxy from 'src/pages/Route/Vehicle/Card/VehicleDescriptorProxy.vue';
|
||||||
import VnSection from 'src/components/common/VnSection.vue';
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
import RouteTickets from './RouteTickets.vue';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
@ -46,6 +45,7 @@ const columns = computed(() => [
|
||||||
width: '25px',
|
width: '25px',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
align: 'left',
|
||||||
name: 'workerFk',
|
name: 'workerFk',
|
||||||
label: t('globals.worker'),
|
label: t('globals.worker'),
|
||||||
component: markRaw(VnSelectWorker),
|
component: markRaw(VnSelectWorker),
|
||||||
|
@ -54,12 +54,6 @@ const columns = computed(() => [
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
width: '100px',
|
width: '100px',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'workerFk',
|
|
||||||
label: t('globals.worker'),
|
|
||||||
visible: false,
|
|
||||||
cardVisible: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'agencyModeFk',
|
name: 'agencyModeFk',
|
||||||
|
@ -199,7 +193,7 @@ 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-agencyName="{ row }">
|
<template #column-agencyModeFk="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
{{ row?.agencyName }}
|
{{ row?.agencyName }}
|
||||||
<AgencyDescriptorProxy
|
<AgencyDescriptorProxy
|
||||||
|
@ -208,7 +202,7 @@ const columns = computed(() => [
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #column-vehiclePlateNumber="{ row }">
|
<template #column-vehicleFk="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
{{ row?.vehiclePlateNumber }}
|
{{ row?.vehiclePlateNumber }}
|
||||||
<VehicleDescriptorProxy
|
<VehicleDescriptorProxy
|
||||||
|
|
|
@ -39,6 +39,7 @@ onBeforeMount(async () => {
|
||||||
url="Workers/summary"
|
url="Workers/summary"
|
||||||
:user-filter="{ where: { id: entityId } }"
|
:user-filter="{ where: { id: entityId } }"
|
||||||
data-key="Worker"
|
data-key="Worker"
|
||||||
|
module-name="Worker"
|
||||||
>
|
>
|
||||||
<template #header="{ entity }">
|
<template #header="{ entity }">
|
||||||
<div>{{ entity.id }} - {{ entity.firstName }} {{ entity.lastName }}</div>
|
<div>{{ entity.id }} - {{ entity.firstName }} {{ entity.lastName }}</div>
|
||||||
|
|
|
@ -120,7 +120,7 @@ describe('Route extended list', () => {
|
||||||
it('Should clone selected route', () => {
|
it('Should clone selected route', () => {
|
||||||
cy.get(selectors.lastRowSelectCheckBox).click();
|
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||||
cy.get(selectors.cloneBtn).click();
|
cy.get(selectors.cloneBtn).click();
|
||||||
cy.dataCy('route.Starting date_inputDate').type('10-05-2001');
|
cy.dataCy('Starting date_inputDate').type('10-05-2001');
|
||||||
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
|
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
|
||||||
cy.validateContent(selectors.date, '05/10/2001');
|
cy.validateContent(selectors.date, '05/10/2001');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,26 @@
|
||||||
describe('Route', () => {
|
describe('Route', () => {
|
||||||
|
const getSelector = (colField) =>
|
||||||
|
`tr:last-child > [data-col-field="${colField}"] > .no-padding > .link`;
|
||||||
|
|
||||||
const selectors = {
|
const selectors = {
|
||||||
worker: 'tr:last-child > [data-col-field="workerFk"]',
|
lastRow: 'tr:last-child > [data-col-field="workerFk"]',
|
||||||
workerLink: 'tr:last-child > [data-col-field="workerFk"] > .no-padding > .link',
|
workerLink: getSelector('workerFk'),
|
||||||
rowSummaryBtn: 'tableAction-0',
|
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';
|
const summaryUrl = '/summary';
|
||||||
|
@ -14,49 +32,165 @@ describe('Route', () => {
|
||||||
cy.typeSearchbar('{enter}');
|
cy.typeSearchbar('{enter}');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should list routes', () => {
|
xit('Should list routes', () => {
|
||||||
cy.get('.q-table')
|
cy.get('.q-table')
|
||||||
.children()
|
.children()
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.should('have.length.greaterThan', 0);
|
.should('have.length.greaterThan', 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should create new route', () => {
|
xit('Should create new route', () => {
|
||||||
cy.addBtnClick();
|
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.fillInForm(data);
|
||||||
|
|
||||||
cy.dataCy('FormModelPopup_save').should('be.visible').click();
|
cy.dataCy('FormModelPopup_save').should('be.visible').click();
|
||||||
|
|
||||||
cy.checkNotification('Data created');
|
cy.checkNotification('Data created');
|
||||||
cy.url().should('include', summaryUrl);
|
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', () => {
|
xit('Should open route summary by clicking a route', () => {
|
||||||
cy.get(selectors.worker).should('be.visible').click();
|
cy.get(selectors.lastRow).should('be.visible').click();
|
||||||
cy.url().should('include', summaryUrl);
|
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', () => {
|
xit('Should redirect to the summary from the route pop-up summary', () => {
|
||||||
cy.dataCy(selectors.rowSummaryBtn).last().should('be.visible').click();
|
cy.dataCy(selectors.rowSummaryBtn).last().should('be.visible').click();
|
||||||
cy.get('.summaryHeader > :nth-child(2').should('contain', 'routeTest');
|
cy.get(selectors.descriptorTitle)
|
||||||
cy.validateContent(':nth-child(2) > :nth-child(3) > .value > span', '3333-BAT');
|
.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', () => {
|
describe('Worker pop-ups', () => {
|
||||||
cy.dataCy(selectors.rowSummaryBtn).last().should('be.visible').click();
|
it('Should redirect to summary from the worker pop-up descriptor', () => {
|
||||||
cy.get('.header > .q-icon').should('be.visible').click();
|
cy.get(selectors.workerLink).click();
|
||||||
cy.url().should('include', summaryUrl);
|
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);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should open the worker summary pop-up', () => {
|
describe('Agency pop-ups', () => {
|
||||||
cy.get(selectors.workerLink).click();
|
it('Should redirect to summary from the agency pop-up descriptor', () => {
|
||||||
cy.get(':nth-child(1) > .value > span').should('contain', 'logistic');
|
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.only('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