fix: refs #8581 update validateDownload command to support multiple file types

This commit is contained in:
Jorge Penadés 2025-03-11 17:19:39 +01:00
parent f5a1172d32
commit 8890006c43
1 changed files with 6 additions and 2 deletions

View File

@ -473,6 +473,7 @@ Cypress.Commands.add('validateDescriptor', (toCheck = {}) => {
});
Cypress.Commands.add('validateVnTableRows', (opts = {}) => {
cy.waitTableLoad();
let { cols = [], rows = [] } = opts;
if (!Array.isArray(cols)) cols = [cols];
const rowSelector = rows.length
@ -545,14 +546,17 @@ Cypress.Commands.add('validateCheckbox', (selector, expectedVal = 'true') => {
Cypress.Commands.add('validateDownload', (trigger, opts = {}) => {
const {
url = /api\/dms\/\d+\/downloadFile\?access_token=.+/,
type = 'text/plain',
types = ['text/plain', 'image/jpeg'],
alias = 'download',
} = opts;
cy.intercept('GET', url).as(alias);
trigger();
cy.wait(`@${alias}`).then(({ response }) => {
expect(response.statusCode).to.equal(200);
expect(response.headers['content-type']).to.include(type);
const isValidType = types.some((type) =>
response.headers['content-type'].includes(type),
);
expect(isValidType).to.be.true;
});
});