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 names fail if they include dots #3512

Closed
bahmutov opened this issue Feb 16, 2019 · 4 comments
Closed

Alias names fail if they include dots #3512

bahmutov opened this issue Feb 16, 2019 · 4 comments

Comments

@bahmutov
Copy link
Collaborator

@bahmutov bahmutov commented Feb 16, 2019

Cypress 3.1.5

This alias works fine

cy.spy(obj, 'foo').as('foo')
cy.get('@foo')

This crashes and burns during cy.get

cy.spy(obj, 'foo').as('obj.foo')
cy.get('@obj.foo')

screen shot 2019-02-16 at 10 44 23 am

Nice touch: the Command Log shows that spy is actually working, it is just cy.get that fails

@jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented May 22, 2019

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

@cypress-bot
Copy link

@cypress-bot cypress-bot bot commented May 23, 2019

Released in 3.3.1.

@6220119
Copy link

@6220119 6220119 commented Jan 5, 2021

Hi @jennifer-shehane , we've come across this issue when trying to wait for an alias-containing-dot of CyHttpMessages.IncomingHttpRequest in the latest version (6.2.1) of Cypress.

Our code looks something like this:

  cy.intercept('POST', REQUEST_END_POINT, (req) => {
      req.alias = 'alias-with-dot:image.jpg'
      req.reply(aStaticResponse)
    })
  }

  // trigger the request to be intercepted
  // ...

  cy.wait('@alias-with-dot:image.jpg') // ERROR: Fail to wait for the alias

Is this a limitation by design? As it seems to conflict with a feature mentioned in cypress-io/cypress-documentation#1573 (cy.get("@getList.all"))

@jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Jan 7, 2021

I don't believe this is by design. The dot in the alias works outside of it being defined in this req.alias, so I think it's just an oversight with cy.intercept() there. I've opened a new issue here: #14444 if you'd like to comment in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants