diff --git a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py
index 993c4bf7..19b33e4c 100644
--- a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py
+++ b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py
@@ -13,6 +13,7 @@ from selenium.webdriver.common.by import By
 from selenium.webdriver.support import expected_conditions as EC
 from regression.feature_utils.base_feature_test import BaseFeatureTest
 from regression.python_test_utils import test_utils
+from regression.python_test_utils import test_gui_helper
 
 
 class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
@@ -138,31 +139,7 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
                 os.remove(backup_file)
 
     def after(self):
-        self._screenshot()
-
-        # In cases where backup div is not closed (sometime due to some error)
-        try:
-            if self.driver.find_element_by_css_selector(
-                ".ajs-message.ajs-bg-bgprocess.ajs-visible > div > "
-                    "div > div > i"):
-                self.driver.find_element_by_css_selector(
-                    ".ajs-message.ajs-bg-bgprocess.ajs-visible >div >div  "
-                    ">div>i").click()
-        except Exception:
-            pass
-
-        # In cases where restore div is not closed (sometime due to some error)
-        try:
-            if self.driver.find_element_by_xpath(
-                "//div[contains(text(), 'Process Watcher - "
-                    "Restoring backup')]"):
-                self.driver.find_element_by_xpath(
-                    "//div[div[div[div[contains(text(), 'Process Watcher "
-                    "- Restoring backup')]]]]"
-                    "/following-sibling::div/div/div").click()
-        except Exception:
-            pass
-
+        test_gui_helper.close_bgprocess_popup(self)
         self.page.remove_server(self.server)
         connection = test_utils.get_db_connection(
             self.server['db'],
diff --git a/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py b/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py
index 2cfef117..7504eca1 100644
--- a/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py
+++ b/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py
@@ -12,6 +12,7 @@ import time
 from selenium.webdriver.support.ui import WebDriverWait
 from regression.feature_utils.base_feature_test import BaseFeatureTest
 from regression.python_test_utils import test_utils
+from regression.python_test_utils import test_gui_helper
 
 
 class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest):
@@ -98,29 +99,7 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest):
             "div.wcFloatingFocus div.fa-close").click()
 
     def after(self):
