The getAll...
functions can't really use a timeout.
The difference between { timeout: 20 * 1000 }
and cy.wait(20 * 1000)
is that timeout returns early when the condition it met.
But how many exactly is "all"?
The only way to do an "all" query is to wait the maximum time and return everything at that point in time - which is what you already do with explicit cy.wait()
.
Since you are using .first()
, just switch to cy.getByTestId()
cy.getByTestId('test-field-one', { timeout: 20 * 1000 })
.within(() => cy.getByTestId('test-field-two'))
.should('contain', 'test')
Also note that
.should('contain', 'test')
is testing test-field-one
not test-field-two
because .within()
does not pass on the inner value, it passes on the previous subject.