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

Scenarios for the following UI tests were added to sanity_check:
  - Deploy from table view
  - Abandon from table view

Also added helper function in base.py called
execute_action_from_table_view, which does the following:
  - Clicks the drop-down button in the table view corresponding
    to a specific environment.
  - Waits for the drop-down menu to appear.
  - Clicks the designated action button from the menu.

Change-Id: I61890d1795e92789fca0265e814914a0dc5a91ff
Partial-Bug: #1596196
This commit is contained in:
Felipe Monteiro 2017-01-10 11:30:20 -05:00
parent 47ab2911fb
commit e6e9267fea
3 changed files with 90 additions and 0 deletions

View File

@ -554,6 +554,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):