#8442 - createVehicleDms #1614

Merged
jtubau merged 47 commits from 8422-createVehicleDms into dev 2025-04-16 14:20:24 +00:00
7 changed files with 110 additions and 115 deletions
Showing only changes of commit 9a0211787a - Show all commits

View File

@ -93,7 +93,7 @@ async function save() {
delete dms.value.files;
return response;
} catch (e) {
throw new Error(e.message);
throw e;
jtubau marked this conversation as resolved Outdated

No puedes usar throw e y ya está?

No puedes usar throw e y ya está?
}
}

View File

@ -267,7 +267,7 @@ function deleteDms(dmsFk) {
rows.value.splice(index, 1);
notify(t('globals.dataDeleted'), 'positive');
} catch (e) {
throw new Error(e.message);
throw e;
jtubau marked this conversation as resolved Outdated

throw e?

throw e?
}
});
}

View File

@ -33,7 +33,7 @@ const importDms = async () => {
dmsId.value = null;
jtubau marked this conversation as resolved
Review

Revisar si se muestra el el error al usuario

Revisar si se muestra el el error al usuario
emit('onDataSaved');
} catch (e) {
throw new Error(e.message);
throw e;
jtubau marked this conversation as resolved Outdated

throw e?

throw e?
}
};
</script>

View File

@ -34,7 +34,7 @@ const importDms = async () => {
dmsId.value = null;
emit('onDataSaved');
} catch (e) {
throw new Error(e.message);
throw e;
}
};
</script>

View File

