refactor: refs #6683 update download button selector and implement download test
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jose Antonio Tubau 2025-04-24 08:56:55 +02:00
parent 79fa369fd1
commit 28927016a4
1 changed files with 20 additions and 10 deletions

View File

@ -3,7 +3,7 @@ describe('Property DMS', () => {
`tr:${trPosition}-child > .text-right > .no-wrap > :nth-child(${btnPosition}) > .q-btn > .q-btn__content > .q-icon`;
const selectors = {
lastRowDownloadBtn: getBtnSelector('last', 1),
firstRowDownloadBtn: getBtnSelector('first', 1),
firstRowEditBtn: getBtnSelector('first', 2),
lastRowDeleteBtn: getBtnSelector('last', 3),
firstRowDeleteBtn: getBtnSelector('first', 3),
@ -65,6 +65,25 @@ describe('Property DMS', () => {
cy.dataCy(selectors.saveFormBtn).click();
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', () => {
cy.get(selectors.firstRowEditBtn).click();
@ -95,15 +114,6 @@ describe('Property DMS', () => {
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', () => {
it('Should redirect to the worker summary from worker descriptor pop-up', () => {
cy.get(selectors.lastRowWorkerLink)