test: refs #8626 addTestCases #1422

Merged
jtubau merged 40 commits from 8626-addTestCasesInRouteListTest into dev 2025-03-17 11:43:39 +00:00
7 changed files with 166 additions and 34 deletions
Showing only changes of commit 656f279301 - Show all commits

View File

@ -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') }}

View File

@ -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>

View File

@ -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>

View File

@ -11,7 +11,6 @@ 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 { viewSummary } = useSummaryDialog();
@ -46,6 +45,7 @@ const columns = computed(() => [
width: '25px',
},
{
align: 'left',
name: 'workerFk',
label: t('globals.worker'),
component: markRaw(VnSelectWorker),
@ -54,12 +54,6 @@ const columns = computed(() => [
columnFilter: false,
width: '100px',
},
{
name: 'workerFk',
label: t('globals.worker'),
visible: false,
cardVisible: true,
},
{
align: 'left',
name: 'agencyModeFk',
@ -199,7 +193,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
@ -208,7 +202,7 @@ const columns = computed(() => [
/>
</span>
</template>
<template #column-vehiclePlateNumber="{ row }">
<template #column-vehicleFk="{ row }">
<span class="link" @click.stop>
{{ row?.vehiclePlateNumber }}
<VehicleDescriptorProxy

View File

@ -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>

View File

@ -120,7 +120,7 @@ describe('Route extended list', () => {
it('Should clone selected route', () => {
cy.get(selectors.lastRowSelectCheckBox).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.validateContent(selectors.date, '05/10/2001');
});

View File

@ -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';
@ -14,49 +32,165 @@ describe('Route', () => {
cy.typeSearchbar('{enter}');
});
jtubau marked this conversation as resolved Outdated
Outdated
Review

Ya no se comprueba que edite?

Ya no se comprueba que edite?

no, routeList no puede editar, el que edita es routeExtendedList, copie el archivo si no recuerdo mal, por eso esta lo de editar (la línea 5 hacía el visit a extended-list)

no, routeList no puede editar, el que edita es routeExtendedList, copie el archivo si no recuerdo mal, por eso esta lo de editar (la línea 5 hacía el visit a extended-list)
it('Should list routes', () => {
xit('Should list routes', () => {
jtubau marked this conversation as resolved Outdated
Outdated
Review

Skips?

Skips?
cy.get('.q-table')
.children()
.should('be.visible')
.should('have.length.greaterThan', 0);
});
it('Should create new route', () => {
xit('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();
xit('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', () => {
xit('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.descriptorTitle)
.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);
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);
});
});
});
it('Should open the worker summary pop-up', () => {
cy.get(selectors.workerLink).click();
cy.get(':nth-child(1) > .value > span').should('contain', 'logistic');
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.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);
});
});
});
});