Change of the procedure how the popup messages are checked

Check and close all the popup messages in one step
and return all the levels of present messages.
There is no longer necessary to use a separate step for checking
presence/absence of Success message, Error message, etc.

Change-Id: I15a0dbe99282f00c5970d9d7d5c9b480989e9e14
This commit is contained in:
Jan Jasek 2023-03-16 22:13:09 +01:00
parent 1947656728
commit c88583e33a
25 changed files with 294 additions and 433 deletions

View File

@ -332,10 +332,8 @@ class TestCase(BaseTestCase, AssertsMixin):
self.home_pg = self.login_pg.login(self.TEST_USER_NAME,
self.TEST_PASSWORD)
self.home_pg.change_project(self.HOME_PROJECT)
self.assertTrue(
self.home_pg.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
self.home_pg.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
self.home_pg.find_messages_and_dismiss(), {messages.SUCCESS})
def cleanup():
if self.home_pg.is_logged_in:

View File

@ -12,7 +12,7 @@ help_url=https://docs.openstack.org/
[selenium]
# Timeout in seconds to wait for message confirmation modal
# (float value)
message_implicit_wait=0.1
message_implicit_wait=3
# Timeout in seconds to wait for a page to become available
# (integer value)

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import selenium.common.exceptions as Exceptions
from selenium.webdriver.common import by
from openstack_dashboard.test.integration_tests.pages import navigation
@ -24,6 +25,7 @@ class BasePage(pageobject.PageObject):
_heading_locator = (by.By.CSS_SELECTOR, 'div.page-header > h2')
_help_page_brand = (by.By.CSS_SELECTOR, '.navbar-brand')
_default_message_locator = (by.By.CSS_SELECTOR, 'div.alert')
@property
def heading(self):
@ -59,12 +61,25 @@ class BasePage(pageobject.PageObject):
def choose_theme(self, theme_name):
self.topbar.user_dropdown_menu.choose_theme(theme_name)
def find_message_and_dismiss(self, message_level=messages.SUCCESS):
message = messages.MessageRegion(self.driver, self.conf, message_level)
is_message_present = message.exists()
if is_message_present:
def find_all_messages(self):
self.driver.implicitly_wait(self.conf.selenium.message_implicit_wait)
try:
msg_elements = self.driver.find_elements(
*self._default_message_locator)
except Exceptions.NoSuchElementException:
msg_elements = []
finally:
self._turn_on_implicit_wait()
return msg_elements
def find_messages_and_dismiss(self):
messages_level_present = set()
for message_element in self.find_all_messages():
message = messages.MessageRegion(
self.driver, self.conf, message_element)
messages_level_present.add(message.message_class)
message.close()
return is_message_present
return messages_level_present
def change_project(self, name):
self.topbar.user_dropdown_project.click_on_project(name)

View File

@ -215,6 +215,7 @@ class ImagesPage(basepage.BaseNavigationPage):
confirm_edit_images_form.protected.pick('No')
confirm_edit_images_form.submit()
self.wait_till_element_disappears(self.wizard_getter)
def delete_image_via_row_action(self, name):
row = self._get_row_with_image_name(name)
@ -289,6 +290,7 @@ class ImagesPage(basepage.BaseNavigationPage):
create_volume_form.availability_zone.value = \
self.conf.launch_instances.available_zone
create_volume_form.submit()
self.wait_till_element_disappears(self.wizard_getter)
def launch_instance_from_image(self, name, instance_name,
instance_count=1, flavor=None):

View File

@ -10,7 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common import by
from openstack_dashboard.test.integration_tests.regions import baseregion
@ -18,28 +17,31 @@ from openstack_dashboard.test.integration_tests.regions import baseregion
ERROR = 'alert-danger'
INFO = 'alert-info'
SUCCESS = 'alert-success'
WARNING = 'alert-warning'
class MessageRegion(baseregion.BaseRegion):
_close_locator = (by.By.CSS_SELECTOR, 'a.close')
def _msg_locator(self, level):
return (by.By.CSS_SELECTOR, 'div.alert.%s' % level)
def __init__(self, driver, conf, level=SUCCESS):
self._default_src_locator = self._msg_locator(level)
# NOTE(nhelgeson): Running selenium on remote servers
# requires extra time to wait for message to pop up.
driver.implicitly_wait(conf.selenium.message_implicit_wait)
try:
super().__init__(driver, conf)
except NoSuchElementException:
self.src_elem = None
finally:
self._turn_on_implicit_wait()
def __init__(self, driver, conf, src_elem):
self.src_elem = src_elem
self.message_class = self.get_message_class()
def exists(self):
return self._is_element_displayed(self.src_elem)
def close(self):
self._get_element(*self._close_locator).click()
def get_message_class(self):
message_class = self.src_elem.get_attribute("class")
if SUCCESS in message_class:
return SUCCESS
elif ERROR in message_class:
return ERROR
elif INFO in message_class:
return INFO
elif WARNING in message_class:
return WARNING
else:
return "Unknown"

View File

