cypress-documentation
                                
                                 cypress-documentation copied to clipboard
                                
                                    cypress-documentation copied to clipboard
                            
                            
                            
                        [Documentation] Add incorrect usage to `cy.get`
What would you like?
I have been declaring a variable with cy.get and was causing inconsistency as to which element it was asserting. The documentation doesn't state that this is actually an incorrect way of using it. Here is an example
const nameInput = cy.get('[data-testid="name-input"]');
const addressInput = cy.get('[data-testid="google-autocomplete-input"]');
addressInput.type('mcdonalds north road');
cy.wait(1000);
addressInput.type('{downArrow}{enter}');
nameInput.should('have.value', `McDonald's`);
nameInput.should will assert if addressInput has the value of McDonald's. I don't know why this is happening.
Why is this needed?
Save new developer times on producing a bug and debugging.
Other
No response
We do cover this in the docs under Core Concepts > Querying Elements, but I think adding a reference here as well could be useful.