fix: refs #8581 enhance form filling command by adding backspace before input
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jorge Penadés 2025-03-14 13:21:05 +01:00
parent 7bd6c92aed
commit c729c6a241
1 changed files with 9 additions and 2 deletions

View File

@ -173,7 +173,9 @@ Cypress.Commands.add('fillInForm', (obj, opts = {}) => {
const field = obj[key];
if (!field) return;
if (typeof field == 'string')
return cy.wrap(el).type(`{selectall}${field}`, { delay: 0 });
return cy
.wrap(el)
.type(`{selectall}{backspace}${field}`, { delay: 0 });
const { type, val } = field;
switch (type) {
@ -181,7 +183,9 @@ Cypress.Commands.add('fillInForm', (obj, opts = {}) => {
cy.selectOption(el, val);
break;
case 'date':
cy.get(el).type(`{selectall}${val.split('-').join('')}`);
cy.get(el).type(
`{selectall}{backspace}${val.split('-').join('')}`,
);
break;
case 'time':
cy.get(el).click();
@ -189,6 +193,9 @@ Cypress.Commands.add('fillInForm', (obj, opts = {}) => {
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}`, { delay: 0 });
break;
}
});
});