xhr requests logged from within a cy.origin block are duplicated in the log #23840
Labels
stale
no activity on this issue for a long period
topic: cy.origin
Problems or enhancements related to cy.origin command
type: bug
Current behavior
xhr requests logged from within a cy.origin block are not matched with the pre-request.
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
The text was updated successfully, but these errors were encountered: