Support running feature tests against Firefox. Fixes #3270

This commit is contained in:
Akshay Joshi authored and Dave Page committed 2018-05-15 15:10:11 +01:00
1 parent 8d9e9eab13
commit ccf58570b1
9 files changed
+104 -15

No files matched your search

+21 -4
View File
@@ -12,6 +12,7 @@ import signal
import random
import time
from selenium.common.exceptions import WebDriverException
class AppStarter:
@@ -41,10 +42,26 @@ class AppStarter:
env=env
)
self.driver.get(
"http://" + self.app_config.DEFAULT_SERVER + ":" +
random_server_port
)
def launch_browser(retry_count):
try:
self.driver.get(
"http://" + self.app_config.DEFAULT_SERVER + ":" +
random_server_port
)
except WebDriverException as e:
# In case of WebDriverException sleep for 1 second and retry
# again. Retry 10 times and if still app will not start then
# raise exception.
time.sleep(1)
if retry_count < 60:
retry_count = retry_count + 1
launch_browser(retry_count)
else:
raise Exception('Unable to start python server even after '
'retrying 60 times.')
launch_browser(0)
def stop_app(self):
""" This function stop the started app by killing process """
@@ -60,6 +60,8 @@ class PgadminPage:
self.fill_input_by_field_name("port", server_config['port'])
self.fill_input_by_field_name("username", server_config['username'])
self.fill_input_by_field_name("password", server_config['db_password'])
# Required sleep to avoid "fe_sendauth" password error.
time.sleep(0.5)
self.find_by_xpath("//button[contains(.,'Save')]").click()
self.find_by_xpath(
@@ -318,6 +320,14 @@ class PgadminPage:
self._wait_for("app to start", page_shows_app, self.app_start_timeout)
def wait_for_element_to_reload(self, element_selector):
WebDriverWait(self.driver, 20) \
.until(EC.staleness_of(element_selector(self.driver)))
WebDriverWait(self.driver, 20) \
.until_not(EC.staleness_of(element_selector(self.driver)))
return element_selector(self.driver)
def _wait_for(self, waiting_for_message, condition_met_function,
timeout=None):
if timeout is None: