Merge "Refactor some table rows & cells waits in i9n tests"

This commit is contained in:
Jenkins 2016-03-10 05:01:02 +00:00 committed by Gerrit Code Review
commit 90f3964455
9 changed files with 39 additions and 94 deletions

View File

@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from selenium.common import exceptions
from openstack_dashboard.test.integration_tests.pages import basepage
from openstack_dashboard.test.integration_tests.regions import forms
from openstack_dashboard.test.integration_tests.regions import tables
@ -110,17 +108,9 @@ class VolumetypesPage(basepage.BaseNavigationPage):
return bool(self._get_row_with_volume_type_name(name))
def is_qos_spec_deleted(self, name):
try:
getter = lambda: self._get_row_with_qos_spec_name(name)
self.wait_till_element_disappears(getter)
except exceptions.TimeoutException:
return False
return True
return self.qos_specs_table.is_row_deleted(
lambda: self._get_row_with_qos_spec_name(name))
def is_volume_type_deleted(self, name):
try:
getter = lambda: self._get_row_with_volume_type_name(name)
self.wait_till_element_disappears(getter)
except exceptions.TimeoutException:
return False
return True
return self.volume_types_table.is_row_deleted(
lambda: self._get_row_with_volume_type_name(name))

View File

@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from selenium.common import exceptions
from openstack_dashboard.test.integration_tests.pages import basepage
from openstack_dashboard.test.integration_tests.regions import forms
from openstack_dashboard.test.integration_tests.regions import tables
@ -129,14 +127,8 @@ class ImagesPage(basepage.BaseNavigationPage):
def is_image_active(self, name):
row = self._get_row_with_image_name(name)
def cell_getter():
return row.cells[self.IMAGES_TABLE_STATUS_COLUMN]
try:
self._wait_till_text_present_in_element(cell_getter, 'Active')
except exceptions.TimeoutException:
return False
return True
return self.images_table.is_cell_status(
lambda: row.cells[self.IMAGES_TABLE_STATUS_COLUMN], 'Active')
def wait_until_image_active(self, name):
self._wait_until(lambda x: self.is_image_active(name))

View File

@ -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 selenium.common import exceptions
from openstack_dashboard.test.integration_tests.pages import basepage
from openstack_dashboard.test.integration_tests.regions import forms
from openstack_dashboard.test.integration_tests.regions import tables
@ -108,23 +106,13 @@ class InstancesPage(basepage.BaseNavigationPage):
confirm_delete_instances_form.submit()
def is_instance_deleted(self, name):
try:
getter = lambda: self._get_row_with_instance_name(name)
self.wait_till_element_disappears(getter)
except exceptions.TimeoutException:
return False
return True
return self.instances_table.is_row_deleted(
lambda: self._get_row_with_instance_name(name))
def is_instance_active(self, name):
row = self._get_row_with_instance_name(name)
def cell_getter():
return row.cells[self.INSTANCES_TABLE_STATUS_COLUMN]
try:
self._wait_till_text_present_in_element(cell_getter, 'Active')
except exceptions.TimeoutException:
return False
return True
return self.instances_table.is_cell_status(
lambda: row.cells[self.INSTANCES_TABLE_STATUS_COLUMN], 'Active')
def _get_source_name(self, instance, boot_source,
conf):

View File

@ -10,7 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from selenium.common import exceptions
from selenium.webdriver.common import by
from openstack_dashboard.test.integration_tests.pages import basepage
@ -83,24 +82,13 @@ class VolumesnapshotsPage(basepage.BaseNavigationPage):
confirm_form.submit()
def is_volume_snapshot_deleted(self, name):
try:
getter = lambda: self._get_row_with_volume_snapshot_name(name)
self.wait_till_element_disappears(getter)
except exceptions.TimeoutException:
return False
return True
return self.volumesnapshots_table.is_row_deleted(
lambda: self._get_row_with_volume_snapshot_name(name))
def is_volume_snapshot_available(self, name):
row = self._get_row_with_volume_snapshot_name(name)
def cell_getter():
return row.cells[self.SNAPSHOT_TABLE_STATUS_COLUMN]
try:
self._wait_till_text_present_in_element(cell_getter, 'Available')
except exceptions.TimeoutException:
return False
return True
return self.volumesnapshots_table.is_cell_status(
lambda: row.cells[self.SNAPSHOT_TABLE_STATUS_COLUMN], 'Available')
def get_volume_name(self, snapshot_name):
row = self._get_row_with_volume_snapshot_name(snapshot_name)

View File

@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from selenium.common import exceptions
from openstack_dashboard.test.integration_tests.pages import basepage
from openstack_dashboard.test.integration_tests.regions import forms
from openstack_dashboard.test.integration_tests.regions import tables
@ -120,23 +118,12 @@ class VolumesPage(basepage.BaseNavigationPage):
def is_volume_status(self, name, status):
row = self._get_row_with_volume_name(name)
def cell_getter():
return row.cells[self.VOLUMES_TABLE_STATUS_COLUMN]
try:
self._wait_till_text_present_in_element(cell_getter, status)
except exceptions.TimeoutException:
return False
return True
return self.volumes_table.is_cell_status(
lambda: row.cells[self.VOLUMES_TABLE_STATUS_COLUMN], status)
def is_volume_deleted(self, name):
try:
getter = lambda: self._get_row_with_volume_name(name)
self.wait_till_element_disappears(getter)
except exceptions.TimeoutException:
return False
return True
return self.volumes_table.is_row_deleted(
lambda: self._get_row_with_volume_name(name))
def _get_source_name(self, volume_form, volume_source_type, conf,
volume_source):

View File

@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from selenium.common import exceptions
from openstack_dashboard.test.integration_tests.pages import basepage
from openstack_dashboard.test.integration_tests.regions import forms
from openstack_dashboard.test.integration_tests.regions import tables
@ -109,11 +107,5 @@ class NetworksPage(basepage.BaseNavigationPage):
def is_network_active(self, name):
row = self._get_row_with_network_name(name)
def cell_getter():
return row.cells[self.NETWORKS_TABLE_STATUS_COLUMN]
try:
self._wait_till_text_present_in_element(cell_getter, 'Active')
except exceptions.TimeoutException:
return False
return True
return self.networks_table.is_cell_status(
lambda: row.cells[self.NETWORKS_TABLE_STATUS_COLUMN], 'Active')

View File

@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from selenium.common import exceptions
from openstack_dashboard.test.integration_tests.pages import basepage
from openstack_dashboard.test.integration_tests.regions import forms
from openstack_dashboard.test.integration_tests.regions import tables
@ -72,11 +70,5 @@ class RoutersPage(basepage.BaseNavigationPage):
def is_router_active(self, name):
row = self._get_row_with_router_name(name)
def cell_getter():
return row.cells[self.ROUTERS_TABLE_STATUS_COLUMN]
try:
self._wait_till_text_present_in_element(cell_getter, 'Active')
except exceptions.TimeoutException:
return False
return True
return self.routers_table.is_cell_status(
lambda: row.cells[self.ROUTERS_TABLE_STATUS_COLUMN], 'Active')

View File

@ -137,6 +137,22 @@ class TableRegion(baseregion.BaseRegion):
return [RowRegion(self.driver, self.conf, elem, self.column_names)
for elem in self._get_elements(*self._rows_locator)]
def is_row_deleted(self, row_getter):
try:
self.wait_till_element_disappears(row_getter)
except exceptions.TimeoutException:
return False
except IndexError:
return True
return True
def is_cell_status(self, cell_getter, status):
try:
self._wait_till_text_present_in_element(cell_getter, status)
except exceptions.TimeoutException:
return False
return True
def is_next_link_available(self):
try:
self._turn_off_implicit_wait()

View File

@ -90,7 +90,7 @@ class TestVolumes(helpers.TestCase):
count = 3
items_per_page = 1
volumes_names = ["{0}_{1}".format(self.VOLUME_NAME, i) for i in
xrange(count)]
range(count)]
for volume_name in volumes_names:
volumes_page.create_volume(volume_name)
volumes_page.find_message_and_dismiss(messages.INFO)