-        # In cases where backup div is not closed
-        try:
-            if self.driver.find_element_by_css_selector(
-                    ".ajs-message.ajs-bg-bgprocess.ajs-visible"
-                    " >div >div  >div>i"):
-                self.driver.find_element_by_css_selector(
-                    ".ajs-message.ajs-bg-bgprocess.ajs-visible >div >div  "
-                    ">div>i").click()
-        except Exception:
-            pass
-
-        # In cases where restore div is not closed (sometime due to some error)
-        try:
-            if self.driver.find_element_by_xpath(
-                "//div[contains(text(), 'Process Watcher - "
-                    "Restoring backup')]"):
-                self.driver.find_element_by_xpath(
-                    "//div[div[div[div[contains(text(), 'Process Watcher "
-                    "- Restoring backup')]]]]"
-                    "/following-sibling::div/div/div").click()
-        except Exception:
-            pass
-
+        test_gui_helper.close_bgprocess_popup(self)
         self.page.remove_server(self.server)
         connection = test_utils.get_db_connection(
             self.server['db'],
diff --git a/web/regression/python_test_utils/test_gui_helper.py b/web/regression/python_test_utils/test_gui_helper.py
new file mode 100644
index 00000000..7149d34e
--- /dev/null
+++ b/web/regression/python_test_utils/test_gui_helper.py
@@ -0,0 +1,38 @@
+##########################################################################
+#
+# pgAdmin 4 - PostgreSQL Tools
+#
+# Copyright (C) 2013 - 2018, The pgAdmin Development Team
+# This software is released under the PostgreSQL Licence
+#
+##########################################################################
+
+
+def close_bgprocess_popup(tester):
+    """
+    Allow us to close the background process popup window
+    """
+    tester._screenshot()
+
+    # In cases where backup div is not closed (sometime due to some error)
+    try:
+        if tester.driver.find_element_by_css_selector(
+                ".ajs-message.ajs-bg-bgprocess.ajs-visible > div > "
+                "div > div > i"):
+            tester.driver.find_element_by_css_selector(
+                ".ajs-message.ajs-bg-bgprocess.ajs-visible >div >div  "
+                ">div>i").click()
+    except Exception:
+        pass
+
+    # In cases where restore div is not closed (sometime due to some error)
+    try:
+        if tester.driver.find_element_by_xpath(
+                "//div[contains(text(), 'Process Watcher - "
+                "Restoring backup')]"):
+            tester.driver.find_element_by_xpath(
+                "//div[div[div[div[contains(text(), 'Process Watcher "
+                "- Restoring backup')]]]]"
+                "/following-sibling::div/div/div").click()
+    except Exception:
+        pass
diff --git a/web/regression/python_test_utils/test_utils.py b/web/regression/python_test_utils/test_utils.py
index 91f3b956..51d54e2d 100644
--- a/web/regression/python_test_utils/test_utils.py
+++ b/web/regression/python_test_utils/test_utils.py
@@ -615,57 +615,28 @@ def get_db_server(sid):
 def set_preference(default_binary_path):
     conn = sqlite3.connect(config.TEST_SQLITE_PATH)
     cur = conn.cursor()
-
     perf = Preferences.module('paths')
-    pg_path_pref = perf.preference('pg_bin_dir')
-
-    user_pref = cur.execute(
-        'SELECT pid, uid FROM user_preferences where pid=%s' % pg_path_pref.pid
-    )
-    user_pref = user_pref.fetchone()
-
-    if user_pref:
-        cur.execute('UPDATE user_preferences SET value = ? WHERE pid = ?',
-                    (default_binary_path['pg'], pg_path_pref.pid))
-    else:
-        pg_pref_details = (pg_path_pref.pid, 1,
-                           default_binary_path['pg'])
-        cur.execute('INSERT INTO user_preferences(pid, uid, value)'
-                    ' VALUES (?,?,?)', pg_pref_details)
+    server_types = default_binary_path.keys()
 
-    ppas_path_pref = perf.preference('ppas_bin_dir')
-
-    user_pref = cur.execute(
-        'SELECT pid, uid FROM user_preferences where pid=%s' %
-        ppas_path_pref.pid
-    )
-    user_pref = user_pref.fetchone()
-
-    if user_pref:
-        cur.execute('UPDATE user_preferences SET value = ? WHERE pid = ? ',
-                    (default_binary_path['ppas'], ppas_path_pref.pid))
-    else:
-        ppas_pref_details = (ppas_path_pref.pid, 1,
-                             default_binary_path['ppas'])
-        cur.execute('INSERT INTO user_preferences(pid, uid, value)'
-                    ' VALUES (?,?,?)', ppas_pref_details)
-
-    gpdb_path_pref = perf.preference('gpdb_bin_dir')
-
-    user_pref = cur.execute(
-        'SELECT pid, uid FROM user_preferences where pid=%s' %
-        gpdb_path_pref.pid
-    )
-    user_pref = user_pref.fetchone()
+    for server in server_types:
+        path_pref = perf.preference('{0}_bin_dir'.format(server))
+        user_pref = cur.execute(
+            'SELECT pid, uid FROM user_preferences '
+            'where pid=%s' % path_pref.pid
+        )
 
-    if user_pref:
-        cur.execute('UPDATE user_preferences SET value = ? WHERE pid = ? ',
-                    (default_binary_path['gpdb'], gpdb_path_pref.pid))
-    else:
-        gpdb_pref_details = (gpdb_path_pref.pid, 1,
-                             default_binary_path['gpdb'])
-        cur.execute('INSERT INTO user_preferences(pid, uid, value)'
-                    ' VALUES (?,?,?)', gpdb_pref_details)
+        user_pref_data = user_pref.fetchone()
+        if user_pref_data:
+            cur.execute(
+                'UPDATE user_preferences SET value = ? WHERE pid = ?',
+                (default_binary_path[server], path_pref.pid)
+            )
+        else:
+            params = (path_pref.pid, 1, default_binary_path[server])
+            cur.execute(
+                'INSERT INTO user_preferences(pid, uid, value)'
+                ' VALUES (?,?,?)', params
+            )
 
     conn.commit()
 
