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

Include actionability waits in before commands #270

Open
Andarist opened this issue Jun 14, 2022 · 3 comments
Open

Include actionability waits in before commands #270

Andarist opened this issue Jun 14, 2022 · 3 comments

Comments

@Andarist
Copy link
Collaborator

I've noticed some flaky tests in our codebase and I think that I've diagnosed them to be related to the fact that cypress-real-events do not wait for "actionability" of the item.

There is no related logic in the realClick's implementation:
https://github.com/dmtrKovalenko/cypress-real-events/blob/660025b0dac4e69ef6a982eeb0a26e025d3a7696/src/commands/realClick.ts
but we can see in Cypress' click implementation that it includes such logic by default:
https://github.com/cypress-io/cypress/blob/380f4e7d6036fc4fbd8c1443c011cb8414b231a7/packages/driver/src/cy/commands/actions/click.ts#L193

I've spotted this in my Cypress report and it seems to verify my conclusion:
Screenshot 2022-06-14 at 10 29 25

I could work on adding the actionability waits if you agree that this is something that should be included by default. The API of $actionability.verify looks a little bit weird and perhaps you would have some tips as to how I could actually use it here.

@dmtrKovalenko
Copy link
Owner

dmtrKovalenko commented Jun 28, 2022

I've been thinking about this when making this package and the real problem here is that actionability is a private Cypress API and as far as I remember working on cypress they are changing it pretty often.

So I feel a little bit unsafe taking the private API and as far as you noticed this package doesn't have first-class maintenance so this can be an arrow in the knee at some point.

@Andarist
Copy link
Collaborator Author

Ye, so I guess the best course of action would be to ask Cypress to expose this as a first-class API cause without it implementing this kind of custom command while matching the "look and feel" of the built-in ones is nearly impossible.

@anilanar
Copy link

anilanar commented Oct 12, 2023

I wonder if there's a smart way to work around this by using one of cypress's built-in commands that would be a no-op but would make it run actionability tests before we dispatch realX events.

Maybe trigger does the job? According to actionability docs, trigger is one of such commands. Then for example: foo.trigger('fake-event').realClick()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants