forked from verdnatura/salix-front
refs #7113 fix test
This commit is contained in:
parent
b3a889e8f6
commit
c621ccb5a6
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue