You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have wierd issue with using alias.
First use of the alias is working, second not.
on first use, I get the element via alias, type something, then blur.
after that on second use, I wanna get the element via alias again, but
alias definition (probably) is failing.
CypressError: cy.find() failed because it requires a DOM element.
The subject received was:
> undefined
The previous command that ran was:
> cy.get()
cy.get('[data-cy=partner_groups_table]').then($table=>{constrowCount=$table.find('tbody').find('tr').length;//add row and assert row countcy.get('[data-cy=add_partner_group_button]').should('be.enabled').click();cy.get('[data-cy=partner_groups_table]').find('tbody')//.eq(0).find('tr').should('have.length',rowCount+1);assertInvalidCategoriesPage();cy.log('Insert data to newly added row START');cy.get('[data-cy=partner_groups_table]').find('tbody')//.eq(0).find('tr').last().as('row');//test required validatorcy.get('@row').find('[data-cy=partner_group_name]').click().blur();cy.get('@row').find('[data-cy=partner_group_name_form_field]').find('mat-error').should('be.visible');assertInvalidCategoriesPage();//insert correct data into rowcy.get('@row').find('[data-cy=partner_group_name]').type('cat'+GuidUtils.newGuid().substring(0,4));cy.get('@row').find('[data-cy=partner_group_working_hour_price]').click();ERRORaftertheclickcommandwhentrytousetherowaliasagaincy.get('@row').find('[data-cy=partner_group_name_form_field]').find('mat-error').should('not.be.visible');cy.log('Insert data to newly added row END');});
I susspect, that this code if failing and have no clue why:
The DOM element that was originally found to represent the alias has likely been removed from the DOM. After the click action, maybe the row is rerendered causing it to not be found. We don't requery the DOM element of aliases and instead use the original reference.
I would suggest requerying the DOM element with cy.get() after the click.
Hi, I have wierd issue with using alias.
First use of the alias is working, second not.
on first use, I get the element via alias, type something, then blur.
after that on second use, I wanna get the element via alias again, but
alias definition (probably) is failing.
I susspect, that this code if failing and have no clue why:
If I use the whole selector instead of allias, it works:
The text was updated successfully, but these errors were encountered: