Replace the template selection feature test with one that tests table DDL generation (which also covers template selection).

This commit is contained in:
Atira Odhner 2017-03-23 11:47:21 +00:00 committed by Dave Page
parent 77007996ed
commit fe9bc379c7
2 changed files with 11 additions and 17 deletions

View File

@ -7,13 +7,11 @@
#
##########################################################################
from selenium.webdriver import ActionChains
from regression import test_utils
from regression.feature_utils.base_feature_test import BaseFeatureTest
class TemplateSelectionFeatureTest(BaseFeatureTest):
class TableDdlFeatureTest(BaseFeatureTest):
def before(self):
connection = test_utils.get_db_connection(self.server['db'],
self.server['username'],
@ -34,25 +32,18 @@ class TemplateSelectionFeatureTest(BaseFeatureTest):
self.page.toggle_open_tree_item('acceptance_test_db')
self.page.toggle_open_tree_item('Schemas')
self.page.toggle_open_tree_item('public')
self.page.find_by_xpath("//*[@id='tree']//*[@class='aciTreeText' and .='Trigger Functions']").click()
self.page.find_by_partial_link_text("Object").click()
ActionChains(self.page.driver) \
.move_to_element(self.page.driver.find_element_by_link_text("Create")) \
.perform()
self.page.find_by_partial_link_text("Trigger function...").click()
self.page.fill_input_by_field_name("name", "test-trigger-function")
self.page.find_by_partial_link_text("Definition").click()
self.page.fill_codemirror_area_with("some-trigger-function-content")
self.page.find_by_partial_link_text("SQL").click()
self.page.toggle_open_tree_item('Tables')
self.page.select_tree_item('test_table')
self.page.click_tab("SQL")
self.page.find_by_xpath("//*[contains(@class,'CodeMirror-lines') and contains(.,'LEAKPROOF')]")
self.page.find_by_xpath(
"//*[contains(@class,'CodeMirror-lines') and contains(.,'CREATE TABLE public.test_table')]")
def after(self):
self.page.find_by_xpath("//button[contains(.,'Cancel')]").click()
self.page.remove_server(self.server)
connection = test_utils.get_db_connection(self.server['db'],
self.server['username'],
self.server['db_password'],
self.server['host'],
self.server['port'])
test_utils.drop_database(connection, "acceptance_test_db")
test_utils.drop_database(connection, "acceptance_test_db")

View File

@ -61,6 +61,9 @@ class PgadminPage:
self.find_by_partial_link_text("Delete/Drop").click()
self.click_modal_ok()
def select_tree_item(self, tree_item_text):
self.find_by_xpath("//*[@id='tree']//*[.='" + tree_item_text + "' and @class='aciTreeItem']").click()
def toggle_open_tree_item(self, tree_item_text):
self.find_by_xpath("//*[@id='tree']//*[.='" + tree_item_text + "']/../*[@class='aciTreeButton']").click()
@ -72,7 +75,7 @@ class PgadminPage:
def find_by_partial_link_text(self, link_text):
return self._wait_for(
'link with text "#{0}"'.format(link_text),
'link with text "{0}"'.format(link_text),
EC.element_to_be_clickable((By.PARTIAL_LINK_TEXT, link_text))
)