@ -73,139 +73,102 @@ describe('RouteAutonomous', () => {
});
it('Should redirect to the summary when clicking a route', () => {
cy.get(selectors.routeId)
.click()
.invoke('text')
.then((routeId) => {
routeId = routeId.trim();
cy.url().should('match', urls.summaryRouteUrlRegex);
cy.containContent(selectors.descriptorRouteSubtitle, routeId);
});
cy.checkRedirectionFromPopUp({
selectorToClick: selectors.routeId,
expectedUrlRegex: urls.summaryRouteUrlRegex,
expectedTextSelector: selectors.descriptorRouteSubtitle,
});
});
describe('Agency route pop-ups', () => {
it('Should redirect to the agency route summary from the agency route descriptor pop-up', () => {
cy.get(selectors.agencyRoute)
.click()
.invoke('text')
.then((agencyName) => {
agencyName = agencyName.trim();
cy.get(selectors.descriptorGoToSummaryBtn).click();
cy.url().should('match', urls.summaryAgencyUrlRegex);
cy.containContent(
selectors.descriptorAgencyAndSupplierTitle,
agencyName,
);
});
cy.checkRedirectionFromPopUp({
selectorToClick: selectors.agencyRoute,
jtubau marked this conversation as resolved Outdated

Veo mucha duplicidad en los tests de los popups, crea una fn que puedas reutilizar

Veo mucha duplicidad en los tests de los popups, crea una fn que puedas reutilizar
steps: [selectors.descriptorGoToSummaryBtn],
expectedUrlRegex: urls.summaryAgencyUrlRegex,
expectedTextSelector: selectors.descriptorAgencyAndSupplierTitle,
});
});
it('Should redirect to the agency route summary from summary pop-up from the agency route descriptor pop-up', () => {
cy.get(selectors.agencyRoute)
.click()
.invoke('text')
.then((agencyName) => {
agencyName = agencyName.trim();
cy.get(selectors.descriptorOpenSummaryBtn).click();
cy.get(selectors.summaryGoToSummaryBtn).click();
cy.url().should('match', urls.summaryAgencyUrlRegex);
cy.containContent(
selectors.descriptorAgencyAndSupplierTitle,
agencyName,
);
});
cy.checkRedirectionFromPopUp({
selectorToClick: selectors.agencyRoute,
steps: [
selectors.descriptorOpenSummaryBtn,
selectors.summaryGoToSummaryBtn,
],
expectedUrlRegex: urls.summaryAgencyUrlRegex,
expectedTextSelector: selectors.descriptorAgencyAndSupplierTitle,
});
});
});
describe('Agency route pop-ups', () => {
it('Should redirect to the agency agreement summary from the agency agreement descriptor pop-up', () => {
cy.get(selectors.agencyAgreement)
.click()
.invoke('text')
.then((agencyName) => {
agencyName = agencyName.trim();
cy.get(selectors.descriptorGoToSummaryBtn).click();
cy.url().should('match', urls.summaryAgencyUrlRegex);
cy.containContent(
selectors.descriptorAgencyAndSupplierTitle,
agencyName,
);
});
cy.checkRedirectionFromPopUp({
selectorToClick: selectors.agencyAgreement,
steps: [selectors.descriptorGoToSummaryBtn],
expectedUrlRegex: urls.summaryAgencyUrlRegex,
expectedTextSelector: selectors.descriptorAgencyAndSupplierTitle,
});
});
it('Should redirect to the agency agreement summary from summary pop-up from the agency agreement descriptor pop-up', () => {
cy.get(selectors.agencyAgreement)
.click()
.invoke('text')
.then((agencyName) => {
agencyName = agencyName.trim();
cy.get(selectors.descriptorOpenSummaryBtn).click();
cy.get(selectors.summaryGoToSummaryBtn).click();
cy.url().should('match', urls.summaryAgencyUrlRegex);
cy.containContent(
selectors.descriptorAgencyAndSupplierTitle,
agencyName,
);
});
cy.checkRedirectionFromPopUp({
selectorToClick: selectors.agencyAgreement,
steps: [
selectors.descriptorOpenSummaryBtn,
selectors.summaryGoToSummaryBtn,
],
expectedUrlRegex: urls.summaryAgencyUrlRegex,
expectedTextSelector: selectors.descriptorAgencyAndSupplierTitle,
});
});
});
describe('Received pop-ups', () => {
it('Should redirect to the invoice in summary from the received descriptor pop-up', () => {
cy.get(selectors.received)
.click()
.invoke('text')
.then((invoice) => {
invoice = invoice.trim();
cy.get(selectors.descriptorGoToSummaryBtn).click();
cy.url().should('match', urls.summaryInvoiceInUrlRegex);
cy.containContent(selectors.descriptorInvoiceInTitle, invoice);
});
cy.checkRedirectionFromPopUp({
selectorToClick: selectors.received,
steps: [selectors.descriptorGoToSummaryBtn],
expectedUrlRegex: urls.summaryInvoiceInUrlRegex,
expectedTextSelector: selectors.descriptorInvoiceInTitle,
});
});
it('Should redirect to the invoiceIn summary from summary pop-up from the received descriptor pop-up', () => {
cy.get(selectors.received)
.click()
.invoke('text')
.then((invoice) => {
invoice = invoice.trim();
cy.get(selectors.descriptorOpenSummaryBtn).click();
cy.get(selectors.summaryGoToSummaryBtn).click();
cy.url().should('match', urls.summaryInvoiceInUrlRegex);
cy.containContent(selectors.descriptorInvoiceInTitle, invoice);
});
cy.checkRedirectionFromPopUp({
selectorToClick: selectors.received,
steps: [
selectors.descriptorOpenSummaryBtn,
selectors.summaryGoToSummaryBtn,
],
expectedUrlRegex: urls.summaryInvoiceInUrlRegex,
expectedTextSelector: selectors.descriptorInvoiceInTitle,
});
});
});
describe('Autonomous pop-ups', () => {
it('Should redirect to the supplier summary from the received descriptor pop-up', () => {
cy.get(selectors.autonomous)
.click()
.invoke('text')
.then((supplier) => {
supplier = supplier.trim();
cy.get(selectors.descriptorGoToSummaryBtn).click();
cy.url().should('match', urls.summarySupplierUrlRegex);
cy.containContent(
selectors.descriptorAgencyAndSupplierTitle,
supplier,
);
});
cy.checkRedirectionFromPopUp({
selectorToClick: selectors.autonomous,
steps: [selectors.descriptorGoToSummaryBtn],
expectedUrlRegex: urls.summarySupplierUrlRegex,
expectedTextSelector: selectors.descriptorAgencyAndSupplierTitle,
});
});
it('Should redirect to the supplier summary from summary pop-up from the autonomous descriptor pop-up', () => {
cy.get(selectors.autonomous)
.click()
.invoke('text')
.then((supplier) => {
supplier = supplier.trim();
cy.get(selectors.descriptorOpenSummaryBtn).click();
cy.get(selectors.summaryGoToSummaryBtn).click();
cy.url().should('match', urls.summarySupplierUrlRegex);
cy.containContent(
selectors.descriptorAgencyAndSupplierTitle,
supplier,
);
});
cy.checkRedirectionFromPopUp({
selectorToClick: selectors.autonomous,
steps: [
selectors.descriptorOpenSummaryBtn,
selectors.summaryGoToSummaryBtn,
],
expectedUrlRegex: urls.summarySupplierUrlRegex,
expectedTextSelector: selectors.descriptorAgencyAndSupplierTitle,
});
});
});

