Skip to content
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

Documentation says it's unsafe to chain after .clear() but has an example with .clear().type("xyz") #5374

Open
m-gug opened this issue Jul 12, 2023 · 3 comments
Labels
content: rewrite triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team.

Comments

@m-gug
Copy link

m-gug commented Jul 12, 2023

Subject

chaining after .clear()

Description

The documentation (and the linting) says, that it is unsafe to chain commands after .clear().
https://docs.cypress.io/api/commands/clear#__docusaurus_skipToContent_fallback

But the same documentation has an example (https://docs.cypress.io/api/commands/clear#No-Args) where it chains a .type() command after the .clear(), which is a little confusing and inconsistent.

Is it safe to chain a type after a clear?

@nagash77 nagash77 added the triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. label Jul 12, 2023
@nagash77
Copy link
Contributor

@m-gug good catch! You should NOT chain off of clear()

I would suggest you do something like this instead:

cy.get('textarea').clear()
cy.get('textarea').type('Hello, World')

@MikeMcC399
Copy link
Contributor

This also needs fixing for
https://docs.cypress.io/api/commands/clear#Usage

@jennifer-shehane

If @jaffrepaul is no longer available, perhaps you could re-assign or remove the assignment?

@jennifer-shehane
Copy link
Member

Open to a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content: rewrite triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team.
Projects
None yet
Development

No branches or pull requests

5 participants