Bug 1517796 - [wpt] Correctly dismiss user prompts in MarionetteTestharnessProtocolPart._close_windows(). r=jgraham

Using the "Switch To Window" command to check if a user prompt is open
doesn't work because that command doesn't raise a "unexpected alert open"
error. To fix that the "Close Window" command can be used for.

Differential Revision: https://phabricator.services.mozilla.com/D15816

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Henrik Skupin 2019-01-07 11:51:59 +00:00
Родитель bc591d2d2c
Коммит 4d57d56819
1 изменённых файлов: 2 добавлений и 3 удалений

Просмотреть файл

@ -157,10 +157,9 @@ class MarionetteTestharnessProtocolPart(TestharnessProtocolPart):
for handle in handles:
try:
self.dismiss_alert(lambda: self.marionette.switch_to_window(handle))
self.marionette.switch_to_window(handle)
self.logger.info("Closing window %s" % handle)
self.marionette.close()
self.marionette.switch_to_window(handle)
self.dismiss_alert(lambda: self.marionette.close())
except errors.NoSuchWindowException:
# We might have raced with the previous test to close this
# window, skip it.