-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: Add keystrokeDelay #15683
feat: Add keystrokeDelay #15683
Conversation
Thanks for taking the time to open a PR!
|
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.
@herecydev Thanks! Can you add tests around this new behavior?
We need tests that:
- the default keystroke still works
- setting a new config value increases the keystroke delay
- setting a global config value overwrites a delay value set in the type command
- setting an invalid value to keystrokeDelay (like 'foo') will error
- setting keystroke to false or 0 disables keystroke delay
- the types are correctly tested
- etc
There is a Contributing Guide that covers how to contribute and get Cypress running locally in generally here: https://github.com/cypress-io/cypress/blob/develop/.github/CONTRIBUTING.md
To run the tests:
- within
cypress
root, runyarn
- run
yarn workspace @packages/driver cypress:open
- click on the test you're writing to run it within Cypress
Instructions for running the driver
tests can always be found here: https://github.com/cypress-io/cypress/blob/develop/packages/driver/README.md
@jennifer-shehane Yep, I'll find some time to add those, I think I kept it as draft to garner some feedback initially. If you're happy in principal that the implementation is reasonable, I'll add some tests to prove it. |
@jennifer-shehane Some initial tests added which I believe covers this:
Can you link some existing tests that cover the following, would be really helpful to follow along how these are already covered;
Also, I'm getting some issues with the CI failing around missing percy tokens, which seems totally unrelated to the changes. How do I approach CI failures, given I can't rerun them? |
Yah, I'm looking into the percy token. That shouldn't error like that, so ignore that for now. Testing the error on an option that's of the wrong type would be similar to this structure: https://github.com/cypress-io/cypress/blob/develop/packages/driver/cypress/integration/commands/actions/type_spec.js#L2535:L2535 Testing the types would be something like this: https://github.com/cypress-io/cypress/blob/develop/cli/types/tests/actions.ts#L85:L85 |
Hey @herecydev, will you have time to add the extra tests? |
I will and I haven't forgotten. Just on holiday at the moment, but will endeavour to finish those up next week. Sorry for the delay. |
@jennifer-shehane I think all the correct tests have now been written. I'm still a little hesistant about the extent of testing invalid types. You can see my efforts to validate an invalid delay, but I can't see other configuration going through similar testing. Take In addition, after rereading this test criteria "setting a global config value overwrites a delay value set in the type command". I disagree with that behavior. I think it's meant to be flipped, and have written a test on that assumption. |
Hey @herecydev, appreciate the work on this. The team discussed this and decided we'd like this to work through a method like There's nothing further you need to do. Just wanted to let you know, since this won't be getting merged immediately. We'll take it from here and get this in as soon as we can. |
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.
Needs some minor changes. I think this also needs to be included in the test config types: https://github.com/cypress-io/cypress/blob/develop/cli/types/cypress.d.ts#L2794:L2794
I think we should discuss the final implementation in our team touchpoint to get some feedback from the whole team on the test config + Keyboard.defaults usage.
I know test config is not a 1to1 reflection of only configuration values, but currently the only exception is 'browser'. That's probably the only thing to go over.
cli/types/cypress.d.ts
Outdated
* @see https://on.cypress.io/keyboard-api | ||
*/ | ||
Keyboard: { | ||
defaults(options: Partial<ScreenshotDefaultsOptions>): void |
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.
Think you mistyped this
defaults(options: Partial<ScreenshotDefaultsOptions>): void | |
defaults(options: Partial<KeyboardDefaultsOptions>): void |
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.
I manually tested this and looked over the code. Looks good. Everyone seems satisfied with the API for now. Thanks again @herecydev!
These tests passed - looks like the Cypress checks are stuck running for some reason and are not up to date with latest reruns. Going to merge in. |
* Add keystrokeDelay * Config tests * Add proper comments * Add some tests for configuring timeout * Add tests for false values * Few additional tests * Rename test * feat: add Cypress.Keyboard.defaults() for specifying default keystrokeDelay * use test-configuration on link * remove obsolete error message * fix types and add type tests * fix types tests * fix type test Co-authored-by: Chris Breiding <chrisbreiding@gmail.com>
keystrokeDelay
configuration option #566User facing changelog
cy.type()
withCypress.Keyboard.defaults()
or via test configuration.PR Tasks
cypress-documentation
? 7.6.0 Release cypress-documentation#3977type definitions
?cypress.schema.json
?