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

Buffer cy.visit()'s response completely before resolving #4231

Closed
flotwig opened this issue May 17, 2019 · 2 comments
Closed

Buffer cy.visit()'s response completely before resolving #4231

flotwig opened this issue May 17, 2019 · 2 comments
Assignees

Comments

@flotwig
Copy link
Member

@flotwig flotwig commented May 17, 2019

Current flow

  1. User issues cy.visit('http://example.com')
  2. Cypress makes a request to http://example.com and buffers it internally.
  3. As soon as successful headers are received and redirects are resolved, Cypress navigates the AUT iframe to load the buffered http://example.com response, which may still be streaming.

This has problems:

  • it means that we can only identify errors like ECONNRESET or non-2xx error codes, but not errors like empty response bodies or timeouts while streaming the response
  • it means we really can't reliably fail a test based on a cy.visit() failing

Proposed flow

  1. User issues cy.visit('http://example.com')
  2. Cypress makes a request to http://example.com and buffers it internally.
  3. As soon as the complete response is buffered and the response ends, Cypress navigates the AUT iframe to load the buffered http://example.com response, which may not still be streaming.

This may add a small delay to the user's test; however, it should also make tests much more reliable and make it easier to diagnose cy.visit() errors.

@flotwig
Copy link
Member Author

@flotwig flotwig commented May 17, 2019

The code for this is done in cypress-io/cypress#4105, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link

@cypress-bot cypress-bot bot commented May 17, 2019

Released in 3.3.0.

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

Successfully merging a pull request may close this issue.

1 participant