fix: refs #8618 update route descriptor to handle empty ticket records and adjust test cases #1478
|
@ -27,12 +27,16 @@ const getZone = async () => {
|
||||||
const filter = {
|
const filter = {
|
||||||
where: { routeFk: $props.id ? $props.id : route.params.id },
|
where: { routeFk: $props.id ? $props.id : route.params.id },
|
||||||
};
|
};
|
||||||
const { data } = await axios.get('Tickets/findOne', {
|
const { data } = await axios.get('Tickets/filter', {
|
||||||
jtubau marked this conversation as resolved
Outdated
|
|||||||
params: {
|
params: {
|
||||||
filter: JSON.stringify(filter),
|
filter: JSON.stringify(filter),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
zoneId.value = data.zoneFk;
|
|
||||||
|
if (!data.length) return;
|
||||||
jtubau marked this conversation as resolved
Outdated
jsegarra
commented
if (!data.length) return; if (!data.length) return;
|
|||||||
|
const firstRecord = data[0];
|
||||||
|
|
||||||
|
zoneId.value = firstRecord.zoneFk;
|
||||||
const { data: zoneData } = await axios.get(`Zones/${zoneId.value}`);
|
const { data: zoneData } = await axios.get(`Zones/${zoneId.value}`);
|
||||||
zone.value = zoneData.name;
|
zone.value = zoneData.name;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe.skip('Route extended list', () => {
|
describe('Route extended list', () => {
|
||||||
const getSelector = (colField) => `tr:last-child > [data-col-field="${colField}"]`;
|
const getSelector = (colField) => `tr:last-child > [data-col-field="${colField}"]`;
|
||||||
|
|
||||||
const selectors = {
|
const selectors = {
|
||||||
|
@ -32,18 +32,18 @@ describe.skip('Route extended list', () => {
|
||||||
|
|
||||||
const originalFields = [
|
const originalFields = [
|
||||||
{ selector: selectors.worker, type: 'select', value: 'logistic' },
|
{ selector: selectors.worker, type: 'select', value: 'logistic' },
|
||||||
{ selector: selectors.agency, type: 'select', value: 'Super-Man delivery' },
|
{ selector: selectors.agency, type: 'select', value: 'inhouse pickup' },
|
||||||
{ selector: selectors.vehicle, type: 'select', value: '3333-IMK' },
|
{ selector: selectors.vehicle, type: 'select', value: '3333-IMK' },
|
||||||
{ selector: selectors.date, type: 'date', value: '01/02/2024' },
|
{ selector: selectors.date, type: 'date', value: '01/01/2001' },
|
||||||
{ selector: selectors.description, type: 'input', value: 'Test route' },
|
{ selector: selectors.description, type: 'input', value: 'Test route' },
|
||||||
{ selector: selectors.served, type: 'checkbox', value: checkboxState.uncheck },
|
{ selector: selectors.served, type: 'checkbox', value: checkboxState.uncheck },
|
||||||
];
|
];
|
||||||
|
|
||||||
const updateFields = [
|
const updateFields = [
|
||||||
{ selector: selectors.worker, type: 'select', value: 'salesperson' },
|
{ selector: selectors.worker, type: 'select', value: 'salesperson' },
|
||||||
{ selector: selectors.agency, type: 'select', value: 'inhouse pickup' },
|
{ selector: selectors.agency, type: 'select', value: 'Super-Man delivery' },
|
||||||
{ selector: selectors.vehicle, type: 'select', value: '1111-IMK' },
|
{ selector: selectors.vehicle, type: 'select', value: '1111-IMK' },
|
||||||
{ selector: selectors.date, type: 'date', value: '01/01/2001' },
|
{ selector: selectors.date, type: 'date', value: '11/01/2001' },
|
||||||
{ selector: selectors.description, type: 'input', value: 'Description updated' },
|
{ selector: selectors.description, type: 'input', value: 'Description updated' },
|
||||||
{ selector: selectors.served, type: 'checkbox', value: checkboxState.check },
|
{ selector: selectors.served, type: 'checkbox', value: checkboxState.check },
|
||||||
];
|
];
|
||||||
|
@ -57,11 +57,11 @@ describe.skip('Route extended list', () => {
|
||||||
break;
|
break;
|
||||||
case 'input':
|
case 'input':
|
||||||
cy.get(selector).should('be.visible').click();
|
cy.get(selector).should('be.visible').click();
|
||||||
cy.dataCy('null_input').clear().type(`${value}{enter}`);
|
cy.dataCy('null_input').clear().type(`${value}`);
|
||||||
break;
|
break;
|
||||||
case 'date':
|
case 'date':
|
||||||
cy.get(selector).should('be.visible').click();
|
cy.get(selector).should('be.visible').click();
|
||||||
cy.dataCy('null_inputDate').clear().type(`${value}{enter}`);
|
cy.dataCy('null_inputDate').clear().type(`${value}`);
|
||||||
break;
|
break;
|
||||||
case 'checkbox':
|
case 'checkbox':
|
||||||
cy.get(selector).should('be.visible').click().click();
|
cy.get(selector).should('be.visible').click().click();
|
||||||
|
@ -76,15 +76,6 @@ describe.skip('Route extended list', () => {
|
||||||
cy.typeSearchbar('{enter}');
|
cy.typeSearchbar('{enter}');
|
||||||
});
|
});
|
||||||
|
|
||||||
after(() => {
|
|
||||||
cy.visit(url);
|
|
||||||
cy.typeSearchbar('{enter}');
|
|
||||||
cy.get(selectors.lastRowSelectCheckBox).click();
|
|
||||||
|
|
||||||
cy.get(selectors.removeBtn).click();
|
|
||||||
cy.dataCy(selectors.confirmBtn).click();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should list routes', () => {
|
it('Should list routes', () => {
|
||||||
cy.get('.q-table')
|
cy.get('.q-table')
|
||||||
.children()
|
.children()
|
||||||
|
@ -97,9 +88,9 @@ describe.skip('Route extended list', () => {
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
Worker: { val: 'logistic', type: 'select' },
|
Worker: { val: 'logistic', type: 'select' },
|
||||||
Agency: { val: 'Super-Man delivery', type: 'select' },
|
Agency: { val: 'inhouse pickup', type: 'select' },
|
||||||
Vehicle: { val: '3333-IMK', type: 'select' },
|
Vehicle: { val: '3333-IMK', type: 'select' },
|
||||||
Date: { val: '02-01-2024', type: 'date' },
|
Date: { val: '01-01-2001', type: 'date' },
|
||||||
From: { val: '01-01-2024', type: 'date' },
|
From: { val: '01-01-2024', type: 'date' },
|
||||||
To: { val: '10-01-2024', type: 'date' },
|
To: { val: '10-01-2024', type: 'date' },
|
||||||
'Km start': { val: 1000 },
|
'Km start': { val: 1000 },
|
||||||
|
@ -129,7 +120,7 @@ describe.skip('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{enter}');
|
cy.dataCy('route.Starting date_inputDate').type('10-05-2001').click();
|
||||||
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');
|
||||||
});
|
});
|
||||||
|
@ -142,10 +133,6 @@ describe.skip('Route extended list', () => {
|
||||||
|
|
||||||
const fileName = 'download.zip';
|
const fileName = 'download.zip';
|
||||||
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
|
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
|
||||||
|
|
||||||
cy.task('deleteFile', `${downloadsFolder}/${fileName}`).then((deleted) => {
|
|
||||||
expect(deleted).to.be.true;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
jtubau marked this conversation as resolved
Outdated
jsegarra
commented
esto lo comentó Juan o tu? esto lo comentó Juan o tu?
jtubau
commented
Esto lo comento Juan Esto lo comento Juan
jsegarra
commented
Okey, elimínalo de todas maneras porque el código ya se queda guardado en git Okey, elimínalo de todas maneras porque el código ya se queda guardado en git
jtubau
commented
Perdón, esto lo comenté yo porque Juan comentó la task del cypress.config.js Perdón, esto lo comenté yo porque Juan comentó la task del cypress.config.js
|
|||||||
it('Should mark as served the selected route', () => {
|
it('Should mark as served the selected route', () => {
|
||||||
|
@ -165,6 +152,13 @@ describe.skip('Route extended list', () => {
|
||||||
cy.checkNotification(dataSaved);
|
cy.checkNotification(dataSaved);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Should add ticket to route', () => {
|
||||||
|
cy.dataCy('tableAction-0').last().click();
|
||||||
|
cy.get(selectors.firstTicketsRowSelectCheckBox).click();
|
||||||
|
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
|
||||||
|
cy.checkNotification(dataSaved);
|
||||||
|
});
|
||||||
|
|
||||||
it('Should save changes in route', () => {
|
it('Should save changes in route', () => {
|
||||||
updateFields.forEach(({ selector, type, value }) => {
|
updateFields.forEach(({ selector, type, value }) => {
|
||||||
fillField(selector, type, value);
|
fillField(selector, type, value);
|
||||||
|
@ -175,18 +169,15 @@ describe.skip('Route extended list', () => {
|
||||||
|
|
||||||
cy.typeSearchbar('{enter}');
|
cy.typeSearchbar('{enter}');
|
||||||
|
|
||||||
updateFields.forEach(({ selector, value }) => {
|
updateFields.forEach(({ selector, value, type }) => {
|
||||||
|
if (type === 'date') {
|
||||||
|
const [month, day, year] = value.split('/');
|
||||||
|
value = `${day}/${month}/${year}`;
|
||||||
|
}
|
||||||
cy.validateContent(selector, value);
|
cy.validateContent(selector, value);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should add ticket to route', () => {
|
|
||||||
cy.dataCy('tableAction-0').last().click();
|
|
||||||
cy.get(selectors.firstTicketsRowSelectCheckBox).click();
|
|
||||||
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
|
|
||||||
cy.checkNotification(dataSaved);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should open summary pop-up when click summuary icon', () => {
|
it('Should open summary pop-up when click summuary icon', () => {
|
||||||
cy.dataCy('tableAction-1').last().click();
|
cy.dataCy('tableAction-1').last().click();
|
||||||
cy.get('.summaryHeader > :nth-child(2').should('contain', updateFields[4].value);
|
cy.get('.summaryHeader > :nth-child(2').should('contain', updateFields[4].value);
|
||||||
|
|
Loading…
Reference in New Issue
Yo lo simplificaria en data
Ya si después de comprobar si existe data o no, ya desestructuras
Ok, lo ajusto