From c729c6a241f73039425a68b973f6f3af76734219 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 14 Mar 2025 13:21:05 +0100 Subject: [PATCH] fix: refs #8581 enhance form filling command by adding backspace before input --- test/cypress/support/commands.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 6572a5afa..8a09c31e2 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -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; } }); });