test: refs #8441 add e2e tests for vehicleInvoiceIn
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jose Antonio Tubau 2025-03-06 13:06:50 +01:00
parent ce827722e3
commit 08e68e47b8
1 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,87 @@
describe('Vehicle Invoice In', () => {
const selectors = {
firstRowSupplier: 'tr:first-child > .expand > .no-padding > .link',
firstRowInvoice:
':nth-child(1) > [data-col-field="supplierRef"] > .no-padding > .link',
descriptorTitle:
'.q-menu > .descriptor > .body > .q-list > .q-item__label--header > .title > span',
descriptorPopupGoToSummaryBtn:
'.header > :nth-child(2) > .q-btn__content > .q-icon',
summaryTitle: '.summaryHeader > :nth-child(2)',
summaryPopUpGoToSummaryBtn: '.header > .q-icon',
unassignBtn: 'tableAction-0',
};
const supplier = 'PLANTS SL';
const invoice = '1234';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('deliveryAssistant');
cy.visit(`/#/route/vehicle/1/invoice-in`);
});
it('Should show assigned tickets', () => {
cy.get('.q-table')
.children()
.should('be.visible')
.should('have.length.greaterThan', 0);
});
it('Should assign a new invoice', () => {
const data = {
'Invoice nº': { val: '5', type: 'select' },
'Nº Plate': { val: '3333-BAT', type: 'select' },
};
cy.addBtnClick();
cy.fillInForm(data);
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data created');
});
it('Should unassign an invoice', () => {
cy.dataCy(selectors.unassignBtn).last().click();
cy.clickConfirm();
cy.checkNotification('Data saved');
});
describe('Supplier pop-ups', () => {
it('Should redirect to the supplier summary from the supplier descriptor pop-up', () => {
cy.get(selectors.firstRowSupplier).click();
cy.get(selectors.descriptorTitle).should('contain', supplier);
cy.get(
'[href="#/supplier/1/summary"] > .q-btn > .q-btn__content > .q-icon',
).click();
cy.get(selectors.summaryTitle).should('contain', supplier);
});
it('Should redirect to the supplier summary from summary pop-up from the supplier descriptor pop-up', () => {
cy.get(selectors.firstRowSupplier).click();
cy.get(selectors.descriptorTitle).should('contain', supplier);
cy.get(selectors.descriptorPopupGoToSummaryBtn).click();
cy.get(selectors.summaryTitle).should('contain', supplier);
cy.get(selectors.summaryPopUpGoToSummaryBtn).click();
cy.get(selectors.summaryTitle).should('contain', supplier);
});
});
describe('Invoice pop-ups', () => {
it('Should redirect to the invoiceIn summary from the invoice descriptor pop-up', () => {
cy.get(selectors.firstRowInvoice).click();
cy.get(selectors.descriptorTitle).should('have.text', invoice);
cy.get(
'[href="#/invoice-in/1/summary"] > .q-btn > .q-btn__content > .q-icon',
).click();
cy.get(selectors.summaryTitle).should('contain', supplier);
});
it('Should redirect to the invoiceIn summary from summary pop-up from the invoice descriptor pop-up', () => {
cy.get(selectors.firstRowInvoice).click();
cy.get(selectors.descriptorTitle).should('have.text', invoice);
cy.get(selectors.descriptorPopupGoToSummaryBtn).click();
cy.get(selectors.summaryTitle).should('contain', supplier);
cy.get(selectors.summaryPopUpGoToSummaryBtn).click();
cy.get(selectors.summaryTitle).should('contain', supplier);
});
});
});