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')
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')
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))
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')
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("")
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("")
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
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')
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')
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
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')
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')
from navmazing import NavigateToSibling, NavigateToAttribute import re from cfme.common import Taggable from cfme.fixtures import pytest_selenium as sel from cfme.middleware.provider import Deployable from cfme.middleware.provider.hawkular import HawkularProvider from cfme.middleware.server import MiddlewareServer from cfme.web_ui import CheckboxTable, toolbar as tb from utils.appliance import Navigatable, current_appliance from utils.appliance.implementations.ui import navigator, CFMENavigateStep, navigate_to from utils.providers import get_crud_by_name, list_providers_by_class from utils.varmeth import variable from cfme.middleware.provider import LIST_TABLE_LOCATOR, MiddlewareBase, download, get_server_name list_tbl = CheckboxTable(table_locator=LIST_TABLE_LOCATOR) def _db_select_query(name=None, server=None, provider=None): """Column order: `id`, `nativeid`, `name`, `server_name`, `feed`, `provider_name`, `host_name`, `status`""" t_ems = current_appliance.db.client['ext_management_systems'] t_ms = current_appliance.db.client['middleware_servers'] t_md = current_appliance.db.client['middleware_deployments'] query = current_appliance.db.client.session.query( t_md.id, t_md.nativeid.label('nativeid'), t_md.name, t_ms.name.label('server_name'), t_ms.feed.label('feed'), t_ems.name.label('provider_name'),
import re from cfme.common import Taggable from cfme.fixtures import pytest_selenium as sel from cfme.middleware import Deployable from cfme.middleware.server import MiddlewareServer from cfme.web_ui import CheckboxTable, paginator from cfme.web_ui.menu import nav, toolbar as tb 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, MiddlewareBase, download, get_server_name list_tbl = CheckboxTable(table_locator=LIST_TABLE_LOCATOR) def _db_select_query(name=None, server=None, provider=None): """Column order: `id`, `nativeid`, `name`, `server_name`, `feed`, `provider_name`, `host_name`, `status`""" t_ems = cfmedb()["ext_management_systems"] t_ms = cfmedb()["middleware_servers"] t_md = cfmedb()["middleware_deployments"] query = ( cfmedb() .session.query( t_md.id, t_md.nativeid.label("nativeid"), t_md.name, t_ms.name.label("server_name"), t_ms.feed.label("feed"), t_ems.name.label("provider_name"), t_ms.hostname.label("host_name"),
("user", ui.Select("//select[@id='user_choice']")), ("time_period", ui.Select("//select[@id='time_period']")), ("task_status_queued", ui.Input('queued')), ("task_status_running", ui.Input('running')), ("task_status_ok", ui.Input('ok')), ("task_status_error", ui.Input('error')), ("task_status_warn", ui.Input('warn')), ("task_state", ui.Select("//select[@id='state_choice']")), ]) table_loc = '//div[@id="records_div"]/table' match_page = partial(match_location, controller='miq_task') tasks_table = CheckboxTable( table_locator='//div[@id="records_div"]/table[thead]', header_checkbox_locator= "//div[@id='records_div']//input[@id='masterToggle']") # TODO move these into Task class def _filter(zone=None, user=None, time_period=None, task_status_queued=None, task_status_running=None, task_status_ok=None, task_status_error=None, task_status_warn=None, task_state=None): """ Does filtering of the results in table. Needs to be on the correct page before called.
'url_default': "//button[@id='rhn_default_button']", 'repo_default': "//button[@id='repo_default_name']", 'validate': "//img[@title='Validate the credentials']" }, identifying_loc="url_default") service_types = { 'rhsm': 'sm_hosted', 'sat5': 'rhn_satellite', 'sat6': 'rhn_satellite6' } appliances_table = CheckboxTable( "//div[@id='form_div']/table[@class='style3']") def update_registration(service, url, username, password, repo_name=None, organization=None, use_proxy=False, proxy_url=None, proxy_username=None, proxy_password=None, validate=False, cancel=False, set_default_rhsm_address=False,
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:
# -*- 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(
from cfme.common.provider import BaseProvider from cfme.web_ui import ( Region, Form, AngularSelect, form_buttons, Input, CheckboxTable ) from cfme.web_ui.menu import nav from cfme.fixtures import pytest_selenium as sel from utils.varmeth import variable from . import cfg_btn, mon_btn, pol_btn, LIST_TABLE_LOCATOR, MiddlewareBase list_tbl = CheckboxTable(table_locator=LIST_TABLE_LOCATOR) details_page = Region(infoblock_type='detail') nav.add_branch( 'middleware_providers', { 'middleware_provider_new': lambda _: cfg_btn('Add a New Middleware Provider'), 'middleware_provider': [ lambda ctx: list_tbl.select_row('name', ctx['provider'].name), { 'middleware_provider_edit': lambda _: cfg_btn('Edit Selected Middleware Provider'), 'middleware_provider_edit_tags': lambda _: pol_btn('Edit Tags') }], 'middleware_provider_detail': [ lambda ctx: list_tbl.click_cells({'name': ctx['provider'].name}), {
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, mon_btn, pwr_btn, 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_ems = cfmedb()['ext_management_systems'] query = cfmedb().session.query(t_ms.name, t_ms.feed, t_ms.product, t_ems.name).join(t_ems, t_ms.ems_id == t_ems.id) if name: query = query.filter(t_ms.name == name) if server: query = query.filter(t_ms.nativeid.like('%{}%'.format(server))) if provider: query = query.filter(t_ems.name == provider) return query nav.add_branch( 'middleware_servers', { 'middleware_server': lambda ctx: list_tbl.select_row('Server Name', ctx['name']), 'middleware_server_detail': lambda ctx: list_tbl.click_row_by_cells({'Server Name': ctx['name']}), } )
# -*- 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 list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table") nav.add_branch( 'containers_image_registries', { 'containers_image_registry': lambda ctx: list_tbl.select_row_by_cells( {'Host': ctx['image_registry'].host, 'Provider': ctx['image_registry'].provider.name}), 'containers_image_registry_detail': lambda ctx: list_tbl.click_row_by_cells( {'Host': ctx['image_registry'].host, 'Provider': ctx['image_registry'].provider.name}), } ) class ImageRegistry(Taggable, SummaryMixin): def __init__(self, host, provider): self.host = host self.provider = provider def load_details(self, refresh=False): if not self._on_detail_page(): self.navigate(detail=True)
import re from cfme.common import Taggable from cfme.fixtures import pytest_selenium as sel from cfme.middleware import parse_properties from cfme.middleware.server import MiddlewareServer from cfme.web_ui import CheckboxTable, paginator from cfme.web_ui.menu import nav, toolbar as tb from utils import attributize_string from utils.db import cfmedb from utils.providers import get_crud, get_provider_key from utils.providers import list_providers from utils.varmeth import variable from . import LIST_TABLE_LOCATOR, MiddlewareBase, download list_tbl = CheckboxTable(table_locator=LIST_TABLE_LOCATOR) def _db_select_query(name=None, nativeid=None, server=None, provider=None): """Column order: `id`, `nativeid`, `name`, `properties`, `server_name`, `feed`, `provider_name`, `ems_ref`, `messaging_type`""" t_ms = cfmedb()['middleware_servers'] t_mm = cfmedb()['middleware_messagings'] t_ems = cfmedb()['ext_management_systems'] query = cfmedb().session.query( t_mm.id, t_mm.nativeid, t_mm.name, t_mm.properties, t_ms.name.label('server_name'), t_ms.feed, t_ems.name.label('provider_name'),
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']),
form_buttons, flash, paginator) from utils import version from utils.appliance import Navigatable from utils.appliance.implementations.ui import CFMENavigateStep, navigator, navigate_to from utils.log import logger from utils.wait import wait_for, TimedOutError create_tenant_form = Form( fields=[('prov_select', AngularSelect("ems_id")), ('name', Input('name')), ('save_button', { version.LOWEST: form_buttons.angular_save, '5.8': form_buttons.simple_save }), ('reset_button', form_buttons.reset)]) listview_pagetable = PagedTable(table_locator="//div[@id='list_grid']//table") listview_checktable = CheckboxTable( table_locator="//div[@id='list_grid']//table") cfg_btn = partial(tb.select, 'Configuration') pol_btn = partial(tb.select, 'Policy') match_page = partial(match_location, controller='cloud_tenant', title='Cloud Tenants') class Tenant(Navigatable): _param_name = "Tenant" def __init__(self, name, provider, appliance=None): """Base class for a Tenant""" self.name = name
# -*- 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
from cfme.fixtures import pytest_selenium as sel from cfme.intelligence.reports.ui_elements import Timer from cfme.web_ui import (EmailSelectForm, Form, CheckboxTable, Select, ShowingInputs, accordion, fill, flash, toolbar, form_buttons, Input) from cfme.web_ui.menu import nav from utils.db import cfmedb from utils.update import Updateable from utils.wait import wait_for from utils.pretty import Pretty from utils import version cfg_btn = partial(toolbar.select, "Configuration") schedules_table = CheckboxTable("//div[@id='records_div']//table[thead]") def get_sch_name(sch): """Enables us using both string and schedule object""" if isinstance(sch, basestring): return sch elif isinstance(sch, Schedule): return sch.name else: return str(sch) nav.add_branch( "reports", { "schedules": [
filter_form = Form(fields=[ ("zone", ui.Select("//select[@id='chosen_zone']")), ("user", ui.Select("//select[@id='user_choice']")), ("time_period", ui.Select("//select[@id='time_period']")), ("task_status_queued", ui.Input('queued')), ("task_status_running", ui.Input('running')), ("task_status_ok", ui.Input('ok')), ("task_status_error", ui.Input('error')), ("task_status_warn", ui.Input('warn')), ("task_state", ui.Select("//select[@id='state_choice']")), ]) table_loc = '//div[@id="records_div" or @id="main_div"]//table' tasks_table = CheckboxTable( table_locator=table_loc + '[thead]', header_checkbox_locator= "//div[@id='records_div' or @id='main_div']//input[@id='masterToggle']") # TODO move these into Task class def _filter(zone=None, user=None, time_period=None, task_status_queued=None, task_status_running=None, task_status_ok=None, task_status_error=None, task_status_warn=None, task_state=None): """ Does filtering of the results in table. Needs to be on the correct page before called.
class CannedSavedReport(CustomSavedReport, Navigatable): """As we cannot create or edit canned reports, we don't know their titles and so, so we need to change the navigation a little bit for it to work correctly. Args: path_to_report: Iterable with path to report. datetime: Datetime of "Run At" of the report. That's what :py:func:`queue_canned_report` returns. """ saved_table = CheckboxTable('//div[@id="records_div"]//table') def __init__(self, path_to_report, datetime, candu=False, appliance=None): Navigatable.__init__(self, appliance=appliance) self.path = path_to_report self.datetime = datetime self.candu = candu self.datetime_in_tree = version.pick({"5.6": self.datetime, "5.7": parsetime.from_american_with_utc(self.datetime).to_iso_with_utc()}) def navigate(self): navigate_to(self, "Details") @classmethod def new(cls, path): return cls(path, cls.queue_canned_report(path)) @classmethod def queue_canned_report(cls, path): """Queue report from selection of pre-prepared reports. Args: *path: Path in tree after All Reports Returns: Value of Run At in the table so the run can be then checked. """ cls.path = path navigate_to(cls, "Info") toolbar.select("Queue") flash.assert_no_errors() tabstrip.select_tab("Saved Reports") queued_at = sel.text(list(records_table.rows())[0].queued_at) def _get_state(): navigate_to(cls, 'Saved') row = records_table.find_row("queued_at", queued_at) status = sel.text(row.status).strip().lower() assert status != "error", sel.text(row) return status == version.pick({"5.6": "finished", "5.7": "complete"}) wait_for( _get_state, delay=3, message="wait for report generation finished", fail_func=toolbar.refresh() ) return sel.text(list(records_table.rows())[0].run_at).encode("utf-8") def get_saved_canned_reports(self, *path): navigate_to(self, "Saved") results = [] try: for page in paginator.pages(): for row in records_table.rows(): results.append( CannedSavedReport(path, sel.text(row.run_at).encode("utf-8")) ) except sel.NoSuchElementException: pass return results def delete(self): navigate_to(self, 'Saved') self.saved_table.select_row(header='Run At', value=self.datetime) cfg_btn("Delete this Saved Report from the Database", invokes_alert=True) sel.handle_alert() flash.assert_no_errors()
def appliances_table(): return CheckboxTable("//div[@id='form_div']/table")
import re from cfme.common import Taggable from cfme.fixtures import pytest_selenium as sel from cfme.middleware.server import MiddlewareServer from cfme.web_ui import CheckboxTable, paginator from cfme.web_ui.menu import nav, toolbar as tb 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, MiddlewareBase, download list_tbl = CheckboxTable(table_locator=LIST_TABLE_LOCATOR) def _db_select_query(name=None, server=None, provider=None): """Column order: `id`, `nativeid`, `name`, `server_name`, `feed`, `provider_name`""" t_ems = cfmedb()['ext_management_systems'] t_ms = cfmedb()['middleware_servers'] t_md = cfmedb()['middleware_deployments'] query = cfmedb().session.query(t_md.id, t_md.nativeid.label('nativeid'), t_md.name, t_ms.name.label('server_name'), t_ms.feed.label('feed'), t_ems.name.label('provider_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_ms.name == server.name) if server.feed: query = query.filter(t_ms.feed == server.feed) if provider: query = query.filter(t_ems.name == provider.name)
}), ('cancel_changes', { version.LOWEST: form_buttons.cancel_changes, '5.5': form_buttons.cancel }), ('validate_host', { version.LOWEST: Select('select#validate_id'), '5.5': AngularSelect('validate_id') }), ]) manage_policies_tree = CheckboxTree("//div[@id='protect_treebox']/ul") drift_table = CheckboxTable({ version.LOWEST: "//table[@class='style3']", "5.4": "//th[normalize-space(.)='Timestamp']/ancestor::table[1]" }) host_add_btn = { version.LOWEST: FormButton('Add this Host'), "5.5": FormButton("Add") } default_host_filter_btn = FormButton('Set the current filter as my default') cfg_btn = partial(tb.select, 'Configuration') pol_btn = partial(tb.select, 'Policy') pow_btn = partial(tb.select, 'Power') lif_btn = partial(tb.select, 'Lifecycle') mon_btn = partial(tb.select, 'Monitoring') match_page = partial(match_location, controller='host', title='Hosts')
import re from cfme.common import Taggable from cfme.fixtures import pytest_selenium as sel from cfme.middleware import parse_properties from cfme.middleware.server import MiddlewareServer from cfme.web_ui import CheckboxTable, paginator 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 from utils.providers import list_providers from utils.varmeth import variable from . import LIST_TABLE_LOCATOR, MiddlewareBase, download list_tbl = CheckboxTable(table_locator=LIST_TABLE_LOCATOR) def _db_select_query(name=None, nativeid=None, server=None, provider=None): """Column order: `id`, `nativeid`, `name`, `properties`, `server_name`, `feed`, `provider_name`, `ems_ref`""" t_ms = cfmedb()['middleware_servers'] t_mds = cfmedb()['middleware_datasources'] t_ems = cfmedb()['ext_management_systems'] query = cfmedb().session.query(t_mds.id, t_mds.nativeid, t_mds.name, t_mds.properties, t_ms.name.label('server_name'), t_ms.feed, t_ems.name.label('provider_name'), t_mds.ems_ref)\ .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 nativeid:
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')
# -*- coding: utf-8 -*- import random import itertools from cfme.common import SummaryMixin, Taggable from cfme.fixtures import pytest_selenium as sel from cfme.web_ui import toolbar as tb, paginator, match_location,\ PagedTable, CheckboxTable from cfme.containers.provider import details_page, Labelable from utils.appliance.implementations.ui import navigator, CFMENavigateStep,\ navigate_to from navmazing import NavigateToAttribute, NavigateToSibling from utils.appliance import Navigatable from functools import partial list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table") paged_tbl = PagedTable(table_locator="//div[@id='list_grid']//table") match_page = partial(match_location, controller='container_routes', title='Routes') class Route(Taggable, Labelable, SummaryMixin, Navigatable): def __init__(self, name, project_name, provider, appliance=None): self.name = name self.project_name = project_name self.provider = provider Navigatable.__init__(self, appliance=appliance) def load_details(self, refresh=False):
pol_btn = partial(toolbar.select, "Policy") pwr_btn = partial(toolbar.select, "Power") retire_remove_button = "//span[@id='remove_button']/a/img|//a/img[contains(@src, '/clear')]" set_ownership_form = Form(fields=[( 'user_name', AngularSelect('user_name')), ( 'group_name', AngularSelect('group_name')), ( 'create_button', form_buttons.save), ( 'reset_button', form_buttons.reset), ('cancel_button', form_buttons.cancel)]) drift_table = CheckboxTable( "//th[normalize-space(.)='Timestamp']/ancestor::table[1]") drift_section = BootstrapTreeview('all_sectionsbox') def base_types(template=False): from pkg_resources import iter_entry_points search = "template" if template else "vm" return { ep.name: ep.resolve() for ep in iter_entry_points('manageiq.{}_categories'.format(search)) } def instance_types(category, template=False): from pkg_resources import iter_entry_points search = "template" if template else "vm"
# -*- coding: utf-8 -*- # added new list_tbl definition from cfme.common import SummaryMixin, Taggable from cfme.fixtures import pytest_selenium as sel from cfme.web_ui import toolbar as tb, CheckboxTable 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_replicators', { 'containers_replicator': lambda ctx: list_tbl.select_row_by_cells( {'Name': ctx['replicator'].name, 'Provider': ctx['replicator'].provider.name}), 'containers_replicator_detail': lambda ctx: list_tbl.click_row_by_cells( {'Name': ctx['replicator'].name, 'Provider': ctx['replicator'].provider.name}), } ) class Replicator(Taggable, SummaryMixin): def __init__(self, name, provider): self.name = name self.provider = provider def _on_detail_page(self):
'url_default': "//button[@id='rhn_default_button']", 'repo_default': "//button[@id='repo_default_name']", }, identifying_loc="url_default") service_types = { 'rhsm': 'sm_hosted', 'sat5': 'rhn_satellite', 'sat6': 'rhn_satellite6' } appliances_table = version.pick({ version.LOWEST: CheckboxTable("//div[@id='form_div']/table[@class='style3']"), '5.4': CheckboxTable("//div[@id='form_div']/table") }) def update_registration(service, url, username, password, password_verify=None, repo_name=None, organization=None, use_proxy=False, proxy_url=None, proxy_username=None,
filter_form = Form(fields=[ ("zone", ui.Select("//select[@id='chosen_zone']")), ("user", ui.Select("//select[@id='user_choice']")), ("time_period", ui.Select("//select[@id='time_period']")), ("task_status_queued", ui.Input('queued')), ("task_status_running", ui.Input('running')), ("task_status_ok", ui.Input('ok')), ("task_status_error", ui.Input('error')), ("task_status_warn", ui.Input('warn')), ("task_state", ui.Select("//select[@id='state_choice']")), ]) tasks_table = CheckboxTable( table_locator={ LOWEST: '//div[@id="records_div"]/table[@class="style3"]', "5.4": '//div[@id="records_div"]/table[thead]' }, header_checkbox_locator= "//div[@id='records_div']//input[@id='masterToggle']") def _filter(zone=None, user=None, time_period=None, task_status_queued=None, task_status_running=None, task_status_ok=None, task_status_error=None, task_status_warn=None, task_state=None): """ Does filtering of the results in table. Needs to be on the correct page before called.
import re from cfme.fixtures import pytest_selenium as sel from cfme.middleware.server import MiddlewareServer from cfme.web_ui import CheckboxTable, paginator from cfme.web_ui.menu import nav, toolbar as tb from utils.db import cfmedb from utils.providers import get_crud, get_provider_key, list_middleware_providers 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): """Column order: `nativeid`, `name`, `server_name`, `feed`, `provider_name`""" t_ems = cfmedb()['ext_management_systems'] t_ms = cfmedb()['middleware_servers'] t_md = cfmedb()['middleware_deployments'] query = cfmedb().session.query(t_md.nativeid.label('nativeid'), t_md.name, t_ms.name.label('server_name'), t_ms.feed.label('feed'), t_ems.name.label('provider_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_ms.name == server.name) if server.feed: query = query.filter(t_ms.feed == server.feed) if provider: query = query.filter(t_ems.name == provider.name) return query
from cfme.common import Taggable from cfme.fixtures import pytest_selenium as sel from cfme.middleware import parse_properties from cfme.middleware.server import MiddlewareServer from cfme.web_ui import CheckboxTable, paginator 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 from utils.providers import list_providers from utils.varmeth import variable from . import LIST_TABLE_LOCATOR, MiddlewareBase, download, get_server_name list_tbl = CheckboxTable(table_locator=LIST_TABLE_LOCATOR) def _db_select_query(name=None, nativeid=None, server=None, provider=None): """Column order: `id`, `nativeid`, `name`, `properties`, `server_name`, `feed`, `provider_name`, `ems_ref`, `hostname`""" t_ms = cfmedb()['middleware_servers'] t_mds = cfmedb()['middleware_datasources'] t_ems = cfmedb()['ext_management_systems'] query = cfmedb().session.query( t_mds.id, t_mds.nativeid, t_mds.name, t_mds.properties, t_ms.name.label('server_name'), t_ms.feed, t_ems.name.label('provider_name'),
# -*- coding: utf-8 -*- from functools import partial from navmazing import NavigateToSibling, NavigateToObject from . import Report from cfme.fixtures import pytest_selenium as sel from cfme.web_ui import CheckboxTable, accordion, toolbar from utils.appliance.implementations.ui import navigator, CFMENavigateStep, navigate_to from utils.appliance import Navigatable reports_table = CheckboxTable("//div[@id='records_div']//table[thead]") cfg_btn = partial(toolbar.select, "Configuration") class SavedReport(Navigatable): def __init__(self, name, timestamp, appliance=None): Navigatable.__init__(self, appliance) self.name = name self.timestamp = timestamp def delete(self, cancel): navigate_to(self, 'Delete') sel.handle_alert(cancel) @classmethod def get_all_saved_reports_by_name(cls, name): navigate_to(cls, 'All') accordion.tree("Saved Reports", "All Saved Reports", name) dates = [] try: for row in reports_table.rows():
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']),
from functools import partial from cfme.fixtures import pytest_selenium as sel from cfme.intelligence.reports.ui_elements import Timer from cfme.web_ui import (EmailSelectForm, Form, CheckboxTable, InfoBlock, Select, ShowingInputs, accordion, fill, flash, toolbar, form_buttons) from cfme.web_ui.menu import nav from utils.db import cfmedb from utils.update import Updateable from utils.wait import wait_for cfg_btn = partial(toolbar.select, "Configuration") schedules_table = CheckboxTable("//div[@id='records_div']//table[contains(@class, 'style3')]") def get_sch_name(sch): """Enables us using both string and schedule object""" if isinstance(sch, basestring): return sch elif isinstance(sch, Schedule): return sch.name else: return str(sch) nav.add_branch( "reports", { "schedules":
from cfme.common import Taggable from cfme.exceptions import MiddlewareDomainNotFound from cfme.fixtures import pytest_selenium as sel from cfme.middleware import parse_properties from cfme.web_ui import CheckboxTable, paginator 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, MiddlewareBase, download list_tbl = CheckboxTable(table_locator=LIST_TABLE_LOCATOR) def _db_select_query(name=None, feed=None, provider=None): """column order: `id`, `name`, `feed`, `provider_name`, `ems_ref`, `properties`""" t_md = cfmedb()['middleware_domains'] t_ems = cfmedb()['ext_management_systems'] query = cfmedb().session.query(t_md.id, t_md.name, t_md.feed, t_ems.name.label('provider_name'), t_md.ems_ref, t_md.properties)\ .join(t_ems, t_md.ems_id == t_ems.id) if name: query = query.filter(t_md.name == name) if feed: query = query.filter(t_md.feed == feed) if provider: query = query.filter(t_ems.name == provider.name)