Wait until additional window is opened in integration tests

Provide a special predicate for that. This should stabilize tests
involving opening some external links from Horizon.

Implements blueprint: integration-tests-hardening

Change-Id: Icc764273a6fc717a04f31e8e522a6018ac994b0e
This commit is contained in:
Timur Sufiev 2015-09-29 18:23:36 +03:00
parent fab9f1e174
commit 6474215840
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")