mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-24 23:36:48 -06:00
Fixed feature test issues
This commit is contained in:
parent
f706f7ed0c
commit
5c4c09f237
@ -6,6 +6,7 @@
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
##########################################################################
|
||||
import random
|
||||
|
||||
from regression.python_test_utils import test_utils
|
||||
from regression.feature_utils.base_feature_test import BaseFeatureTest
|
||||
@ -19,35 +20,39 @@ class CheckRoleMembershipControlFeatureTest(BaseFeatureTest):
|
||||
dict())
|
||||
]
|
||||
|
||||
role = ""
|
||||
def before(self):
|
||||
with test_utils.Database(self.server) as (connection, _):
|
||||
if connection.server_version < 90100:
|
||||
self.skipTest(
|
||||
"Membership is not present in Postgres below PG v9.1")
|
||||
|
||||
# create role
|
||||
self.role = "test_role" + str(random.randint(10000, 65535))
|
||||
|
||||
# Some test function is needed for debugger
|
||||
test_utils.create_role(self.server, "postgres",
|
||||
"test_role")
|
||||
self.role)
|
||||
test_utils.create_role(self.server, "postgres",
|
||||
"<h1>test</h1>")
|
||||
|
||||
def runTest(self):
|
||||
self.page.wait_for_spinner_to_disappear()
|
||||
self.page.add_server(self.server)
|
||||
self._role_node_expandable()
|
||||
self._role_node_expandable(self.role)
|
||||
self._check_role_membership_control()
|
||||
|
||||
def after(self):
|
||||
self.page.remove_server(self.server)
|
||||
test_utils.drop_role(self.server, "postgres",
|
||||
"test_role")
|
||||
self.role)
|
||||
test_utils.drop_role(self.server, "postgres",
|
||||
"<h1>test</h1>")
|
||||
|
||||
def _role_node_expandable(self):
|
||||
def _role_node_expandable(self, role):
|
||||
self.page.toggle_open_server(self.server['name'])
|
||||
self.page.toggle_open_tree_item('Login/Group Roles')
|
||||
self.page.select_tree_item("test_role")
|
||||
self.page.select_tree_item(role)
|
||||
|
||||
def _check_role_membership_control(self):
|
||||
self.page.driver.find_element_by_link_text("Object").click()
|
||||
|
@ -8,6 +8,8 @@
|
||||
##########################################################################
|
||||
|
||||
import sys
|
||||
import random
|
||||
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from regression.python_test_utils import test_utils
|
||||
from pgadmin.utils import server_utils
|
||||
@ -56,7 +58,8 @@ class TestSQLASCIIEncoding(BaseTestGenerator):
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
self.encode_db_name = 'test_encoding_' + self.db_encoding
|
||||
self.encode_db_name = 'test_encoding_' + self.db_encoding + \
|
||||
str(random.randint(1000, 65535))
|
||||
self.encode_sid = self.server_information['server_id']
|
||||
|
||||
server_con = server_utils.connect_server(self, self.encode_sid)
|
||||
|
@ -182,7 +182,7 @@ class PgadminPage:
|
||||
ActionChains(self.driver).double_click(item).perform()
|
||||
|
||||
def toggle_open_tables_node(self):
|
||||
"""The function will be used for opening Trees node only"""
|
||||
"""The function will be used for opening Tables node only"""
|
||||
|
||||
# get the element which contains 'aria-expanded' info
|
||||
tables_expansion_ele = self.find_by_xpath("//div[div[div[div[div[div"
|
||||
@ -479,7 +479,7 @@ class PgadminPage:
|
||||
return element_selector(self.driver)
|
||||
|
||||
def _wait_for(self, waiting_for_message, condition_met_function,
|
||||
timeout=None):
|
||||
timeout=3):
|
||||
if timeout is None:
|
||||
timeout = self.timeout
|
||||
return WebDriverWait(self.driver, timeout, 0.01).until(
|
||||
|
@ -26,8 +26,19 @@ def close_bgprocess_popup(tester):
|
||||
# In cases where restore div is not closed (sometime due to some error)
|
||||
try:
|
||||
if tester.driver.find_element_by_xpath(
|
||||
"//div[@class='card-header bg-primary d-flex']/div[contains("
|
||||
"text(), 'Restoring backup')]"):
|
||||
"//div[@class='card-header bg-primary d-flex']/div"
|
||||
"[contains(text(), 'Restoring backup')]"):
|
||||
tester.driver.find_element_by_css_selector(
|
||||
".btn.btn-sm-sq.btn-primary.pg-bg-close > i").click()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# In cases where maintenance window is not closed (sometime due to some
|
||||
# error)
|
||||
try:
|
||||
if tester.driver.find_element_by_xpath(
|
||||
"//div[@class='card-header bg-primary d-flex']/div"
|
||||
"[contains(text(), 'Maintenance')]"):
|
||||
tester.driver.find_element_by_css_selector(
|
||||
".btn.btn-sm-sq.btn-primary.pg-bg-close > i").click()
|
||||
except Exception:
|
||||
|
@ -219,6 +219,9 @@ def get_test_modules(arguments):
|
||||
options.add_argument("--window-size=1280,1024")
|
||||
driver = webdriver.Chrome(chrome_options=options)
|
||||
|
||||
# maximize browser window
|
||||
driver.maximize_window()
|
||||
|
||||
app_starter = AppStarter(driver, config)
|
||||
app_starter.start_app()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user