144 lines
6.2 KiB
JavaScript
144 lines
6.2 KiB
JavaScript
describe('FixedAsset summary', () => {
|
|
const selectors = {
|
|
summaryTitle: '.summaryHeader',
|
|
descriptorTitle: '[data-cy="vnDescriptor_title"]',
|
|
supplierDescriptorTitle: '[data-cy="vnDescriptor_description"]',
|
|
descriptorOpenSummaryBtn: '.q-menu > .descriptor [data-cy="openSummaryBtn"]',
|
|
descriptorGoToSummaryBtn: '.q-menu > .descriptor [data-cy="goToSummaryBtn"]',
|
|
summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
|
|
summaryBasicDataBlock1Link: 'a.link[data-cy="titleBasicDataBlock1"]',
|
|
summaryBasicDataBlock2Link: 'a.link[data-cy="titleBasicDataBlock2"]',
|
|
summaryInvoiceBlockLink: 'a.link[data-cy="titleInvoiceBlock"]',
|
|
summaryDmsBlockLink: 'a.link[data-cy="titleDmsBlock"]',
|
|
dmsFirstRowWorkerLink: '.summaryBody :nth-child(1) > :nth-child(7) .link',
|
|
invoiceFirstRowSupplierLink:
|
|
':nth-child(1) > :nth-child(2) > [data-cy="supplierLink"]',
|
|
invoiceFirstRowSupplierRefLink:
|
|
':nth-child(1) > :nth-child(3) > [data-cy="invoiceLink"]',
|
|
basicDataIcon: 'FixedAssetBasicData-menu-item',
|
|
invoiceIcon: 'FixedAssetInvoice-menu-item',
|
|
dmsIcon: 'FixedAssetDms-menu-item',
|
|
logIcon: 'FixedAssetLog-menu-item',
|
|
};
|
|
|
|
const url = '/#/fixed-asset/1/summary';
|
|
const basicDataUrlRegex = /fixed-asset\/1\/basic-data/;
|
|
const invoiceUrlRegex = /fixed-asset\/1\/invoice/;
|
|
const dmsUrlRegex = /fixed-asset\/1\/dms/;
|
|
const logUrlRegex = /fixed-asset\/1\/history/;
|
|
const workerSummaryUrlRegex = /worker\/\d+\/summary/;
|
|
const supplierSummaryUrlRegex = /supplier\/\d+\/summary/;
|
|
const invoiceSummaryUrlRegex = /invoice-in\/\d+\/summary/;
|
|
|
|
beforeEach(() => {
|
|
cy.viewport(1920, 1080);
|
|
cy.login('administrative');
|
|
cy.visit(url);
|
|
});
|
|
|
|
it('Should redirect to the corresponding section when clicking on the icons in the left menu', () => {
|
|
cy.dataCy(selectors.basicDataIcon).click();
|
|
cy.location().should('match', basicDataUrlRegex);
|
|
|
|
cy.visit(url);
|
|
cy.dataCy(selectors.invoiceIcon).click();
|
|
cy.location().should('match', invoiceUrlRegex);
|
|
|
|
cy.visit(url);
|
|
cy.dataCy(selectors.dmsIcon).click();
|
|
cy.location().should('match', dmsUrlRegex);
|
|
|
|
cy.visit(url);
|
|
cy.dataCy(selectors.logIcon).click();
|
|
cy.location().should('match', logUrlRegex);
|
|
});
|
|
|
|
it('Should redirect to fixed asset basic-data when clicking on basic-data title links', () => {
|
|
cy.get(selectors.summaryBasicDataBlock1Link).click();
|
|
cy.location().should('match', basicDataUrlRegex);
|
|
cy.visit(url);
|
|
cy.get(selectors.summaryBasicDataBlock2Link).click();
|
|
cy.location().should('match', basicDataUrlRegex);
|
|
cy.visit(url);
|
|
});
|
|
|
|
it('Should redirect to fixed asset invoices when clicking on asigned invoices title', () => {
|
|
cy.get(selectors.summaryInvoiceBlockLink).click();
|
|
cy.location().should('match', invoiceUrlRegex);
|
|
});
|
|
|
|
it('Should redirect to fixed asset DMS when clicking on file managment title', () => {
|
|
cy.get(selectors.summaryDmsBlockLink).click();
|
|
cy.location().should('match', dmsUrlRegex);
|
|
});
|
|
|
|
describe('Worker pop-ups', () => {
|
|
it('Should redirect to the worker summary from worker descriptor pop-up', () => {
|
|
cy.checkRedirectionFromPopUp({
|
|
selectorToClick: selectors.dmsFirstRowWorkerLink,
|
|
steps: [selectors.descriptorGoToSummaryBtn],
|
|
expectedUrlRegex: workerSummaryUrlRegex,
|
|
expectedTextSelector: selectors.descriptorTitle,
|
|
});
|
|
});
|
|
|
|
it('Should redirect to the worker summary from summary pop-up from the worker descriptor pop-up', () => {
|
|
cy.checkRedirectionFromPopUp({
|
|
selectorToClick: selectors.dmsFirstRowWorkerLink,
|
|
steps: [
|
|
selectors.descriptorOpenSummaryBtn,
|
|
selectors.summaryGoToSummaryBtn,
|
|
],
|
|
expectedUrlRegex: workerSummaryUrlRegex,
|
|
expectedTextSelector: selectors.descriptorTitle,
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('Supplier pop-ups', () => {
|
|
it('Should redirect to the Supplier summary from Supplier descriptor pop-up', () => {
|
|
cy.checkRedirectionFromPopUp({
|
|
selectorToClick: selectors.invoiceFirstRowSupplierLink,
|
|
steps: [selectors.descriptorGoToSummaryBtn],
|
|
expectedUrlRegex: supplierSummaryUrlRegex,
|
|
expectedTextSelector: selectors.supplierDescriptorTitle,
|
|
});
|
|
});
|
|
|
|
it('Should redirect to the Supplier summary from summary pop-up from the Supplier descriptor pop-up', () => {
|
|
cy.checkRedirectionFromPopUp({
|
|
selectorToClick: selectors.invoiceFirstRowSupplierLink,
|
|
steps: [
|
|
selectors.descriptorOpenSummaryBtn,
|
|
selectors.summaryGoToSummaryBtn,
|
|
],
|
|
expectedUrlRegex: supplierSummaryUrlRegex,
|
|
expectedTextSelector: selectors.supplierDescriptorTitle,
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('Invoice in pop-ups', () => {
|
|
it('Should redirect to the invoice summary from invoice descriptor pop-up', () => {
|
|
cy.checkRedirectionFromPopUp({
|
|
selectorToClick: selectors.invoiceFirstRowSupplierRefLink,
|
|
steps: [selectors.descriptorGoToSummaryBtn],
|
|
expectedUrlRegex: invoiceSummaryUrlRegex,
|
|
expectedTextSelector: selectors.descriptorTitle,
|
|
});
|
|
});
|
|
|
|
it('Should redirect to the invoice summary from summary pop-up from the invoice descriptor pop-up', () => {
|
|
cy.checkRedirectionFromPopUp({
|
|
selectorToClick: selectors.invoiceFirstRowSupplierRefLink,
|
|
steps: [
|
|
selectors.descriptorOpenSummaryBtn,
|
|
selectors.summaryGoToSummaryBtn,
|
|
],
|
|
expectedUrlRegex: invoiceSummaryUrlRegex,
|
|
expectedTextSelector: selectors.descriptorTitle,
|
|
});
|
|
});
|
|
});
|
|
});
|