Ensure parent is expanded before trying to click an item.

This commit is contained in:
Gert Hengeveld 2020-10-08 09:43:04 +02:00
parent ac07320627
commit eb88960fba

View File

@ -98,8 +98,10 @@ Cypress.Commands.add('navigateToStory', (kind, name) => {
cy.log(`navigateToStory ${kind} ${name}`);
if (name !== 'page') {
// Section can be collapsed, click twice ensure expansion
cy.get(`#${kindId}`).click();
// Section might be collapsed
cy.get(`#${kindId}`).then(($item) => {
if ($item.getAttribute('aria-expanded') === 'false') $item.click();
});
}
cy.get(storyLinkId).click();