- I click on a button => Modal window is shown
- On real app. (DOM) - Inside that modal window we have 4 table rows inside the table body:
table > tbody > tr / tr / tr / tr - On Cypress tests (DOM) - Inside that modal window we have 1 table row inside the table body:
table > tbody > tr
I tried waiting a fixed period before and after i click on the button for the modal window to be shown
I tried scrolling initially to the button which triggers the modal window to be opened
I tried invoking show both on the modal window and on the needed <tr elements
Test fails either way when searching for the
#checkboxstrategy0element (checkbox)here is my code (along with what i've tried):
cy.scrollElementIntoView('.select-rating-style')
//cy.wait(10000)
//cy.clickOption(cy.getField('a', 'class', 'select-rating-style'))
cy.get('.select-rating-style').click()
//cy.wait(10000)
//cy.get('.modal-body').eq(2).should('be.visible')
//cy.get('.modal-body').eq(2).invoke('show')
cy.get('#checkboxstrategy0').invoke('show')


It sounds like the rows are loading asynchronously, and you need to assert the correct number before working with the checkbox.