View File

@ -12,7 +12,9 @@ describe('Vehicle DMS', () => {
firstRowId: 'tr:first-child > :nth-child(2) > .q-tr > :nth-child(1) > span',
lastRowWorkerLink: 'tr:last-child > :nth-child(8) > .q-tr > .link',
descriptorTitle: '.descriptor .title',
descriptorOpenSummaryBtn: '.q-menu .descriptor [data-cy="openSummaryBtn"]',
descriptorGoToSummaryBtn: '.q-menu .descriptor [data-cy="goToSummaryBtn"]',
summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
summaryTitle: '.summaryHeader',
referenceInput: 'Reference_input',
companySelect: 'Company_select',
@ -98,15 +100,26 @@ describe('Vehicle DMS', () => {
cy.containContent(selectors.lastRowReference, 'Vehicle:3333-BAT');
});
jtubau marked this conversation as resolved Outdated

Lo mismo que los popup del otro archivo de tests

Lo mismo que los popup del otro archivo de tests
it('Should redirect to worker summary from worker descriptor pop-up', () => {
cy.get(selectors.lastRowWorkerLink)
.click()
.invoke('text')
.then((workerName) => {
workerName = workerName.trim();
cy.get(selectors.descriptorGoToSummaryBtn).click();
cy.url().should('match', workerSummaryUrlRegex);
cy.containContent(selectors.descriptorTitle, workerName);
describe('Worker pop-ups', () => {
it('Should redirect to worker summary from worker descriptor pop-up', () => {
cy.checkRedirectionFromPopUp({
selectorToClick: selectors.lastRowWorkerLink,
steps: [selectors.descriptorGoToSummaryBtn],
expectedUrlRegex: workerSummaryUrlRegex,
expectedTextSelector: selectors.descriptorTitle,
});
});
it('Should redirect to worker summary from summary pop-up from worker descriptor pop-up', () => {
cy.checkRedirectionFromPopUp({
selectorToClick: selectors.lastRowWorkerLink,
steps: [
selectors.descriptorOpenSummaryBtn,
selectors.summaryGoToSummaryBtn,
],
expectedUrlRegex: workerSummaryUrlRegex,
expectedTextSelector: selectors.descriptorTitle,
});
});
});
});

View File

@ -619,3 +619,22 @@ Cypress.Commands.add('validateScrollContent', (validations) => {
);
});
});
Cypress.Commands.add(
'checkRedirectionFromPopup',
({ selectorToClick, steps = [], expectedUrlRegex, expectedTextSelector }) => {
cy.get(selectorToClick)
.click()
.invoke('text')
.then((label) => {
label = label.trim();
steps.forEach((stepSelector) => {
cy.get(stepSelector).should('be.visible').click();
});
cy.location().should('match', expectedUrlRegex);
cy.containContent(expectedTextSelector, label);
});
},
);