UI: "Found undefined alias for 'myalias'" when multiple aliases defined for element
See original GitHub issueCurrent 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?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Webpack doesn't resolve properly my alias - Stack Overflow
Finnaly I found the problem was that I wrote resolve twice. And the second resolve override the previous one. My code is like...
Read more >Defining Aliases for a User Catalog - IBM
You can define aliases for the catalog in the same job in which you define the catalog by including DEFINE ALIAS commands after...
Read more >Aliases | Apache Solr Reference Guide 8.5
Any alias (standard or routed) that references multiple collections may complicate relevancy. By default, SolrCloud scores documents on a per-shard basis.
Read more >Why doesn't my Bash script recognize aliases?
If you look into the bash manpage you find: Aliases are not expanded when the shell is not interactive, unless the expand_aliases shell...
Read more >SELECT | InterSystems IRIS Data Platform 2022.2
FROM table AS tableAlias, table2 AS tableAlias2, ... sets an alias for multiple tables. You can use table aliases to indicate which table...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 https://github.com/cypress-io/cypress/pull/2960
Code to reproduce:
This issue will be closed to further comment as the exact issue here was resolved and tested.
If you’re experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.