本文整理汇总了Python中cfme.web_ui.CheckboxTable类的典型用法代码示例。如果您正苦于以下问题:Python CheckboxTable类的具体用法?Python CheckboxTable怎么用?Python CheckboxTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CheckboxTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pods_rel
def test_pods_rel(provider, rel):
""" This module verifies the integrity of the Relationships table
We also verify that clicking on the Relationships table field
takes the user to the correct page, and the number of rows
that appears on that page is equal to the number in the
Relationships table
"""
sel.force_navigate('containers_pods')
tb.select('List View')
list_tbl_pod = CheckboxTable(table_locator="//div[@id='list_grid']//table")
ui_pods = [r.name.text for r in list_tbl_pod.rows()]
ui_pods_revised = filter(
lambda ch: 'nginx' not in ch and not ch.startswith('metrics'),
ui_pods)
for name in ui_pods_revised:
obj = Pod(name, provider)
val = obj.get_detail('Relationships', rel)
if val == '0':
continue
obj.click_element('Relationships', rel)
try:
val = int(val)
assert len([r for r in list_tbl_pod.rows()]) == val
except ValueError:
assert val == InfoBlock.text('Properties', 'Name')
示例2: test_services_rel
def test_services_rel(provider, rel):
sel.force_navigate('containers_services')
list_tbl_service = CheckboxTable(
table_locator="//div[@id='list_grid']//table")
ui_services = [r.name.text for r in list_tbl_service.rows()]
mgmt_objs = provider.mgmt.list_service() # run only if table is not empty
if ui_services:
# verify that mgmt pods exist in ui listed pods
assert set(ui_services).issubset(
[obj.name for obj in mgmt_objs]), 'Missing objects'
for name in ui_services:
obj = Service(name, provider)
val = obj.get_detail('Relationships', rel)
if val == '0':
continue
obj.click_element('Relationships', rel)
try:
val = int(val)
assert len([r for r in list_tbl_service.rows()]) == val
except ValueError:
assert val == InfoBlock.text('Properties', 'Name')
示例3: test_relationships_tables
def test_relationships_tables(provider, cls):
"""This module verifies the integrity of the Relationships table.
clicking on each field in the Relationships table takes the user
to either Summary page where we verify that the field that appears
in the Relationships table also appears in the Properties table,
or to the page where the number of rows is equal to the number
that is displayed in the Relationships table.
"""
navigate_to(cls.object, 'All')
tb.select('List View')
list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table")
cls_instances = [r.name.text for r in list_tbl.rows()]
cls_instances = sample(cls_instances, min(2, len(cls_instances)))
for name in cls_instances:
obj = cls.object(name, provider)
obj.summary.reload()
keys = sample(obj.summary.relationships.keys,
min(1, len(obj.summary.relationships.keys)))
for key in keys:
# reload summary to prevent StaleElementReferenceException:
obj.summary.reload()
element = getattr(obj.summary.relationships, key)
if element.value in rel_values:
continue
sel.click(element)
# TODO: find a better indication that we are in the right page:
sel.is_displayed_text('{} (Summary)'.format(element.text_value))
示例4: test_relationships_tables
def test_relationships_tables(provider, cls):
""" This module verifies the integrity of the Relationships table.
clicking on each field in the Relationships table takes the user
to either Summary page where we verify that the field that appears
in the Relationships table also appears in the Properties table,
or to the page where the number of rows is equal to the number
that is displayed in the Relationships table.
"""
navigate_to(cls, 'All')
tb.select('List View')
list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table")
cls_instances = [r.name.text for r in list_tbl.rows()]
cls_instances_revised = [ch for ch in cls_instances
if 'nginx' not in ch and not ch.startswith('metrics')]
for name in cls_instances_revised:
navigate_to(cls, 'All')
obj = cls(name, provider)
rel_tbl = obj.summary.groups()['relationships']
keys = [key for key in rel_tbl.keys]
for key in keys:
# reload summary to prevent StaleElementReferenceException:
obj.summary.reload()
rel_tbl = obj.summary.groups()['relationships']
element = getattr(rel_tbl, key)
value = element.value
if value in rel_values:
continue
sel.click(element)
try:
value = int(value)
except ValueError:
assert value == details_page.infoblock.text(
'Properties', 'Name')
else:
# best effort to include all items from rel on one page
if paginator.page_controls_exist():
paginator.results_per_page(1000)
else:
logger.warning(
'Unable to increase results per page, '
'assertion against number of rows may fail.')
assert len([r for r in list_tbl.rows()]) == value
示例5: test_search_bar
def test_search_bar(provider, soft_assert):
""" <object> summary page - Search bar
This test checks Search bar functionality on every object summary page
Steps:
* Goes to <object> page
* Inserts: Irregular symbol, '*' character, full search string, partial search string
* Verify proper results
"""
for obj in TEST_OBJECTS:
rows = navigate_and_get_rows(provider, obj, 1)
if not rows:
pytest.skip('No Records Found in {} table. Could not test search. skipping...'
.format(obj))
exist_member_str = choice(rows).name.text
# Mapping the search string and the expected found result:
search_strings_and_result = {
'***': None,
exist_member_str: exist_member_str,
'$$$': None,
exist_member_str[:len(exist_member_str) / 2]: exist_member_str
}
try:
for search_string, result in search_strings_and_result.items():
search.normal_search(search_string)
# NOTE: We must re-instantiate here table
# in order to prevent StaleElementException or UsingSharedTables
list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table")
results_row_names = ([r.name.text for r in list_tbl.rows_as_list()]
if not sel.is_displayed_text("No Records Found.") else [])
if result:
soft_assert(result in results_row_names,
'Expected to get result "{}" '
'for search string "{}". search results: {}'
.format(result, search_string, results_row_names))
else:
soft_assert(not results_row_names,
'Unexpected result for search string "{}", '
'Should not find records, search results: "{}"'
.format(search_string, results_row_names))
finally:
# search.ensure_no_filter_applied() -> TimedOutError
# https://github.com/ManageIQ/integration_tests/issues/4401
search.normal_search("")
示例6: test_images_rel
def test_images_rel(provider, rel):
sel.force_navigate('containers_images')
list_tbl_image = CheckboxTable(
table_locator="//div[@id='list_grid']//table")
ui_images = [r.name.text for r in list_tbl_image.rows()]
for name in ui_images:
obj = Image(name, provider)
val = obj.get_detail('Relationships', rel)
if val == '0' or val == 'Unknown image source':
continue
obj.click_element('Relationships', rel)
try:
val = int(val)
assert len([r for r in list_tbl_image.rows()]) == val
except ValueError:
assert val == InfoBlock.text('Properties', 'Name')
示例7: test_images_rel
def test_images_rel(provider, rel):
""" https://bugzilla.redhat.com/show_bug.cgi?id=1365878
"""
sel.force_navigate('containers_images')
tb.select('List View')
list_tbl_image = CheckboxTable(
table_locator="//div[@id='list_grid']//table")
ui_images = [r.name.text for r in list_tbl_image.rows()]
for name in ui_images:
obj = Image(name, provider)
val = obj.get_detail('Relationships', rel)
assert val != 'Unknown image source'
obj.click_element('Relationships', rel)
try:
val = int(val)
assert len([r for r in list_tbl_image.rows()]) == val
except ValueError:
assert val == InfoBlock.text('Properties', 'Name')
示例8: test_images_rel
def test_images_rel(provider, rel, detailfield):
""" https://bugzilla.redhat.com/show_bug.cgi?id=1365878
"""
# Nav to provider first
navigate_to(provider, 'Details')
# Then to container images for that provider
# Locate Relationships table in provider details
images_key = ({
version.LOWEST: 'Images',
'5.7': 'Container Images'
})
sel.click(InfoBlock.element('Relationships', version.pick(images_key)))
# Get the names of all the container images from the table
list_tbl_image = CheckboxTable(
table_locator="//div[@id='list_grid']//table")
ui_images = [r.name.text for r in list_tbl_image.rows()]
for name in ui_images:
img = Image(name, provider)
navigate_to(img, 'Details')
val = img.get_detail('Relationships', rel)
assert val != 'Unknown image source'
sel.click(InfoBlock.element('Relationships', rel))
# Containers Provider and Image Registry are string values
# Other rows in the table show the number of the given items
if rel in ['Containers Provider', 'Image Registry']:
assert val == InfoBlock.text('Properties', detailfield)
else:
val = int(val)
# There might be more than 1 page of items
if paginator.page_controls_exist():
paginator.results_per_page(1000)
assert len([r for r in list_tbl_image.rows()]) == val
示例9: test_nodes_rel
def test_nodes_rel(provider, rel):
navigate_to(provider, 'Details')
sel.click(InfoBlock.element('Relationships', 'Nodes'))
list_tbl_node = CheckboxTable(
table_locator="//div[@id='list_grid']//table")
ui_nodes = [r.name.text for r in list_tbl_node.rows()]
mgmt_objs = provider.mgmt.list_node()
assert set(ui_nodes).issubset(
[obj.name for obj in mgmt_objs]), 'Missing objects'
for name in ui_nodes:
node = Node(name, provider)
val = node.get_detail('Relationships', rel)
if val == '0':
# the row can't be clicked when there are no items, and has class 'no-hover'
logger.info('No items for node relationship: {}'.format(rel))
continue
# Should already be here, but just in case
navigate_to(node, 'Details')
sel.click(InfoBlock.element('Relationships', rel))
try:
val = int(val)
# best effort to include all items from rel in one page
if paginator.page_controls_exist():
logger.info('Setting results per page to 1000 for {}'.format(rel))
paginator.results_per_page(1000)
else:
logger.warning('Unable to increase results per page, '
'assertion against number of rows may fail.')
assert len([r for r in list_tbl_node.rows()]) == val
except ValueError: # if the conversion to integer failed, its a non-scalar relationship
assert val == InfoBlock.text('Properties', 'Name')
示例10: test_projects_rel
def test_projects_rel(provider, rel):
sel.force_navigate('containers_projects')
tb.select('List View')
list_tbl_project = CheckboxTable(
table_locator="//div[@id='list_grid']//table")
ui_projects = [r.name.text for r in list_tbl_project.rows()]
mgmt_objs = provider.mgmt.list_project()
assert set(ui_projects).issubset(
[obj.name for obj in mgmt_objs]), 'Missing objects'
for name in ui_projects:
obj = Project(name, provider)
val = obj.get_detail('Relationships', rel)
if val == '0':
continue
obj.click_element('Relationships', rel)
try:
val = int(val)
assert len([r for r in list_tbl_project.rows()]) == val
except ValueError:
assert val == InfoBlock.text('Properties', 'Name')
示例11: step
def step(self, *args, **kwargs):
check_table = CheckboxTable(table_locator="//div[@id='list_grid']//table")
check_table.select_row_by_cells({'Name': self.obj.name,
'Provider': self.obj.provider.name})
cfg_btn('Edit selected Image')
示例12: CheckboxTable
# -*- coding: utf-8 -*-
from cfme.common import SummaryMixin, Taggable
from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import CheckboxTable, toolbar as tb
from cfme.web_ui.menu import nav
from . import details_page
list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table")
nav.add_branch(
'containers_containers',
{
'containers_container':
lambda ctx: list_tbl.select_row_by_cells(
{'Name': ctx['container'].name, 'Pod Name': ctx['container'].pod.name}),
'containers_container_detail':
lambda ctx: list_tbl.click_row_by_cells(
{'Name': ctx['container'].name, 'Pod Name': ctx['container'].pod.name}),
}
)
class Container(Taggable, SummaryMixin):
def __init__(self, name, pod):
self.name = name
self.pod = pod
def _on_detail_page(self):
return sel.is_displayed(
示例13: import
from cfme.exceptions import MiddlewareServerNotFound
from cfme.fixtures import pytest_selenium as sel
from cfme.middleware import parse_properties, Container
from cfme.web_ui import (
CheckboxTable, paginator, Form, Input, fill
)
from cfme.web_ui.form_buttons import FormButton
from cfme.web_ui.menu import nav, toolbar as tb
from mgmtsystem.hawkular import CanonicalPath
from utils import attributize_string
from utils.db import cfmedb
from utils.providers import get_crud, get_provider_key, list_providers
from utils.varmeth import variable
from . import LIST_TABLE_LOCATOR, mon_btn, pwr_btn, MiddlewareBase, download
list_tbl = CheckboxTable(table_locator=LIST_TABLE_LOCATOR)
def _db_select_query(name=None, feed=None, provider=None, server_group=None):
"""column order: `id`, `name`, `hostname`, `feed`, `product`,
`provider_name`, `ems_ref`, `properties`, `server_group_name`"""
t_ms = cfmedb()['middleware_servers']
t_msgr = cfmedb()['middleware_server_groups']
t_ems = cfmedb()['ext_management_systems']
query = cfmedb().session.query(t_ms.id, t_ms.name, t_ms.hostname, t_ms.feed, t_ms.product,
t_ems.name.label('provider_name'),
t_ms.ems_ref, t_ms.properties,
t_msgr.name.label('server_group_name'))\
.join(t_ems, t_ms.ems_id == t_ems.id)\
.outerjoin(t_msgr, t_ms.server_group_id == t_msgr.id)
if name:
示例14: CheckboxTable
import re
from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import CheckboxTable, paginator
from cfme.web_ui.menu import nav, toolbar as tb
from mgmtsystem.hawkular import Deployment, Path
from utils.db import cfmedb
from utils.varmeth import variable
from . import LIST_TABLE_LOCATOR, MiddlewareBase
list_tbl = CheckboxTable(table_locator=LIST_TABLE_LOCATOR)
def _db_select_query(name=None, server=None, provider=None):
t_ms = cfmedb()['middleware_servers']
t_md = cfmedb()['middleware_deployments']
t_ems = cfmedb()['ext_management_systems']
query = cfmedb().session.query(t_md.nativeid, t_md.name,
t_md.ems_ref, t_ms.name, t_ems.name).join(t_ms,
t_md.server_id == t_ms.id).join(t_ems,
t_md.ems_id == t_ems.id)
if name:
query = query.filter(t_md.name == name)
if server:
query = query.filter(t_md.nativeid.like('%{}%'.format(server)))
if provider:
query = query.filter(t_ems.name == provider)
return query
nav.add_branch(
'middleware_deployments', {
'middleware_deployment': lambda ctx: list_tbl.select_row('Deployment Name', ctx['name']),
示例15: CheckboxTable
import re
from cfme.common import Taggable
from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import CheckboxTable, paginator
from cfme.web_ui.menu import nav, toolbar as tb
from utils.db import cfmedb
from . import LIST_TABLE_LOCATOR, MiddlewareBase
list_tbl = CheckboxTable(table_locator=LIST_TABLE_LOCATOR)
def _db_select_query(name=None, server=None, provider=None):
t_ms = cfmedb()['middleware_servers']
t_mds = cfmedb()['middleware_datasources']
t_ems = cfmedb()['ext_management_systems']
query = cfmedb().session.query(t_mds.nativeid, t_mds.name,
t_mds.ems_ref, t_ms.name, t_ems.name,
t_mds.properties).join(t_ms,
t_mds.server_id == t_ms.id).join(t_ems,
t_mds.ems_id == t_ems.id)
if name:
query = query.filter(t_mds.name == name)
if server:
query = query.filter(t_mds.nativeid.like('%{}%'.format(server)))
if provider:
query = query.filter(t_ems.name == provider)
return query
nav.add_branch(
'middleware_datasources', {
'middleware_datasource': lambda ctx: list_tbl.select_row('Datasource Name', ctx['name']),