Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@ const clickControlAndVerifyChartUpdate = (buttonAriaLabel) => {
cy.get('.echChartStatus')
.invoke('attr', 'data-ech-render-count')
.then((initialRenderCount) => {
cy.get(`button[aria-label="${buttonAriaLabel}"]`).click();

// Cypress's .should() will automatically retry until the assertion passes or times out,
// which handles the async nature of the re-render.
cy.get('.echChartStatus')
.invoke('attr', 'data-ech-render-count')
.should('not.eq', initialRenderCount);
// Re-check disabled state right before clicking to avoid TOCTOU race
cy.get(`button[aria-label="${buttonAriaLabel}"]`).then(($btn) => {
if (!$btn.is(':disabled')) {
cy.wrap($btn).click();

cy.get('.echChartStatus')
.invoke('attr', 'data-ech-render-count')
.should('not.eq', initialRenderCount);
}
});
});
}
});
Expand Down
Loading