vendredi 24 janvier 2020

Custom commands for selecting a check box in cypress

I have written a custom command for selecting the checkbox based upon the contact name what i provide(Refer the image ) for example I provide Test10 Test10, it does not get selected, However the test case gets passed without selecting, I tried debugging cname variable is empty attaching the debugger screen shot as well enter image description here

enter image description here

Cypress.Commands.add("SelecttheContact", (contactName) => { 
cy.get('tr td:nth-child(2)').each(($el, index, $list) => {
const cname=$el.find(contactName).text()

if(cname.includes(contactName))
{

   // cy.get("tr td:nth-child(1)").eq(index).click()
   // cy.get("input[type='checkbox']").eq(index).click()
   debugger
   $e1.find('checkbox').click()


}

}) })

Aucun commentaire:

Enregistrer un commentaire