2017-03-16 09:27:55 -05:00
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
|
|
#
|
2024-01-01 02:43:48 -06:00
|
|
|
# Copyright (C) 2013 - 2024, The pgAdmin Development Team
|
2017-03-16 09:27:55 -05:00
|
|
|
# This software is released under the PostgreSQL Licence
|
|
|
|
#
|
|
|
|
##########################################################################
|
|
|
|
|
2022-08-12 06:40:26 -05:00
|
|
|
import secrets
|
2018-08-21 07:09:36 -05:00
|
|
|
|
2017-02-22 06:41:28 -06:00
|
|
|
from regression.feature_utils.base_feature_test import BaseFeatureTest
|
2017-03-23 06:59:31 -05:00
|
|
|
from regression.python_test_utils import test_utils
|
2019-11-12 23:49:21 -06:00
|
|
|
from regression.feature_utils.tree_area_locators import TreeAreaLocators
|
2017-02-22 06:41:28 -06:00
|
|
|
|
|
|
|
|
2017-03-23 06:47:21 -05:00
|
|
|
class TableDdlFeatureTest(BaseFeatureTest):
|
2017-04-06 03:33:29 -05:00
|
|
|
""" This class test acceptance test scenarios """
|
|
|
|
|
|
|
|
scenarios = [
|
|
|
|
("Test table DDL generation", dict())
|
|
|
|
]
|
|
|
|
|
2018-08-21 07:09:36 -05:00
|
|
|
test_table_name = ""
|
|
|
|
|
2017-03-09 09:34:51 -06:00
|
|
|
def before(self):
|
2017-02-22 06:41:28 -06:00
|
|
|
|
|
|
|
self.page.add_server(self.server)
|
|
|
|
|
|
|
|
def runTest(self):
|
2022-08-12 06:40:26 -05:00
|
|
|
self.test_table_name = "test_table" + str(
|
|
|
|
secrets.choice(range(1000, 3000)))
|
2018-08-21 07:09:36 -05:00
|
|
|
test_utils.create_table(self.server, self.test_db,
|
|
|
|
self.test_table_name)
|
2021-11-10 00:20:20 -06:00
|
|
|
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))
|
2022-11-29 06:05:07 -06:00
|
|
|
|
|
|
|
self.assertTrue(bool(table_node), 'Table node not found.')
|
|
|
|
|
2021-11-10 00:20:20 -06:00
|
|
|
table_node.click()
|
2017-02-22 06:41:28 -06:00
|
|
|
|
2017-03-23 06:47:21 -05:00
|
|
|
self.page.click_tab("SQL")
|
|
|
|
|
2019-08-22 04:20:51 -05:00
|
|
|
# Wait till data is displayed in SQL Tab
|
|
|
|
self.assertTrue(self.page.check_if_element_exist_by_xpath(
|
2024-02-20 23:45:25 -06:00
|
|
|
"//*[contains(@class,'cm-line') and "
|
2021-05-27 00:31:25 -05:00
|
|
|
"contains(.,'CREATE TABLE IF NOT EXISTS public.%s')]"
|
|
|
|
% self.test_table_name, 10), "No data displayed in SQL tab")
|
2017-02-22 06:41:28 -06:00
|
|
|
|
2017-03-09 09:34:51 -06:00
|
|
|
def after(self):
|
2017-02-22 06:41:28 -06:00
|
|
|
self.page.remove_server(self.server)
|
2019-08-22 04:20:51 -05:00
|
|
|
test_utils.delete_table(
|
|
|
|
self.server, self.test_db, self.test_table_name)
|