fix: refs #6942 tests e2e
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-03-07 14:54:20 +01:00
parent 3b0d3b4998
commit 92dcff6d49
3 changed files with 56 additions and 19 deletions

View File

@ -312,17 +312,32 @@ watch(formUrl, async () => {
/>
<QBtnDropdown
v-if="$props.goTo && $props.defaultSave"
@click="onSubmit"
:label="tMobile('globals.save')"
@click="onSumbitAndGo"
:label="tMobile('globals.saveAndContinue')"
:title="t('globals.saveAndContinue')"
:disable="!hasChanges"
color="primary"
icon="save"
split
>
<QList>
<QItem color="primary" clickable v-close-popup @click="onSumbitAndGo">
<QItem
color="primary"
clickable
v-close-popup
@click="onSubmit"
:title="t('globals.save')"
>
<QItemSection>
<QItemLabel>{{ t('globals.saveAndContinue') }}</QItemLabel>
<QItemLabel>
<QIcon
name="save"
color="white"
class="q-mr-sm"
size="sm"
/>
{{ t('globals.save').toUpperCase() }}
</QItemLabel>
</QItemSection>
</QItem>
</QList>

View File

@ -254,19 +254,31 @@ watch(formUrl, async () => {
/>
<QBtnDropdown
v-if="$props.goTo"
@click="save"
:label="tMobile('globals.save')"
@click="saveAndGo"
:label="tMobile('globals.saveAndContinue')"
:title="t('globals.saveAndContinue')"
:disable="!hasChanges"
color="primary"
icon="save"
split
>
<QList>
<QItem color="primary" clickable v-close-popup @click="saveAndGo">
<QItem
clickable
v-close-popup
@click="save"
:title="t('globals.save')"
>
<QItemSection>
<QItemLabel>{{
t('globals.saveAndContinue')
}}</QItemLabel>
<QItemLabel>
<QIcon
name="save"
color="white"
class="q-mr-sm"
size="sm"
/>
{{ t('globals.save').toUpperCase() }}
</QItemLabel>
</QItemSection>
</QItem>
</QList>

View File

@ -52,16 +52,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');
@ -80,8 +82,16 @@ Cypress.Commands.add('checkOption', (selector) => {
// Global buttons
Cypress.Commands.add('saveCard', () => {
const dropdownArrow = '.q-btn-dropdown__arrow-container > .q-btn__content > .q-icon';
cy.get('#st-actions').then(($el) => {
if ($el.find(dropdownArrow).length) cy.get(dropdownArrow).click();
});
cy.get('[title="Save"]').click();
});
/* Cypress.Commands.add('saveCard', () => {
cy.get('[title="Save"]').click();
}); */
Cypress.Commands.add('resetCard', () => {
cy.get('[title="Reset"]').click();
});
@ -132,13 +142,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);
}
});
});