Skip to content

cy.intercept logging option marks route as stubbed when it is not #29324

@verheyenkoen

Description

@verheyenkoen

Description

When you set the log option for a cy.intercept command, it is shown as being stubbed, even if not stubbed.

URL of Issue(s)

https://docs.cypress.io/api/commands/intercept#Disabling-logs-for-a-request

Steps to replicate

  1. Write a test for a page that performs an AJAX callback.
  2. Include a cy.intercept for the AJAX callback and pass on { log: false | true } as the second argument (or third argument if you use the cy.intercept(method, url, staticResponse) overload).
  3. Write a command that triggers the AJAX callback to fire.
  4. Run the test with cypress open
  5. Analyse the command log and console properties (see below for concrete example).
    It marks the route as being stubbed, even though the request went to origin (since there was nothing provided to stub the route).

Note this happens also if you explicitly enable logging with { log: true }. Obviously if you suppress logging, you won't have a line in the command log for this, but it is displayed as stubbed in the routes section above the test body.

Browser

Electron 118

Device

  • PC
  • Mac
  • iPhone
  • iPad
  • Android Phone
  • Android Tablet

Additional Information

Eg. just this intercept command produces the following falsehoods:

cy.intercept({ method: "GET", url: "/dashboard-icon" }, { log: true });

In routes section of command log it displays "Yes" in the "Stubbed" column:
image

In the command log (only if { log: true }) it displays a circle instead of a disc, which indicates a stubbed response:
image

When you click that line in the command log (only if { log: true }), in the console properties display multiple stubbing related false-positives.
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    stage: needs investigatingSomeone from Cypress needs to look at thisstaleno activity on this issue for a long periodtype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions