Skip to content

Alias for intercept is not working if overwriting cy.intercept command #9580

@bahmutov

Description

@bahmutov

Cypress v6.1.0

describe('intercept', () => {
  Cypress.Commands.overwrite('intercept', (intercept, ...args) => {
    return cy.log('intercept!').then(() => {
      return intercept(...args)
    })
  })

  it('is registered too late', () => {
    cy.visit('/')
    cy.intercept('/todos').as('todos')
    cy.wait('@todos')
  })
})

The alias todos is not recognized, but the routes table is showing it

Screen Shot 2020-12-08 at 9 35 57 PM

Note: even putting cy.wait into cy.then does not solve it - something is really off about this alias.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions