salix-front/test/cypress/integration/property/propertyDescriptor.spec.js

46 lines
1.8 KiB
JavaScript

describe('Property descriptor', () => {
const selectors = {
notaryLink: '.descriptor [data-cy="vnLvNotario"] .link',
descriptorOpenSummaryBtn: '.q-menu > .descriptor [data-cy="openSummaryBtn"]',
descriptorGoToSummaryBtn: '.q-menu > .descriptor [data-cy="goToSummaryBtn"]',
summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
descriptorTitle: '[data-cy="vnDescriptor_description"]',
};
const notarySummaryUrlRegex = /supplier\/\d+\/summary/;
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('#/property/1/summary');
});
it('Should redirect to the notary summary from notary descriptor pop-up', () => {
cy.get(selectors.notaryLink)
.should('be.visible')
.click()
.invoke('text')
.then((notaryName) => {
notaryName = notaryName.trim();
cy.log('Notary name: ', notaryName);
cy.get(selectors.descriptorGoToSummaryBtn).click();
cy.location().should('match', notarySummaryUrlRegex);
cy.containContent(selectors.descriptorTitle, notaryName);
});
});
it('Should redirect to the notary summary from summary pop-up from the notary descriptor pop-up', () => {
cy.get(selectors.notaryLink)
.should('be.visible')
.click()
.invoke('text')
.then((notaryName) => {
notaryName = notaryName.trim();
cy.get(selectors.descriptorOpenSummaryBtn).click();
cy.get(selectors.summaryGoToSummaryBtn).click();
cy.location().should('match', notarySummaryUrlRegex);
cy.containContent(selectors.descriptorTitle, notaryName);
});
});
});