test: refs #8224 fix fillInForm use q-select
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Alex Moreno 2025-04-25 14:28:09 +02:00
parent b1d637f382
commit d79d37dcaf
1 changed files with 10 additions and 10 deletions

View File

@ -183,23 +183,23 @@ Cypress.Commands.add('fillInForm', (obj, opts = {}) => {
.then((key) => { .then((key) => {
const field = obj[key]; const field = obj[key];
if (!field) return; if (!field) return;
if (typeof field == 'string')
return cy
.wrap(el)
.type(`{selectall}{backspace}${field}`, { delay: 0 });
const { type, val } = field; const { type, val } =
typeof field === 'string' ? { type: 'string', val: field } : field;
switch (type) { switch (type) {
case 'select': case 'select':
cy.selectOption(el, val); cy.wrap(el)
.closest('.q-select')
.then(($select) => {
cy.selectOption($select, val);
});
break; break;
case 'date': case 'date':
cy.get(el).type( cy.wrap(el).type(`{selectall}{backspace}${val}`).blur();
`{selectall}{backspace}${val}`,
).blur();
break; break;
case 'time': case 'time':
cy.get(el).click(); cy.wrap(el).click();
cy.get('.q-time .q-time__clock').contains(val.h).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__clock').contains(val.m).click();
cy.get('.q-time .q-time__link').contains(val.x).click(); cy.get('.q-time .q-time__link').contains(val.x).click();