refactor: refs #6683 update download button selector and implement download test
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
79fa369fd1
commit
28927016a4
|
@ -3,7 +3,7 @@ describe('Property DMS', () => {
|
||||||
`tr:${trPosition}-child > .text-right > .no-wrap > :nth-child(${btnPosition}) > .q-btn > .q-btn__content > .q-icon`;
|
`tr:${trPosition}-child > .text-right > .no-wrap > :nth-child(${btnPosition}) > .q-btn > .q-btn__content > .q-icon`;
|
||||||
|
|
||||||
const selectors = {
|
const selectors = {
|
||||||
lastRowDownloadBtn: getBtnSelector('last', 1),
|
firstRowDownloadBtn: getBtnSelector('first', 1),
|
||||||
firstRowEditBtn: getBtnSelector('first', 2),
|
firstRowEditBtn: getBtnSelector('first', 2),
|
||||||
lastRowDeleteBtn: getBtnSelector('last', 3),
|
lastRowDeleteBtn: getBtnSelector('last', 3),
|
||||||
firstRowDeleteBtn: getBtnSelector('first', 3),
|
firstRowDeleteBtn: getBtnSelector('first', 3),
|
||||||
|
@ -66,6 +66,25 @@ describe('Property DMS', () => {
|
||||||
cy.checkNotification('Data saved');
|
cy.checkNotification('Data saved');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Should download DMS', () => {
|
||||||
|
let fileName;
|
||||||
|
cy.get(selectors.firstRowId)
|
||||||
|
.invoke('text')
|
||||||
|
.then((label) => {
|
||||||
|
label = label.trim();
|
||||||
|
fileName = `${label}.jpg`;
|
||||||
|
});
|
||||||
|
cy.intercept('GET', /\/api\/dms\/\d+\/downloadFile/).as('download');
|
||||||
|
cy.get(selectors.firstRowDownloadBtn).click();
|
||||||
|
|
||||||
|
cy.wait('@download').then((interception) => {
|
||||||
|
expect(interception.response.statusCode).to.equal(200);
|
||||||
|
expect(interception.response.headers['content-disposition']).to.contain(
|
||||||
|
fileName,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('Should edit DMS', () => {
|
it('Should edit DMS', () => {
|
||||||
cy.get(selectors.firstRowEditBtn).click();
|
cy.get(selectors.firstRowEditBtn).click();
|
||||||
cy.fillInForm(updateData);
|
cy.fillInForm(updateData);
|
||||||
|
@ -95,15 +114,6 @@ describe('Property DMS', () => {
|
||||||
cy.clickConfirm();
|
cy.clickConfirm();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should download DMS', () => {
|
|
||||||
const downloadsFolder = Cypress.config('downloadsFolder');
|
|
||||||
cy.get(selectors.lastRowDownloadBtn).click();
|
|
||||||
cy.wait(3000);
|
|
||||||
|
|
||||||
const fileName = '1.txt';
|
|
||||||
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Worker pop-ups', () => {
|
describe('Worker pop-ups', () => {
|
||||||
it('Should redirect to the worker summary from worker descriptor pop-up', () => {
|
it('Should redirect to the worker summary from worker descriptor pop-up', () => {
|
||||||
cy.get(selectors.lastRowWorkerLink)
|
cy.get(selectors.lastRowWorkerLink)
|
||||||
|
|
Loading…
Reference in New Issue