diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index f075d500f..13103950c 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -38,6 +38,15 @@ Cypress.Commands.add('login', (user) => { }, }).then((response) => { window.localStorage.setItem('token', response.body.token); + cy.request({ + method: 'GET', + url: '/api/VnUsers/ShareToken', + headers: { + Authorization: window.localStorage.getItem('token'), + }, + }).then(({ body }) => { + window.localStorage.setItem('tokenMultimedia', body.multimediaToken.id); + }); }); }); @@ -52,16 +61,18 @@ Cypress.Commands.add('getValue', (selector) => { } // Si es un QSelect if ($el.find('.q-select__dropdown-icon').length) { - return cy.get( - selector + - '> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input' - ).invoke('val') + return cy + .get( + selector + + '> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input' + ) + .invoke('val'); } // Si es un QSelect if ($el.find('span').length) { - return cy.get( - selector + ' span' - ).then(($span) => { return $span[0].innerText }) + return cy.get(selector + ' span').then(($span) => { + return $span[0].innerText; + }); } // Puedes aƱadir un log o lanzar un error si el elemento no es reconocido cy.log('Elemento no soportado'); @@ -132,13 +143,13 @@ Cypress.Commands.add('validateRow', (rowSelector, expectedValues) => { cy.get(rowSelector).within(() => { for (const [index, value] of expectedValues.entries()) { cy.log('CHECKING ', index, value); - if(value === undefined) continue + if (value === undefined) continue; if (typeof value == 'boolean') { const prefix = value ? '' : 'not.'; cy.getValue(`:nth-child(${index + 1})`).should(`${prefix}be.checked`); continue; } - cy.getValue(`:nth-child(${index + 1})`).should('equal', value) + cy.getValue(`:nth-child(${index + 1})`).should('equal', value); } }); });