gray-kilobyte-89541
01/17/2023, 12:35 PMcy.click
automatically waits for the element to not be disabled. So it should be simply cy.get(...).click()
purple-afternoon-2408
01/17/2023, 12:35 PMcy.click() failed because it requires a DOM element.
The subject received was:
> undefined
The previous command that ran was:
> cy.should()
purple-afternoon-2408
01/17/2023, 12:36 PM(subject ? cy.wrap(subject) : cy)
.get(`.button-y`)
.eq(index)
.parent()
.find('.button-x')
.should('not.have.attr', 'disabled')
.click()
gray-kilobyte-89541
01/17/2023, 12:37 PMpurple-afternoon-2408
01/17/2023, 12:38 PMpurple-afternoon-2408
01/17/2023, 12:40 PMretryability
, I am already using it, but it's not going to help when cypress already returns undefined
subjectpurple-afternoon-2408
01/17/2023, 12:41 PMshould
assertion is successful but it simply doesn't return elementpurple-afternoon-2408
01/17/2023, 12:42 PMgray-kilobyte-89541
01/17/2023, 12:44 PMpurple-afternoon-2408
01/17/2023, 12:45 PMpurple-afternoon-2408
01/17/2023, 12:50 PM(subject ? cy.wrap(subject) : cy)
.get(`.button-y`)
.eq(index)
.parent()
.find('.button-x')
.should('not.have.attr', 'disabled') // this line
.click()
thousands-house-85089
01/17/2023, 12:55 PMjs
cy.get('.quantity > .control-group > input')
purple-afternoon-2408
01/17/2023, 12:57 PM(subject ? cy.wrap(subject) : cy)
.get(`label`)
.eq(index)
.parent() // div
.find('button')
.should('not.have.attr', 'disabled') // this line
.click()
HTML code:
<div>
<label>Some label</label>
<button>Some button</button>
</div>
purple-afternoon-2408
01/17/2023, 1:03 PM.click()
a chance without the should
for checking if button enabled or not. and see how it goesgray-kilobyte-89541
01/17/2023, 1:04 PMpurple-afternoon-2408
01/17/2023, 1:04 PMshould
, it used to fail 6/10 times of retrying the teststhousands-house-85089
01/17/2023, 1:04 PMpurple-afternoon-2408
01/17/2023, 1:04 PMpurple-afternoon-2408
01/17/2023, 1:05 PMpurple-afternoon-2408
01/17/2023, 1:07 PMdiv
shows app with a label
, button (disabled)
and loading circle
indicator
- Cypress gets that div
while the loading is still in progress and button
is still disabled
- that loading circle
indicator goes away (gets removed)
- that button
becomes enabled
The application is Angular v13 FYIpurple-afternoon-2408
01/17/2023, 1:10 PMshould
and if it happens to fail again a lot, I'll be back here for sure. Thanks for your help.gray-kilobyte-89541
01/17/2023, 1:14 PMpurple-afternoon-2408
01/17/2023, 1:20 PMpurple-afternoon-2408
01/17/2023, 1:21 PMgray-kilobyte-89541
01/17/2023, 1:23 PMgray-kilobyte-89541
01/17/2023, 1:24 PMpurple-afternoon-2408
01/17/2023, 1:25 PMpurple-afternoon-2408
01/17/2023, 1:25 PMpurple-afternoon-2408
01/17/2023, 1:27 PMpurple-afternoon-2408
01/17/2023, 1:29 PM