fix: refs #8581 enhance form filling command by adding backspace before input
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
7bd6c92aed
commit
c729c6a241
|
@ -173,7 +173,9 @@ Cypress.Commands.add('fillInForm', (obj, opts = {}) => {
|
||||||
const field = obj[key];
|
const field = obj[key];
|
||||||
if (!field) return;
|
if (!field) return;
|
||||||
if (typeof field == 'string')
|
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;
|
const { type, val } = field;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -181,7 +183,9 @@ Cypress.Commands.add('fillInForm', (obj, opts = {}) => {
|
||||||
cy.selectOption(el, val);
|
cy.selectOption(el, val);
|
||||||
break;
|
break;
|
||||||
case 'date':
|
case 'date':
|
||||||
cy.get(el).type(`{selectall}${val.split('-').join('')}`);
|
cy.get(el).type(
|
||||||
|
`{selectall}{backspace}${val.split('-').join('')}`,
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case 'time':
|
case 'time':
|
||||||
cy.get(el).click();
|
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__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();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
cy.wrap(el).type(`{selectall}{backspace}${val}`, { delay: 0 });
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue