Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

[1LP][RFR] dismiss_alerts closes vmrc related alerts #9764

Merged
merged 1 commit into from
Dec 13, 2019
Merged
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions cfme/common/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,14 @@ def open_console(self, console='VM Console', invokes_alert=None):

view = navigate_to(self, 'Details')

# Click console button given by type
view.toolbar.access.item_select(console, handle_alert=invokes_alert)
# dismiss_any_alerts() call closed subsequent alerts needed for vmrc
# below code is needed to fix such issue
try:
view.browser.IGNORE_SUBSEQUENT_ALERTS = True
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be worthwhile to replace this try/finally with appropriate context manager ? 🤔

Copy link
Contributor

@john-dupuy john-dupuy Dec 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@izapolsk I think so, it could have uses elsewhere. But I'm okay with that being a separate PR. Up to you if you want to do it here.

# Click console button given by type
view.toolbar.access.item_select(console, handle_alert=invokes_alert)
finally:
view.browser.IGNORE_SUBSEQUENT_ALERTS = False
self.vm_console

def open_details(self, properties=None):
Expand Down
4 changes: 3 additions & 1 deletion cfme/utils/appliance/implementations/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


class HandleModalsMixin(object):
IGNORE_SUBSEQUENT_ALERTS = False
@property
def _modal_alert(self):
return Modal(parent=self)
Expand Down Expand Up @@ -92,7 +93,8 @@ def handle_alert(self, cancel=False, wait=30.0, squash=False, prompt=None, check
self.logger.info(' accepting')
popup.accept()
# Should any problematic "double" alerts appear here, we don't care, just blow'em away.
self.dismiss_any_alerts()
if not self.IGNORE_SUBSEQUENT_ALERTS:
self.dismiss_any_alerts()
return True
except TimedOutError:
# we waited (or didn't), and there was no alert
Expand Down