This commit is contained in:
parent
b3a889e8f6
commit
c621ccb5a6
|
@ -38,6 +38,15 @@ Cypress.Commands.add('login', (user) => {
|
||||||
},
|
},
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
window.localStorage.setItem('token', response.body.token);
|
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
|
// Si es un QSelect
|
||||||
if ($el.find('.q-select__dropdown-icon').length) {
|
if ($el.find('.q-select__dropdown-icon').length) {
|
||||||
return cy.get(
|
return cy
|
||||||
|
.get(
|
||||||
selector +
|
selector +
|
||||||
'> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input'
|
'> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input'
|
||||||
).invoke('val')
|
)
|
||||||
|
.invoke('val');
|
||||||
}
|
}
|
||||||
// Si es un QSelect
|
// Si es un QSelect
|
||||||
if ($el.find('span').length) {
|
if ($el.find('span').length) {
|
||||||
return cy.get(
|
return cy.get(selector + ' span').then(($span) => {
|
||||||
selector + ' span'
|
return $span[0].innerText;
|
||||||
).then(($span) => { return $span[0].innerText })
|
});
|
||||||
}
|
}
|
||||||
// Puedes añadir un log o lanzar un error si el elemento no es reconocido
|
// Puedes añadir un log o lanzar un error si el elemento no es reconocido
|
||||||
cy.log('Elemento no soportado');
|
cy.log('Elemento no soportado');
|
||||||
|
@ -132,13 +143,13 @@ Cypress.Commands.add('validateRow', (rowSelector, expectedValues) => {
|
||||||
cy.get(rowSelector).within(() => {
|
cy.get(rowSelector).within(() => {
|
||||||
for (const [index, value] of expectedValues.entries()) {
|
for (const [index, value] of expectedValues.entries()) {
|
||||||
cy.log('CHECKING ', index, value);
|
cy.log('CHECKING ', index, value);
|
||||||
if(value === undefined) continue
|
if (value === undefined) continue;
|
||||||
if (typeof value == 'boolean') {
|
if (typeof value == 'boolean') {
|
||||||
const prefix = value ? '' : 'not.';
|
const prefix = value ? '' : 'not.';
|
||||||
cy.getValue(`:nth-child(${index + 1})`).should(`${prefix}be.checked`);
|
cy.getValue(`:nth-child(${index + 1})`).should(`${prefix}be.checked`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cy.getValue(`:nth-child(${index + 1})`).should('equal', value)
|
cy.getValue(`:nth-child(${index + 1})`).should('equal', value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue