diff --git a/cypress/support/customCommands/sharedElementsOperations/selects.js b/cypress/support/customCommands/sharedElementsOperations/selects.js index 5e5a03763..7a5e984ef 100644 --- a/cypress/support/customCommands/sharedElementsOperations/selects.js +++ b/cypress/support/customCommands/sharedElementsOperations/selects.js @@ -38,9 +38,17 @@ Cypress.Commands.add("fillAutocompleteSelect", (selectSelector, option) => { .get(BUTTON_SELECTORS.selectOption) .should("be.visible"); if (option) { - cy.get(selectSelector).clearAndType(option); - cy.contains(BUTTON_SELECTORS.selectOption, option).click(); - cy.wrap(option).as("option"); + cy.get(BUTTON_SELECTORS.selectOption) + .first() + .then(detachedOption => { + cy.get(selectSelector).clear(); + cy.get(selectSelector).type(option); + cy.wrap(detachedOption).should(det => { + Cypress.dom.isDetached(det); + }); + cy.contains(BUTTON_SELECTORS.selectOption, option).click(); + cy.wrap(option).as("option"); + }); } else { cy.get(BUTTON_SELECTORS.selectOption) .wait(1000)