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

UI: "Found undefined alias for 'myalias'" when multiple aliases defined for element #4429

Closed
nitzel opened this issue Jun 11, 2019 · 3 comments

Comments

2 participants
@nitzel
Copy link

commented Jun 11, 2019

Current behavior:

When using .as('myalias') in a loop the message Found undefined alias for: 'myalias' shows up in the UI but it still works (in the console you can see that the alias resolved to two elements).

The message does not show up when the loop is only executed once.

Desired behavior:

This message should not appear and irritate the developer :)

Steps to reproduce: (app code and test code)

describe('Test', () => {
  it('test', () => {
    cy.visit('http://google.com');
    for (let i = 0; i < 2; i += 1) {
      cy.get('[name="btnK"]').as('search-button');
      cy.get('@search-button');
    }
  });
});

Versions

Cypress 3.3.1
OS Windows 10
Browsers Electron headed

PS:

Am I using aliases incorrectly here or is this just a misguided message from the UI?

@jennifer-shehane

This comment has been minimized.

Copy link
Member

commented Jun 17, 2019

Oh, yeah, this is a bug. This isn't even concerned with the loop, it seems that when using aliases for elements, if more than 1 is matching, the UI messes up a bit and displays this undefined message.

I believe this was introduced in this PR #2960

Code to reproduce:

it('test', () => {
  cy.visit('http://google.com')
  cy.get('[name="btnK"]').as('search-button')
  cy.get('@search-button')
  cy.get('[name="btnK"]').as('search-button')
  cy.get('@search-button')
})

@jennifer-shehane jennifer-shehane changed the title UI: "Found undefined alias for 'myalias'" in loops UI: "Found undefined alias for 'myalias'" when multiple aliases defined for element Jun 17, 2019

@cypress-bot

This comment has been minimized.

Copy link

commented Jun 26, 2019

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

@cypress-io cypress-io deleted a comment from cypress-bot bot Jun 26, 2019

@jennifer-shehane jennifer-shehane self-assigned this Jun 26, 2019

@cypress-bot

This comment has been minimized.

Copy link

commented Jun 27, 2019

Released in 3.3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.