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

Commit

Permalink
Merge pull request #9764 from izapolsk/ignore-subsequent-alerts
Browse files Browse the repository at this point in the history
[1LP][RFR] dismiss_alerts closes vmrc related alerts
  • Loading branch information
mshriver authored Dec 13, 2019
2 parents eef5671 + da435fd commit c015c15
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
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
# 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

0 comments on commit c015c15

Please sign in to comment.