Fix UI locators on settings tab
Change-Id: I1866d0b4d35c5b57b2e4acfeb143d72242a6ed9d
This commit is contained in:
parent
4f951a668f
commit
f0be16258f
|
@ -85,10 +85,20 @@ class PageObject:
|
|||
|
||||
@staticmethod
|
||||
def click_element(page_object, *args):
|
||||
# get the list of attributes passed to the method
|
||||
attributes = [attribute for attribute in args]
|
||||
attempts = 0
|
||||
while attempts < 3:
|
||||
while attempts < 5:
|
||||
try:
|
||||
"""1, 3, 4 are the number of passed to the method attributes
|
||||
|
||||
1 means that only class name and one property
|
||||
were passed to the method
|
||||
3 means that class name, two properties and index
|
||||
of the element were passed to the method
|
||||
4 means that class name, three properties and index
|
||||
of the element were passed to the method
|
||||
"""
|
||||
if len(attributes) == 1:
|
||||
getattr(page_object, attributes[0]).click()
|
||||
elif len(attributes) == 3:
|
||||
|
@ -99,29 +109,50 @@ class PageObject:
|
|||
attributes[0])[attributes[3]],
|
||||
attributes[1]), attributes[2]).click()
|
||||
break
|
||||
except StaleElementReferenceException:
|
||||
pass
|
||||
except (StaleElementReferenceException, NoSuchElementException):
|
||||
time.sleep(0.5)
|
||||
attempts += 1
|
||||
|
||||
@staticmethod
|
||||
def find_element(page_object, *args):
|
||||
attributes = [attribute for attribute in args]
|
||||
attempts = 0
|
||||
while attempts < 3:
|
||||
while attempts < 5:
|
||||
try:
|
||||
if len(attributes) == 1:
|
||||
getattr(page_object, attributes[0])
|
||||
return getattr(page_object, attributes[0])
|
||||
elif len(attributes) == 3:
|
||||
getattr(getattr(page_object,
|
||||
attributes[0])[attributes[2]],
|
||||
attributes[1])
|
||||
return getattr(getattr(page_object,
|
||||
attributes[0])[attributes[2]],
|
||||
attributes[1])
|
||||
elif len(attributes) == 4:
|
||||
getattr(getattr(getattr(page_object,
|
||||
attributes[0])[attributes[3]],
|
||||
attributes[1]), attributes[2])
|
||||
return getattr(getattr(getattr(page_object,
|
||||
attributes[0])[attributes[3]],
|
||||
attributes[1]), attributes[2])
|
||||
break
|
||||
except StaleElementReferenceException:
|
||||
pass
|
||||
except (StaleElementReferenceException, NoSuchElementException):
|
||||
time.sleep(0.5)
|
||||
attempts += 1
|
||||
|
||||
@staticmethod
|
||||
def get_text(page_object, *args):
|
||||
attributes = [attribute for attribute in args]
|
||||
attempts = 0
|
||||
while attempts < 5:
|
||||
try:
|
||||
if len(attributes) == 1:
|
||||
return getattr(page_object, attributes[0]).text
|
||||
elif len(attributes) == 3:
|
||||
return getattr(getattr(page_object,
|
||||
attributes[0])[attributes[2]],
|
||||
attributes[1]).text
|
||||
elif len(attributes) == 4:
|
||||
return getattr(getattr(getattr(page_object,
|
||||
attributes[0])[attributes[3]],
|
||||
attributes[1]), attributes[2]).text
|
||||
break
|
||||
except (StaleElementReferenceException, NoSuchElementException):
|
||||
time.sleep(0.5)
|
||||
attempts += 1
|
||||
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ class Wizard(Popup, RedhatAccountPopup):
|
|||
def install_savanna(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(
|
||||
self.XPATH_CHECKBOX.format('savanna'))
|
||||
self.XPATH_CHECKBOX.format('sahara'))
|
||||
|
||||
@property
|
||||
def install_murano(self):
|
||||
|
|
|
@ -40,75 +40,78 @@ class Settings(PageObject, SettingsFooter):
|
|||
|
||||
@property
|
||||
def username(self):
|
||||
return self.parent.find_element_by_name('user')
|
||||
return self.parent.find_element_by_name('access.user')
|
||||
|
||||
@property
|
||||
def password(self):
|
||||
return self.parent.find_element_by_name('password')
|
||||
return self.parent.find_element_by_name('access.password')
|
||||
|
||||
@property
|
||||
def show_password(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath('//div[input[@name="password"]]/span')
|
||||
find_element_by_xpath('//div[input[@name="access.password"]]/span')
|
||||
|
||||
@property
|
||||
def tenant(self):
|
||||
return self.parent.find_element_by_name('tenant')
|
||||
return self.parent.find_element_by_name('access.tenant')
|
||||
|
||||
@property
|
||||
def email(self):
|
||||
return self.parent.find_element_by_name('email')
|
||||
return self.parent.find_element_by_name('access.email')
|
||||
|
||||
@property
|
||||
def install_savanna(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format('savanna'))
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format
|
||||
('additional_components.sahara'))
|
||||
|
||||
@property
|
||||
def install_murano(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format('murano'))
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format
|
||||
('additional_components.murano'))
|
||||
|
||||
@property
|
||||
def install_ceilometer(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format('ceilometer'))
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format
|
||||
('additional_components.ceilometer'))
|
||||
|
||||
@property
|
||||
def debug(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format('debug'))
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format('common.debug'))
|
||||
|
||||
@property
|
||||
def hypervisor_kvm(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(self.XPATH_RADIO.format('libvirt_type',
|
||||
'kvm'))
|
||||
find_element_by_xpath(self.XPATH_RADIO.format
|
||||
('common.libvirt_type', 'kvm'))
|
||||
|
||||
@property
|
||||
def hypervisor_qemu(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(self.XPATH_RADIO.format('libvirt_type',
|
||||
'qemu'))
|
||||
find_element_by_xpath(self.XPATH_RADIO.format
|
||||
('common.libvirt_type', 'qemu'))
|
||||
|
||||
@property
|
||||
def assign_ip(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(
|
||||
self.XPATH_CHECKBOX.format('auto_assign_floating_ip'))
|
||||
self.XPATH_CHECKBOX.format('common.auto_assign_floating_ip'))
|
||||
|
||||
@property
|
||||
def filter_scheduler(self):
|
||||
return self.parent.find_element_by_xpath(
|
||||
self.XPATH_RADIO.format(
|
||||
'compute_scheduler_driver',
|
||||
'common.compute_scheduler_driver',
|
||||
'nova.scheduler.filter_scheduler.FilterScheduler'))
|
||||
|
||||
@property
|
||||
def simple_scheduler(self):
|
||||
return self.parent.find_element_by_xpath(
|
||||
self.XPATH_RADIO.format(
|
||||
'compute_scheduler_driver',
|
||||
'common.compute_scheduler_driver',
|
||||
'nova.scheduler.simple.SimpleScheduler'))
|
||||
|
||||
@property
|
||||
|
@ -126,75 +129,80 @@ class Settings(PageObject, SettingsFooter):
|
|||
def vlan_splinters_soft(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(
|
||||
self.XPATH_RADIO.format('vlan_splinters', 'soft'))
|
||||
self.XPATH_RADIO.format('vlan_splinters.vswitch', 'soft'))
|
||||
|
||||
@property
|
||||
def vlan_splinters_hard(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(
|
||||
self.XPATH_RADIO.format('vlan_splinters', 'hard'))
|
||||
self.XPATH_RADIO.format('vlan_splinters.vswitch', 'hard'))
|
||||
|
||||
@property
|
||||
def use_cow_images(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(
|
||||
self.XPATH_CHECKBOX.format('use_cow_images'))
|
||||
self.XPATH_CHECKBOX.format('common.use_cow_images'))
|
||||
|
||||
@property
|
||||
def start_guests(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(
|
||||
self.XPATH_CHECKBOX.format('start_guests_on_host_boot'))
|
||||
self.XPATH_CHECKBOX.format('common.start_guests_on_host_boot'))
|
||||
|
||||
@property
|
||||
def auth_key(self):
|
||||
return self.parent.find_element_by_name('auth_key')
|
||||
return self.parent.find_element_by_name('common.auth_key')
|
||||
|
||||
@property
|
||||
def syslog_server(self):
|
||||
return self.parent.find_element_by_name('syslog_server')
|
||||
return self.parent.find_element_by_name('syslog.syslog_server')
|
||||
|
||||
@property
|
||||
def syslog_port(self):
|
||||
return self.parent.find_element_by_name('syslog_port')
|
||||
return self.parent.find_element_by_name('syslog.syslog_port')
|
||||
|
||||
@property
|
||||
def syslog_udp(self):
|
||||
return self.parent.find_element_by_xpath(
|
||||
self.XPATH_RADIO.format(
|
||||
'syslog_transport', 'udp'))
|
||||
'syslog.syslog_transport', 'udp'))
|
||||
|
||||
@property
|
||||
def syslog_tcp(self):
|
||||
return self.parent.find_element_by_xpath(
|
||||
self.XPATH_RADIO.format(
|
||||
'syslog_transport', 'tcp'))
|
||||
'syslog.syslog_transport', 'tcp'))
|
||||
|
||||
@property
|
||||
def cinder_for_volumes(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format('volumes_lvm'))
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format
|
||||
('storage.volumes_lvm'))
|
||||
|
||||
@property
|
||||
def ceph_for_volumes(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format('volumes_ceph'))
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format
|
||||
('storage.volumes_ceph'))
|
||||
|
||||
@property
|
||||
def ceph_for_images(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format('images_ceph'))
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format
|
||||
('storage.images_ceph'))
|
||||
|
||||
@property
|
||||
def ceph_ephemeral(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format('ephemeral_ceph'))
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format
|
||||
('storage.ephemeral_ceph'))
|
||||
|
||||
@property
|
||||
def ceph_rados_gw(self):
|
||||
return self.parent.\
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format('objects_ceph'))
|
||||
find_element_by_xpath(self.XPATH_CHECKBOX.format
|
||||
('storage.objects_ceph'))
|
||||
|
||||
@property
|
||||
def ceph_factor(self):
|
||||
return self.parent.find_element_by_name('osd_pool_size')
|
||||
return self.parent.find_element_by_name('storage.osd_pool_size')
|
||||
|
|
|
@ -427,8 +427,9 @@ class TestBondingInterfaces(BaseTestCase):
|
|||
Scenario:
|
||||
1. Verify bond and unbond buttons are disabled
|
||||
"""
|
||||
PageObject.find_element(InterfacesSettings(), 'bond_interfaces')
|
||||
self.assertFalse(InterfacesSettings().bond_interfaces.is_enabled())
|
||||
self.assertFalse(PageObject.find_element
|
||||
(InterfacesSettings(), 'bond_interfaces').
|
||||
is_enabled())
|
||||
self.assertFalse(InterfacesSettings().unbond_interfaces.is_enabled())
|
||||
|
||||
def test_inactive_one_selected(self):
|
||||
|
|
|
@ -6,6 +6,7 @@ from pageobjects.settings import Settings
|
|||
from pageobjects.tabs import Tabs
|
||||
from settings import OPENSTACK_CENTOS, OPENSTACK_RELEASE_CENTOS
|
||||
from tests.base import BaseTestCase
|
||||
from pageobjects.base import PageObject
|
||||
|
||||
|
||||
class TestEnvironment(BaseTestCase):
|
||||
|
@ -96,9 +97,11 @@ class TestEnvironment(BaseTestCase):
|
|||
cb.click()
|
||||
|
||||
with Nodes() as n:
|
||||
self.assertEqual(n.env_name.text, OPENSTACK_CENTOS)
|
||||
n.info_icon.click()
|
||||
self.assertIn(OPENSTACK_CENTOS, n.env_details.text)
|
||||
self.assertEqual(PageObject.get_text(n, 'env_name'),
|
||||
OPENSTACK_CENTOS)
|
||||
PageObject.click_element(n, 'info_icon')
|
||||
self.assertIn(OPENSTACK_CENTOS, PageObject.get_text
|
||||
(n, 'env_details'))
|
||||
self.assertIn('Multi-node with HA', n.env_details.text)
|
||||
|
||||
def test_hypervisor_kvm(self):
|
||||
|
@ -216,8 +219,6 @@ class TestEnvironment(BaseTestCase):
|
|||
Tabs().settings.click()
|
||||
|
||||
with Settings() as s:
|
||||
self.assertTrue(s.cinder_for_volumes.
|
||||
find_element_by_tag_name('input').is_selected())
|
||||
self.assertTrue(s.ceph_for_volumes.
|
||||
find_element_by_tag_name('input').is_selected())
|
||||
self.assertTrue(s.ceph_for_images.
|
||||
|
|
Loading…
Reference in New Issue