-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(studio): generate clear before type commands #15145
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ Flakiness
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yah, I actually ran into this situation when I first used Studio. I was trying to write something like 'Cypress', but I misspelled it so started backspacing and fixing and it ended up like 'Cp{backspace}ypress' and I was like....well....yah I guess that is what I typed...
I think this is a much more intuitive implementation. Will it meet 100% of use cases? Probably not, but I think it will hit the majority.
The cy.get('input').clear()
and cy.get('input').type('message')
would be nice to clear up doing extra gets, but it works fine.
@jennifer-shehane Not quite sure what you mean at the end there - do you mean combining them into something like |
User facing changelog
Updates how Studio records typing by using the value of the input rather than the keys that were pressed. Studio no longer records pressing special keys (such as arrows or ctrl) except for Enter.
Additional details
While it could be beneficial to record all keys that were pressed in an input field, usually users only care about the content within that field and are often pressing characters like backspace or arrows in order to correct a mistype. With that said, while these changes may hurt a portion of users, I feel that a majority of users will benefit from the cleaner code that does what they want.
In addition, the real issue arises when users place their cursor in the middle of the input field, mode/delete some characters by highlighting, or change text that was already in the input field. These are events that are extremely difficult to track accurately and would be really tough for us to generate a system that compares the diff before/after an event and generates a appropriate Cypress commands.
Therefore, before every typing event we'll record a
cy.clear()
and thency.type()
with the value of whatever is in that input field. While this will not perfectly mimic the user's behavior and might potentially cause some issues with use cases that break when the input is cleared (or something like that), for the majority of users it will behave in the way that they would expect it to, with the final value being exactly what they see when they record the actions.I'm marking this as a feature rather than a fix since it fundamentally changes the behavior of studio when recording typing. This would probably be a breaking change but since we're experimental it's okay.
How has the user experience changed?
When modifying an input with existing value:
What would have happened before these changes:
PR Tasks
cypress-documentation
?