Fixed feature test cases after react porting.
parent
aff84103d9
commit
9479f0e632
|
@ -47,7 +47,7 @@ class BrowserToolBarFeatureTest(BaseFeatureTest):
|
|||
file=sys.stderr, end="")
|
||||
self.test_view_data_tool_button()
|
||||
print("OK.", file=sys.stderr)
|
||||
#
|
||||
|
||||
# Check for filtered rows button
|
||||
print("\nFiltered Rows ToolBar Button ",
|
||||
file=sys.stderr, end="")
|
||||
|
@ -60,28 +60,24 @@ class BrowserToolBarFeatureTest(BaseFeatureTest):
|
|||
self.test_table_name)
|
||||
|
||||
def test_query_tool_button(self):
|
||||
self.page.expand_database_node(
|
||||
self.server['name'],
|
||||
self.server['db_password'], self.test_db)
|
||||
self.page.expand_database_node("Servers", self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.test_db)
|
||||
self.assertTrue(self.page.retry_click(
|
||||
(By.CSS_SELECTOR,
|
||||
BrowserToolBarLocators.open_query_tool_button_css),
|
||||
(By.CSS_SELECTOR, BrowserToolBarLocators.query_tool_panel_css)),
|
||||
'Query tool did not open on clicking Query Tool button.')
|
||||
self.page.close_query_tool(prompt=False)
|
||||
|
||||
def test_view_data_tool_button(self):
|
||||
self.page.click_a_tree_node(
|
||||
self.test_db,
|
||||
TreeAreaLocators.sub_nodes_of_databases_node(self.server['name']))
|
||||
self.page.toggle_open_schema_node(
|
||||
self.server['name'], self.server['db_password'],
|
||||
self.test_db, 'public')
|
||||
self.page.toggle_open_tables_node(
|
||||
self.server['name'], self.server['db_password'],
|
||||
self.test_db, 'public')
|
||||
self.page.click_a_tree_node(
|
||||
self.test_table_name,
|
||||
TreeAreaLocators.sub_nodes_of_tables_node)
|
||||
self.page.expand_tables_node("Servers", self.server['name'],
|
||||
self.server['db_password'], self.test_db,
|
||||
"public")
|
||||
|
||||
table_node = self.page.check_if_element_exists_with_scroll(
|
||||
TreeAreaLocators.table_node(self.test_table_name))
|
||||
table_node.click()
|
||||
|
||||
self.assertTrue(self.page.retry_click(
|
||||
(By.CSS_SELECTOR,
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
##########################################################################
|
||||
|
||||
import random
|
||||
import time
|
||||
|
||||
from selenium.webdriver import ActionChains
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
|
@ -37,9 +38,9 @@ class CopySelectedQueryResultsFeatureTest(BaseFeatureTest):
|
|||
self.server, self.test_db, self.test_table_name)
|
||||
|
||||
def runTest(self):
|
||||
self.page.expand_database_node(
|
||||
self.server['name'],
|
||||
self.server['db_password'], self.test_db)
|
||||
self.page.expand_database_node("Servers", self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.test_db)
|
||||
self.page.open_query_tool()
|
||||
|
||||
self.page.fill_codemirror_area_with(
|
||||
|
@ -60,7 +61,7 @@ class CopySelectedQueryResultsFeatureTest(BaseFeatureTest):
|
|||
|
||||
def paste_values_to_scratch_pad(self):
|
||||
self.page.driver.switch_to.default_content()
|
||||
self.page.driver.switch_to_frame(
|
||||
self.page.driver.switch_to.frame(
|
||||
self.page.driver.find_element_by_tag_name("iframe"))
|
||||
scratch_pad_ele = self.page.find_by_css_selector(
|
||||
QueryToolLocators.scratch_pad_css)
|
||||
|
|
|
@ -67,9 +67,9 @@ class CheckFileManagerFeatureTest(BaseFeatureTest):
|
|||
print("OK.", file=sys.stderr)
|
||||
|
||||
def _navigate_to_query_tool(self):
|
||||
self.page.expand_database_node(
|
||||
self.server['name'],
|
||||
self.server['db_password'], self.test_db)
|
||||
self.page.expand_database_node("Server", self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.test_db)
|
||||
self.page.open_query_tool()
|
||||
|
||||
def _create_new_file(self):
|
||||
|
|
|
@ -133,7 +133,7 @@ class KeyboardShortcutFeatureTest(BaseFeatureTest):
|
|||
"and contains(.,'" + locator + "')]"
|
||||
)
|
||||
|
||||
field = file_menu.find_element_by_name('key')
|
||||
field = file_menu.find_element(By.NAME, 'key')
|
||||
field.click()
|
||||
field.send_keys(key)
|
||||
|
||||
|
@ -141,5 +141,5 @@ class KeyboardShortcutFeatureTest(BaseFeatureTest):
|
|||
self.page.click_modal('Save')
|
||||
|
||||
self.page.wait_for_element_to_disappear(
|
||||
lambda driver: driver.find_element_by_css_selector(".ajs-modal")
|
||||
lambda driver: driver.find_element(By.CSS_SELECTOR, ".ajs-modal")
|
||||
)
|
||||
|
|
|
@ -154,7 +154,9 @@ class PGDataypeFeatureTest(BaseFeatureTest):
|
|||
def runTest(self):
|
||||
self.page.wait_for_spinner_to_disappear()
|
||||
self.page.add_server(self.server)
|
||||
self._schema_node_expandable()
|
||||
self.page.expand_database_node("Server", self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.test_db)
|
||||
|
||||
# Check data types
|
||||
self._check_datatype()
|
||||
|
@ -163,17 +165,15 @@ class PGDataypeFeatureTest(BaseFeatureTest):
|
|||
def after(self):
|
||||
self.page.remove_server(self.server)
|
||||
|
||||
# TODO - To be remove
|
||||
def _schema_node_expandable(self):
|
||||
self.page.expand_database_node(
|
||||
self.server['name'],
|
||||
self.server['db_password'], self.test_db)
|
||||
self.page.expand_database_node("Server", self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.test_db)
|
||||
|
||||
def _check_datatype(self):
|
||||
# Slick grid does not render all the column if viewport is not enough
|
||||
# wide. So execute test as batch of queries.
|
||||
self.page.click_a_tree_node(
|
||||
self.test_db,
|
||||
TreeAreaLocators.sub_nodes_of_databases_node(self.server['name']))
|
||||
self.page.open_query_tool()
|
||||
self._create_enum_type()
|
||||
for batch in config_data:
|
||||
|
|
|
@ -67,9 +67,9 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
|
|||
self.wait = WebDriverWait(self.page.driver, 20)
|
||||
|
||||
def runTest(self):
|
||||
self.page.expand_database_node(
|
||||
self.server['name'],
|
||||
self.server['db_password'], self.database_name)
|
||||
self.page.expand_database_node("Server", self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.database_name)
|
||||
|
||||
# Backup
|
||||
self.initiate_backup()
|
||||
|
|
|
@ -91,29 +91,25 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest):
|
|||
self.verify_command()
|
||||
|
||||
def _open_maintenance_dialogue(self):
|
||||
self.page.expand_database_node(
|
||||
self.server['name'],
|
||||
self.server['db_password'], self.database_name)
|
||||
if self.test_level == 'table':
|
||||
self.page.toggle_open_schema_node(self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.database_name, 'public')
|
||||
self.page.toggle_open_tables_node(self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.database_name, 'public')
|
||||
retry = 5
|
||||
status = False
|
||||
while retry > 0:
|
||||
status = self.page.click_a_tree_node(
|
||||
self.table_name,
|
||||
TreeAreaLocators.sub_nodes_of_tables_node)
|
||||
if status:
|
||||
break
|
||||
else:
|
||||
retry -= 1
|
||||
self.assertTrue(status, "Table name {} is not selected".format(
|
||||
self.table_name))
|
||||
self.page.expand_tables_node("Server", self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.database_name, 'public')
|
||||
|
||||
table_node = self.page.check_if_element_exists_with_scroll(
|
||||
TreeAreaLocators.table_node(self.table_name))
|
||||
|
||||
status = False
|
||||
if table_node:
|
||||
status = True
|
||||
self.assertTrue(status, "Table name {} is not visible/selected".
|
||||
format(self.table_name))
|
||||
table_node.click()
|
||||
|
||||
else:
|
||||
self.page.expand_database_node("Server", self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.database_name)
|
||||
self.page.retry_click(
|
||||
(By.LINK_TEXT,
|
||||
NavMenuLocators.tools_menu_link_text),
|
||||
|
|
|
@ -12,6 +12,7 @@ import random
|
|||
|
||||
from selenium.webdriver import ActionChains
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.common.by import By
|
||||
from regression.python_test_utils import test_utils
|
||||
from regression.feature_utils.base_feature_test import BaseFeatureTest
|
||||
from regression.feature_utils.locators import QueryToolLocators
|
||||
|
@ -55,9 +56,9 @@ class QueryToolAutoCompleteFeatureTest(BaseFeatureTest):
|
|||
test_utils.create_table(self.server, self.test_db,
|
||||
self.second_table_name)
|
||||
|
||||
self.page.expand_database_node(
|
||||
self.server['name'],
|
||||
self.server['db_password'], self.test_db)
|
||||
self.page.expand_database_node("Server", self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.test_db)
|
||||
|
||||
self.page.open_query_tool()
|
||||
self.page.wait_for_spinner_to_disappear()
|
||||
|
@ -171,7 +172,7 @@ class QueryToolAutoCompleteFeatureTest(BaseFeatureTest):
|
|||
Keys.CONTROL).send_keys(Keys.SPACE).key_up(
|
||||
Keys.CONTROL).perform()
|
||||
if self.page.check_if_element_exist_by_xpath(
|
||||
QueryToolLocators.code_mirror_hint_box_xpath, 20):
|
||||
QueryToolLocators.code_mirror_hint_box_xpath, 15):
|
||||
hint_displayed = True
|
||||
break
|
||||
else:
|
||||
|
@ -184,8 +185,8 @@ class QueryToolAutoCompleteFeatureTest(BaseFeatureTest):
|
|||
else:
|
||||
# if no IntelliSense is present it means there is only one option
|
||||
# so check if required string is present in codeMirror
|
||||
code_mirror = self.driver.find_elements_by_xpath(
|
||||
QueryToolLocators.code_mirror_data_xpath)
|
||||
code_mirror = self.driver.find_elements(
|
||||
By.XPATH, QueryToolLocators.code_mirror_data_xpath)
|
||||
for data in code_mirror:
|
||||
code_mirror_text = data.text
|
||||
print("Single entry..........")
|
||||
|
|
|
@ -12,6 +12,7 @@ import random
|
|||
|
||||
from selenium.webdriver import ActionChains
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from regression.python_test_utils import test_utils
|
||||
from regression.feature_utils.base_feature_test import BaseFeatureTest
|
||||
|
@ -94,7 +95,7 @@ class QueryToolJourneyTest(BaseFeatureTest):
|
|||
|
||||
def _test_copies_rows(self):
|
||||
self.page.driver.switch_to.default_content()
|
||||
self.page.driver.switch_to_frame(
|
||||
self.page.driver.switch_to.frame(
|
||||
self.page.driver.find_element_by_tag_name("iframe"))
|
||||
|
||||
select_row = self.page.find_by_xpath(
|
||||
|
@ -106,7 +107,7 @@ class QueryToolJourneyTest(BaseFeatureTest):
|
|||
copy_row.click()
|
||||
|
||||
self.page.driver.switch_to.default_content()
|
||||
self.page.driver.switch_to_frame(
|
||||
self.page.driver.switch_to.frame(
|
||||
self.page.driver.find_element_by_tag_name("iframe"))
|
||||
|
||||
scratch_pad_ele = self.page.find_by_css_selector(
|
||||
|
@ -121,7 +122,7 @@ class QueryToolJourneyTest(BaseFeatureTest):
|
|||
|
||||
def _test_copies_columns(self):
|
||||
self.page.driver.switch_to.default_content()
|
||||
self.page.driver.switch_to_frame(
|
||||
self.page.driver.switch_to.frame(
|
||||
self.page.driver.find_element_by_tag_name("iframe"))
|
||||
|
||||
column_header = self.page.find_by_css_selector(
|
||||
|
@ -133,7 +134,7 @@ class QueryToolJourneyTest(BaseFeatureTest):
|
|||
copy_btn.click()
|
||||
|
||||
self.page.driver.switch_to.default_content()
|
||||
self.page.driver.switch_to_frame(
|
||||
self.page.driver.switch_to.frame(
|
||||
self.page.driver.find_element_by_tag_name("iframe"))
|
||||
|
||||
scratch_pad_ele = self.page.find_by_css_selector(
|
||||
|
@ -169,13 +170,13 @@ class QueryToolJourneyTest(BaseFeatureTest):
|
|||
failed_history_detail_pane.text
|
||||
)
|
||||
self.page.wait_for_elements(
|
||||
lambda driver: driver.find_elements_by_css_selector(
|
||||
QueryToolLocators.query_history_entries))
|
||||
lambda driver: driver.find_elements(
|
||||
By.CSS_SELECTOR, QueryToolLocators.query_history_entries))
|
||||
|
||||
# get the query history rows and click the previous query row which
|
||||
# was executed and verify it
|
||||
history_rows = self.driver.find_elements_by_css_selector(
|
||||
QueryToolLocators.query_history_entries)
|
||||
history_rows = self.driver.find_elements(
|
||||
By.CSS_SELECTOR, QueryToolLocators.query_history_entries)
|
||||
history_rows[1].click()
|
||||
|
||||
selected_history_entry = self.page.find_by_css_selector(
|
||||
|
@ -209,8 +210,8 @@ class QueryToolJourneyTest(BaseFeatureTest):
|
|||
self.page.click_tab(self.query_history_tab_name)
|
||||
|
||||
query_list = self.page.wait_for_elements(
|
||||
lambda driver: driver.find_elements_by_css_selector(
|
||||
QueryToolLocators.query_history_entries))
|
||||
lambda driver: driver.find_elements(
|
||||
By.CSS_SELECTOR, QueryToolLocators.query_history_entries))
|
||||
|
||||
self.assertTrue(17, len(query_list))
|
||||
|
||||
|
@ -420,9 +421,9 @@ class QueryToolJourneyTest(BaseFeatureTest):
|
|||
self.page.click_modal('Yes')
|
||||
|
||||
def _navigate_to_query_tool(self):
|
||||
self.page.expand_database_node(
|
||||
self.server['name'],
|
||||
self.server['db_password'], self.test_db)
|
||||
self.page.expand_database_node("Server", self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.test_db)
|
||||
self.page.open_query_tool()
|
||||
self.page.wait_for_spinner_to_disappear()
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ class QueryToolFeatureTest(BaseFeatureTest):
|
|||
def before(self):
|
||||
self.page.wait_for_spinner_to_disappear()
|
||||
self.page.add_server(self.server)
|
||||
self.page.expand_database_node(
|
||||
self.server['name'],
|
||||
self.server['db_password'], self.test_db)
|
||||
self.page.expand_database_node("Server", self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.test_db)
|
||||
self.page.open_query_tool()
|
||||
self.page.wait_for_spinner_to_disappear()
|
||||
self._reset_options()
|
||||
|
@ -128,7 +128,7 @@ class QueryToolFeatureTest(BaseFeatureTest):
|
|||
QueryToolLocators.btn_explain_buffers,
|
||||
QueryToolLocators.btn_explain_timing):
|
||||
btn = self.page.find_by_css_selector(op)
|
||||
check = btn.find_element_by_tag_name('i')
|
||||
check = btn.find_element(By.TAG_NAME, 'i')
|
||||
if 'visibility-hidden' not in check.get_attribute('class'):
|
||||
btn.click()
|
||||
|
||||
|
@ -286,10 +286,10 @@ SELECT generate_series(1, 1000) as id order by id desc"""
|
|||
)
|
||||
|
||||
# Search for 'Output' word in result (verbose option)
|
||||
canvas.find_element_by_xpath("//*[contains(string(), 'Output')]")
|
||||
canvas.find_element(By.XPATH, "//*[contains(string(), 'Output')]")
|
||||
|
||||
# Search for 'Total Cost' word in result (cost option)
|
||||
canvas.find_element_by_xpath("//*[contains(string(),'Total Cost')]")
|
||||
canvas.find_element(By.XPATH, "//*[contains(string(),'Total Cost')]")
|
||||
|
||||
def _query_tool_explain_analyze_with_buffers_and_timing(self):
|
||||
query = """-- Explain analyze query with buffers and timing
|
||||
|
@ -382,8 +382,8 @@ SELECT relname FROM pg_catalog.pg_class
|
|||
canvas = self.wait.until(EC.presence_of_element_located(
|
||||
(By.CSS_SELECTOR, QueryToolLocators.query_output_canvas_css)))
|
||||
|
||||
el = canvas.find_elements_by_xpath(
|
||||
QueryToolLocators.output_column_data_xpath.format(table_name))
|
||||
el = canvas.find_elements(By.XPATH, QueryToolLocators.
|
||||
output_column_data_xpath.format(table_name))
|
||||
|
||||
assert len(el) == 0, "Table '{}' created with auto commit disabled " \
|
||||
"and without any explicit commit.".format(
|
||||
|
@ -699,7 +699,7 @@ SELECT 1, pg_sleep(300)"""
|
|||
QueryToolLocators.btn_explain_buffers,
|
||||
QueryToolLocators.btn_explain_timing):
|
||||
btn = self.page.find_by_css_selector(op)
|
||||
check = btn.find_element_by_tag_name('i')
|
||||
check = btn.find_element(By.TAG_NAME, 'i')
|
||||
if 'visibility-hidden' not in check.get_attribute('class'):
|
||||
btn.click()
|
||||
# click cost button
|
||||
|
@ -720,7 +720,7 @@ SELECT 1, pg_sleep(300)"""
|
|||
(By.CSS_SELECTOR, QueryToolLocators.query_output_canvas_css))
|
||||
)
|
||||
# Search for 'Output' word in result (verbose option)
|
||||
canvas.find_element_by_xpath("//*[contains(string(), 'JIT')]")
|
||||
canvas.find_element(By.XPATH, "//*[contains(string(), 'JIT')]")
|
||||
|
||||
self.page.clear_query_tool()
|
||||
|
||||
|
@ -732,7 +732,7 @@ class WaitForAnyElementWithText(object):
|
|||
|
||||
def __call__(self, driver):
|
||||
try:
|
||||
elements = EC._find_elements(driver, self.locator)
|
||||
elements = driver.find_elements(*self.locator)
|
||||
for elem in elements:
|
||||
if self.text in elem.text:
|
||||
return True
|
||||
|
|
|
@ -31,16 +31,13 @@ class TableDdlFeatureTest(BaseFeatureTest):
|
|||
self.test_table_name = "test_table" + str(random.randint(1000, 3000))
|
||||
test_utils.create_table(self.server, self.test_db,
|
||||
self.test_table_name)
|
||||
self.page.expand_tables_node("Server", self.server['name'],
|
||||
self.server['db_password'], self.test_db,
|
||||
'public')
|
||||
table_node = self.page.check_if_element_exists_with_scroll(
|
||||
TreeAreaLocators.table_node(self.test_table_name))
|
||||
table_node.click()
|
||||
|
||||
self.page.expand_database_node(
|
||||
self.server['name'],
|
||||
self.server['db_password'], self.test_db)
|
||||
self.page.toggle_open_tables_node(
|
||||
self.server['name'], self.server['db_password'],
|
||||
self.test_db, 'public')
|
||||
self.page.click_a_tree_node(
|
||||
self.test_table_name,
|
||||
TreeAreaLocators.sub_nodes_of_tables_node)
|
||||
self.page.click_tab("SQL")
|
||||
|
||||
# Wait till data is displayed in SQL Tab
|
||||
|
|
|
@ -73,7 +73,7 @@ class CopySQLFeatureTest(BaseFeatureTest):
|
|||
time.sleep(5)
|
||||
|
||||
self.driver.switch_to.default_content()
|
||||
self.driver.switch_to_frame(
|
||||
self.driver.switch_to.frame(
|
||||
self.driver.find_element_by_tag_name("iframe"))
|
||||
|
||||
code_mirror = self.driver.find_elements_by_xpath(
|
||||
|
@ -89,16 +89,12 @@ class CopySQLFeatureTest(BaseFeatureTest):
|
|||
self.test_table_name = "test_table" + str(random.randint(1000, 3000))
|
||||
test_utils.create_table(self.server, self.test_db,
|
||||
self.test_table_name)
|
||||
|
||||
self.page.expand_database_node(
|
||||
self.server['name'],
|
||||
self.server['db_password'], self.test_db)
|
||||
self.page.toggle_open_tables_node(
|
||||
self.server['name'], self.server['db_password'],
|
||||
self.test_db, 'public')
|
||||
self.page.click_a_tree_node(
|
||||
self.test_table_name,
|
||||
TreeAreaLocators.sub_nodes_of_tables_node)
|
||||
self.page.expand_tables_node("Server", self.server['name'],
|
||||
self.server['db_password'], self.test_db,
|
||||
'public')
|
||||
table_node = self.page.check_if_element_exists_with_scroll(
|
||||
TreeAreaLocators.table_node(self.test_table_name))
|
||||
table_node.click()
|
||||
|
||||
def _update_preferences_setting(self):
|
||||
file_menu = self.page.find_by_css_selector(
|
||||
|
|
|
@ -121,13 +121,9 @@ CREATE TABLE public.nonintpkey
|
|||
def runTest(self):
|
||||
self.page.wait_for_spinner_to_disappear()
|
||||
self.page.add_server(self.server)
|
||||
|
||||
self.page.expand_database_node(
|
||||
self.server['name'],
|
||||
self.server['db_password'], self.test_db)
|
||||
self.page.toggle_open_tables_node(self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.test_db, 'public')
|
||||
self.page.expand_tables_node("Server", self.server['name'],
|
||||
self.server['db_password'], self.test_db,
|
||||
'public')
|
||||
|
||||
self._load_config_data('table_insert_update_cases')
|
||||
data_local = config_data
|
||||
|
@ -169,12 +165,17 @@ CREATE TABLE public.nonintpkey
|
|||
config_data = config_data_json[config_key]
|
||||
|
||||
def _perform_test_for_table(self, table_name, config_data_local):
|
||||
self.page.click_a_tree_node(
|
||||
table_name,
|
||||
TreeAreaLocators.sub_nodes_of_tables_node)
|
||||
# self.page.click_a_tree_node(
|
||||
# table_name,
|
||||
# TreeAreaLocators.sub_nodes_of_tables_node)
|
||||
table_node = self.page.check_if_element_exists_with_scroll(
|
||||
TreeAreaLocators.table_node(table_name))
|
||||
table_node.click()
|
||||
|
||||
# Open Object -> View/Edit data
|
||||
self._view_data_grid(table_name)
|
||||
|
||||
time.sleep(3)
|
||||
self.page.wait_for_query_tool_loading_indicator_to_disappear()
|
||||
# Run test to insert a new row in table with default values
|
||||
self._add_row(config_data_local)
|
||||
|
@ -237,7 +238,7 @@ CREATE TABLE public.nonintpkey
|
|||
|
||||
if cell_type in ['int', 'int[]']:
|
||||
if value == 'clear':
|
||||
cell_el.find_element_by_css_selector('input').clear()
|
||||
cell_el.find_element(By.CSS_SELECTOR, 'input').clear()
|
||||
else:
|
||||
ActionChains(self.driver).send_keys(value). \
|
||||
send_keys(Keys.ENTER).perform()
|
||||
|
@ -273,13 +274,13 @@ CREATE TABLE public.nonintpkey
|
|||
else:
|
||||
# Boolean editor test for to True click
|
||||
if data[1] == 'true':
|
||||
checkbox_el = cell_el.find_element_by_xpath(
|
||||
".//*[contains(@class, 'multi-checkbox')]")
|
||||
checkbox_el = cell_el.find_element(
|
||||
By.XPATH, ".//*[contains(@class, 'multi-checkbox')]")
|
||||
checkbox_el.click()
|
||||
# Boolean editor test for to False click
|
||||
elif data[1] == 'false':
|
||||
checkbox_el = cell_el.find_element_by_xpath(
|
||||
".//*[contains(@class, 'multi-checkbox')]")
|
||||
checkbox_el = cell_el.find_element(
|
||||
By.XPATH, ".//*[contains(@class, 'multi-checkbox')]")
|
||||
# Sets true
|
||||
checkbox_el.click()
|
||||
# Sets false
|
||||
|
@ -307,7 +308,7 @@ CREATE TABLE public.nonintpkey
|
|||
), CheckForViewDataTest.TIMEOUT_STRING
|
||||
)
|
||||
self.page.driver.switch_to.frame(
|
||||
self.page.driver.find_element_by_tag_name('iframe')
|
||||
self.page.driver.find_element(By.TAG_NAME, 'iframe')
|
||||
)
|
||||
|
||||
def _copy_paste_row(self, config_data_l):
|
||||
|
@ -380,7 +381,7 @@ CREATE TABLE public.nonintpkey
|
|||
try:
|
||||
result_row = self.page.find_by_xpath(xpath)
|
||||
element = \
|
||||
result_row.find_element_by_class_name("r" + str(idx))
|
||||
result_row.find_element(By.CLASS_NAME, "r" + str(idx))
|
||||
self.page.driver.execute_script(
|
||||
scroll_on_arg_for_js, element)
|
||||
break
|
||||
|
@ -398,6 +399,6 @@ CREATE TABLE public.nonintpkey
|
|||
list_item.sort(reverse=True)
|
||||
for idx in list_item:
|
||||
time.sleep(0.4)
|
||||
element = result_row.find_element_by_class_name("r" + str(idx))
|
||||
element = result_row.find_element(By.CLASS_NAME, "r" + str(idx))
|
||||
self.page.driver.execute_script(
|
||||
scroll_on_arg_for_js, element)
|
||||
|
|
|
@ -9,12 +9,14 @@
|
|||
|
||||
import sys
|
||||
import random
|
||||
import time
|
||||
|
||||
from regression.python_test_utils import test_utils
|
||||
from regression.feature_utils.base_feature_test import BaseFeatureTest
|
||||
from selenium.webdriver import ActionChains
|
||||
from selenium.common.exceptions import StaleElementReferenceException, \
|
||||
WebDriverException
|
||||
from selenium.webdriver.common.by import By
|
||||
from regression.feature_utils.locators import QueryToolLocators
|
||||
from regression.feature_utils.tree_area_locators import TreeAreaLocators
|
||||
|
||||
|
@ -74,7 +76,6 @@ class CheckForXssFeatureTest(BaseFeatureTest):
|
|||
while retry > 0:
|
||||
try:
|
||||
self.page.refresh_page()
|
||||
self.page.toggle_open_servers_group()
|
||||
self._tables_node_expandable()
|
||||
self._check_xss_in_dependents_tab()
|
||||
retry = 0
|
||||
|
@ -106,15 +107,13 @@ class CheckForXssFeatureTest(BaseFeatureTest):
|
|||
self.server, self.test_db, self.test_table_name)
|
||||
|
||||
def _tables_node_expandable(self):
|
||||
self.page.expand_database_node(
|
||||
self.server['name'],
|
||||
self.server['db_password'], self.test_db)
|
||||
self.page.toggle_open_tables_node(self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.test_db, 'public')
|
||||
self.page.click_a_tree_node(
|
||||
self.test_table_name,
|
||||
TreeAreaLocators.sub_nodes_of_tables_node)
|
||||
self.page.expand_tables_node("Server", self.server['name'],
|
||||
self.server['db_password'], self.test_db,
|
||||
'public')
|
||||
|
||||
table_node = self.page.check_if_element_exists_with_scroll(
|
||||
TreeAreaLocators.table_node(self.test_table_name))
|
||||
table_node.click()
|
||||
|
||||
def _check_xss_in_browser_tree(self):
|
||||
print(
|
||||
|
@ -138,6 +137,12 @@ class CheckForXssFeatureTest(BaseFeatureTest):
|
|||
file=sys.stderr, end=""
|
||||
)
|
||||
self.page.click_tab("SQL")
|
||||
|
||||
# Wait till data is displayed in SQL Tab
|
||||
self.assertTrue(self.page.check_if_element_exist_by_xpath(
|
||||
"//*[contains(@class,'CodeMirror-lines') and "
|
||||
"contains(.,'CREATE TABLE')]", 10), "No data displayed in SQL tab")
|
||||
|
||||
# Fetch the inner html & check for escaped characters
|
||||
source_code = self.page.find_by_xpath(
|
||||
"//*[contains(@class,'CodeMirror-lines') and "
|
||||
|
@ -197,7 +202,7 @@ class CheckForXssFeatureTest(BaseFeatureTest):
|
|||
"contains(@style, 'top:0px')]"
|
||||
)
|
||||
|
||||
cells = result_row.find_elements_by_tag_name('div')
|
||||
cells = result_row.find_elements(By.TAG_NAME, 'div')
|
||||
|
||||
# remove first element as it is row number.
|
||||
source_code = cells[1].get_attribute('innerHTML')
|
||||
|
@ -239,8 +244,8 @@ class CheckForXssFeatureTest(BaseFeatureTest):
|
|||
while retry > 0:
|
||||
try:
|
||||
history_ele = self.driver \
|
||||
.find_element_by_css_selector(
|
||||
".query-detail .content-value")
|
||||
.find_element(By.CSS_SELECTOR,
|
||||
".query-detail .content-value")
|
||||
source_code = history_ele.get_attribute('innerHTML')
|
||||
break
|
||||
except StaleElementReferenceException:
|
||||
|
@ -279,7 +284,7 @@ class CheckForXssFeatureTest(BaseFeatureTest):
|
|||
)
|
||||
|
||||
self.page.find_by_css_selector(".slick-header-column")
|
||||
cells = self.driver.\
|
||||
cells = self.driver. \
|
||||
find_elements_by_css_selector(".slick-header-column")
|
||||
|
||||
# remove first element as it is row number.
|
||||
|
|
|
@ -58,16 +58,12 @@ class CheckDebuggerForXssFeatureTest(BaseFeatureTest):
|
|||
self.function_name)
|
||||
|
||||
def _function_node_expandable(self):
|
||||
self.page.expand_database_node(
|
||||
self.server['name'],
|
||||
self.server['db_password'], self.test_db)
|
||||
self.page.toggle_open_schema_node(self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.test_db, 'public')
|
||||
self.page.toggle_open_function_node()
|
||||
self.page.click_a_tree_node(
|
||||
self.function_name + "()",
|
||||
TreeAreaLocators.sub_nodes_of_functions_node)
|
||||
self.page.expand_schema_child_node("Server", self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.test_db, 'public', "Functions")
|
||||
function_node = self.page.check_if_element_exists_with_scroll(
|
||||
TreeAreaLocators.function_node(self.function_name + "()"))
|
||||
function_node.click()
|
||||
|
||||
def _debug_function(self):
|
||||
self.page.driver.find_element_by_link_text("Object").click()
|
||||
|
|
|
@ -42,6 +42,8 @@ class CheckRoleMembershipControlFeatureTest(BaseFeatureTest):
|
|||
self.role)
|
||||
test_utils.create_role(self.server, "postgres",
|
||||
"<h1>test</h1>")
|
||||
test_utils.grant_role(self.server, "postgres",
|
||||
self.role, "<h1>test</h1>")
|
||||
self.wait = WebDriverWait(self.page.driver, 20)
|
||||
|
||||
def runTest(self):
|
||||
|
@ -58,11 +60,13 @@ class CheckRoleMembershipControlFeatureTest(BaseFeatureTest):
|
|||
"<h1>test</h1>")
|
||||
|
||||
def _role_node_expandable(self, role):
|
||||
self.page.expand_server_node(
|
||||
self.server['name'], self.server['db_password'])
|
||||
self.page.toggle_open_tree_item('Login/Group Roles')
|
||||
self.page.click_a_tree_node(
|
||||
role, TreeAreaLocators.sub_nodes_of_login_group_node)
|
||||
self.page.expand_server_child_node("Server", self.server['name'],
|
||||
self.server['db_password'],
|
||||
'Login/Group Roles')
|
||||
|
||||
role_node = self.page.check_if_element_exists_with_scroll(
|
||||
TreeAreaLocators.role_node(role))
|
||||
role_node.click()
|
||||
|
||||
def _check_role_membership_control(self):
|
||||
self.page.driver.find_element_by_link_text(
|
||||
|
@ -70,24 +74,22 @@ class CheckRoleMembershipControlFeatureTest(BaseFeatureTest):
|
|||
property_object = self.wait.until(EC.visibility_of_element_located(
|
||||
(By.CSS_SELECTOR, NavMenuLocators.properties_obj_css)))
|
||||
property_object.click()
|
||||
WebDriverWait(self.page.driver, 4).until(
|
||||
membership_tab = WebDriverWait(self.page.driver, 4).until(
|
||||
EC.presence_of_element_located((
|
||||
By.XPATH, "//a[normalize-space(text())='Membership']")))
|
||||
self.click_membership_tab()
|
||||
By.XPATH, "//span[normalize-space(text())='Membership']")))
|
||||
membership_tab.click()
|
||||
|
||||
# Fetch the source code for our custom control
|
||||
source_code = self.page.find_by_xpath(
|
||||
"//div[contains(@class,'rolmembership')]"
|
||||
).get_attribute('innerHTML')
|
||||
"//span[contains(@class,'icon-')]/following-sibling::span"
|
||||
).text
|
||||
|
||||
self._check_escaped_characters(
|
||||
source_code,
|
||||
'<h1>test</h1>',
|
||||
'Role Membership Control'
|
||||
)
|
||||
self.page.find_by_xpath(
|
||||
"//button[contains(@type, 'cancel') and "
|
||||
"contains(.,'Cancel')]"
|
||||
).click()
|
||||
self.page.find_by_xpath("//button/span[text()='Close']").click()
|
||||
|
||||
def _check_escaped_characters(self, source_code, string_to_find, source):
|
||||
# For XSS we need to search against element's html code
|
||||
|
|
|
@ -249,8 +249,8 @@ class ConnectToServerDiv:
|
|||
password_field = "//input[@id='password']"
|
||||
|
||||
ok_button = \
|
||||
"//div [@class='alertify ajs-modeless ajs-movable ajs-zoom']" \
|
||||
"//button[text()='OK']"
|
||||
"//button[@class='ajs-button btn btn-primary fa fa-check " \
|
||||
"pg-alertify-button']"
|
||||
|
||||
error_message = \
|
||||
"//form[@id='frmPassword']/div/div//div[@class='alert-text']"
|
||||
|
@ -258,3 +258,12 @@ class ConnectToServerDiv:
|
|||
cancel_button = \
|
||||
"//div [@class='alertify ajs-modeless ajs-movable ajs-zoom']" \
|
||||
"//button[text()='Cancel']"
|
||||
|
||||
|
||||
class PropertyDialogueLocators:
|
||||
# This will contain xpaths for elements in properties dialogue
|
||||
server_dialogue_title = "//div[text()='Create - Server']"
|
||||
|
||||
server_connection_tab = "//button/span[text()='Connection']"
|
||||
|
||||
server_tab_save = "//button/span[text()='Save']"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,126 +11,260 @@ class TreeAreaLocators():
|
|||
"""This will contains element locators for tree area, will also contain
|
||||
parametrized xpath where applicable"""
|
||||
|
||||
server_group_node = \
|
||||
"//div[@id='tree']//span[@class='aciTreeItem']" \
|
||||
"/span[(@class='aciTreeText') and starts-with(text(),'Servers ') or " \
|
||||
"starts-with(text(), 'Servers')]"
|
||||
|
||||
server_group_node_exp_status = "//div[div[span[span[" \
|
||||
"(@class='aciTreeText') and " \
|
||||
"(text()='Servers ' or " \
|
||||
"text()='Servers')]]]]"
|
||||
|
||||
server_group_sub_nodes = \
|
||||
"//div[div[span[span[contains(text(),'Servers')]]]]/" \
|
||||
"following-sibling::ul/li/div/div/div/span[2]/" \
|
||||
"span[@class='aciTreeText']"
|
||||
|
||||
server_group_sub_nodes_exp_status = \
|
||||
"//div[div[span[span[contains(text(),'Servers')]]]]" \
|
||||
"/following-sibling::ul/li/div"
|
||||
|
||||
server_group_sub_nodes_connected_status = \
|
||||
"//div[div[span[span[contains(text(), 'Servers')]]]]/" \
|
||||
"following-sibling::ul/li/div/div/div/span[2]"
|
||||
|
||||
specified_tree_node = \
|
||||
"//div[@id='tree']//span[@class='aciTreeItem']/" \
|
||||
"span[(@class='aciTreeText') and text()='{}']"
|
||||
|
||||
specified_tree_node_exp_status = \
|
||||
"//div[@id='tree']//span[@class='aciTreeItem']/" \
|
||||
"span[(@class='aciTreeText') and text()='{}']" \
|
||||
"//ancestor::*[@class='aciTreeLine']"
|
||||
|
||||
sub_nodes_of_tables_node = \
|
||||
"//div[div[div[div[div[div[div[div[span[span[" \
|
||||
"contains(text(),'Tables')]]]]]]]]]]/" \
|
||||
"following-sibling::ul/li/div//div/span[2]/span[2]"
|
||||
|
||||
sub_nodes_of_functions_node = \
|
||||
"//div[div[div[div[div[div[div[div[span[span[" \
|
||||
"contains(text(),'Functions')]]]]]]]]]]/" \
|
||||
"following-sibling::ul/li/div//div/span[2]/span[2]"
|
||||
|
||||
sub_nodes_of_login_group_node = \
|
||||
"//div[div[div[span[span[contains(text(),'Login/Group Roles')]]]]]" \
|
||||
"/following::ul/li/div[@class='aciTreeLine']"
|
||||
# Server Group Node
|
||||
@staticmethod
|
||||
def server_group_node(server_group_name):
|
||||
return "//span[starts-with(text(),'%s')]" % server_group_name
|
||||
|
||||
@staticmethod
|
||||
def sub_nodes_of_a_server_node(server_name):
|
||||
xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \
|
||||
"following-sibling::ul/li/div[@class='aciTreeLine']" % \
|
||||
server_name
|
||||
return xpath
|
||||
def server_group_node_exp_status(server_group_name):
|
||||
return "//i[@class='directory-toggle open']/following-sibling::" \
|
||||
"span//span[starts-with(text(),'%s')]" % server_group_name
|
||||
|
||||
# Server Node
|
||||
@staticmethod
|
||||
def server_node(server_name):
|
||||
return "//div[@id='tree']//span[starts-with(text(),'%s')]" \
|
||||
% server_name
|
||||
|
||||
@staticmethod
|
||||
def sub_nodes_of_a_server_node_exp_status(server_name):
|
||||
xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \
|
||||
"following-sibling::ul/li/div" % server_name
|
||||
return xpath
|
||||
def server_node_exp_status(server_name):
|
||||
return "//i[@class='directory-toggle open']/following-sibling::" \
|
||||
"span//span[starts-with(text(),'%s')]" % server_name
|
||||
|
||||
# Server Connection
|
||||
@staticmethod
|
||||
def server_connection_status_element(server_name):
|
||||
return "//div[@id='tree']//span[starts-with(text(),'%s')]/" \
|
||||
"preceding-sibling::i" % server_name
|
||||
|
||||
# Databases Node
|
||||
@staticmethod
|
||||
def databases_node(server_name):
|
||||
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
||||
"following-sibling::div//span[text()='Databases']" % server_name
|
||||
|
||||
@staticmethod
|
||||
def databases_node_of_a_server_node(server_name):
|
||||
xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \
|
||||
"following-sibling::ul/li/div/div/div/div/span[2]/span[2 " \
|
||||
"and text()='Databases ']" % server_name
|
||||
return xpath
|
||||
def databases_node_exp_status(server_name):
|
||||
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
||||
"following-sibling::div//span[span[text()='Databases']]/" \
|
||||
"preceding-sibling::i[@class='directory-toggle open']" \
|
||||
% server_name
|
||||
|
||||
# Database Node
|
||||
@staticmethod
|
||||
def database_node(database_name):
|
||||
return "//div[@data-depth='4']/span/span[text()='%s']" % database_name
|
||||
|
||||
@staticmethod
|
||||
def sub_nodes_of_databases_node(server_name):
|
||||
xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \
|
||||
"following-sibling::ul/li[1]/div/following-sibling::ul/li/" \
|
||||
"div/div/div/div/div/span[2]/span[@class='aciTreeText']" % \
|
||||
server_name
|
||||
return xpath
|
||||
def database_node_exp_status(database_name):
|
||||
return "//i[@class='directory-toggle open']/following-sibling::" \
|
||||
"span//span[text()='%s']" % database_name
|
||||
|
||||
# Schemas Node
|
||||
@staticmethod
|
||||
def schemas_node(database_name):
|
||||
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
||||
"following-sibling::div//span[text()='Schemas']" % database_name
|
||||
|
||||
@staticmethod
|
||||
def sub_nodes_of_databases_node_exp_status(server_name):
|
||||
xpath = "//div[div[div[span[span[contains(text(), '%s')]]]]]/" \
|
||||
"following-sibling::ul/li[1]/div/following-sibling::ul/li/" \
|
||||
"div" % server_name
|
||||
return xpath
|
||||
def schemas_node_exp_status(database_name):
|
||||
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
||||
"following-sibling::div//span[span[text()='Schemas']]/" \
|
||||
"preceding-sibling::i[@class='directory-toggle open']" \
|
||||
% database_name
|
||||
|
||||
# Schema Node
|
||||
@staticmethod
|
||||
def schema_node(schema_name):
|
||||
return "//div[@id='tree']//span[text()='%s']" % schema_name
|
||||
|
||||
@staticmethod
|
||||
def sub_nodes_of_database_node(database_name):
|
||||
xpath = "//div[div[div[div[div[span[span[contains(text()," \
|
||||
"'%s')]]]]]]]/following-sibling::ul/li/div/div/div/div/div/" \
|
||||
"div/span[2]/span[2]" % database_name
|
||||
return xpath
|
||||
def schema_node_exp_status(schema_name):
|
||||
return "//i[@class='directory-toggle open']/" \
|
||||
"following-sibling::span//span[text()='%s']" % schema_name
|
||||
|
||||
# Tables Node
|
||||
@staticmethod
|
||||
def tables_node(schema_name):
|
||||
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
||||
"following-sibling::div//span[text()='Tables']" % schema_name
|
||||
|
||||
@staticmethod
|
||||
def sub_nodes_of_database_node_exp_status(database_name):
|
||||
xpath = "//div[div[div[div[div[span[span[contains(text(), " \
|
||||
"'%s')]]]]]]]/following-sibling::ul/li/div" % database_name
|
||||
return xpath
|
||||
def tables_node_exp_status(schema_name):
|
||||
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
||||
"following-sibling::div//span[span[text()='Tables']]/" \
|
||||
"preceding-sibling::i[@class='directory-toggle open']"\
|
||||
% schema_name
|
||||
|
||||
# Schema child
|
||||
@staticmethod
|
||||
def schema_child_node_exp_status(schema_name, child_node_name):
|
||||
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
||||
"following-sibling::div//span[span[text()='%s']]/" \
|
||||
"preceding-sibling::i[@class='directory-toggle open']" \
|
||||
% (schema_name, child_node_name)
|
||||
|
||||
@staticmethod
|
||||
def sub_nodes_of_schemas_node(database_name):
|
||||
xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \
|
||||
"following-sibling::ul/li[" \
|
||||
"@role='presentation']/ul/li/div//div/span/span[" \
|
||||
"@class='aciTreeText']" % database_name
|
||||
return xpath
|
||||
def schema_child_node(schema_name, child_node_name):
|
||||
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
||||
"following-sibling::div//span[text()='%s']" \
|
||||
% (schema_name, child_node_name)
|
||||
|
||||
# Database child
|
||||
@staticmethod
|
||||
def database_child_node_exp_status(database_name, child_node_name):
|
||||
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
||||
"following-sibling::div//span[span[text()='%s']]/" \
|
||||
"preceding-sibling::i[@class='directory-toggle open']"\
|
||||
% (database_name, child_node_name)
|
||||
|
||||
@staticmethod
|
||||
def sub_nodes_of_schemas_node_exp_status(database_name):
|
||||
xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \
|
||||
"following-sibling::ul/li[@role='presentation']/ul/li/div" \
|
||||
% database_name
|
||||
return xpath
|
||||
def database_child_node(database_name, child_node_name):
|
||||
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
||||
"following-sibling::div//span[text()='%s']" \
|
||||
% (database_name, child_node_name)
|
||||
|
||||
# Server child
|
||||
@staticmethod
|
||||
def server_child_node_exp_status(server_name, child_node_name):
|
||||
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
||||
"following-sibling::div//span[span[text()='%s']]/" \
|
||||
"preceding-sibling::i[@class='directory-toggle open']"\
|
||||
% (server_name, child_node_name)
|
||||
|
||||
@staticmethod
|
||||
def sub_nodes_of_schema_node(database_name):
|
||||
xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \
|
||||
"following-sibling::ul/li[" \
|
||||
"@role='presentation']/ul/li/ul/li/div//div/span[2]/span[2]" \
|
||||
% database_name
|
||||
return xpath
|
||||
def server_child_node(server_name, child_node_name):
|
||||
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
||||
"following-sibling::div//span[text()='%s']" \
|
||||
% (server_name, child_node_name)
|
||||
|
||||
# Table Node
|
||||
@staticmethod
|
||||
def sub_nodes_of_schema_node_exp_status(database_name):
|
||||
xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \
|
||||
"following-sibling::ul/li[@role='presentation']" \
|
||||
"/ul/li/ul/li/div" % database_name
|
||||
return xpath
|
||||
def table_node(table_name):
|
||||
return "//div[@data-depth='8']/span/span[text()='%s']" % table_name
|
||||
|
||||
# Function Node
|
||||
@staticmethod
|
||||
def function_node(table_name):
|
||||
return "//div[@data-depth='8']/span/span[text()='%s']" % table_name
|
||||
|
||||
# Role Node
|
||||
@staticmethod
|
||||
def role_node(role_name):
|
||||
return "//div[@data-depth='4']/span/span[text()='%s']" % role_name
|
||||
|
||||
# Context element option
|
||||
@staticmethod
|
||||
def context_menu_element(schema_name):
|
||||
return "//li/span[text()='%s']" % schema_name
|
||||
|
||||
# Old xpaths
|
||||
# server_group_sub_nodes_exp_status = \
|
||||
# "//div[div[span[span[contains(text(),'Servers')]]]]" \
|
||||
# "/following-sibling::ul/li/div"
|
||||
#
|
||||
# server_group_sub_nodes_connected_status = \
|
||||
# "//div[div[span[span[contains(text(), 'Servers')]]]]/" \
|
||||
# "following-sibling::ul/li/div/div/div/span[2]"
|
||||
#
|
||||
# specified_tree_node = \
|
||||
# "//div[@id='tree']//span[@class='aciTreeItem']/" \
|
||||
# "span[(@class='aciTreeText') and text()='{}']"
|
||||
#
|
||||
# specified_tree_node_exp_status = \
|
||||
# "//div[@id='tree']//span[@class='aciTreeItem']/" \
|
||||
# "span[(@class='aciTreeText') and text()='{}']" \
|
||||
# "//ancestor::*[@class='aciTreeLine']"
|
||||
#
|
||||
# sub_nodes_of_tables_node = \
|
||||
# "//div[div[div[div[div[div[div[div[span[span[" \
|
||||
# "contains(text(),'Tables')]]]]]]]]]]/" \
|
||||
# "following-sibling::ul/li/div//div/span[2]/span[2]"
|
||||
#
|
||||
# sub_nodes_of_functions_node = \
|
||||
# "//div[div[div[div[div[div[div[div[span[span[" \
|
||||
# "contains(text(),'Functions')]]]]]]]]]]/" \
|
||||
# "following-sibling::ul/li/div//div/span[2]/span[2]"
|
||||
#
|
||||
# sub_nodes_of_login_group_node = \
|
||||
# "//div[div[div[span[span[contains(text(),'Login/Group Roles')]]]]]" \
|
||||
# "/following::ul/li/div[@class='aciTreeLine']"
|
||||
#
|
||||
# @staticmethod
|
||||
# def sub_nodes_of_a_server_node(server_name):
|
||||
# xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \
|
||||
# "following-sibling::ul/li/div[@class='aciTreeLine']" % \
|
||||
# server_name
|
||||
# return xpath
|
||||
#
|
||||
# @staticmethod
|
||||
# def sub_nodes_of_a_server_node_exp_status(server_name):
|
||||
# xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \
|
||||
# "following-sibling::ul/li/div" % server_name
|
||||
# return xpath
|
||||
#
|
||||
# @staticmethod
|
||||
# def databases_node_of_a_server_node(server_name):
|
||||
# xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \
|
||||
# "following-sibling::ul/li/div/div/div/div/span[2]/span[2 " \
|
||||
# "and text()='Databases ']" % server_name
|
||||
# return xpath
|
||||
#
|
||||
# @staticmethod
|
||||
# def sub_nodes_of_databases_node(server_name):
|
||||
# xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \
|
||||
# "following-sibling::ul/li[1]/div/following-sibling::ul/li/" \
|
||||
# "div/div/div/div/div/span[2]/span[@class='aciTreeText']" % \
|
||||
# server_name
|
||||
# return xpath
|
||||
#
|
||||
# @staticmethod
|
||||
# def sub_nodes_of_databases_node_exp_status(server_name):
|
||||
# xpath = "//div[div[div[span[span[contains(text(), '%s')]]]]]/" \
|
||||
# "following-sibling::ul/li[1]/div/following-sibling::ul/li/" \
|
||||
# "div" % server_name
|
||||
# return xpath
|
||||
#
|
||||
# @staticmethod
|
||||
# def sub_nodes_of_database_node(database_name):
|
||||
# xpath = "//div[div[div[div[div[span[span[contains(text()," \
|
||||
# "'%s')]]]]]]]/following-sibling::" \
|
||||
# "ul/li/div/div/div/div/div/div/span[2]/span[2]"\
|
||||
# % database_name
|
||||
# return xpath
|
||||
#
|
||||
# @staticmethod
|
||||
# def sub_nodes_of_database_node_exp_status(database_name):
|
||||
# xpath = "//div[div[div[div[div[span[span[contains(text(), " \
|
||||
# "'%s')]]]]]]]/following-sibling::ul/li/div" % database_name
|
||||
# return xpath
|
||||
#
|
||||
# @staticmethod
|
||||
# def sub_nodes_of_schemas_node(database_name):
|
||||
# xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \
|
||||
# "following-sibling::ul/li[" \
|
||||
# "@role='presentation']/ul/li/div//div/span/span[" \
|
||||
# "@class='aciTreeText']" % database_name
|
||||
# return xpath
|
||||
#
|
||||
# @staticmethod
|
||||
# def sub_nodes_of_schemas_node_exp_status(database_name):
|
||||
# xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \
|
||||
# "following-sibling::ul/li[@role='presentation']/ul/li/div" \
|
||||
# % database_name
|
||||
# return xpath
|
||||
#
|
||||
# @staticmethod
|
||||
# def sub_nodes_of_schema_node(database_name):
|
||||
# xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \
|
||||
# "following-sibling::ul/li[@role='presentation']" \
|
||||
# "/ul/li/ul/li/div//div/span[2]/span[2]" % database_name
|
||||
# return xpath
|
||||
#
|
||||
# @staticmethod
|
||||
# def sub_nodes_of_schema_node_exp_status(database_name):
|
||||
# xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \
|
||||
# "following-sibling::ul/li[@role='presentation']" \
|
||||
# "/ul/li/ul/li/div" % database_name
|
||||
# return xpath
|
||||
|
|
|
@ -422,6 +422,32 @@ def does_function_exist(server, db_name, fun_name):
|
|||
return str(result[0][0])
|
||||
|
||||
|
||||
def grant_role(server, db_name, role_name="test_role",
|
||||
grant_role="<h1>test</h1>"):
|
||||
try:
|
||||
connection = get_db_connection(
|
||||
db_name,
|
||||
server['username'],
|
||||
server['db_password'],
|
||||
server['host'],
|
||||
server['port'],
|
||||
server['sslmode']
|
||||
)
|
||||
old_isolation_level = connection.isolation_level
|
||||
connection.set_isolation_level(0)
|
||||
pg_cursor = connection.cursor()
|
||||
sql_query = '''GRANT "%s" TO %s;''' % (grant_role, role_name)
|
||||
|
||||
pg_cursor.execute(
|
||||
sql_query
|
||||
)
|
||||
connection.set_isolation_level(old_isolation_level)
|
||||
connection.commit()
|
||||
|
||||
except Exception:
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
|
||||
|
||||
def create_role(server, db_name, role_name="test_role"):
|
||||
try:
|
||||
connection = get_db_connection(
|
||||
|
|
|
@ -25,5 +25,5 @@ python-mimeparse==1.6.0
|
|||
testscenarios==0.5.0
|
||||
testtools==2.3.0
|
||||
traceback2==1.4.0
|
||||
selenium==3.14.0
|
||||
selenium==4.0.0
|
||||
coverage==5.0.1
|
||||
|
|
|
@ -295,9 +295,9 @@ def setup_webdriver_specification(arguments):
|
|||
options.add_argument("--headless")
|
||||
options.add_argument("--no-sandbox")
|
||||
options.add_argument("--disable-setuid-sandbox")
|
||||
options.add_argument("--window-size=1280,1024")
|
||||
options.add_argument("--window-size=1790,1080")
|
||||
options.add_argument("--disable-infobars")
|
||||
options.add_experimental_option('w3c', False)
|
||||
# options.add_experimental_option('w3c', False)
|
||||
driver_local = webdriver.Chrome(chrome_options=options)
|
||||
|
||||
# maximize browser window
|
||||
|
|
Loading…
Reference in New Issue