Ensure closing of firefox window if setUp fails

In the functional integration test, test class opened a firefox
window as part of setUp() but in case of failure of setUp(), the
window remained open, as the tearDown() method is not called on
failure of setUp(). This problem can be solved by adding the
close command for firefox through addCleanup method which is
excecuted irrespective of success of the setUp method.

Change-Id: Ic576fa05b62afa08356f11825cbf442baaf9a4cb
Closes-bug: 1487446
This commit is contained in:
Akanksha
2015-11-01 00:58:31 +05:30
parent 098aa33c2a
commit 08ef17f1be

View File

@@ -68,6 +68,7 @@ class UITestCase(BaseDeps):
super(UITestCase, self).setUp()
self.driver = webdriver.Firefox()
self.addCleanup(self.driver.quit)
self.driver.maximize_window()
self.driver.get(cfg.common.horizon_url + '/murano/environments')
self.driver.implicitly_wait(30)
@@ -76,7 +77,6 @@ class UITestCase(BaseDeps):
def tearDown(self):
super(UITestCase, self).tearDown()
self.driver.quit()
for env in self.murano_client.environments.list():
self.remove_environment(env.id)