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

View File

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

View File

@ -52,16 +52,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
selector + .get(
'> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input' selector +
).invoke('val') '> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input'
)
.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');
@ -80,8 +82,16 @@ Cypress.Commands.add('checkOption', (selector) => {
// Global buttons // Global buttons
Cypress.Commands.add('saveCard', () => { 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(); cy.get('[title="Save"]').click();
}); });
/* Cypress.Commands.add('saveCard', () => {
cy.get('[title="Save"]').click();
}); */
Cypress.Commands.add('resetCard', () => { Cypress.Commands.add('resetCard', () => {
cy.get('[title="Reset"]').click(); cy.get('[title="Reset"]').click();
}); });
@ -132,13 +142,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);
} }
}); });
}); });