Fixed feature tests related to process watcher.
parent
00ebc58795
commit
7b568cfce2
|
@ -14,6 +14,7 @@ import random
|
|||
from regression.python_test_utils import test_utils
|
||||
from regression.feature_utils.locators import BrowserToolBarLocators
|
||||
from regression.feature_utils.base_feature_test import BaseFeatureTest
|
||||
from regression.feature_utils.tree_area_locators import TreeAreaLocators
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
|
||||
|
@ -69,14 +70,18 @@ class BrowserToolBarFeatureTest(BaseFeatureTest):
|
|||
(By.CSS_SELECTOR, BrowserToolBarLocators.query_tool_panel_css))
|
||||
|
||||
def test_view_data_tool_button(self):
|
||||
self.page.select_tree_item(self.test_db)
|
||||
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.select_tree_item(self.test_table_name)
|
||||
self.page.click_a_tree_node(
|
||||
self.test_table_name,
|
||||
TreeAreaLocators.sub_nodes_of_tables_node)
|
||||
|
||||
self.page.retry_click(
|
||||
(By.CSS_SELECTOR,
|
||||
|
|
|
@ -21,6 +21,7 @@ from regression.python_test_utils import test_utils
|
|||
from regression.feature_utils.base_feature_test import BaseFeatureTest
|
||||
from regression.feature_utils.locators import NavMenuLocators, \
|
||||
QueryToolLocators
|
||||
from regression.feature_utils.tree_area_locators import TreeAreaLocators
|
||||
|
||||
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
@ -156,7 +157,9 @@ class PGDataypeFeatureTest(BaseFeatureTest):
|
|||
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.select_tree_item(self.test_db)
|
||||
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:
|
||||
|
|
|
@ -55,14 +55,12 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
|
|||
self.server['sslmode']
|
||||
)
|
||||
test_utils.drop_database(connection, self.database_name)
|
||||
|
||||
test_utils.create_database(self.server, self.database_name)
|
||||
test_gui_helper.close_bgprocess_popup(self)
|
||||
self.page.add_server(self.server)
|
||||
|
||||
self.wait = WebDriverWait(self.page.driver, 20)
|
||||
|
||||
test_gui_helper.close_bgprocess_popup(self)
|
||||
|
||||
def runTest(self):
|
||||
self.page.expand_database_node(
|
||||
self.server['name'],
|
||||
|
|
|
@ -18,6 +18,7 @@ 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
|
||||
from regression.feature_utils.locators import NavMenuLocators
|
||||
from regression.feature_utils.tree_area_locators import TreeAreaLocators
|
||||
|
||||
|
||||
class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest):
|
||||
|
@ -71,9 +72,9 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest):
|
|||
test_utils.create_database(self.server, self.database_name)
|
||||
test_utils.create_table(self.server, self.database_name,
|
||||
self.table_name)
|
||||
test_gui_helper.close_bgprocess_popup(self)
|
||||
self.page.add_server(self.server)
|
||||
self.wait = WebDriverWait(self.page.driver, 20)
|
||||
test_gui_helper.close_bgprocess_popup(self)
|
||||
|
||||
def runTest(self):
|
||||
self._open_maintenance_dialogue()
|
||||
|
@ -100,7 +101,9 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest):
|
|||
self.page.toggle_open_tables_node(self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.database_name, 'public')
|
||||
self.page.select_tree_item(self.table_name)
|
||||
self.page.click_a_tree_node(
|
||||
self.table_name,
|
||||
TreeAreaLocators.sub_nodes_of_tables_node)
|
||||
|
||||
self.page.retry_click(
|
||||
(By.LINK_TEXT,
|
||||
|
|
|
@ -207,7 +207,6 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format(
|
|||
ElementClickInterceptedException):
|
||||
count += 1
|
||||
pass
|
||||
print(count)
|
||||
|
||||
self._check_ondemand_result(row_id_to_find)
|
||||
print("OK.", file=sys.stderr)
|
||||
|
@ -244,6 +243,7 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format(
|
|||
def _check_ondemand_result(self, row_id_to_find):
|
||||
# scroll to bottom to bring last row of next chunk in viewport.
|
||||
scroll = 10
|
||||
status = False
|
||||
while scroll:
|
||||
canvas_ele = self.page.find_by_css_selector('.grid-canvas')
|
||||
scrolling_height = canvas_ele.size['height']
|
||||
|
@ -255,14 +255,18 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format(
|
|||
# Table height takes some time to update, for which their is no
|
||||
# particular way
|
||||
time.sleep(2)
|
||||
if canvas_ele.size['height'] == scrolling_height:
|
||||
if canvas_ele.size['height'] == scrolling_height and \
|
||||
self.page.check_if_element_exist_by_xpath(
|
||||
QueryToolLocators.output_column_data_xpath.format(
|
||||
row_id_to_find)):
|
||||
status = True
|
||||
break
|
||||
else:
|
||||
scroll -= 1
|
||||
|
||||
self.assertTrue(self.page.check_if_element_exist_by_xpath(
|
||||
QueryToolLocators.output_column_data_xpath.format(row_id_to_find)
|
||||
))
|
||||
self.assertTrue(
|
||||
status, "Element is not loaded to the rows id: "
|
||||
"{}".format(row_id_to_find))
|
||||
|
||||
def _query_tool_explain_with_verbose_and_cost(self):
|
||||
query = """-- Explain query with verbose and cost
|
||||
|
@ -372,11 +376,7 @@ CREATE TABLE public.{}();""".format(table_name)
|
|||
-- 3. ROLLBACK transaction.
|
||||
-- 4. Check if table is *NOT* created.
|
||||
ROLLBACK;"""
|
||||
self.page.fill_codemirror_area_with(query)
|
||||
self.page.find_by_css_selector(
|
||||
QueryToolLocators.btn_execute_query_css).click()
|
||||
|
||||
self.page.wait_for_query_tool_loading_indicator_to_disappear()
|
||||
self.page.execute_query(query)
|
||||
self.page.click_tab('Messages')
|
||||
self.assertTrue(self.page.check_if_element_exist_by_xpath(
|
||||
QueryToolLocators.sql_editor_message.format('ROLLBACK')),
|
||||
|
@ -389,11 +389,8 @@ ROLLBACK;"""
|
|||
-- 4. Check if table is *NOT* created.
|
||||
SELECT relname FROM pg_class
|
||||
WHERE relkind IN ('r','s','t') and relnamespace = 2200::oid;"""
|
||||
self.page.fill_codemirror_area_with(query)
|
||||
self.page.find_by_css_selector(
|
||||
QueryToolLocators.btn_execute_query_css).click()
|
||||
|
||||
self.page.wait_for_query_tool_loading_indicator_to_disappear()
|
||||
self.page.execute_query(query)
|
||||
self.page.click_tab('Data Output')
|
||||
canvas = self.wait.until(EC.presence_of_element_located(
|
||||
(By.CSS_SELECTOR, QueryToolLocators.query_output_canvas_css)))
|
||||
|
@ -411,11 +408,7 @@ SELECT relname FROM pg_class
|
|||
-- 3. ROLLBACK transaction.
|
||||
-- 4. Check if table is *NOT* created.
|
||||
ROLLBACK;"""
|
||||
self.page.fill_codemirror_area_with(query)
|
||||
self.page.find_by_css_selector(
|
||||
QueryToolLocators.btn_execute_query_css).click()
|
||||
|
||||
self.page.wait_for_query_tool_loading_indicator_to_disappear()
|
||||
self.page.execute_query(query)
|
||||
|
||||
def _query_tool_auto_commit_enabled(self):
|
||||
query = """-- 1. Enable auto commit.
|
||||
|
@ -481,10 +474,8 @@ ROLLBACK;"""
|
|||
-- 5. Check if table is created event after ROLLBACK.
|
||||
SELECT relname FROM pg_class
|
||||
WHERE relkind IN ('r','s','t') and relnamespace = 2200::oid;"""
|
||||
self.page.fill_codemirror_area_with(query)
|
||||
self.page.find_by_css_selector(
|
||||
QueryToolLocators.btn_execute_query_css).click()
|
||||
|
||||
self.page.execute_query(query)
|
||||
self.page.click_tab('Data Output')
|
||||
self.page.wait_for_query_tool_loading_indicator_to_disappear()
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import random
|
|||
|
||||
from regression.feature_utils.base_feature_test import BaseFeatureTest
|
||||
from regression.python_test_utils import test_utils
|
||||
from regression.feature_utils.tree_area_locators import TreeAreaLocators
|
||||
|
||||
|
||||
class TableDdlFeatureTest(BaseFeatureTest):
|
||||
|
@ -38,7 +39,9 @@ class TableDdlFeatureTest(BaseFeatureTest):
|
|||
self.page.toggle_open_tables_node(
|
||||
self.server['name'], self.server['db_password'],
|
||||
self.test_db, 'public')
|
||||
self.page.select_tree_item(self.test_table_name)
|
||||
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
|
||||
|
|
|
@ -21,6 +21,7 @@ from selenium.webdriver.support import expected_conditions as EC
|
|||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from regression.feature_utils.locators import QueryToolLocators, \
|
||||
NavMenuLocators
|
||||
from regression.feature_utils.tree_area_locators import TreeAreaLocators
|
||||
|
||||
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
@ -167,7 +168,9 @@ CREATE TABLE public.nonintpkey
|
|||
config_data = config_data_json[config_key]
|
||||
|
||||
def _perform_test_for_table(self, table_name):
|
||||
self.page.select_tree_item(table_name)
|
||||
self.page.click_a_tree_node(
|
||||
table_name,
|
||||
TreeAreaLocators.sub_nodes_of_tables_node)
|
||||
# Open Object -> View/Edit data
|
||||
self._view_data_grid(table_name)
|
||||
|
||||
|
@ -354,7 +357,11 @@ CREATE TABLE public.nonintpkey
|
|||
|
||||
# scroll browser back to the left
|
||||
# to reset position so other assertions can succeed
|
||||
for idx in reversed(list(config_check_data.keys())):
|
||||
list_item = list(config_check_data.keys())
|
||||
for item in range(0, len(list_item)):
|
||||
list_item[item] = int(list_item[item])
|
||||
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))
|
||||
self.page.driver.execute_script(
|
||||
|
|
|
@ -16,6 +16,7 @@ from regression.feature_utils.base_feature_test import BaseFeatureTest
|
|||
from selenium.webdriver import ActionChains
|
||||
from selenium.common.exceptions import StaleElementReferenceException
|
||||
from regression.feature_utils.locators import QueryToolLocators
|
||||
from regression.feature_utils.tree_area_locators import TreeAreaLocators
|
||||
|
||||
|
||||
class CheckForXssFeatureTest(BaseFeatureTest):
|
||||
|
@ -100,7 +101,9 @@ class CheckForXssFeatureTest(BaseFeatureTest):
|
|||
self.page.toggle_open_tables_node(self.server['name'],
|
||||
self.server['db_password'],
|
||||
self.test_db, 'public')
|
||||
self.page.select_tree_item(self.test_table_name)
|
||||
self.page.click_a_tree_node(
|
||||
self.test_table_name,
|
||||
TreeAreaLocators.sub_nodes_of_tables_node)
|
||||
|
||||
def _check_xss_in_browser_tree(self):
|
||||
print(
|
||||
|
|
|
@ -14,6 +14,7 @@ from selenium.webdriver import ActionChains
|
|||
from selenium.common.exceptions import TimeoutException
|
||||
from regression.python_test_utils import test_utils
|
||||
from regression.feature_utils.base_feature_test import BaseFeatureTest
|
||||
from regression.feature_utils.tree_area_locators import TreeAreaLocators
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.common.by import By
|
||||
|
@ -65,7 +66,9 @@ class CheckDebuggerForXssFeatureTest(BaseFeatureTest):
|
|||
self.server['db_password'],
|
||||
self.test_db, 'public')
|
||||
self.page.toggle_open_function_node()
|
||||
self.page.select_tree_item(self.function_name + "()")
|
||||
self.page.click_a_tree_node(
|
||||
self.function_name + "()",
|
||||
TreeAreaLocators.sub_nodes_of_functions_node)
|
||||
|
||||
def _debug_function(self):
|
||||
self.page.driver.find_element_by_link_text("Object").click()
|
||||
|
|
|
@ -245,6 +245,36 @@ class PgadminPage:
|
|||
if attempts == 0:
|
||||
raise Exception(e)
|
||||
|
||||
def click_a_tree_node(self, element_name, list_of_element):
|
||||
"""It will click a tree node eg. server, schema, table name etc
|
||||
will take server name and list of element where this node lies"""
|
||||
operation_status = False
|
||||
elements = list_of_element = self.find_by_xpath_list(
|
||||
list_of_element)
|
||||
if len(elements) > 0:
|
||||
index_of_element = self.get_index_of_element(
|
||||
elements, element_name)
|
||||
if index_of_element >= 0:
|
||||
self.driver.execute_script(
|
||||
"arguments[0].scrollIntoView()",
|
||||
list_of_element[index_of_element])
|
||||
self.wait_for_elements_to_appear(
|
||||
self.driver, list_of_element[index_of_element])
|
||||
time.sleep(1)
|
||||
self.driver.execute_script(
|
||||
"arguments[0].click()",
|
||||
list_of_element[index_of_element])
|
||||
operation_status = True
|
||||
else:
|
||||
print("{ERROR} - The required element with name: " + str(
|
||||
element_name) +
|
||||
" is not found in function click_a_tree_node, "
|
||||
"so click operation is not performed")
|
||||
else:
|
||||
print("{ERROR} - The element list passed to function "
|
||||
"click_a_tree_node seems empty")
|
||||
return operation_status
|
||||
|
||||
def toggle_open_servers_group(self):
|
||||
"""This will open Servers group to display underlying nodes"""
|
||||
is_expanded = False
|
||||
|
|
|
@ -48,6 +48,11 @@ class TreeAreaLocators():
|
|||
"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]"
|
||||
|
||||
@staticmethod
|
||||
def sub_nodes_of_a_server_node(server_name):
|
||||
xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \
|
||||
|
|
|
@ -45,7 +45,7 @@ def close_bgprocess_popup(tester):
|
|||
|
||||
|
||||
def close_process_watcher(tester):
|
||||
attempt = 5
|
||||
attempt = 10
|
||||
while attempt > 0:
|
||||
close_btn = tester.page.find_by_xpath(
|
||||
NavMenuLocators.process_watcher_close_button_xpath)
|
||||
|
|
|
@ -820,6 +820,7 @@ def reset_layout_db(user_id=None):
|
|||
'("Browser/Layout", "SQLEditor/Layout", "Debugger/Layout")'
|
||||
' AND USER_ID=?', user_id
|
||||
)
|
||||
cur.execute('DELETE FROM process')
|
||||
conn.commit()
|
||||
conn.close()
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue