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

fix: ensure that proxy logs are updated after the xhr has actually completed #21373

Merged

Conversation

ryanthemanuel
Copy link
Collaborator

User facing changelog

XHR calls will now properly display the response body in the command log

Additional details

When the proxy gets the close event for the response, we send the response:received event to the client. There is a race condition where this might reach the client before the XHR readystate has been updated on the client. If this happens, the xhr that gets attached to the log will not have a response body yet. To fix this, we will listen to the onload event of the xhr call if the xhr call hasn't completed and delay updating the proxy logging response until then.

How has the user experience changed?

n/a

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [na] Has a PR for user-facing changes been opened in cypress-documentation?
  • [na] Have API changes been updated in the type definitions?
  • [na] Have new configuration options been added to the cypress.schema.json?

@ryanthemanuel ryanthemanuel requested a review from a team as a code owner May 6, 2022 18:03
@ryanthemanuel ryanthemanuel requested review from jennifer-shehane and removed request for a team May 6, 2022 18:03
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 6, 2022

Thanks for taking the time to open a PR!

@ryanthemanuel ryanthemanuel requested review from flotwig and mschile and removed request for jennifer-shehane May 6, 2022 18:16
@cypress
Copy link

cypress bot commented May 6, 2022



Test summary

39082 0 465 4Flakiness 1


Run details

Project cypress
Status Passed
Commit 4714c81
Started May 9, 2022 1:56 PM
Ended May 9, 2022 2:14 PM
Duration 17:53 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/integration/e2e/origin/commands/navigation.spec.ts Flakiness
1 cy.origin navigation > .visit() > supports auth options and adding auth to subsequent requests

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

packages/driver/src/cypress/proxy-logging.ts Outdated Show resolved Hide resolved
packages/driver/src/cypress/proxy-logging.ts Outdated Show resolved Hide resolved
}

if (proxyRequest.xhr && proxyRequest.xhr.xhr.readyState !== XMLHttpRequest.DONE) {
proxyRequest.xhr.xhr.addEventListener('load', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@flotwig flotwig changed the title fix: ensure that we update the proxy logging after xhr has actually completed fix: ensure that proxy logs are updated after the xhr has actually completed May 6, 2022
@ryanthemanuel ryanthemanuel merged commit 0d958dc into develop May 9, 2022
@ryanthemanuel ryanthemanuel deleted the ryanm/fix/21361-fix-proxy-logging-with-xhr-develop branch May 9, 2022 14:24
AtofStryker pushed a commit that referenced this pull request May 9, 2022
…mpleted (#21373)

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
tgriesser added a commit that referenced this pull request May 13, 2022
* 10.0-release: (22 commits)
  fix: migrate multiples projects when in global mode (#21458)
  test: fix flaky cy-in-cy selector validity test (#21360)
  chore: remove unused codeGenGlobs (#21438)
  fix: use correct path for scaffolding spec on CT (#21411)
  fix: remove breaking options from testing type on migration (#21437)
  fix: test-recording instructions in Component Test mode (#21422)
  feat: distinguish app vs launchpad utm_source when using utm params (#21424)
  chore: update stubbed cloud types (#21451)
  chore: change to yarn registry
  fix(sessions): refactor flows, fix grouping bugs and align validation fail text (#21379)
  chore(sessions): more driver tests (#21378)
  chore: rename domain_fn to origin_fn (#21413)
  chore: release 9.6.1 (#21404)
  fix: ensure that proxy logs are updated after the xhr has actually completed (#21373)
  chore: Re-organize tests in assertions_spec.js (#21283)
  chore: Distribute tests to desktop-gui containers. Make `desktop-gui` tests faster! (#21305)
  chore(sessions): add additional tests (#21338)
  fix: Allow submit button to be outside of the form for implicit submission (#21279)
  fix(launcher): support Firefox as a snap (#21328)
  chore(sessions): break out sessions manager code and add unit tests (#21268)
  ...
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

Successfully merging this pull request may close these issues.

Response body sometimes not displayed in console props for xhr request
4 participants