-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
type: regressionA bug that didn't appear until a specific Cy version releaseA bug that didn't appear until a specific Cy version releasev3.5.0 🐛Issue present since 3.5.0Issue present since 3.5.0
Description
Current behavior:
Cypress 3.5.0 is no longer behaving the same way as executing outside of Cypress with regards to an input with an onFocus handler implemented as e => e.target.select() (select-on-focus behavior). It does not appear to select the text (the onFocus handler is called, though). The application code has not changed and works "in real life" but fails in Cypress. This worked in Cypress 3.4.1.
Desired behavior:
The behavior should be consistent with running outside of Cypress, as it was in previous versions.
Steps to reproduce: (app code and test code)
App code:
<input defaultValue="42" onFocus={e => e.target.select()} />Test code:
cy.get('input')
.should('have.value', '42')
.click()
// input has just been focused so its value should now be selected
// (and thus typing would replace the value, not append to it)
.type('36')
// fail - input value is 4236
.should('have.value', '36');Reproduction repository:
https://github.com/wKovacs64/cypress-350-select-on-focus
Versions
Cypress 3.5.0
Windows 10, Linux (Circle CI)
Chrome 78, Electron 73
lukeapage
Metadata
Metadata
Assignees
Labels
type: regressionA bug that didn't appear until a specific Cy version releaseA bug that didn't appear until a specific Cy version releasev3.5.0 🐛Issue present since 3.5.0Issue present since 3.5.0