Merge "Add UI tests for Deploy/Abandon Environment from Table View."

This commit is contained in:
Jenkins 2017-01-12 01:16:39 +00:00 committed by Gerrit Code Review
commit a73cb4b7bb
3 changed files with 90 additions and 0 deletions

View File

@ -563,6 +563,31 @@ class ApplicationTestCase(ImageTestCase):
else:
self.wait_for_alert_message()
def execute_action_from_table_view(self, env_name, table_action):
"""Executes an action like Deploy or Delete from the table view.
Does not handle clicking on the confirmation modal that may appear.
Scenario:
1. Checks for the table drop-down button and then clicks it.
2. Checks for the table drop-down menu to appear.
3. Checks for the ``table_action`` button and then clicks it.
"""
self.check_element_on_page(
by.By.XPATH, consts.TableDropdownBtn.format(env_name))
dropdown_btn = self.driver.find_element(
by.By.XPATH, consts.TableDropdownBtn.format(env_name))
dropdown_btn.click()
self.check_element_on_page(by.By.XPATH,
consts.TableDropdownMenu.format(env_name))
self.check_element_on_page(
by.By.XPATH, consts.TableDropdownAction.format(env_name,
table_action))
action_btn = self.driver.find_element(
by.By.XPATH, consts.TableDropdownAction.format(env_name,
table_action))
action_btn.click()
class PackageTestCase(ApplicationTestCase):
@classmethod

View File

@ -47,6 +47,12 @@ NewEnvRow = "table#environments thead tr.new_env"
TableSorterByName = "table#environments thead th.tablesorter-header[data-column='1']" # noqa
ServiceDetail = "//dd[contains(text(), '{0}')]"
ServiceType = "//table[@id='services']//tbody//tr//td[2][contains(text(), '{0}')]" # noqa
TableDropdownBtn = "//tr[contains(@data-display, '{0}')]//a[contains(@class, "\
"'dropdown-toggle')]"
TableDropdownMenu = "//tr[contains(@data-display, '{0}')]//div[contains("\
"@class, 'open')]"
TableDropdownAction = "//tr[contains(@data-display, '{0}')]//button[contains("\
"text(), '{1}')]"
# Buttons
ButtonSubmit = ".//*[@name='wizard_goto_step'][2]"

View File

@ -715,6 +715,65 @@ class TestSuiteEnvironment(base.ApplicationTestCase):
for pkg_id in packages:
self.murano_client.packages.delete(pkg_id)
def test_deploy_env_from_table_view(self):
"""Test that deploy environment works from the table view.
Scenario:
1. Create environment.
2. Add one app to the environment.
3. Deploy the environment from the table view.
4. Log out.
5. Log in.
6. Check that the environment status is 'Ready'.
"""
self.add_app_to_env(self.mockapp_id)
self.navigate_to('Applications')
self.go_to_submenu('Environments')
self.check_element_on_page(by.By.LINK_TEXT, 'quick-env-1')
self.execute_action_from_table_view('quick-env-1',
'Deploy Environment')
self.log_out()
self.log_in()
self.navigate_to('Applications')
self.go_to_submenu('Environments')
self.check_element_on_page(by.By.XPATH,
c.EnvStatus.format('quick-env-1',
'Ready'))
def test_abandon_env_from_table_view(self):
"""Test that abandon environment works from the table view.
Scenario:
1. Create environment.
2. Add one app to the environment.
3. Deploy the environment from the table view.
4. Log out.
5. Log in.
6. Go to the Applications > Environments page.
7. Abandon the environment from the table view.
8. Click the confirmation in the modal.
9. Check that the environment is no longer present on the page.
"""
self.add_app_to_env(self.mockapp_id)
self.navigate_to('Applications')
self.go_to_submenu('Environments')
self.check_element_on_page(by.By.LINK_TEXT, 'quick-env-1')
self.execute_action_from_table_view('quick-env-1',
'Deploy Environment')
self.log_out()
self.log_in()
self.navigate_to('Applications')
self.go_to_submenu('Environments')
self.check_element_on_page(by.By.XPATH,
c.EnvStatus.format('quick-env-1',
'Ready'))
self.execute_action_from_table_view('quick-env-1',
'Abandon Environment')
self.check_element_on_page(by.By.XPATH, c.ConfirmAbandon)
self.driver.find_element(by.By.XPATH, c.ConfirmAbandon).click()
self.wait_for_alert_message()
self.check_element_not_on_page(by.By.LINK_TEXT, 'quick-env-1')
class TestSuiteImage(base.ImageTestCase):
def test_mark_image(self):