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

Alias name for req.alias containing a dot fail to intercept #14444

Closed
jennifer-shehane opened this issue Jan 7, 2021 · 2 comments · Fixed by #14621
Closed

Alias name for req.alias containing a dot fail to intercept #14444

jennifer-shehane opened this issue Jan 7, 2021 · 2 comments · Fixed by #14621

Comments

@jennifer-shehane
Copy link
Member

Current behavior

This was first mentioned here: #3512 (comment)

Alias names containing a dot in the req.alias (like get.url) cause the cy.wait() to timeout.

This does not occur when setting the alias name within an .as() command (.as('get.url')).

Test code to reproduce

it('alias without dot', () => {
  cy.intercept('/users', (req) => {
    req.alias = 'getUrl'
    req.reply('foo')
  })
  cy.visit('https://example.com')
  cy.window().then((win) => {
    const xhr = new win.XMLHttpRequest()
    xhr.open('GET', '/users')
    xhr.send()
  })
  // ✅ passes
  cy.wait('@getUrl')
})

it('alias with dot', () => {
  cy.intercept('/users', (req) => {
    req.alias = 'get.url'
    req.reply('foo')
  })
  cy.visit('https://example.com')
  cy.window().then((win) => {
    const xhr = new win.XMLHttpRequest()
    xhr.open('GET', '/users')
    xhr.send()
  })
  // ❗️ fails, cy.wait() times out
  cy.wait('@get.url')
})

Screen Shot 2021-01-07 at 4 04 08 PM

Versions

Cypress 6.2.1

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jan 22, 2021

The code for this is done in cypress-io/cypress#14621, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Jan 22, 2021
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Feb 1, 2021

Released in 6.4.0.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Feb 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant