test: refs #8621 add data-cy attributes for summary navigation buttons in CMR list tests
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jose Antonio Tubau 2025-03-13 09:02:41 +01:00
parent 54bfd9f384
commit c50d6d884e
2 changed files with 59 additions and 19 deletions

View File

@ -26,6 +26,7 @@ const id = props.entityId;
:to="{ name: routeName, params: { id: id } }"
class="header link"
:href="url"
data-cy="goToSummaryBtn"
>
<QIcon name="open_in_new" color="white" size="sm" />
</router-link>

View File

@ -9,13 +9,12 @@ describe('Cmr list', () => {
'.q-virtual-scroll__content > tr:last-child > :nth-child(1) > .q-checkbox',
downloadBtn: '#subToolbar > .q-btn',
viewCmr: 'tableAction-0',
summaryPopupBtn: '.header > :nth-child(2) > .q-btn__content > .q-icon',
summaryPopupHeader: '.summaryHeader > :nth-child(2)',
summaryHeader: '.summaryHeader',
descriptorId: '.q-item > .q-item__label',
descriptorTitle: '.q-item__label--header > .title > span',
summaryGoToSummaryBtn: '.header > .q-icon',
descriptorGoToSummaryBtn: '.descriptor > .header > a[href] > .q-btn',
descriptorOpenSummaryBtn: '.descriptor [data-cy="openSummaryBtn"]',
summaryTitle: '.summaryHeader',
descriptorId: '.descriptor .subtitle',
descriptorTitle: '.descriptor .title',
summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
descriptorGoToSummaryBtn: '.descriptor [data-cy="goToSummaryBtn"]',
removeFilter: '.q-chip__icon--remove',
};
@ -54,36 +53,76 @@ describe('Cmr list', () => {
describe('Ticket pop-ups', () => {
it('Should redirect to the ticket summary from the ticket descriptor pop-up', () => {
cy.get(selectors.ticket).click();
cy.get(selectors.descriptorId).should('contain', data.ticket);
cy.get(selectors.descriptorId)
.invoke('text')
.then((text) => {
expect(text).to.include(data.ticket);
});
cy.get(selectors.descriptorGoToSummaryBtn).click();
cy.get(selectors.summaryHeader).should('contain', data.client);
cy.get(selectors.summaryTitle)
.invoke('text')
.then((text) => {
expect(text).to.include(data.client);
});
});
it('Should redirect to the ticket summary from summary pop-up from the ticket descriptor pop-up', () => {
cy.get(selectors.ticket).click();
cy.get(selectors.descriptorId).should('contain', data.ticket);
cy.get(selectors.summaryPopupBtn).click();
cy.get(selectors.summaryPopupHeader).should('contain', data.client);
cy.get(selectors.descriptorId)
.invoke('text')
.then((text) => {
expect(text).to.include(data.ticket);
});
cy.get(selectors.descriptorOpenSummaryBtn).click();
cy.get(selectors.summaryTitle)
.invoke('text')
.then((text) => {
expect(text).to.include(data.client);
});
cy.get(selectors.summaryGoToSummaryBtn).click();
cy.get(selectors.summaryHeader).should('contain', data.client);
cy.get(selectors.summaryTitle)
.invoke('text')
.then((text) => {
expect(text).to.include(data.client);
});
});
});
describe('Client pop-ups', () => {
it('Should redirect to the client summary from the client descriptor pop-up', () => {
cy.get(selectors.client).click();
cy.get(selectors.descriptorTitle).should('contain', data.client);
cy.get(selectors.descriptorTitle)
.invoke('text')
.then((text) => {
expect(text).to.include(data.client);
});
cy.get(selectors.descriptorGoToSummaryBtn).click();
cy.get(selectors.summaryHeader).should('contain', data.client);
cy.get(selectors.summaryTitle)
.invoke('text')
.then((text) => {
expect(text).to.include(data.client);
});
});
it('Should redirect to the client summary from summary pop-up from the client descriptor pop-up', () => {
cy.get(selectors.client).click();
cy.get(selectors.descriptorTitle).should('contain', data.client);
cy.get(selectors.summaryPopupBtn).click();
cy.get(selectors.summaryHeader).should('contain', data.client);
cy.get(selectors.descriptorTitle)
.invoke('text')
.then((text) => {
expect(text).to.include(data.client);
});
cy.get(selectors.descriptorOpenSummaryBtn).click();
cy.get(selectors.summaryTitle)
.invoke('text')
.then((text) => {
expect(text).to.include(data.client);
});
cy.get(selectors.summaryGoToSummaryBtn).click();
cy.get(selectors.summaryHeader).should('contain', data.client);
cy.get(selectors.summaryTitle)
.invoke('text')
.then((text) => {
expect(text).to.include(data.client);
});
});
});
});