-
Notifications
You must be signed in to change notification settings - Fork 367
Enhanced selectAccordionItem to wait for items to load before proceeding #9713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhanced selectAccordionItem to wait for items to load before proceeding #9713
Conversation
0ab1a78 to
29c406c
Compare
| cy.get('div.panel-collapse.collapse.in').then((freshAccordion) => { | ||
| cy.wrap(freshAccordion) | ||
| .find('li.list-group-item') | ||
| .should('have.length.greaterThan', 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes Cypress to retry the .find() command until this assertion passes for a minimum time (4Sec here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question, in addition to the .find, does the freshAccordion get refreshed if the list is not yet populated with more than 0 entries?
| }); | ||
|
|
||
| cy.get('div.panel-collapse.collapse.in').then((freshAccordion) => { | ||
| cy.wrap(freshAccordion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though freshAccordion was captured once, when we do cy.wrap(freshAccordion).find(), jQuery's .find() method queries the current state of the DOM tree under that element, not a snapshot because jQuery maintains a reference to the DOM elements.
Note: We could also query the whole accordion repeatedly here, but since this approach seems to work, let’s stick with it for now
|
Wow, this is awesome! Great find! I saw this on other screens doing some of the conversions from UI driven test setup to using factories and I'm pretty sure this will decrease the sporadic failures in many tests. 👍 |
jrafanie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, merging. I had a question but it's not more for my education than anything else.
Enhanced the


selectAccordionItemcommand to wait for list items to load prior to initiating the lookupThis issue was noticed as part of #8916 where it failed to find
linodes when there is a delay:Fix: re-query the dom when no
linodes are found initially:@miq-bot add-label cypress
@miq-bot add-label refactoring
@miq-bot assign @jrafanie