Skip to content

Cypress pauses every single request in CDP/Web Extension Unnecessarily  #26620

Description

@AtofStryker

Current behavior

Currently in Electron, Chrome, and Firefox, Cypress pauses every single request coming from the app to determine if the frame making the request is the AUT frame. This is really only needed to happen on ResourceType document requests. We have some data to suggest that possibly not pausing on every single request entering CDP/Web extension might improve performance of general network timings in the form of reducing blocking time.

Desired behavior

Cypress requests should only be paused if the request being made is a document request. This scope of work does not include support for electron as an electron upgrade is needed to support web filters (see issue #26621)

Right now, our invocation of Fetch.RequestPaused takes in every single request from the browser. However, the method Fetch.Enable takes an optional RequestPattern. For the use of cy.origin(), Cypress really only needs to intercept Document resourceType, which should greatly reduce the amount of intercepted requests and hypothetically would reduce blocking time.

Fetch.Enable is really the chromium mechanism we use to pause requests, but we leverage other methods in Electron and Firefox to accomplish the same thing. The good thing for us is that these methods, like onBeforeSendHeaders in electron, takes a WebRequestFilter option, and the extension method for Firefox also takes a RequestFilter, so we should be able to implement very similar logic across our supported browsers.

Test code to reproduce

N/A. enable browser CDP debug logs to see every inbound request in the pause handler

Cypress Version

12.11

Node version

v16.16.0

Operating System

macOS 12.6

Debug Logs

No response

Other

No response

Activity

  1. self-assigned this
    on Apr 28, 2023
  2. cypress-bot commented on Aug 1, 2023

    @cypress-bot
    Contributor

    Released in 12.17.3.

    This comment thread has been locked. If you are still experiencing this issue after upgrading to
    Cypress v12.17.3, please open a new issue.

  3. locked as resolved and limited conversation to collaborators on Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions