Fix volumes and volume_snapshots integration tests
The aim of this PS is to fix existing skipped integration tests related to volumes and volume_snapshots listed below: - TestAdminVolumes.test_volume_create_edit_delete - TestVolumesActions.test_volume_extend - TestVolumesBasic.test_volume_create_edit_delete - TestAdminVolumes.test_volumes_pagination - TestVolumesBasic.test_volumes_pagination - TestVolumeSnapshotsAdmin.test_create_edit_delete_volume_snapshot - TestVolumeSnapshotsBasic.test_create_edit_delete_volume_snapshot - TestVolumeSnapshotsAdmin.test_volume_snapshots_pagination - TestVolumeSnapshotsAdvanced.test_create_volume_from_snapshot - TestVolumeSnapshotsBasic.test_volume_snapshots_pagination This PS also resolves Partial-Bug: #1792028 Change-Id: I31a8d681f87d22ce8486de38ba6c01be9c9cc469
This commit is contained in:
parent
1d072dbe69
commit
7b7cabd071
@ -139,7 +139,7 @@ InstancesGroup = [
|
||||
default='nova',
|
||||
help="Zone to be selected for launch Instances"),
|
||||
cfg.StrOpt('image_name',
|
||||
default='cirros-0.3.5-x86_64-disk (12.7 MB)',
|
||||
default='cirros-0.4.0-x86_64-disk (12.1 MB)',
|
||||
help="Boot Source to be selected for launch Instances"),
|
||||
cfg.StrOpt('flavor',
|
||||
default='m1.tiny',
|
||||
|
@ -97,7 +97,7 @@ ssh_user=cirros
|
||||
#available zone to launch instances
|
||||
available_zone=nova
|
||||
#image_name to launch instances
|
||||
image_name=cirros-0.3.5-x86_64-disk (12.7 MB)
|
||||
image_name=cirros-0.4.0-x86_64-disk (12.1 MB)
|
||||
#flavor to launch instances
|
||||
flavor=m1.tiny
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from selenium.common import exceptions
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
from openstack_dashboard.test.integration_tests.pages import basepage
|
||||
@ -164,9 +165,13 @@ class VolumesPage(basepage.BaseNavigationPage):
|
||||
def is_volume_status(self, name, status):
|
||||
def cell_getter():
|
||||
row = self._get_row_with_volume_name(name)
|
||||
return row and row.cells[self.VOLUMES_TABLE_STATUS_COLUMN]
|
||||
return row.cells[self.VOLUMES_TABLE_STATUS_COLUMN]
|
||||
|
||||
return bool(self.volumes_table.wait_cell_status(cell_getter, status))
|
||||
try:
|
||||
self._wait_till_text_present_in_element(cell_getter, status)
|
||||
except exceptions.TimeoutException:
|
||||
return False
|
||||
return True
|
||||
|
||||
def is_volume_deleted(self, name):
|
||||
return self.volumes_table.is_row_deleted(
|
||||
@ -210,7 +215,7 @@ class VolumesPage(basepage.BaseNavigationPage):
|
||||
def get_size(self, name):
|
||||
row = self._get_row_with_volume_name(name)
|
||||
size = str(row.cells[self.VOLUMES_TABLE_SIZE_COLUMN].text)
|
||||
return int(filter(str.isdigit, size))
|
||||
return int(''.join(filter(str.isdigit, size)))
|
||||
|
||||
def launch_instance(self, name, instance_name, available_zone=None):
|
||||
row = self._get_row_with_volume_name(name)
|
||||
|
@ -208,7 +208,10 @@ class SelectFormFieldRegion(BaseFormFieldRegion):
|
||||
|
||||
@text.setter
|
||||
def text(self, text):
|
||||
self.element.select_by_visible_text(text)
|
||||
js_cmd = ("$('select option').filter(function() {return $(this).text()"
|
||||
" == \"%s\";}).prop('selected', true); $('[name=\"%s\"]')."
|
||||
"change();" % (html.escape(text), self.name))
|
||||
self.driver.execute_script(js_cmd)
|
||||
|
||||
@property
|
||||
def value(self):
|
||||
|
@ -58,6 +58,8 @@ class TableRegion(baseregion.BaseRegion):
|
||||
'div.table_search > button')
|
||||
_search_option_locator = (by.By.CSS_SELECTOR,
|
||||
'div.table_search > .themable-select')
|
||||
_cell_progress_bar_locator = (by.By.CSS_SELECTOR, 'div.progress-bar')
|
||||
_warning_cell_locator = (by.By.CSS_SELECTOR, 'td.warning')
|
||||
marker_name = 'marker'
|
||||
prev_marker_name = 'prev_marker'
|
||||
|
||||
@ -76,6 +78,12 @@ class TableRegion(baseregion.BaseRegion):
|
||||
return (by.By.CSS_SELECTOR,
|
||||
'ul.dropdown-menu a[data-select-value="%s"]' % value)
|
||||
|
||||
def _cell_progress_bar_getter(self):
|
||||
return self.driver.find_element(*self._cell_progress_bar_locator)
|
||||
|
||||
def _warning_cell_getter(self):
|
||||
return self.driver.find_element(*self._warning_cell_locator)
|
||||
|
||||
def __init__(self, driver, conf):
|
||||
self._default_src_locator = self._table_locator(self.__class__.name)
|
||||
super(TableRegion, self).__init__(driver, conf)
|
||||
@ -125,6 +133,11 @@ class TableRegion(baseregion.BaseRegion):
|
||||
text = element.get_attribute('data-selenium')
|
||||
return text or element.text
|
||||
|
||||
# wait until cells actions are completed eg: downloading image,
|
||||
# uploading image, creating, deleting etc.
|
||||
self.wait_till_element_disappears(self._cell_progress_bar_getter)
|
||||
self.wait_till_element_disappears(self._warning_cell_getter)
|
||||
|
||||
for row in self.rows:
|
||||
try:
|
||||
cell = row.cells[column_name]
|
||||
@ -169,6 +182,9 @@ class TableRegion(baseregion.BaseRegion):
|
||||
lambda: not self._is_element_displayed(row_getter()))
|
||||
|
||||
def are_rows_deleted(self, rows_getter):
|
||||
# wait until rows are deleted.
|
||||
self.wait_till_element_disappears(self._warning_cell_getter)
|
||||
|
||||
return self._is_row_deleted(
|
||||
lambda: all([not self._is_element_displayed(row) for row
|
||||
in rows_getter()]))
|
||||
|
@ -9,8 +9,6 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from unittest import skip
|
||||
|
||||
from openstack_dashboard.test.integration_tests import helpers
|
||||
from openstack_dashboard.test.integration_tests.regions import messages
|
||||
|
||||
@ -36,12 +34,11 @@ class TestVolumeSnapshotsBasic(helpers.TestCase):
|
||||
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.SUCCESS)
|
||||
volumes_page.find_message_and_dismiss(messages.INFO)
|
||||
self.assertTrue(volumes_page.is_volume_deleted(self.VOLUME_NAME))
|
||||
|
||||
self.addCleanup(cleanup)
|
||||
|
||||
@skip('Skipped until bug 1792028 is resolved')
|
||||
def test_create_edit_delete_volume_snapshot(self):
|
||||
"""Test checks create/delete volume snapshot action
|
||||
|
||||
@ -87,7 +84,6 @@ class TestVolumeSnapshotsBasic(helpers.TestCase):
|
||||
self.assertTrue(volumes_snapshot_page.is_volume_snapshot_deleted(
|
||||
new_name))
|
||||
|
||||
@skip('Skipped until bug 1792028 is resolved')
|
||||
def test_volume_snapshots_pagination(self):
|
||||
"""This test checks volumes snapshots pagination
|
||||
|
||||
@ -180,12 +176,10 @@ class TestVolumeSnapshotsAdmin(helpers.AdminTestCase,
|
||||
def volumes_snapshot_page(self):
|
||||
return self.home_pg.go_to_project_volumes_snapshotspage()
|
||||
|
||||
@skip('Skipped until bug 1792028 is resolved')
|
||||
def test_create_edit_delete_volume_snapshot(self):
|
||||
super(TestVolumeSnapshotsAdmin, self).\
|
||||
test_create_edit_delete_volume_snapshot()
|
||||
|
||||
@skip('Skipped until bug 1792028 is resolved')
|
||||
def test_volume_snapshots_pagination(self):
|
||||
super(TestVolumeSnapshotsAdmin, self).\
|
||||
test_volume_snapshots_pagination()
|
||||
@ -213,14 +207,13 @@ class TestVolumeSnapshotsAdvanced(helpers.TestCase):
|
||||
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.SUCCESS))
|
||||
volumes_page.find_message_and_dismiss(messages.INFO))
|
||||
self.assertFalse(
|
||||
volumes_page.find_message_and_dismiss(messages.ERROR))
|
||||
self.assertTrue(volumes_page.is_volume_deleted(self.VOLUME_NAME))
|
||||
|
||||
self.addCleanup(cleanup)
|
||||
|
||||
@skip('Skipped until bug 1792028 is resolved')
|
||||
def test_create_volume_from_snapshot(self):
|
||||
"""Test checks possibility to create volume from snapshot
|
||||
|
||||
@ -259,6 +252,6 @@ class TestVolumeSnapshotsAdvanced(helpers.TestCase):
|
||||
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.SUCCESS))
|
||||
volumes_page.find_message_and_dismiss(messages.INFO))
|
||||
self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
|
||||
self.assertTrue(volumes_page.is_volume_deleted(new_volume))
|
||||
|
@ -25,7 +25,6 @@ class TestVolumesBasic(helpers.TestCase):
|
||||
def volumes_page(self):
|
||||
return self.home_pg.go_to_project_volumes_volumespage()
|
||||
|
||||
@skip('Skipped until bug 1792028 is resolved')
|
||||
def test_volume_create_edit_delete(self):
|
||||
"""This test case checks create, edit, delete volume functionality:
|
||||
|
||||
@ -64,7 +63,7 @@ class TestVolumesBasic(helpers.TestCase):
|
||||
volumes_page = self.volumes_page
|
||||
volumes_page.delete_volume(new_name)
|
||||
self.assertTrue(
|
||||
volumes_page.find_message_and_dismiss(messages.SUCCESS))
|
||||
volumes_page.find_message_and_dismiss(messages.INFO))
|
||||
self.assertFalse(
|
||||
volumes_page.find_message_and_dismiss(messages.ERROR))
|
||||
self.assertTrue(volumes_page.is_volume_deleted(new_name))
|
||||
@ -78,7 +77,6 @@ class TestVolumesBasic(helpers.TestCase):
|
||||
form = volumes_page.volumes_table.create_volume()
|
||||
form.cancel()
|
||||
|
||||
@skip('Skipped until bug 1792028 is resolved')
|
||||
def test_volumes_pagination(self):
|
||||
"""This test checks volumes pagination
|
||||
|
||||
@ -108,8 +106,13 @@ class TestVolumesBasic(helpers.TestCase):
|
||||
range(count)]
|
||||
for volume_name in volumes_names:
|
||||
volumes_page.create_volume(volume_name)
|
||||
volumes_page.find_message_and_dismiss(messages.INFO)
|
||||
self.assertTrue(
|
||||
volumes_page.find_message_and_dismiss(messages.INFO))
|
||||
self.assertFalse(
|
||||
volumes_page.find_message_and_dismiss(messages.ERROR))
|
||||
self.assertTrue(volumes_page.is_volume_present(volume_name))
|
||||
self.assertTrue(volumes_page.is_volume_status(volume_name,
|
||||
'Available'))
|
||||
|
||||
first_page_definition = {'Next': True, 'Prev': False,
|
||||
'Count': items_per_page,
|
||||
@ -145,7 +148,10 @@ class TestVolumesBasic(helpers.TestCase):
|
||||
|
||||
volumes_page = self.volumes_page
|
||||
volumes_page.delete_volumes(volumes_names)
|
||||
volumes_page.find_message_and_dismiss(messages.SUCCESS)
|
||||
self.assertTrue(
|
||||
volumes_page.find_message_and_dismiss(messages.INFO))
|
||||
self.assertFalse(
|
||||
volumes_page.find_message_and_dismiss(messages.ERROR))
|
||||
self.assertTrue(volumes_page.are_volumes_deleted(volumes_names))
|
||||
|
||||
|
||||
@ -251,7 +257,7 @@ class TestVolumesActions(helpers.TestCase):
|
||||
volumes_page = self.volumes_page
|
||||
volumes_page.delete_volume(self.VOLUME_NAME)
|
||||
self.assertTrue(
|
||||
volumes_page.find_message_and_dismiss(messages.SUCCESS))
|
||||
volumes_page.find_message_and_dismiss(messages.INFO))
|
||||
self.assertFalse(
|
||||
volumes_page.find_message_and_dismiss(messages.ERROR))
|
||||
self.assertTrue(
|
||||
@ -259,7 +265,6 @@ class TestVolumesActions(helpers.TestCase):
|
||||
|
||||
self.addCleanup(cleanup)
|
||||
|
||||
@skip('Skipped until bug 1792028 is resolved')
|
||||
def test_volume_extend(self):
|
||||
"""This test case checks extend volume functionality:
|
||||
|
||||
@ -282,7 +287,7 @@ class TestVolumesActions(helpers.TestCase):
|
||||
new_size = volumes_page.get_size(self.VOLUME_NAME)
|
||||
self.assertLess(orig_size, new_size)
|
||||
|
||||
@skip('Skipped until bug 1774697 is resolved')
|
||||
@skip('Skipped until bug 1847715 is resolved')
|
||||
def test_volume_upload_to_image(self):
|
||||
"""This test case checks upload volume to image functionality:
|
||||
|
||||
@ -311,7 +316,7 @@ class TestVolumesActions(helpers.TestCase):
|
||||
all_formats[disk_format])
|
||||
images_page.delete_image(self.IMAGE_NAME)
|
||||
self.assertTrue(images_page.find_message_and_dismiss(
|
||||
messages.SUCCESS))
|
||||
messages.INFO))
|
||||
self.assertFalse(images_page.find_message_and_dismiss(
|
||||
messages.ERROR))
|
||||
self.assertFalse(images_page.is_image_present(self.IMAGE_NAME))
|
||||
|
Loading…
Reference in New Issue
Block a user