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

xhr requests logged from within a cy.origin block are duplicated in the log #23840

Closed
mjhenkes opened this issue Sep 15, 2022 · 4 comments
Closed
Labels
stale no activity on this issue for a long period topic: cy.origin Problems or enhancements related to cy.origin command type: bug

Comments

@mjhenkes
Copy link
Member

Current behavior

xhr requests logged from within a cy.origin block are not matched with the pre-request.

Screen Shot 2022-09-15 at 8 13 18 AM

additionally the pre request is returned with the wrong url, localhost instead of the origin url, in this case foobar.

Desired behavior

xhr requests should only show up in the log once.

Log incoming request here does not have an unmatched xhrLog to attach to.
https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cypress/proxy-logging.ts#L371

Because the xhr is logged from the secondary origin, proxy logging has no knowledge of it. One option could be to send a new message from the secondary to inform the primary of the unmatched xhr log.

You may also be able to monitor the existing add log event handler for an xhr log to find the unmatched xhr log.
https://github.com/cypress-io/cypress/blob/develop/packages/app/src/runner/event-manager.ts#L691

Test code to reproduce

Un-skip this test to see the behaviour

https://github.com/cypress-io/cypress/blob/develop/packages/driver/cypress/e2e/e2e/origin/snapshots.cy.ts#L29

Cypress Version

10.8.0

Node version

16.14.2

Operating System

mac

Debug Logs

No response

Other

No response

@mjhenkes mjhenkes added topic: cy.origin Problems or enhancements related to cy.origin command type: bug labels Sep 15, 2022
@flotwig
Copy link
Contributor

flotwig commented Feb 1, 2023

@mjhenkes now that cy.route() has been removed, is this issue is no longer valid?

@flotwig
Copy link
Contributor

flotwig commented Feb 1, 2023

Seems like this is still an issue, no snapshot is being attached to the request log still.

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Aug 1, 2023
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale no activity on this issue for a long period topic: cy.origin Problems or enhancements related to cy.origin command type: bug
Projects
None yet
Development

No branches or pull requests

3 participants