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

Comments

1 participant
@flotwig
Copy link
Member

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 label May 17, 2019

@flotwig flotwig self-assigned this May 17, 2019

@flotwig flotwig referenced this issue May 17, 2019

Merged

Don't send Cypress error HTML on network errors #4105

3 of 3 tasks complete
@flotwig

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link

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
You can’t perform that action at this time.