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 · Fixed by #4105
Closed

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

flotwig opened this issue May 17, 2019 · 2 comments · Fixed by #4105
Assignees
Labels
pkg/server This is due to an issue in the packages/server directory

Comments

@flotwig
Copy link
Contributor

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 flotwig added the pkg/server This is due to an issue in the packages/server directory label May 17, 2019
@flotwig flotwig self-assigned this May 17, 2019
@flotwig
Copy link
Contributor Author

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
Contributor

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
Labels
pkg/server This is due to an issue in the packages/server directory
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant