test: refs #8621 add e2e tests for cmrList
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
566e4f0e13
commit
ee3ebc51f1
|
@ -0,0 +1,87 @@
|
|||
describe('Cmr list', () => {
|
||||
const getLinkSelector = (colField) =>
|
||||
`tr:first-child > [data-col-field="${colField}"] > .no-padding > .link`;
|
||||
|
||||
const selectors = {
|
||||
ticket: getLinkSelector('ticketFk'),
|
||||
client: getLinkSelector('clientFk'),
|
||||
lastRowSelectCheckBox:
|
||||
'.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',
|
||||
};
|
||||
|
||||
const data = {
|
||||
ticket: '2',
|
||||
client: 'Bruce Wayne',
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit('/#/route/cmr');
|
||||
cy.typeSearchbar('{enter}');
|
||||
});
|
||||
|
||||
it('Should download selected cmr', () => {
|
||||
const downloadsFolder = Cypress.config('downloadsFolder');
|
||||
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||
cy.get(selectors.downloadBtn).click();
|
||||
cy.wait(3000);
|
||||
|
||||
const fileName = 'cmrs.zip';
|
||||
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
|
||||
});
|
||||
|
||||
it('Should open selected cmr pdf', () => {
|
||||
cy.window().then((win) => {
|
||||
cy.stub(win, 'open').as('windowOpen');
|
||||
});
|
||||
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||
cy.dataCy(selectors.viewCmr).last().click();
|
||||
cy.get('@windowOpen').should('be.calledWithMatch', '\/api\/Cmrs\/3');
|
||||
});
|
||||
|
||||
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.descriptorGoToSummaryBtn).click();
|
||||
cy.get(selectors.summaryHeader).should('contain', 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.summaryGoToSummaryBtn).click();
|
||||
cy.get(selectors.summaryHeader).should('contain', 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.descriptorGoToSummaryBtn).click();
|
||||
cy.get(selectors.summaryHeader).should('contain', 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.summaryGoToSummaryBtn).click();
|
||||
cy.get(selectors.summaryHeader).should('contain', data.client);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue