cypress-real-events icon indicating copy to clipboard operation
cypress-real-events copied to clipboard

Include actionability waits in before commands

Open Andarist opened this issue 3 years ago • 3 comments

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.

Andarist avatar Jun 14 '22 08:06 Andarist

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.

dmtrKovalenko avatar Jun 28 '22 20:06 dmtrKovalenko

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.

Andarist avatar Jun 29 '22 08:06 Andarist

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()

anilanar avatar Oct 12 '23 08:10 anilanar