Add ability to delete arbitrary component in functional tests
Patch adds no-arguments mode to delete_component() method. It means that if no component_name is provided as an argument, an arbitrary component of the env will be deleted. For most test cases the exact component to delete doesn't matter. It allows to get rid of finding component's id by its name and thus simplify the action a bit. Hopefully it will make tests that use this method more reliable. Change-Id: If32a8691701349a173522fed22e88f40e21784cd Related-bug: #1618118
This commit is contained in:
parent
dfc80b6122
commit
3b04e2068b
|
@ -472,10 +472,16 @@ class FieldsTestCase(PackageBase):
|
|||
|
||||
|
||||
class ApplicationTestCase(ImageTestCase):
|
||||
def delete_component(self, component_name):
|
||||
component_id = self.get_element_id(component_name)
|
||||
self.driver.find_element_by_id(
|
||||
'services__row_{0}__action_delete'.format(component_id)).click()
|
||||
def delete_component(self, component_name=None):
|
||||
if component_name:
|
||||
component_id = self.get_element_id(component_name)
|
||||
btn = self.driver.find_element_by_id(
|
||||
'services__row_{0}__action_delete'.format(
|
||||
component_id))
|
||||
else:
|
||||
btn = self.driver.find_element_by_css_selector(
|
||||
consts.DeleteComponent)
|
||||
btn.click()
|
||||
el = self.wait_element_is_clickable(by.By.LINK_TEXT,
|
||||
'Delete Component')
|
||||
el.click()
|
||||
|
|
|
@ -67,6 +67,7 @@ AddCategory = "categories__action_add_category"
|
|||
DeleteCategory = "//tr[td[contains(text(), '{0}')]]//button[contains(@id, 'action_delete')]" # noqa
|
||||
NextBtn = "//tfoot//tr//td//a[contains(@href,'?marker')]"
|
||||
PrevBtn = "//tfoot//tr//td//a[contains(@href,'prev_marker')]"
|
||||
DeleteComponent = ".btn[id^='services__row_'][id$='__action_delete']"
|
||||
|
||||
# Panel's
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@ class TestSuiteEnvironment(base.ApplicationTestCase):
|
|||
self.check_element_on_page(by.By.XPATH,
|
||||
c.Status.format('Ready'),
|
||||
sec=90)
|
||||
self.delete_component('TestApp')
|
||||
self.delete_component()
|
||||
self.check_element_not_on_page(by.By.LINK_TEXT, 'TestApp')
|
||||
self.go_to_submenu('Environments')
|
||||
self.check_element_on_page(by.By.XPATH,
|
||||
|
@ -312,8 +312,7 @@ class TestSuiteEnvironment(base.ApplicationTestCase):
|
|||
self.check_element_on_page(by.By.XPATH,
|
||||
c.Status.format('Ready'),
|
||||
sec=90)
|
||||
self.delete_component('TestApp1')
|
||||
self.check_element_not_on_page(by.By.LINK_TEXT, 'TestApp1')
|
||||
self.delete_component()
|
||||
self.go_to_submenu('Environments')
|
||||
self.check_element_on_page(by.By.XPATH,
|
||||
c.EnvStatus.format('quick-env-1',
|
||||
|
@ -608,7 +607,7 @@ class TestSuiteApplications(base.ApplicationTestCase):
|
|||
self.driver.find_element_by_xpath(c.InputSubmit).click()
|
||||
self.wait_element_is_clickable(by.By.ID, c.AddComponent)
|
||||
self.check_element_on_page(by.By.LINK_TEXT, 'TestA')
|
||||
self.delete_component('TestA')
|
||||
self.delete_component()
|
||||
self.check_element_not_on_page(by.By.LINK_TEXT, 'TestA')
|
||||
|
||||
def test_check_search_option(self):
|
||||
|
@ -915,7 +914,7 @@ class TestSuiteApplications(base.ApplicationTestCase):
|
|||
if idx:
|
||||
self.check_element_not_on_page(by.By.LINK_TEXT,
|
||||
app_names[idx - 1])
|
||||
self.delete_component(app_name)
|
||||
self.delete_component()
|
||||
|
||||
# To ensure that the very last application is deleted as well
|
||||
for app_name in app_names[-1::]:
|
||||
|
|
Loading…
Reference in New Issue