test: refs #8441 add Cypress tests for vehicle summary functionality
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jose Antonio Tubau 2025-03-11 11:35:50 +01:00
parent 7ebf4cd38f
commit ef797a3675
2 changed files with 113 additions and 1 deletions

View File

@ -138,7 +138,7 @@ const links = {
</QCard>
<QCard class="vn-max">
<VnTitle
:url="`#/route/vehicle/${route.params.id}/invoice-in`"
:url="links['invoice-in']"
:text="$t('vehicle.ticket.assignedInvoices')"
/>
<QTable :rows="invoices" style="text-align: center">

View File

@ -0,0 +1,112 @@
describe('Vehicle summary', () => {
const selectors = {
summaryTitle: '.summaryHeader > :nth-child(2)',
descriptorTitle: '.q-item__label--header > .title > span',
descriptorPopupTitle: '.q-menu > .descriptor > .body > .q-list > .q-item__label--header > .title > span',
supplierSummaryPopUpTitle: '.q-dialog__inner > .summary > .cardSummary > .summaryHeader > :nth-child(2)',
invoiceSummaryPopupTitle: '.q-dialog__inner > .summary > .cardSummary > .summaryHeader > div',
descriptorOptions: 'descriptor-more-opts',
delete: 'delete',
basicDataSupplierLink: ':nth-child(4) > .value > .link',
summaryAssignedInvoicesLink: '.vn-max > .q-pb-lg > .header-link > .link',
summaryBasicDataLink: '[dense=""] > .q-pb-lg > .header-link > .link',
assignedInvoicesSupplierLink: 'tbody > :nth-child(1) > :nth-child(2) > .link',
assignedInvoicesInvoiceLink: ':nth-child(1) > :nth-child(3) > .link',
supplierDescriptorGoToSummary: '[href="#/supplier/1/summary"] > .q-btn > .q-btn__content > .q-icon',
invoiceDescriptorGoToSummary: '[href="#/invoice-in/1/summary"] > .q-btn > .q-btn__content > .q-icon',
descriptorSummaryPopup: '.header > :nth-child(2) > .q-btn__content > .q-icon',
summaryPopupGoToSummary: '.header > .q-icon',
}
const data = {
vehiclePlate: '3333-BAT',
supplierName: 'PLANTS SL',
invoice: '1234',
}
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('deliveryAssistant');
cy.visit(`/#/route/vehicle/1/summary`);
});
it('Should load summary', () => {
cy.get(selectors.summaryTitle).should('contain', data.vehiclePlate);
cy.get(selectors.descriptorTitle).should('contain', data.vehiclePlate);
});
it('should delete a vehicle', () => {
cy.typeSearchbar('7{enter}');
cy.dataCy(selectors.descriptorOptions).click();
cy.dataCy(selectors.delete).click();
cy.checkNotification('Vehicle removed');
});
it('Should redirect to vehicle basic-data', () => {
cy.get(selectors.summaryBasicDataLink).click();
cy.url().should('include', '/vehicle/1/basic-data');
})
it('Should redirect to vehicle invoice-ins', () => {
cy.get(selectors.summaryAssignedInvoicesLink).click();
cy.url().should('include', '/vehicle/1/invoice-in');
})
describe('Supplier basic data pop-ups', () => {
it('Should redirect to the supplier summary from the supplier descriptor pop-up', () => {
cy.get(selectors.basicDataSupplierLink).click();
cy.get(selectors.descriptorPopupTitle).should('contain', data.supplierName);
cy.get(selectors.supplierDescriptorGoToSummary).click();
cy.get(selectors.summaryTitle).should('contain', data.supplierName);
cy.url().should('include', '/supplier/1/summary');
});
it('Should redirect to the supplier summary from summary pop-up from the supplier descriptor pop-up', () => {
cy.get(selectors.basicDataSupplierLink).click();
cy.get(selectors.descriptorPopupTitle).should('contain', data.supplierName);
cy.get(selectors.descriptorSummaryPopup).click();
cy.get(selectors.supplierSummaryPopUpTitle).should('contain', data.supplierName);
cy.get(selectors.summaryPopupGoToSummary).click();
cy.get(selectors.summaryTitle).should('contain', data.supplierName);
cy.url().should('include', '/supplier/1/summary');
});
});
describe('Supplier assigned invoices pop-ups', () => {
it('Should redirect to the supplier summary from the invoice descriptor pop-up', () => {
cy.get(selectors.assignedInvoicesSupplierLink).click();
cy.get(selectors.descriptorPopupTitle).should('contain', data.supplierName);
cy.get(selectors.supplierDescriptorGoToSummary).click();
cy.get(selectors.summaryTitle).should('contain', data.supplierName);
cy.url().should('include', '/supplier/1/summary');
});
it('Should redirect to the supplier summary from summary pop-up from the supplier descriptor pop-up', () => {
cy.get(selectors.assignedInvoicesSupplierLink).click();
cy.get(selectors.descriptorPopupTitle).should('contain', data.supplierName);
cy.get(selectors.descriptorSummaryPopup).click();
cy.get(selectors.supplierSummaryPopUpTitle).should('contain', data.supplierName);
cy.get(selectors.summaryPopupGoToSummary).click();
cy.get(selectors.summaryTitle).should('contain', data.supplierName);
cy.url().should('include', '/supplier/1/summary');
});
});
describe('Invoice pop-ups', () => {
it('Should redirect to the invoiceIn summary from the invoice descriptor pop-up', () => {
cy.get(selectors.assignedInvoicesInvoiceLink).click();
cy.get(selectors.descriptorPopupTitle).should('contain', data.invoice);
cy.get(selectors.invoiceDescriptorGoToSummary).click();
cy.get(selectors.summaryTitle).should('contain', data.supplierName);
cy.url().should('include', '/invoice-in/1/summary');
});
it('Should redirect to the invoiceIn summary from summary pop-up from the invoice descriptor pop-up', () => {
cy.get(selectors.assignedInvoicesInvoiceLink).click();
cy.get(selectors.descriptorPopupTitle).should('contain', data.invoice);
cy.get(selectors.descriptorSummaryPopup).click();
cy.get(selectors.invoiceSummaryPopupTitle).should('contain', data.supplierName);
cy.get(selectors.summaryPopupGoToSummary).click();
cy.get(selectors.summaryTitle).should('contain', data.supplierName);
cy.url().should('include', '/invoice-in/1/summary');
});
});
});