I have this code:
<div class="input-group" data-cy="k-item">
<input type="text" placeholder="my_placeholder" value="my_value">
<div data-cy="delete-field" role="button" tabindex="-1" class="r_field">
<i class="close"></i>
</div>
</div>
I have my cypress code for clicking on "close" and check that the item when submit is deleted in the table:
cy.getBySel('k-item').within(() => {
cy.getBySel('delete-field').click().click()
})
cy.getBySel('register').click()
cy.intercept('GET', 'route_intercepted').as('getRoute')
cy.wait('@getRoute')
cy.get('table').should('not.contain', 'my_item')
})
The test is passing in my local and even in headless mode but when in pipeline it is failing saying:
AssertionError: Timed out retrying after 4000ms: Expected not to find content: 'my_item' within the selector: 'table' but continuously found it.
I think the item is not getting deleted after the submit. I am experiencing the same issue with force:true. Have anyone experienced this issue please and also is there any other way to make the same tests more robust.
You have to wait the response on the wait call and just then you can check your element: