Merge "Wait until additional window is opened in integration tests"

This commit is contained in:
Jenkins 2015-11-18 01:37:30 +00:00 committed by Gerrit Code Review
commit e645bd6ef1
2 changed files with 5 additions and 0 deletions

View File

@ -38,6 +38,9 @@ class PageObject(basewebobject.BaseWebObject):
def close_window(self):
return self.driver.close()
def is_nth_window_opened(self, n):
return len(self.driver.window_handles) == n
def switch_window(self, window_name=None, window_index=None):
"""Switches focus between the webdriver windows.
Args:

View File

@ -21,6 +21,8 @@ class TestDashboardHelp(helpers.TestCase):
self.home_pg.go_to_help_page()
self.home_pg.switch_window()
self.home_pg._wait_until(
lambda _: self.home_pg.is_nth_window_opened(2))
self.assertEqual(self.CONFIG.dashboard.help_url,
self.home_pg.get_url_current_page(),
"help link did not redirect to the right URL")