#8581 invoiceIn e2e #1452

Merged
jorgep merged 153 commits from 8581-invoiceinE2e into dev 2025-03-20 08:58:01 +00:00
1 changed files with 35 additions and 29 deletions
Showing only changes of commit 94cc4f2950 - Show all commits

View File

@ -142,36 +142,41 @@ Cypress.Commands.add('countSelectOptions', (selector, option) => {
cy.get('.q-menu .q-item').should('have.length', option);
});
Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
cy.waitForElement(form);
cy.get(`${form} input`).each(([el]) => {
cy.wrap(el)
.invoke('attr', 'aria-label')
.then((ariaLabel) => {
const field = obj[ariaLabel];
if (!field) return;
Cypress.Commands.add(
'fillInForm',
(obj, { form = '.q-form > .q-card', attr = 'aria-label' }) => {
cy.waitForElement(form);
cy.get(`${form} input`).each(([el]) => {
cy.wrap(el)
.invoke('attr', attr)
.then((ariaLabel) => {
const field = obj[ariaLabel];
if (!field) return;
const { type, val } = field;
switch (type) {
case 'select':
cy.selectOption(el, val);
break;
case 'date':
cy.get(el).type(val.split('-').join(''));
break;
case 'time':
cy.get(el).click();
cy.get('.q-time .q-time__clock').contains(val.h).click();
cy.get('.q-time .q-time__clock').contains(val.m).click();
cy.get('.q-time .q-time__link').contains(val.x).click();
break;
default:
cy.wrap(el).type(val);
break;
}
});
});
});
const { type, val } = field;
switch (type) {
case 'select':
cy.selectOption(el, val);
break;
case 'date':
cy.get(el).type(
`{selectall}{backspace}${val.split('-').join('')}`,
);
break;
case 'time':
cy.get(el).click();
cy.get('.q-time .q-time__clock').contains(val.h).click();
cy.get('.q-time .q-time__clock').contains(val.m).click();
cy.get('.q-time .q-time__link').contains(val.x).click();
break;
default:
cy.wrap(el).type(`{selectall}{backspace}${val}`);
break;
}
});
});
},
);
Cypress.Commands.add('checkOption', (selector) => {
cy.get(selector).find('.q-checkbox__inner').click();
@ -381,6 +386,7 @@ Cypress.Commands.add('clickButtonWith', (type, value) => {
Cypress.Commands.add('clickButtonWithIcon', (iconClass) => {
cy.get(`.q-icon.${iconClass}`).parent().click();
});
Cypress.Commands.add('clickButtonWithText', (buttonText) => {
cy.get('.q-btn').contains(buttonText).click();
});