58 lines
2.2 KiB
JavaScript
58 lines
2.2 KiB
JavaScript
describe('InvoiceInVehicle', () => {
|
|
const selectors = {
|
|
tableActionUnlink: 'tableAction-0',
|
|
firstVehicleLink:
|
|
'tr:first-child > [data-col-field="vehicleFk"] > .no-padding > .link',
|
|
descriptorOpenSummaryBtn: '.q-menu .descriptor [data-cy="openSummaryBtn"]',
|
|
descriptorGoToSummaryBtn: '.q-menu .descriptor [data-cy="goToSummaryBtn"]',
|
|
summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
|
|
descriptorTitle: '[data-cy="vnDescriptor_title"]',
|
|
};
|
|
const vehicleSummaryUrlRegex = /vehicle\/\d+\/summary/;
|
|
|
|
beforeEach(() => {
|
|
cy.login('administrative');
|
|
cy.visit(`/#/invoice-in/1/vehicle`);
|
|
});
|
|
|
|
it('should link vehicle to the invoice', () => {
|
|
const data = {
|
|
Vehicle: { val: '2222-IMK', type: 'select' },
|
|
Amount: { val: 125 },
|
|
};
|
|
cy.addBtnClick();
|
|
cy.fillInForm(data);
|
|
cy.dataCy('FormModelPopup_save').click();
|
|
cy.checkNotification('Data created');
|
|
});
|
|
|
|
it('should unlink vehicle to the invoice', () => {
|
|
cy.dataCy(selectors.tableActionUnlink).last().click();
|
|
cy.clickConfirm();
|
|
cy.checkNotification('Unlinked vehicle');
|
|
});
|
|
|
|
describe('Vehicle pop-ups', () => {
|
|
it('Should redirect to the vehicle summary from the vehicle descriptor pop-up', () => {
|
|
cy.checkRedirectionFromPopUp({
|
|
selectorToClick: selectors.firstVehicleLink,
|
|
steps: [selectors.descriptorGoToSummaryBtn],
|
|
expectedUrlRegex: vehicleSummaryUrlRegex,
|
|
expectedTextSelector: selectors.descriptorTitle,
|
|
});
|
|
});
|
|
|
|
it('Should redirect to the vehicle summary from summary pop-up from the vehicle descriptor pop-up', () => {
|
|
cy.checkRedirectionFromPopUp({
|
|
selectorToClick: selectors.firstVehicleLink,
|
|
steps: [
|
|
selectors.descriptorOpenSummaryBtn,
|
|
selectors.summaryGoToSummaryBtn,
|
|
],
|
|
expectedUrlRegex: vehicleSummaryUrlRegex,
|
|
expectedTextSelector: selectors.descriptorTitle,
|
|
});
|
|
});
|
|
});
|
|
});
|