@ -34,12 +34,8 @@ class TestDefaults(helpers.AdminTestCase):
"""
default_quota_values = self.defaults_page.compute_quota_values
self.defaults_page.update_compute_defaults(self.add_up)
self.assertTrue(
self.defaults_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
self.defaults_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
self.defaults_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertGreater(len(default_quota_values), 0)
for quota_name in default_quota_values:
@ -63,12 +59,8 @@ class TestDefaults(helpers.AdminTestCase):
self.defaults_page.go_to_volume_quotas_tab()
default_quota_values = self.defaults_page.volume_quota_values
self.defaults_page.update_volume_defaults(self.add_up)
self.assertTrue(
self.defaults_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
self.defaults_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
self.defaults_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertGreater(len(default_quota_values), 0)
for quota_name in default_quota_values:

View File

@ -43,19 +43,15 @@ class TestFlavors(helpers.AdminTestCase):
ephemeral_disk=0,
swap_disk=0
)
self.assertTrue(
self.flavors_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
self.flavors_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
self.flavors_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(
self.flavors_page.is_flavor_present(self.FLAVOR_NAME))
def _delete_flavor(self, flavor_name):
self.flavors_page.delete_flavor_by_row(flavor_name)
self.assertTrue(
self.flavors_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
self.flavors_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
self.flavors_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(
self.flavors_page.is_flavor_present(self.FLAVOR_NAME))

View File

@ -25,17 +25,13 @@ class TestFloatingip(helpers.TestCase):
floatingip_page = \
self.home_pg.go_to_project_network_floatingipspage()
floating_ip = floatingip_page.allocate_floatingip()
self.assertTrue(
floatingip_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
floatingip_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
floatingip_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(floatingip_page.is_floatingip_present(floating_ip))
floatingip_page.release_floatingip(floating_ip)
self.assertTrue(
floatingip_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
floatingip_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
floatingip_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(floatingip_page.is_floatingip_present(floating_ip))
@ -48,10 +44,8 @@ class TestFloatingipAssociateDisassociate(helpers.TestCase):
timestamp=False)
instances_page = self.home_pg.go_to_project_compute_instancespage()
instances_page.create_instance(instance_name)
self.assertTrue(
instances_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
instances_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(instances_page.is_instance_active(instance_name))
instance_ipv4 = instances_page.get_fixed_ipv4(instance_name)
instance_info = "{} {}".format(instance_name, instance_ipv4)
@ -59,40 +53,29 @@ class TestFloatingipAssociateDisassociate(helpers.TestCase):
floatingip_page = \
self.home_pg.go_to_project_network_floatingipspage()
floating_ip = floatingip_page.allocate_floatingip()
self.assertTrue(
floatingip_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
floatingip_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
floatingip_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(floatingip_page.is_floatingip_present(floating_ip))
self.assertEqual('-', floatingip_page.get_fixed_ip(floating_ip))
floatingip_page.associate_floatingip(floating_ip, instance_name,
instance_ipv4)
self.assertTrue(
floatingip_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
floatingip_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
floatingip_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertEqual(instance_info,
floatingip_page.get_fixed_ip(floating_ip))
floatingip_page.disassociate_floatingip(floating_ip)
self.assertTrue(
floatingip_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
floatingip_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
floatingip_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertEqual('-', floatingip_page.get_fixed_ip(floating_ip))
floatingip_page.release_floatingip(floating_ip)
self.assertTrue(
floatingip_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
floatingip_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
floatingip_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(floatingip_page.is_floatingip_present(floating_ip))
instances_page = self.home_pg.go_to_project_compute_instancespage()
instances_page.delete_instance(instance_name)
self.assertTrue(
instances_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
instances_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
floatingip_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(instances_page.is_instance_deleted(instance_name))

View File

@ -31,18 +31,14 @@ class TestGroup(helpers.AdminTestCase):
def _test_create_group(self, group_name, group_desc=None):
self.groups_page.create_group(name=group_name, description=group_desc)
self.assertTrue(
self.groups_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
self.groups_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
self.groups_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(self.groups_page.is_group_present(group_name))
def _test_delete_group(self, group_name):
self.groups_page.delete_group(name=group_name)
self.assertTrue(
self.groups_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
self.groups_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
self.groups_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(self.groups_page.is_group_present(group_name))
def test_create_delete_group(self):
@ -58,9 +54,7 @@ class TestGroup(helpers.AdminTestCase):
new_group_name = self.group_name
new_group_desc = self.group_description
self.groups_page.edit_group(group_name, new_group_name, new_group_desc)
self.assertTrue(
self.groups_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
self.groups_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
self.groups_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(self.groups_page.is_group_present(new_group_name))
self._test_delete_group(new_group_name)

View File

@ -32,16 +32,12 @@ class TestAdminGroupTypes(helpers.AdminTestCase):
"""
group_types_page = self.home_pg.go_to_admin_volume_grouptypespage()
group_types_page.create_group_type(self.GROUP_TYPE_NAME)
self.assertTrue(
group_types_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
group_types_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
group_types_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(group_types_page.is_group_type_present(
self.GROUP_TYPE_NAME))
group_types_page.delete_group_type(self.GROUP_TYPE_NAME)
self.assertTrue(
group_types_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
group_types_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
group_types_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(group_types_page.is_group_type_deleted(
self.GROUP_TYPE_NAME))

View File

@ -34,17 +34,13 @@ class TestHostAggregates(helpers.AdminTestCase):
hostaggregates_page.create_host_aggregate(
name=self.HOST_AGGREGATE_NAME,
availability_zone=self.HOST_AGGREGATE_AVAILABILITY_ZONE)
self.assertTrue(
hostaggregates_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(hostaggregates_page.find_message_and_dismiss(
messages.ERROR))
self.assertEqual(
hostaggregates_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(hostaggregates_page.is_host_aggregate_present(
self.HOST_AGGREGATE_NAME))
hostaggregates_page.delete_host_aggregate(self.HOST_AGGREGATE_NAME)
self.assertTrue(
hostaggregates_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(hostaggregates_page.find_message_and_dismiss(
messages.ERROR))
self.assertEqual(
hostaggregates_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(hostaggregates_page.is_host_aggregate_present(
self.HOST_AGGREGATE_NAME))

View File

@ -43,8 +43,8 @@ class TestImagesBasicAngular(helpers.TestCase):
images_page.create_image(self.IMAGE_NAME,
image_source_type='url',
**kwargs)
self.assertTrue(images_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(images_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
images_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(images_page.is_image_present(self.IMAGE_NAME))
self.assertTrue(images_page.is_image_active(self.IMAGE_NAME))
return images_page
@ -52,8 +52,8 @@ class TestImagesBasicAngular(helpers.TestCase):
def image_delete(self, image_name):
images_page = self.images_page
images_page.delete_image(image_name)
self.assertTrue(images_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(images_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
images_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(images_page.is_image_present(self.IMAGE_NAME))
def test_image_create_delete_from_local_file(self):
@ -111,8 +111,8 @@ class TestImagesBasicAngular(helpers.TestCase):
garbage = [i for i in image_list if i not in default_image_list]
if garbage:
images_page.delete_images(garbage)
self.assertTrue(
images_page.find_message_and_dismiss(messages.SUCCESS))
self.assertEqual(
images_page.find_messages_and_dismiss(), {messages.SUCCESS})
items_per_page = 1
images_count = 2
@ -121,10 +121,8 @@ class TestImagesBasicAngular(helpers.TestCase):
for image_name in images_names:
with helpers.gen_temporary_file() as file_name:
images_page.create_image(image_name, image_file=file_name)
self.assertTrue(
images_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
images_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
images_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(images_page.is_image_present(image_name))
first_page_definition = {'Next': True, 'Prev': False,
@ -139,7 +137,7 @@ class TestImagesBasicAngular(helpers.TestCase):
settings_page = self.home_pg.go_to_settings_usersettingspage()
settings_page.change_pagesize(items_per_page)
settings_page.find_message_and_dismiss(messages.SUCCESS)
settings_page.find_messages_and_dismiss()
images_page = self.images_page
if not images_page.is_image_present(default_image_list[0]):
@ -160,13 +158,13 @@ class TestImagesBasicAngular(helpers.TestCase):
settings_page = self.home_pg.go_to_settings_usersettingspage()
settings_page.change_pagesize()
settings_page.find_message_and_dismiss(messages.SUCCESS)
settings_page.find_messages_and_dismiss()
images_page = self.images_page
images_page.wait_until_image_present(default_image_list[0])
images_page.delete_images(images_names)
self.assertTrue(images_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(images_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
images_page.find_messages_and_dismiss(), {messages.SUCCESS})
class TestImagesAdminAngular(helpers.AdminTestCase, TestImagesBasicAngular):
@ -220,8 +218,8 @@ class TestImagesAdminAngular(helpers.AdminTestCase, TestImagesBasicAngular):
with helpers.gen_temporary_file() as file_name:
images_page = self.image_create(local_file=file_name)
images_page.edit_image(self.IMAGE_NAME, protected=True)
self.assertTrue(
images_page.find_message_and_dismiss(messages.SUCCESS))
self.assertEqual(
images_page.find_messages_and_dismiss(), {messages.SUCCESS})
# Check that Delete action is not available in the action list.
# The below action will generate exception since the bind fails.
@ -235,15 +233,9 @@ class TestImagesAdminAngular(helpers.AdminTestCase, TestImagesBasicAngular):
images_page = self.images_page
images_page.edit_image(self.IMAGE_NAME, protected=False)
self.assertTrue(
images_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
images_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
images_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.image_delete(self.IMAGE_NAME)
self.assertFalse(
images_page.find_message_and_dismiss(messages.ERROR))
self.assertFalse(images_page.is_image_present(self.IMAGE_NAME))
def test_edit_image_description_and_name(self):
"""tests that image description is editable
@ -265,10 +257,8 @@ class TestImagesAdminAngular(helpers.AdminTestCase, TestImagesBasicAngular):
images_page = self.image_create(local_file=file_name)
images_page.edit_image(self.IMAGE_NAME,
description=new_description_text)
self.assertTrue(
images_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
images_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
images_page.find_messages_and_dismiss(), {messages.SUCCESS})
results = images_page.check_image_details(self.IMAGE_NAME,
{'Description':
@ -279,20 +269,14 @@ class TestImagesAdminAngular(helpers.AdminTestCase, TestImagesBasicAngular):
images_page = self.images_page
images_page.edit_image(self.IMAGE_NAME,
new_name=new_image_name)
self.assertTrue(
images_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
images_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
images_page.find_messages_and_dismiss(), {messages.SUCCESS})
results = images_page.check_image_details(new_image_name,
{'Name':
new_image_name})
self.assertSequenceTrue(results)
self.image_delete(new_image_name)
self.assertFalse(
images_page.find_message_and_dismiss(messages.ERROR))
self.assertFalse(images_page.is_image_present(self.IMAGE_NAME))
def test_filter_images(self):
"""This test checks filtering of images
@ -354,10 +338,8 @@ class TestImagesAdvancedAngular(helpers.TestCase):
images_page.create_volume_from_image(
source_image, volume_name=target_volume)
self.assertTrue(
images_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
images_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
images_page.find_messages_and_dismiss(), {messages.INFO})
volumes_page = self.volumes_page()
@ -365,8 +347,7 @@ class TestImagesAdvancedAngular(helpers.TestCase):
self.assertTrue(volumes_page.is_volume_status(target_volume,
'Available'))
volumes_page.delete_volume(target_volume)
volumes_page.find_message_and_dismiss(messages.SUCCESS)
volumes_page.find_message_and_dismiss(messages.ERROR)
volumes_page.find_messages_and_dismiss()
volumes_page = self.volumes_page()
self.assertTrue(volumes_page.is_volume_deleted(target_volume))
@ -387,10 +368,8 @@ class TestImagesAdvancedAngular(helpers.TestCase):
target_instance = "created_from_{0}".format(source_image)
images_page.launch_instance_from_image(source_image, target_instance)
self.assertTrue(
images_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
images_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
images_page.find_messages_and_dismiss(), {messages.INFO})
instances_page = self.instances_page()
self.assertTrue(instances_page.is_instance_active(target_instance))
@ -399,8 +378,6 @@ class TestImagesAdvancedAngular(helpers.TestCase):
self.assertEqual(source_image, actual_image_name)
instances_page.delete_instance(target_instance)
self.assertTrue(
instances_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
instances_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(instances_page.is_instance_deleted(target_instance))

View File

@ -33,16 +33,14 @@ class TestInstances(helpers.TestCase):
instances_page = self.home_pg.go_to_project_compute_instancespage()
instances_page.create_instance(self.INSTANCE_NAME)
self.assertTrue(instances_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
instances_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(instances_page.is_instance_active(self.INSTANCE_NAME))
instances_page = self.instances_page
instances_page.delete_instance(self.INSTANCE_NAME)
self.assertTrue(instances_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
instances_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(instances_page.is_instance_deleted(self.INSTANCE_NAME))
@ -68,33 +66,33 @@ class TestInstancesPagination(helpers.TestCase):
name_column='Instance Name')
if garbage:
instances_page.delete_instances(garbage)
self.assertTrue(
instances_page.find_message_and_dismiss(messages.INFO))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(
instances_page.are_instances_deleted(garbage))
instances_page.create_instance(self.INSTANCE_NAME,
instance_count=self.INSTANCE_COUNT)
self.assertTrue(
instances_page.find_message_and_dismiss(messages.INFO))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(
instances_page.is_instance_active(self.instance_list[1]))
settings_page = self.home_pg.go_to_settings_usersettingspage()
settings_page.change_pagesize(self.ITEMS_PER_PAGE)
self.assertTrue(
settings_page.find_message_and_dismiss(messages.SUCCESS))
self.assertEqual(
settings_page.find_messages_and_dismiss(), {messages.SUCCESS})
def cleanup():
settings_page = self.home_pg.go_to_settings_usersettingspage()
settings_page.change_pagesize()
self.assertTrue(
settings_page.find_message_and_dismiss(messages.SUCCESS))
self.assertEqual(
settings_page.find_messages_and_dismiss(), {messages.SUCCESS})
instances_page = self.instances_page
instances_page.delete_instances(self.instance_list)
self.assertTrue(
instances_page.find_message_and_dismiss(messages.INFO))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(
instances_page.are_instances_deleted(self.instance_list))
@ -207,23 +205,23 @@ class TestInstancesFilter(helpers.TestCase):
name_column='Instance Name')
if garbage:
instances_page.delete_instances(garbage)
self.assertTrue(
instances_page.find_message_and_dismiss(messages.INFO))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(
instances_page.are_instances_deleted(garbage))
instances_page.create_instance(self.INSTANCE_NAME,
instance_count=self.INSTANCE_COUNT)
self.assertTrue(
instances_page.find_message_and_dismiss(messages.INFO))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(
instances_page.is_instance_active(self.instance_list[1]))
def cleanup():
instances_page = self.instances_page
instances_page.delete_instances(self.instance_list)
self.assertTrue(
instances_page.find_message_and_dismiss(messages.INFO))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(
instances_page.are_instances_deleted(self.instance_list))
@ -289,33 +287,33 @@ class TestAdminInstancesPagination(helpers.AdminTestCase, TestInstances):
name_column='Instance Name')
if garbage:
instances_page.delete_instances(garbage)
self.assertTrue(
instances_page.find_message_and_dismiss(messages.INFO))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(
instances_page.are_instances_deleted(garbage))
instances_page.create_instance(self.INSTANCE_NAME,
instance_count=self.INSTANCE_COUNT)
self.assertTrue(
instances_page.find_message_and_dismiss(messages.INFO))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(
instances_page.is_instance_active(self.instance_list[1]))
settings_page = self.home_pg.go_to_settings_usersettingspage()
settings_page.change_pagesize(self.ITEMS_PER_PAGE)
self.assertTrue(
settings_page.find_message_and_dismiss(messages.SUCCESS))
self.assertEqual(
settings_page.find_messages_and_dismiss(), {messages.SUCCESS})
def cleanup():
settings_page = self.home_pg.go_to_settings_usersettingspage()
settings_page.change_pagesize()
self.assertTrue(
settings_page.find_message_and_dismiss(messages.SUCCESS))
self.assertEqual(
settings_page.find_messages_and_dismiss(), {messages.SUCCESS})
instances_page = self.instances_page
instances_page.delete_instances(self.instance_list)
self.assertTrue(
instances_page.find_message_and_dismiss(messages.INFO))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(
instances_page.are_instances_deleted(self.instance_list))

View File

@ -27,14 +27,14 @@ class TestKeypair(helpers.TestCase):
keypair_page = self.home_pg.\
go_to_project_compute_keypairspage()
keypair_page.create_keypair(self.KEYPAIR_NAME)
self.assertFalse(keypair_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
keypair_page.find_messages_and_dismiss(), {messages.SUCCESS})
keypair_page = self.home_pg.\
go_to_project_compute_keypairspage()
self.assertTrue(keypair_page.is_keypair_present(self.KEYPAIR_NAME))
keypair_page.delete_keypair(self.KEYPAIR_NAME)
self.assertTrue(
keypair_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(keypair_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
keypair_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(keypair_page.is_keypair_present(self.KEYPAIR_NAME))

View File

@ -54,8 +54,8 @@ class TestMetadataDefinitions(helpers.AdminTestCase):
is_protected=is_protected,
namespace_source_type=template_source_type)
# Checks
self.assertTrue(page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(page.is_namespace_present(namespace_name))
row = page._get_row_with_namespace_name(namespace_name)
if checks:
@ -79,8 +79,8 @@ class TestMetadataDefinitions(helpers.AdminTestCase):
"""
page.delete_namespace(name=namespace_name)
# Checks
self.assertTrue(page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(page.is_namespace_present(namespace_name))
def test_namespace_create_delete(self):

View File

@ -37,18 +37,14 @@ class TestNetworks(helpers.TestCase):
networks_page = self.networks_page
networks_page.create_network(self.NETWORK_NAME, self.SUBNET_NAME)
self.assertTrue(
networks_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
networks_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
networks_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(networks_page.is_network_present(self.NETWORK_NAME))
self.assertTrue(networks_page.is_network_active(self.NETWORK_NAME))
networks_page.delete_network(self.NETWORK_NAME)
self.assertTrue(
networks_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
networks_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
networks_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(networks_page.is_network_present(self.NETWORK_NAME))
@ -81,10 +77,8 @@ class TestNetworksPagination(helpers.TestCase):
networks_page = self.networks_page
for network_name in networks_names:
networks_page.create_network(network_name, self.SUBNET_NAME)
self.assertTrue(
networks_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
networks_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
networks_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(networks_page.is_network_present(network_name))
self.assertTrue(networks_page.is_network_active(network_name))
# we have to get this now, before we change page size
@ -98,10 +92,9 @@ class TestNetworksPagination(helpers.TestCase):
networks_page = self.networks_page
for network_name in networks_names:
networks_page.delete_network(network_name)
self.assertTrue(
networks_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
networks_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
networks_page.find_messages_and_dismiss(),
{messages.SUCCESS})
self.assertFalse(networks_page.is_network_present(network_name))
self.addCleanup(cleanup)
@ -166,4 +159,4 @@ class TestNetworksPagination(helpers.TestCase):
settings_page.change_pagesize(items_per_page)
else:
settings_page.change_pagesize()
settings_page.find_message_and_dismiss(messages.SUCCESS)
settings_page.find_messages_and_dismiss()

View File

@ -24,17 +24,13 @@ class TestCreateDeleteProject(helpers.AdminTestCase):
def test_create_delete_project(self):
self.projects_page.create_project(PROJECT_NAME)
self.assertTrue(
self.projects_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
self.projects_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
self.projects_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(self.projects_page.is_project_present(PROJECT_NAME))
self.projects_page.delete_project(PROJECT_NAME)
self.assertTrue(
self.projects_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
self.projects_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
self.projects_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(self.projects_page.is_project_present(PROJECT_NAME))
@ -44,8 +40,8 @@ class TestModifyProject(helpers.AdminTestCase):
super().setUp()
self.projects_page = self.home_pg.go_to_identity_projectspage()
self.projects_page.create_project(PROJECT_NAME)
self.assertTrue(
self.projects_page.find_message_and_dismiss(messages.SUCCESS))
self.assertEqual(
self.projects_page.find_messages_and_dismiss(), {messages.SUCCESS})
def cleanup():
if not self.projects_page.is_the_current_page():
@ -62,10 +58,8 @@ class TestModifyProject(helpers.AdminTestCase):
self.projects_page.allocate_user_to_project(
admin_name, roles2add, PROJECT_NAME)
self.assertTrue(
self.projects_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
self.projects_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
self.projects_page.find_messages_and_dismiss(), {messages.SUCCESS})
user_roles = self.projects_page.get_user_roles_at_project(
admin_name, PROJECT_NAME)

View File

@ -28,18 +28,16 @@ class TestRouters(helpers.TestCase):
routers_page = self.routers_page
routers_page.create_router(self.ROUTER_NAME)
self.assertTrue(
routers_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
routers_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(routers_page.is_router_present(self.ROUTER_NAME))
self.assertTrue(routers_page.is_router_active(self.ROUTER_NAME))
def _delete_router(self):
routers_page = self.routers_page
routers_page.delete_router(self.ROUTER_NAME)
self.assertTrue(
routers_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
routers_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(routers_page.is_router_present(self.ROUTER_NAME))
def test_router_create(self):
@ -55,32 +53,28 @@ class TestRouters(helpers.TestCase):
def _create_interface(self, interfaces_page):
interfaces_page.create_interface(self.SUBNET_NAME)
self.assertTrue(
interfaces_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
interfaces_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
interfaces_page.find_messages_and_dismiss(), {messages.SUCCESS})
interface_name = interfaces_page.interface_name
self.assertTrue(interfaces_page.is_interface_present(interface_name))
def _delete_interface(self, interfaces_page, interface_name):
interfaces_page.delete_interface(interface_name)
self.assertTrue(
interfaces_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
interfaces_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
interfaces_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(interfaces_page.is_interface_present(interface_name))
def _create_subnet(self):
networks_page = self.home_pg.go_to_project_network_networkspage()
networks_page.create_network(self.NETWORK_NAME, self.SUBNET_NAME)
self.assertTrue(
networks_page.find_message_and_dismiss(messages.SUCCESS))
self.assertEqual(
networks_page.find_messages_and_dismiss(), {messages.SUCCESS})
def _delete_subnet(self):
networks_page = self.home_pg.go_to_project_network_networkspage()
networks_page.delete_network(self.NETWORK_NAME)
self.assertTrue(
networks_page.find_message_and_dismiss(messages.SUCCESS))
self.assertEqual(
networks_page.find_messages_and_dismiss(), {messages.SUCCESS})
def test_router_add_delete_interface(self):
"""Tests the router interface creation and deletion functionalities:
@ -191,9 +185,8 @@ class TestAdminRouters(helpers.AdminTestCase):
routers_page = self.home_pg.go_to_project_network_routerspage()
routers_page.create_router(self.ROUTER_NAME)
self.assertTrue(
routers_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
routers_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(routers_page.is_router_present(self.ROUTER_NAME))
self.assertTrue(routers_page.is_router_active(self.ROUTER_NAME))
@ -204,18 +197,14 @@ class TestAdminRouters(helpers.AdminTestCase):
new_name = "edited_" + self.ROUTER_NAME
admin_routers_page.edit_router(self.ROUTER_NAME, new_name=new_name)
self.assertTrue(
admin_routers_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
admin_routers_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
admin_routers_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(
admin_routers_page.is_router_present(new_name))
self.assertTrue(
admin_routers_page.is_router_active(new_name))
admin_routers_page.delete_router(new_name)
self.assertTrue(
admin_routers_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
admin_routers_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
admin_routers_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(admin_routers_page.is_router_present(new_name))

View File

@ -45,26 +45,22 @@ class TestRouters(helpers.TestCase):
routers_page = self.home_pg.go_to_project_network_routerspage()
routers_page.create_router(self.ROUTER_NAME)
self.assertTrue(
routers_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
routers_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(routers_page.is_router_present(self.ROUTER_NAME))
self.assertTrue(routers_page.is_router_active(self.ROUTER_NAME))
routers_page.clear_gateway(self.ROUTER_NAME)
self.assertTrue(
routers_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
routers_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(routers_page.is_gateway_cleared(self.ROUTER_NAME))
routers_page.set_gateway(self.ROUTER_NAME)
self.assertTrue(
routers_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
routers_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(routers_page.is_gateway_set(self.ROUTER_NAME))
routers_page.delete_router(self.ROUTER_NAME)
self.assertTrue(
routers_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
routers_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(routers_page.is_router_present(self.ROUTER_NAME))

View File

@ -29,45 +29,44 @@ class TestSecuritygroup(helpers.TestCase):
page = self.securitygroup_page
rule_page = page.create_securitygroup(self.SEC_GROUP_NAME)
if rule_page:
self.assertTrue(
rule_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
rule_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
rule_page.find_messages_and_dismiss(), {messages.SUCCESS})
page = self.securitygroup_page
self.assertTrue(page.is_securitygroup_present(self.SEC_GROUP_NAME))
else:
self.assertTrue(page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(page.is_securitygroup_present(self.SEC_GROUP_NAME))
def _delete_securitygroup(self):
page = self.securitygroup_page
page.delete_securitygroup(self.SEC_GROUP_NAME)
self.assertTrue(page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(page.is_securitygroup_present(self.SEC_GROUP_NAME))
def _add_rule(self):
page = self.securitygroup_page
page = page.go_to_manage_rules(self.SEC_GROUP_NAME)
page.create_rule(self.RULE_PORT)
self.assertTrue(page.find_message_and_dismiss(messages.SUCCESS))
self.assertEqual(
page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(page.is_port_present(self.RULE_PORT))
def _delete_rule_by_table_action(self):
page = self.securitygroup_page
page = page.go_to_manage_rules(self.SEC_GROUP_NAME)
page.delete_rules(self.RULE_PORT)
self.assertTrue(page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(page.is_port_present(self.RULE_PORT))
def _delete_rule_by_row_action(self):
page = self.securitygroup_page
page = page.go_to_manage_rules(self.SEC_GROUP_NAME)
page.delete_rule(self.RULE_PORT)
self.assertTrue(page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(page.is_port_present(self.RULE_PORT))
def test_securitygroup_create_delete(self):

View File

@ -135,28 +135,20 @@ class TestUserSettings(helpers.TestCase):
"""
settings_page = self.home_pg.go_to_settings_usersettingspage()
settings_page.change_language("es")
self.assertTrue(
settings_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
settings_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
settings_page.find_messages_and_dismiss(), {messages.SUCCESS})
settings_page.change_timezone("Asia/Jerusalem")
self.assertTrue(
settings_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
settings_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
settings_page.find_messages_and_dismiss(), {messages.SUCCESS})
settings_page.change_pagesize("30")
self.assertTrue(
settings_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
settings_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
settings_page.find_messages_and_dismiss(), {messages.SUCCESS})
settings_page.change_loglines("50")
self.assertTrue(
settings_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
settings_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
settings_page.find_messages_and_dismiss(), {messages.SUCCESS})
changed_settings = {
"language": "es",

View File

@ -23,11 +23,11 @@ class TestUser(helpers.AdminTestCase):
users_page.create_user(self.USER_NAME, password=password,
project='admin', role='admin')
self.assertTrue(users_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(users_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
users_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(users_page.is_user_present(self.USER_NAME))
users_page.delete_user(self.USER_NAME)
self.assertTrue(users_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(users_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
users_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(users_page.is_user_present(self.USER_NAME))

View File

@ -32,14 +32,14 @@ class TestVolumeSnapshotsBasic(helpers.TestCase):
super().setUp()
volumes_page = self.home_pg.go_to_project_volumes_volumespage()
volumes_page.create_volume(self.VOLUME_NAME)
volumes_page.find_message_and_dismiss(messages.INFO)
volumes_page.find_messages_and_dismiss()
self.assertTrue(volumes_page.is_volume_status(self.VOLUME_NAME,
'Available'))
def cleanup():
volumes_page = self.home_pg.go_to_project_volumes_volumespage()
volumes_page.delete_volume(self.VOLUME_NAME)
volumes_page.find_message_and_dismiss(messages.INFO)
volumes_page.find_messages_and_dismiss()
self.assertTrue(volumes_page.is_volume_deleted(self.VOLUME_NAME))
self.addCleanup(cleanup)
@ -61,8 +61,8 @@ class TestVolumeSnapshotsBasic(helpers.TestCase):
volumes_page = self.home_pg.go_to_project_volumes_volumespage()
volumes_snapshot_page = volumes_page.create_volume_snapshot(
self.VOLUME_NAME, self.VOLUME_SNAPSHOT_NAME)
self.assertTrue(volumes_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(volumes_snapshot_page.is_volume_snapshot_available(
self.VOLUME_SNAPSHOT_NAME))
actual_volume_name = volumes_snapshot_page.get_volume_name(
@ -74,18 +74,15 @@ class TestVolumeSnapshotsBasic(helpers.TestCase):
self.home_pg.go_to_project_volumes_snapshotspage()
volumes_snapshot_page.edit_snapshot(self.VOLUME_SNAPSHOT_NAME,
new_name, "description")
self.assertTrue(
volumes_snapshot_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
volumes_snapshot_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(volumes_snapshot_page.
is_volume_snapshot_available(new_name))
volumes_snapshot_page.delete_volume_snapshot(new_name)
self.assertTrue(
volumes_snapshot_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
volumes_snapshot_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_snapshot_page.find_messages_and_dismiss(),
{messages.SUCCESS})
self.assertTrue(volumes_snapshot_page.is_volume_snapshot_deleted(
new_name))
@ -120,7 +117,7 @@ class TestVolumeSnapshotsBasic(helpers.TestCase):
for i, name in enumerate(snapshot_names):
volumes_snapshot_page = volumes_page.create_volume_snapshot(
self.VOLUME_NAME, name)
volumes_page.find_message_and_dismiss(messages.INFO)
volumes_page.find_messages_and_dismiss()
self.assertTrue(
volumes_snapshot_page.is_volume_snapshot_available(name))
if i < count - 1:
@ -138,7 +135,7 @@ class TestVolumeSnapshotsBasic(helpers.TestCase):
settings_page = self.home_pg.go_to_settings_usersettingspage()
settings_page.change_pagesize(items_per_page)
settings_page.find_message_and_dismiss(messages.SUCCESS)
settings_page.find_messages_and_dismiss()
volumes_snapshot_page = self.volumes_snapshot_page
volumes_snapshot_page.volumesnapshots_table.assert_definition(
@ -162,11 +159,11 @@ class TestVolumeSnapshotsBasic(helpers.TestCase):
settings_page = self.home_pg.go_to_settings_usersettingspage()
settings_page.change_pagesize()
settings_page.find_message_and_dismiss(messages.SUCCESS)
settings_page.find_messages_and_dismiss()
volumes_snapshot_page = self.volumes_snapshot_page
volumes_snapshot_page.delete_volume_snapshots(snapshot_names)
volumes_snapshot_page.find_message_and_dismiss(messages.SUCCESS)
volumes_snapshot_page.find_messages_and_dismiss()
for name in snapshot_names:
volumes_snapshot_page.is_volume_snapshot_deleted(name)
@ -202,17 +199,15 @@ class TestVolumeSnapshotsAdvanced(helpers.TestCase):
super().setUp()
volumes_page = self.home_pg.go_to_project_volumes_volumespage()
volumes_page.create_volume(self.VOLUME_NAME)
volumes_page.find_message_and_dismiss(messages.INFO)
volumes_page.find_messages_and_dismiss()
self.assertTrue(volumes_page.is_volume_status(self.VOLUME_NAME,
'Available'))
def cleanup():
volumes_page = self.home_pg.go_to_project_volumes_volumespage()
volumes_page.delete_volume(self.VOLUME_NAME)
self.assertTrue(
volumes_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(volumes_page.is_volume_deleted(self.VOLUME_NAME))
self.addCleanup(cleanup)
@ -221,8 +216,8 @@ class TestVolumeSnapshotsAdvanced(helpers.TestCase):
volumes_page = self.home_pg.go_to_project_volumes_volumespage()
volumes_snapshot_page = volumes_page.create_volume_snapshot(
self.VOLUME_NAME, self.VOLUME_SNAPSHOT_NAME)
self.assertTrue(volumes_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(volumes_snapshot_page.is_volume_snapshot_available(
self.VOLUME_SNAPSHOT_NAME))
@ -236,19 +231,17 @@ class TestVolumeSnapshotsAdvanced(helpers.TestCase):
def delete_snapshot(self):
volumes_snapshot_page = self.volumes_snapshot_page
volumes_snapshot_page.delete_volume_snapshot(self.VOLUME_SNAPSHOT_NAME)
self.assertTrue(
volumes_snapshot_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
volumes_snapshot_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_snapshot_page.find_messages_and_dismiss(),
{messages.SUCCESS})
self.assertTrue(volumes_snapshot_page.is_volume_snapshot_deleted(
self.VOLUME_SNAPSHOT_NAME))
def delete_volume(self, new_volume):
volumes_page = self.home_pg.go_to_project_volumes_volumespage()
volumes_page.delete_volume(new_volume)
self.assertTrue(
volumes_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(volumes_page.is_volume_deleted(new_volume))
@pytest.mark.skipif(

View File

@ -44,29 +44,23 @@ class TestVolumesBasic(helpers.TestCase):
"""
volumes_page = self.home_pg.go_to_project_volumes_volumespage()
volumes_page.create_volume(self.VOLUME_NAME)
self.assertTrue(
volumes_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(volumes_page.is_volume_present(self.VOLUME_NAME))
self.assertTrue(volumes_page.is_volume_status(self.VOLUME_NAME,
'Available'))
new_name = "edited_" + self.VOLUME_NAME
volumes_page.edit_volume(self.VOLUME_NAME, new_name, "description")
self.assertTrue(
volumes_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(volumes_page.is_volume_present(new_name))
self.assertTrue(volumes_page.is_volume_status(new_name, 'Available'))
volumes_page = self.volumes_page
volumes_page.delete_volume(new_name)
self.assertTrue(
volumes_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(volumes_page.is_volume_deleted(new_name))
# NOTE(tsufiev): A short regression test on bug 1553314: we try to
# re-open 'Create Volume' button after the volume was deleted. If the
@ -107,8 +101,8 @@ class TestVolumesBasic(helpers.TestCase):
name_column='Name')
if garbage:
volumes_page.delete_volumes(garbage)
self.assertTrue(
volumes_page.find_message_and_dismiss(messages.INFO))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
count = 3
items_per_page = 1
@ -116,10 +110,8 @@ class TestVolumesBasic(helpers.TestCase):
range(count)]
for volume_name in volumes_names:
volumes_page.create_volume(volume_name)
self.assertTrue(
volumes_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(volumes_page.is_volume_present(volume_name))
self.assertTrue(volumes_page.is_volume_status(volume_name,
'Available'))
@ -135,7 +127,7 @@ class TestVolumesBasic(helpers.TestCase):
'Names': [volumes_names[0]]}
settings_page = self.home_pg.go_to_settings_usersettingspage()
settings_page.change_pagesize(items_per_page)
settings_page.find_message_and_dismiss(messages.SUCCESS)
settings_page.find_messages_and_dismiss()
volumes_page = self.volumes_page
volumes_page.volumes_table.assert_definition(first_page_definition)
@ -154,14 +146,12 @@ class TestVolumesBasic(helpers.TestCase):
settings_page = self.home_pg.go_to_settings_usersettingspage()
settings_page.change_pagesize()
settings_page.find_message_and_dismiss(messages.SUCCESS)
settings_page.find_messages_and_dismiss()
volumes_page = self.volumes_page
volumes_page.delete_volumes(volumes_names)
self.assertTrue(
volumes_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(volumes_page.are_volumes_deleted(volumes_names))
@ -200,21 +190,20 @@ class TestVolumesAdvanced(helpers.TestCase):
instance_name = helpers.gen_random_resource_name('instance')
instances_page = self.home_pg.go_to_project_compute_instancespage()
instances_page.create_instance(instance_name)
instances_page.find_message_and_dismiss(messages.INFO)
self.assertFalse(
instances_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(instances_page.is_instance_active(instance_name))
volumes_page = self.volumes_page
volumes_page.create_volume(self.VOLUME_NAME)
volumes_page.find_message_and_dismiss(messages.INFO)
self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(volumes_page.is_volume_status(self.VOLUME_NAME,
'Available'))
volumes_page.attach_volume_to_instance(self.VOLUME_NAME, instance_name)
volumes_page.find_message_and_dismiss(messages.INFO)
self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(volumes_page.is_volume_status(self.VOLUME_NAME,
'In-use'))
self.assertTrue(
@ -223,21 +212,20 @@ class TestVolumesAdvanced(helpers.TestCase):
volumes_page.detach_volume_from_instance(self.VOLUME_NAME,
instance_name)
volumes_page.find_message_and_dismiss(messages.SUCCESS)
self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(volumes_page.is_volume_status(self.VOLUME_NAME,
'Available'))
volumes_page.delete_volume(self.VOLUME_NAME)
volumes_page.find_message_and_dismiss(messages.SUCCESS)
self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(volumes_page.is_volume_deleted(self.VOLUME_NAME))
instances_page = self.home_pg.go_to_project_compute_instancespage()
instances_page.delete_instance(instance_name)
instances_page.find_message_and_dismiss(messages.INFO)
self.assertFalse(
instances_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(instances_page.is_instance_deleted(instance_name))
@ -258,10 +246,8 @@ class TestVolumesActions(helpers.TestCase):
super().setUp()
volumes_page = self.volumes_page
volumes_page.create_volume(self.VOLUME_NAME)
self.assertTrue(
volumes_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(volumes_page.is_volume_present(self.VOLUME_NAME))
self.assertTrue(
volumes_page.is_volume_status(self.VOLUME_NAME, 'Available'))
@ -269,10 +255,8 @@ class TestVolumesActions(helpers.TestCase):
def cleanup():
volumes_page = self.volumes_page
volumes_page.delete_volume(self.VOLUME_NAME)
self.assertTrue(
volumes_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(
volumes_page.is_volume_deleted(self.VOLUME_NAME))
@ -291,10 +275,8 @@ class TestVolumesActions(helpers.TestCase):
volumes_page = self.volumes_page
orig_size = volumes_page.get_size(self.VOLUME_NAME)
volumes_page.extend_volume(self.VOLUME_NAME, orig_size + 1)
self.assertTrue(
volumes_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(
volumes_page.is_volume_status(self.VOLUME_NAME, 'Available'))
new_size = volumes_page.get_size(self.VOLUME_NAME)
@ -316,8 +298,8 @@ class TestVolumesActions(helpers.TestCase):
for disk_format in all_formats:
volumes_page.upload_volume_to_image(
self.VOLUME_NAME, self.IMAGE_NAME, disk_format)
self.assertFalse(
volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volumes_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(volumes_page.is_volume_status(
self.VOLUME_NAME, 'Available'))
images_page = self.images_page
@ -326,10 +308,8 @@ class TestVolumesActions(helpers.TestCase):
self.assertEqual(images_page.get_image_format(self.IMAGE_NAME),
all_formats[disk_format])
images_page.delete_image(self.IMAGE_NAME)
self.assertTrue(images_page.find_message_and_dismiss(
messages.SUCCESS))
self.assertFalse(images_page.find_message_and_dismiss(
messages.ERROR))
self.assertEqual(
images_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(images_page.is_image_present(self.IMAGE_NAME))
volumes_page = \
self.home_pg.go_to_project_volumes_volumespage()
@ -347,10 +327,8 @@ class TestVolumesActions(helpers.TestCase):
6. Delete instance
"""
self.volumes_page.launch_instance(self.VOLUME_NAME, self.INSTANCE_NAME)
self.assertTrue(
self.volumes_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
self.volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
self.volumes_page.find_messages_and_dismiss(), {messages.SUCCESS})
instances_page = self.home_pg.go_to_project_compute_instancespage()
self.assertTrue(instances_page.is_instance_active(self.INSTANCE_NAME))
self.volumes_page = self.home_pg.go_to_project_volumes_volumespage()
@ -360,9 +338,7 @@ class TestVolumesActions(helpers.TestCase):
self.volumes_page.get_attach_instance(self.VOLUME_NAME))
instances_page = self.home_pg.go_to_project_compute_instancespage()
instances_page.delete_instance(self.INSTANCE_NAME)
self.assertTrue(
instances_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(
instances_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
instances_page.find_messages_and_dismiss(), {messages.INFO})
self.assertTrue(instances_page.is_instance_deleted(self.INSTANCE_NAME))
self.volumes_page = self.home_pg.go_to_project_volumes_volumespage()

View File

@ -33,20 +33,14 @@ class TestAdminVolumeTypes(helpers.AdminTestCase):
volume_types_page = self.home_pg.go_to_admin_volume_volumetypespage()
volume_types_page.create_volume_type(self.VOLUME_TYPE_NAME)
self.assertTrue(
volume_types_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
volume_types_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volume_types_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(volume_types_page.is_volume_type_present(
self.VOLUME_TYPE_NAME))
volume_types_page.delete_volume_type(self.VOLUME_TYPE_NAME)
self.assertTrue(
volume_types_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
volume_types_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
volume_types_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(volume_types_page.is_volume_type_deleted(
self.VOLUME_TYPE_NAME))
@ -65,17 +59,13 @@ class TestQoSSpec(helpers.AdminTestCase):
qos_spec_page = self.home_pg.go_to_admin_volume_volumetypespage()
qos_spec_page.create_qos_spec(self.QOS_SPEC_NAME)
self.assertTrue(
qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
qos_spec_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
qos_spec_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(qos_spec_page.is_qos_spec_present(self.QOS_SPEC_NAME))
qos_spec_page.delete_qos_specs(self.QOS_SPEC_NAME)
self.assertTrue(
qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
qos_spec_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
qos_spec_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(qos_spec_page.is_qos_spec_present(self.QOS_SPEC_NAME))
def test_qos_spec_edit_consumer(self):
@ -96,39 +86,29 @@ class TestQoSSpec(helpers.AdminTestCase):
cinder_consumer = 'back-end'
qos_spec_page.create_qos_spec(qos_spec_name)
self.assertTrue(
qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
qos_spec_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
qos_spec_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertTrue(qos_spec_page.is_qos_spec_present(qos_spec_name))
qos_spec_page.edit_consumer(qos_spec_name, nova_compute_consumer)
self.assertTrue(
qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
qos_spec_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
qos_spec_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertEqual(
qos_spec_page.get_consumer(qos_spec_name), nova_compute_consumer)
qos_spec_page.edit_consumer(qos_spec_name, both_consumers)
self.assertTrue(
qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
qos_spec_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
qos_spec_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertEqual(
qos_spec_page.get_consumer(qos_spec_name), both_consumers)
qos_spec_page.edit_consumer(qos_spec_name, cinder_consumer)
self.assertTrue(
qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
qos_spec_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
qos_spec_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertEqual(
qos_spec_page.get_consumer(qos_spec_name), cinder_consumer)
qos_spec_page.delete_qos_specs(qos_spec_name)
self.assertTrue(
qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
self.assertFalse(
qos_spec_page.find_message_and_dismiss(messages.ERROR))
self.assertEqual(
qos_spec_page.find_messages_and_dismiss(), {messages.SUCCESS})
self.assertFalse(qos_spec_page.is_qos_spec_present(qos_spec_name))