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

Interceptor subject not passed to alias flakiness in Cypress 12 #25966

Closed
apexskier opened this issue Feb 27, 2023 · 9 comments
Closed

Interceptor subject not passed to alias flakiness in Cypress 12 #25966

apexskier opened this issue Feb 27, 2023 · 9 comments
Assignees

Comments

@apexskier
Copy link

apexskier commented Feb 27, 2023

Current behavior

It appears Cypress isn't seeing the interceptor passed from the cy.intercept chainable sometimes. I'm getting the error:

You wrote code that looks like this:

`cy.as("randomizeIP")

A child command must be chained after a parent because it operates on a previous subject.

...

But my code is cy.intercept("...", ...).as("randomizeIP").

(In my screenshot I have type as set to "static", but I've seen it with and without that, the docs say it has no effect on interceptors)

e2e - Cypress - 2023-02-27 at 14 07 05@2x

Desired behavior

Interceptor subject should always be passed to .as and this should be stable as it was in V10

Test code to reproduce

cy.intercept("/orchestrator/v1/logout").as("postLogout");

I've seen reproductions <75% of the time.

Cypress Version

12.7.0

Node version

v18.12.1

Operating System

macOS 12.3.1

Debug Logs

No response

Other

No response

@mjhenkes
Copy link
Member

mjhenkes commented Mar 1, 2023

@apexskier, i threw together a repo to reproduce this and ran the intercept command 1000, but was unable to recreate. What am I missing?

https://github.com/mjhenkes/issue-25966-repro

@mjhenkes
Copy link
Member

Right now there doesn't seem to be enough information to reproduce the problem on our end. We'll have to close this issue until we can reproduce it. This does not mean that your issue is not happening - it just means that we do not have a path to move forward.

Please open comment on this issue with a reproducible example, and we can look into it further. Here are some tips for providing a Short, Self Contained, Correct, Example and our own Troubleshooting Cypress guide.

@apexskier
Copy link
Author

I don't seem to reproduce this in cypress 12.8 (or at least now)

@Sanzhanov
Copy link

@apexskier did you manage to overcome this issue? I get the same when using multiple cy.intercept()

@apexskier
Copy link
Author

It stopped happening for me without any known cause.

@craigmiller160
Copy link

Having this same issue on 13.6.3. Not sure what the cause could be. I also use a lot of intercept calls with aliases.

@inder128
Copy link

Having the same issue.

@jennifer-shehane
Copy link
Member

@craigmiller160 @inder128 Please create a new issue with a reproducible example

@craigmiller160
Copy link

Hello. I have just experienced this as I am trying to setup a gitlab pipeline. It is definitely a real issue. The best I can do is provide my mochawesome report from my tests.
cache.zip

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

6 participants