do not assume a popover is closed before attempting to open it again

This commit is contained in:
Greg Thompson 2022-08-17 15:29:23 -05:00
parent 3976bc42d1
commit 1b231657cb
No known key found for this signature in database
GPG key ID: ED1F695C1077B958
2 changed files with 8 additions and 0 deletions

View file

@ -17,6 +17,7 @@ import {
waitForRulesTableToBeLoaded,
selectAllRules,
openRefreshSettingsPopover,
closeRefreshSettingsPopover,
clearAllRuleSelection,
selectNumberOfRules,
mockGlobalClock,
@ -96,6 +97,7 @@ describe('Alerts detection rules table auto-refresh', () => {
REFRESH_SETTINGS_SELECTION_NOTE,
'Note: Refresh is disabled while there is an active selection.'
);
closeRefreshSettingsPopover();
clearAllRuleSelection();
@ -116,6 +118,7 @@ describe('Alerts detection rules table auto-refresh', () => {
openRefreshSettingsPopover();
checkAutoRefreshIsDisabled();
closeRefreshSettingsPopover();
clearAllRuleSelection();

View file

@ -315,6 +315,11 @@ export const openRefreshSettingsPopover = () => {
cy.get(REFRESH_SETTINGS_SWITCH).should('be.visible');
};
export const closeRefreshSettingsPopover = () => {
cy.get(REFRESH_SETTINGS_POPOVER).click();
cy.get(REFRESH_SETTINGS_SWITCH).should('not.be.visible');
};
export const checkAutoRefreshIsDisabled = () => {
cy.get(REFRESH_SETTINGS_SWITCH).should('have.attr', 'aria-checked', 'false');
};