Beispiel #1
0
 def list_data_table(self, raw=False):
     """Returns list of data from table"""
     self.load_chart_reference()
     data = []
     if self.has_warning:
         return data
     table = Table(table_locator="//table[contains(@class, 'table')]")
     headers = []
     for header in table.headers:
         headers.append(attributize_string(sel.text_sane(header)))
     for row in table.rows():
         _data = {}
         for header in headers:
             if header == "datetime":
                 _datetime = sel.text_sane(row[header])
                 if raw:
                     _data[header] = _datetime
                 else:
                     # sample 10/19/16 15:23:38 UTC
                     _data['timestamp'] = self._timestamp(
                         datetime.strptime(_datetime,
                                           "%m/%d/%y %H:%M:%S %Z"))
             else:
                 _value = round_double(value_of(sel.text_sane(row[header])))
                 _data[header] = None if _value == '' else _value
         data.append(_data)
     return data
 def list_data_table(self, raw=False):
     """Returns list of data from table"""
     self.load_chart_reference()
     data = []
     if self.has_warning:
         return data
     table = Table(table_locator="//table[contains(@class, 'table')]")
     headers = []
     for header in table.headers:
         headers.append(attributize_string(sel.text_sane(header)))
     for row in table.rows():
         _data = {}
         for header in headers:
             if header == "datetime":
                 _datetime = sel.text_sane(row[header])
                 if raw:
                     _data[header] = _datetime
                 else:
                     # sample 10/19/16 15:23:38 UTC
                     _data['timestamp'] = self._timestamp(
                         datetime.strptime(_datetime, "%m/%d/%y %H:%M:%S %Z"))
             else:
                 _value = round_double(value_of(sel.text_sane(row[header])))
                 _data[header] = None if _value == '' else _value
         data.append(_data)
     return data
Beispiel #3
0
 class environment(Tab):  # noqa
     TAB_NAME = 'Environment'
     # Infra
     datacenter = BootstrapSelect('environment__placement_dc_name')
     cluster = BootstrapSelect('environment__placement_cluster_name')
     resource_pool = BootstrapSelect('environment__placement_rp_name')
     folder = BootstrapSelect('environment__placement_folder_name')
     host_filter = BootstrapSelect('environment__host_filter')
     host_name = Table('//div[@id="prov_host_div"]/table')
     datastore_filter = BootstrapSelect('environment__ds_filter')
     datastore_name = Table('//div[@id="prov_ds_div"]/table')
def test_templates(provider, soft_assert):
    navigate_to(provider, 'Details')
    images = [i.name for i in provider.mgmt.images]

    assert int(provider.get_detail('Relationships', 'Templates')) == len(images)
    sel.click(InfoBlock.element('Relationships', 'Templates'))
    table = Table("//table[contains(@class, 'table')]")

    for image in images:
        cell = table.find_cell('Name', image)
        soft_assert(cell, 'Missing template: {}'.format(image))
def test_templates(provider, soft_assert):
    navigate_to(provider, 'Details')
    images = [i.name for i in provider.mgmt.images]

    assert int(provider.get_detail('Relationships', 'Templates')) == len(images)
    sel.click(InfoBlock.element('Relationships', 'Templates'))
    table = Table("//table[contains(@class, 'table')]")

    for image in images:
        cell = table.find_cell('Name', image)
        soft_assert(cell, 'Missing template: {}'.format(image))
Beispiel #6
0
def test_outputs_link_url(stack):
    try:
        navigate_to(stack, 'RelationshipOutputs')
    except CandidateNotFound:
        # Assert there is a non-clickable anchor
        assert sel.is_displayed(
            '//div[@id="stack_rel"]//a[@href="#" and normalize-space(.)="Outputs (0)"]')
    else:
        # Outputs is a table with clickable rows
        table = Table('//div[@id="list_grid"]//table[contains(@class, "table-selectable")]')
        table.click_row_by_cells({'Key': 'WebsiteURL'}, 'Key')
        assert sel.is_displayed_text("WebsiteURL")
Beispiel #7
0
def restart_workers(name, wait_time_min=1):
    """ Restarts workers by their name.

    Args:
        name: Name of the worker. Multiple workers can have the same name. Name is matched with `in`
    Returns: bool whether the restart succeeded.
    """

    table = Table("//div[@id='records_div']/table[@class='style3']")
    sel.force_navigate("cfg_diagnostics_server_workers")

    def get_all_pids(worker_name):
        return {row.pid.text for row in table.rows() if worker_name in row.name.text}

    reload_func = partial(tb.select, "Reload current workers display")

    pids = get_all_pids(name)
    # Initiate the restart
    for pid in pids:
        table.click_cell("pid", pid)
        tb.select("Configuration", "Restart selected worker", invokes_alert=True)
        sel.handle_alert(cancel=False)
        reload_func()

    # Check they have finished
    def _check_all_workers_finished():
        for pid in pids:
            if table.click_cell("pid", pid):    # If could not click, it is no longer present
                return False                    # If clicked, it is still there so unsuccess
        return True

    # Wait for all original workers to be gone
    try:
        wait_for(
            _check_all_workers_finished,
            fail_func=reload_func,
            num_sec=wait_time_min * 60
        )
    except TimedOutError:
        return False

    # And now check whether the same number of workers is back online
    try:
        wait_for(
            lambda: len(pids) == len(get_all_pids(name)),
            fail_func=reload_func,
            num_sec=wait_time_min * 60,
            message="wait_workers_back_online"
        )
        return True
    except TimedOutError:
        return False
Beispiel #8
0
def test_outputs_link_url(stack):
    try:
        navigate_to(stack, 'RelationshipOutputs')
    except CandidateNotFound:
        # Assert there is a non-clickable anchor
        assert sel.is_displayed(
            '//div[@id="stack_rel"]//a[@href="#" and normalize-space(.)="Outputs (0)"]'
        )
    else:
        # Outputs is a table with clickable rows
        table = Table(
            '//div[@id="list_grid"]//table[contains(@class, "table-selectable")]'
        )
        table.click_row_by_cells({'Key': 'WebsiteURL'}, 'Key')
        assert sel.is_displayed_text("WebsiteURL")
Beispiel #9
0
class InstanceFieldsRow(pretty.Pretty):
    """Represents one row of instance fields.

    Args:
        row_id: Sequential id of the row (begins with 0)
    """
    table = Table({
        version.LOWEST: "//div[@id='form_div']//table[@class='style3']",
        "5.4": "//div[@id='form_div']//table[thead]"
    })
    columns = ("value", "on_entry", "on_exit", "on_error", "collect")
    fields = ("inst_value_{}", "inst_on_entry_{}", "inst_on_exit_{}",
              "inst_on_error_{}", "inst_collect_{}")
    pretty_attrs = ['_row_id']

    def __init__(self, row_id):
        self._row_id = row_id

    @property
    def form(self):
        """Returns the form with fields targeted at our row_id.

        Does not need to be on the page.
        """
        return Form(fields=[(col_name, "//input[contains(@id, '{}')]".format(
            self.fields[i].format(self._row_id)))
                            for i, col_name in enumerate(self.columns)])
def test_routes_search(routes_search_strings):
    """ Routes summary page - Search bar

           This test checks Search bar functionality on the Routes summary page

           Steps:
               * Goes to Containers Routes page
               * Inserts: Irregular symbol, '*' character, full search string, partial search string
               * Verify proper results
           """
    sel.force_navigate('containers_routes')
    if ''.join(routes_search_strings) == '*':
        full_name_to_search = '*'
        names_list = []
        located_names = []
        projects_table = Table(table_el)
        for row in projects_table.rows():
            names_list.append(row.name.text)
        search.normal_search(full_name_to_search)
        for row in projects_table.rows():
            located_names.append(row.name.text)
        for name in located_names:
            assert name in names_list
    elif ''.join(routes_search_strings) == 'front':
        full_name_to_search = 'front'
        search.normal_search(full_name_to_search)
        projects_table = Table(table_el)
        for row in projects_table.rows():
            name = row.name.text
            assert full_name_to_search in name
    elif ''.join(routes_search_strings) == '$':
        full_name_to_search = '$'
        search.normal_search(full_name_to_search)
        assert sel.is_displayed_text("No Records Found.")
    else:
        full_name_to_search = ''.join(routes_search_strings)
        search.normal_search(full_name_to_search)
        projects_table = Table(table_el)
        for row in projects_table.rows():
            name = row.name.text
            assert name == full_name_to_search
def test_ssa_packages(provider, instance, soft_assert):
    """ Tests SSA fetches correct results for packages

    Metadata:
        test_flag: vm_analysis
    """

    if instance.system_type == WINDOWS:
        pytest.skip("Windows has no packages")

    expected = None
    if 'package' not in instance.system_type.keys():
        pytest.skip("Don't know how to update packages for {}".format(
            instance.system_type))

    package_name = instance.system_type['package']
    package_command = instance.system_type['install-command']
    package_number_command = instance.system_type['package-number']

    cmd = package_command.format(package_name)
    output = instance.ssh.run_command(cmd.format(package_name)).output
    logger.info("{0} output:\n{1}".format(cmd, output))

    expected = instance.ssh.run_command(package_number_command).output.strip(
        '\n')

    instance.smartstate_scan()
    wait_for(lambda: is_vm_analysis_finished(instance.name),
             delay=15,
             timeout="10m",
             fail_func=lambda: tb.select('Reload'))

    # Check that all data has been fetched
    current = instance.get_detail(properties=('Configuration', 'Packages'))
    assert current == expected

    # Make sure new package is listed
    sel.click(InfoBlock("Configuration", "Packages"))
    template = '//div[@id="list_grid"]/div[@class="{}"]/table/tbody'
    packages = version.pick({
        version.LOWEST:
        SplitTable(header_data=(template.format("xhdr"), 1),
                   body_data=(template.format("objbox"), 0)),
        "5.5":
        Table('//table'),
    })

    for page in paginator.pages():
        if packages.find_row('Name', package_name):
            return
    pytest.fail("Package {0} was not found".format(package_name))
def test_ssa_users(provider, instance, soft_assert):
    """ Tests SSA fetches correct results for users list

    Metadata:
        test_flag: vm_analysis
    """
    username = fauxfactory.gen_alphanumeric()
    expected = None

    # In windows case we can't add new users (yet)
    # So we simply check that user list doesn't cause any Rails errors
    if instance.system_type != WINDOWS:
        # Add a new user
        instance.ssh.run_command("userdel {0} || useradd {0}".format(username))
        expected = instance.ssh.run_command(
            "cat /etc/passwd | wc -l").output.strip('\n')

    instance.smartstate_scan()
    wait_for(lambda: is_vm_analysis_finished(instance.name),
             delay=15,
             timeout="10m",
             fail_func=lambda: tb.select('Reload'))

    # Check that all data has been fetched
    current = instance.get_detail(properties=('Security', 'Users'))
    if instance.system_type != WINDOWS:
        assert current == expected

    # Make sure created user is in the list
    sel.click(InfoBlock("Security", "Users"))
    template = '//div[@id="list_grid"]/div[@class="{}"]/table/tbody'
    users = version.pick({
        version.LOWEST:
        SplitTable(header_data=(template.format("xhdr"), 1),
                   body_data=(template.format("objbox"), 0)),
        "5.5":
        Table('//table'),
    })

    for page in paginator.pages():
        sel.wait_for_element(users)
        if users.find_row('Name', username):
            return
    if instance.system_type != WINDOWS:
        pytest.fail("User {0} was not found".format(username))
def test_ssa_groups(provider, instance, soft_assert):
    """ Tests SSA fetches correct results for groups

    Metadata:
        test_flag: vm_analysis
    """
    group = fauxfactory.gen_alphanumeric()
    expected = None

    if instance.system_type != WINDOWS:
        # Add a new group
        instance.ssh.run_command("groupdel {0} || groupadd {0}".format(group))
        expected = instance.ssh.run_command(
            "cat /etc/group | wc -l").output.strip('\n')

    instance.smartstate_scan()
    wait_for(lambda: is_vm_analysis_finished(instance.name),
             delay=15,
             timeout="10m",
             fail_func=lambda: tb.select('Reload'))

    # Check that all data has been fetched
    current = instance.get_detail(properties=('Security', 'Groups'))
    if instance.system_type != WINDOWS:
        assert current == expected

    # Make sure created group is in the list
    sel.click(InfoBlock("Security", "Groups"))
    template = '//div[@id="list_grid"]/div[@class="{}"]/table/tbody'
    groups = version.pick({
        version.LOWEST:
        SplitTable(header_data=(template.format("xhdr"), 1),
                   body_data=(template.format("objbox"), 0)),
        "5.5":
        Table('//table'),
    })

    for page in paginator.pages():
        sel.wait_for_element(groups)
        if groups.find_row('Name', group):
            return
    if instance.system_type != WINDOWS:
        pytest.fail("Group {0} was not found".format(group))
def test_routes_search(routes_search_strings):
    """ Routes summary page - Search bar

           This test checks Search bar functionality on the Routes summary page

           Steps:
               * Goes to Containers Routes page
               * Inserts: Irregular symbol, '*' character, full search string, partial search string
               * Verify proper results
           """
    navigate_to(Route, 'All')
    if ''.join(routes_search_strings) == '*':
        full_name_to_search = '*'
        names_list = []
        located_names = []
        projects_table = Table(table_el)
        for row in projects_table.rows():
            names_list.append(row.name.text)
        search.normal_search(full_name_to_search)
        for row in projects_table.rows():
            located_names.append(row.name.text)
        for name in located_names:
            assert name in names_list
    elif ''.join(routes_search_strings) == 'front':
        full_name_to_search = 'front'
        search.normal_search(full_name_to_search)
        projects_table = Table(table_el)
        for row in projects_table.rows():
            name = row.name.text
            assert full_name_to_search in name
    elif ''.join(routes_search_strings) == '$':
        full_name_to_search = '$'
        search.normal_search(full_name_to_search)
        assert sel.is_displayed_text("No Records Found.")
    else:
        full_name_to_search = ''.join(routes_search_strings)
        search.normal_search(full_name_to_search)
        projects_table = Table(table_el)
        for row in projects_table.rows():
            name = row.name.text
            assert name == full_name_to_search
Beispiel #15
0
 def _table(self):
     """This is required to prevent the StaleElementReference for different instances"""
     if self.candu:
         return CAndUGroupTable(self._table_loc)
     else:
         return Table(self._table_loc)
Beispiel #16
0
                select(id="chosen_unit1"),
                select(id="chosen_unit2"),
                select(id="chosen_unit3"),
                min_values=1
            )),
            ("event_position", select(id="chosen_position")),
            ("show_event_unit", select(id="chosen_last_unit")),
            ("show_event_count", select(id="chosen_last_time")),
        ],
        "Preview": [],
    },
    # This will go away after the order of the tabs will be guaranteed
    order=["Columns", "Consolidation", "Formatting", "Styling", "Filter", "Summary", "Charts"]
)

records_table = Table("//div[@id='records_div']//table[thead]")


class CustomReport(Updateable, Navigatable):
    _default_dict = {
        "menu_name": None,
        "title": None,
        "base_report_on": None,
        "report_fields": None,
        "cancel_after": None,
        "group_records": None,
        "calculations_grouped": None,
        "page_size": None,
        "headers": None,
        "column_styles": None,
        "filter": None,
Beispiel #17
0
    """ Precise button factory. Targets only buttons that are visible.

    """
    return "//div[@id='buttons_on']/ul[@id='form_buttons']/li/img[@title='%s']" % button_title

crud_buttons = Region(
    locators={
        'save_button': make_button("Save Changes"),
        'reset_button': make_button("Reset Changes"),
        'cancel_button': make_button("Cancel"),
        'add_button': make_button("Add"),
    },
    identifying_loc="//div[@id='buttons_on']/ul[@id='form_buttons']",
)

records_table = Table("//div[@id='records_div']/table[@class='style3']")

nav.add_branch("configuration",
    {
        "configuration_settings":
        [
            lambda _: accordion.click("Settings"),
            {
                "cfg_settings_region":
                lambda _: settings_tree.click_path("Region: Region"),

                "cfg_settings_defaultzone":
                lambda _: settings_tree.click_path("Region: Region", "Zones", "Default Zone"),

                "cfg_settings_schedules":
                [
Beispiel #18
0
        edit="//*[@title='Edit the original Request']/img",
        delete="//*[@title='Delete this Request']/img",
        submit="//span[@id='buttons_on']/a[@title='Submit']",
        cancel="//a[@title='Cancel']",
    )
)


fields = Region(
    locators=dict(
        reason=Input("reason"),
        request_list={
            version.LOWEST: SplitTable(
                ('//*[@id="list_grid"]//table[contains(@class, "hdr")]/tbody', 1),
                ('//*[@id="list_grid"]//table[contains(@class, "obj")]/tbody', 1)),
            "5.5.0.8": Table('//*[@id="list_grid"]/table'),
        }
    )
)


def reload():
    toolbar.select('Reload')


def approve(reason, cancel=False):
    """Approve currently opened request

    Args:
        reason: Reason for approving the request.
        cancel: Whether to cancel the approval.
Beispiel #19
0
from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import fill, Form, Select, Table, toolbar, form_buttons, flash

tag_form = Form(
    fields=[
        ('category', Select('//select[@id="tag_cat"]')),
        ('tag', Select('//select[@id="tag_add"]'))
    ])

tag_table = Table("//div[@id='assignments_div']//table[@class='style3']")


def add_tag(tag):
    toolbar.select('Policy', 'Edit Tags')
    if tag.category.single_value:
        display_name = "{} *".format(tag.category.display_name)
    else:
        display_name = tag.category.display_name
    fill(tag_form, {'category': display_name,
                    'tag': tag.display_name})
    form_buttons.save()
    flash.assert_success_message('Tag edits were successfully saved')


def remove_tag(tag):
    toolbar.select('Policy', 'Edit Tags')
    display_name = tag.category.display_name
    row = tag_table.find_row_by_cells({'category': display_name,
                                       'assigned_value': tag.display_name},
                                      partial_check=True)
    sel.click(row[0])
Beispiel #20
0
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
import utils.error as error
import cfme.fixtures.pytest_selenium as sel
from cfme.configure.configuration import HostAnalysisProfile, VMAnalysisProfile
from cfme.web_ui import Table, flash, toolbar as tb
from utils.blockers import BZ
from utils.update import update

records_table = Table("//div[@id='records_div']/table")


def test_vm_analysis_profile_crud():
    """CRUD for VM analysis profiles."""
    p = VMAnalysisProfile(fauxfactory.gen_alphanumeric(),
                          fauxfactory.gen_alphanumeric(),
                          files=["asdf", "dfg"])
    p.create()
    with update(p):
        p.files = ["qwer"]
    with update(p):
        p.categories = ["check_system"]
    p.delete()


def test_host_analysis_profile_crud():
    """CRUD for Host analysis profiles."""
    p = HostAnalysisProfile(fauxfactory.gen_alphanumeric(),
                            fauxfactory.gen_alphanumeric(),
                            files=["asdf", "dfg"])
Beispiel #21
0
from cfme.web_ui import fill, InfoBlock, Region, Form, ScriptBox, Select, Table, form_buttons, Input
from cfme.web_ui import paginator as pg
from selenium.common.exceptions import NoSuchElementException
import utils.conf as conf
from utils.datafile import load_data_file
from utils.log import logger
from utils.path import project_path
from utils.update import Updateable
from utils.wait import wait_for
from utils.pretty import Pretty
from utils.db import cfmedb
from utils.varmeth import variable

cfg_btn = partial(tb.select, 'Configuration')

pxe_server_table_exist = Table('//div[@id="records_div"]/table/tbody/tr/td')
pxe_details_page = Region(locators=dict(
    last_refreshed=InfoBlock("Basic Information", "Last Refreshed On"),
    pxe_image_type=InfoBlock("Basic Information", "Type")))

pxe_properties_form = Form(fields=[
    ('name_text', Input('name')),
    ('log_protocol', Select("//select[@id='log_protocol']")),
    ('uri_text', Input('uri')),
    ('userid_text', Input('log_userid')),
    ('password_text', Input('log_password')),
    ('verify_text', Input('log_verify')),
    ('validate_btn', "//a[@id='val']"),
    ('access_url_text', Input('access_url')),
    ('pxe_dir_text', Input('pxe_directory')),
    ('windows_dir_text', Input('windows_images_directory')),
Beispiel #22
0
from cfme.web_ui.menu import extend_nav, nav
from utils.log import logger
from utils.update import Updateable
from utils import version
from utils.pretty import Pretty

from configuration import server_region_string

tb_select = partial(tb.select, "Configuration")
pol_btn = partial(tb.select, "Policy")

edit_tags_form = Form(fields=[(
    "select_tag",
    Select("select#tag_cat")), ("select_value", Select("select#tag_add"))])

tag_table = Table("//div[@id='assignments_div']//table")

group_order_selector = UpDownSelect("select#seq_fields",
                                    "//img[@alt='Move selected fields up']",
                                    "//img[@alt='Move selected fields down']")

nav.add_branch(
    'configuration', {
        'cfg_accesscontrol_users': [
            lambda d: accordion.tree("Access Control", server_region_string(),
                                     "Users"), {
                                         'cfg_accesscontrol_user_add':
                                         lambda d: tb_select("Add a new User")
                                     }
        ],
        'cfg_accesscontrol_user_ed': [
def cfm_mgr_table():
    return Table("//div[@id='main_div']//div[@id='list_grid']/table")
def test_outputs_link_url(stack):
    navigate_to(stack, 'RelationshipOutputs')
    # Outputs is a table with clickable rows
    table = Table('//div[@id="list_grid"]//table[contains(@class, "table-selectable")]')
    table.click_row_by_cells({'Key': 'WebsiteURL'}, 'Key')
    assert sel.is_displayed_text("WebsiteURL")
Beispiel #25
0
from functools import partial
import cfme.fixtures.pytest_selenium as sel
import cfme.web_ui.tabstrip as tabs
import cfme.web_ui.toolbar as tb
from cfme.web_ui import Form, Region, Select, fill, form_buttons, flash, Table, Quadicon, CheckboxTree, Input
from cfme.web_ui.menu import nav
from utils import version
from utils.pretty import Pretty
from utils.update import Updateable


details_page = Region(infoblock_type="detail")

cfg_btn = partial(tb.select, "Configuration")
timeprofile_table = Table("//div[@id='main_div']//table")


nav.add_branch(
    "my_settings",
    {
        "my_settings_time_profiles": [
            lambda _: tabs.select_tab("Time Profiles"),
            {
                "timeprofile_new": lambda _: cfg_btn("Add a new Time Profile"),
                "timeprofile_edit": lambda ctx: timeprofile_table.click_cell(
                    "description", ctx.timeprofile.description
                ),
            },
        ],
        "my_settings_visual": [lambda _: tabs.select_tab("Visual"), {}],
Beispiel #26
0
template_add_button = version.pick({
    'default': form_buttons.add,
    '5.3': form_buttons.save
})

template_properties_form = Form(
    fields=[
        ('name_text', "//input[@id='name']"),
        ('description_text', "//input[@id='description']"),
        ('image_type', Select('//select[@id="img_typ"]')),
        ('script_type', Select('//select[@id="typ"]')),
        ('script_data', ScriptBox("miqEditor"))
    ])


image_table = Table('//div[@id="records_div"]//table')

image_properties_form = Form(
    fields=[
        ('name_text', "//input[@id='name']"),
        ('provision_type', Select('//select[@id="provision_type"]'))
    ])

iso_details_page = Region(infoblock_type='form')  # infoblock shoudl be type 'detail' #gofigure

iso_properties_form = Form(
    fields=[
        ('provider', Select('//select[@id="ems_id"]')),
    ])

iso_image_type_form = Form(
Beispiel #27
0
from utils.pretty import Pretty
from functools import partial
from cfme.web_ui import toolbar as tb
from cfme import web_ui as ui
from xml.sax.saxutils import quoteattr
from cfme.exceptions import CFMEException
from utils.wait import wait_for
from utils import version

details_page = Region(infoblock_type='detail')
cfg_btn = partial(tb.select, "Configuration")
pol_btn = partial(tb.select, 'Policy')
lifecycle_btn = partial(tb.select, 'Lifecycle')
output_table = version.pick({
    '5.5':
    Table('//div[@id="list_grid"]/table'),
    '5.4':
    SplitTable(
        ('//*[@id="list_grid"]//table[contains(@class, "hdr")]/tbody', 1),
        ('//*[@id="list_grid"]//table[contains(@class, "obj")]/tbody', 1))
})

edit_tags_form = Form(fields=[(
    "select_tag",
    ui.Select("select#tag_cat")), ("select_value",
                                   ui.Select("select#tag_add"))])

nav.add_branch('clouds_stacks', {
    'clouds_stack':
    lambda ctx: sel.click(Quadicon(ctx['stack'].name, 'stack'))
})
Beispiel #28
0
    ])


template_details_page = Region(infoblock_type='form')  # infoblock shoudl be type 'detail' #gofigure

template_properties_form = Form(
    fields=[
        ('name_text', Input('name')),
        ('description_text', Input('description')),
        ('image_type', Select('//select[@id="img_typ"]')),
        ('script_type', Select('//select[@id="typ"]')),
        ('script_data', ScriptBox(ta_locator="//textarea[@id='script_data']"))
    ])


image_table = Table('//div[@id="records_div"]//table')

image_properties_form = Form(
    fields=[
        ('name_text', Input('name')),
        ('provision_type', Select('//select[@id="provision_type"]'))
    ])

iso_details_page = Region(infoblock_type='form')  # infoblock shoudl be type 'detail' #gofigure

iso_properties_form = Form(
    fields=[
        ('provider', Select('//select[@id="ems_id"]')),
    ])

iso_image_type_form = Form(
import utils.error as error
import cfme.fixtures.pytest_selenium as sel
from cfme import Credential
from cfme import login
from cfme.configure.access_control import set_group_order
from cfme.exceptions import OptionNotAvailable
from cfme.infrastructure import virtual_machines
from cfme.web_ui import flash, Table, InfoBlock, toolbar as tb
from cfme.web_ui.menu import nav
from cfme.configure import tasks
from utils.log import logger
from utils.providers import setup_a_provider
from utils.update import update
from utils import version

records_table = Table("//div[@id='main_div']//table")
usergrp = ac.Group(description='EvmGroup-user')
group_table = Table("//div[@id='main_div']//table")


@pytest.fixture(scope="module")
def setup_first_provider():
    setup_a_provider(validate=True, check_existing=True)


# due to pytest.mark.meta(blockers=[1035399]), non admin users can't login
# with no providers added
pytestmark = [pytest.mark.usefixtures("setup_first_provider")]


def new_credential():
 class configured_systems(Tab):  # noqa
     TAB_NAME = 'Configured Systems'
     elements = Table(
         '//div[@id="main_div"]//div[@id="list_grid" or @id="gtl_div"]//table'
     )
Beispiel #31
0
# -*- coding: utf-8 -*-
import functools

from cfme.web_ui import menu
from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import toolbar as tb
from cfme.web_ui import AngularSelect, Form, Select, SplitTable, accordion,\
    fill, flash, form_buttons, Table, Tree, Input, Region
from utils.update import Updateable
from utils.pretty import Pretty
from utils import version

accordion_tree = functools.partial(accordion.tree, "Service Dialogs")
cfg_btn = functools.partial(tb.select, "Configuration")
plus_btn = functools.partial(tb.select, "Add")
entry_table = Table("//div[@id='field_values_div']/form/fieldset/table")
text_area_table = Table(
    "//div[@id='dialog_field_div']/fieldset/table[@class='style1']")
text_area_table = Table({
    version.LOWEST:
    "//div[@id='dialog_field_div']/fieldset/table"
    "[@class='style1']",
    '5.5':
    "//div[@id='dialog_field_div']/div[@class='form-horizontal']"
})
dynamic_tree = Tree({
    version.LOWEST:
    "//div[@class='dhxcont_global_content_area']"
    "[not(contains(@style, 'display: none'))]/div/div/div/div/div"
    "/fieldset/div/ul[@class='dynatree-container']",
    '5.4':
Beispiel #32
0
 def __init__(self, table_loc):
     self._table_loc = table_loc
     self.table = Table(table_loc)
cfg_btn = partial(toolbar.select, 'Configuration')
pol_btn = partial(toolbar.select, 'Policy')
lcl_btn = partial(toolbar.select, 'Lifecycle')
mon_btn = partial(toolbar.select, 'Monitoring')
pwr_btn = partial(toolbar.select, 'Power')

create_button = form_buttons.FormButton("Create")

manage_policies_tree = CheckboxTree("//div[@id='protect_treebox']/ul")

manage_policies_page = Region(locators={
    'save_button': form_buttons.save,
})

template_select_form = Form(fields=[('template_table',
                                     Table('//div[@id="pre_prov_div"]//table')
                                     ), ('cancel_button',
                                         form_buttons.cancel)])

snapshot_form = Form(
    fields=[('name', Input('name')), ('description', Input('description')),
            ('snapshot_memory',
             Input('snap_memory')), (
                 'create_button',
                 create_button), ('cancel_button', form_buttons.cancel)])

retirement_date_form = Form(
    fields=[('retirement_date_text', Calendar("miq_date_1")),
            ('retirement_warning_select',
             Select("//select[@id='retirement_warn']"))])
Beispiel #34
0
    ])

credential_form = Form(
    fields=[
        ('principal_text', Input('log_userid')),
        ('secret_pass', Input('log_password')),
        ('verify_secret_pass', Input('log_verify')),
        ('validate_btn', form_buttons.validate)
    ])


CfgMgrSplitTable = lambda: SplitTable(
    header_data=("//div[@id='list_grid']/div[@class='xhdr']/table/tbody", 1),
    body_data=("//div[@id='list_grid']/div[@class='objbox']/table/tbody", 1),)

CfgMgrTable = lambda: Table("//div[@id='main_div']//div[@id='list_grid']/table")


page = Region(locators={
    'list_table_config_profiles': {
        version.LOWEST: CfgMgrSplitTable(),
        "5.5": CfgMgrTable()},
    'list_table_config_systems': {
        version.LOWEST: CfgMgrSplitTable(),
        "5.5": CfgMgrTable()}})

add_manager_btn = form_buttons.FormButton('Add')
edit_manager_btn = form_buttons.FormButton('Save changes')
cfg_btn = partial(tb.select, 'Configuration')

nav.add_branch(
Beispiel #35
0

template_details_page = Region(infoblock_type="form")  # infoblock shoudl be type 'detail' #gofigure

template_properties_form = Form(
    fields=[
        ("name_text", Input("name")),
        ("description_text", Input("description")),
        ("image_type", Select('//select[@id="img_typ"]')),
        ("script_type", Select('//select[@id="typ"]')),
        ("script_data", ScriptBox("miqEditor", ta_locator="//textarea[@id='script_data']")),
    ]
)


image_table = Table('//div[@id="records_div"]//table')

image_properties_form = Form(
    fields=[("name_text", Input("name")), ("provision_type", Select('//select[@id="provision_type"]'))]
)

iso_details_page = Region(infoblock_type="form")  # infoblock shoudl be type 'detail' #gofigure

iso_properties_form = Form(fields=[("provider", Select('//select[@id="ems_id"]'))])

iso_image_type_form = Form(fields=[("image_type", Select("//select[@id='image_typ']"))])


pxe_tree = partial(acc.tree, "PXE Servers", "All PXE Servers")
template_tree = partial(acc.tree, "Customization Templates", "All Customization Templates - System Image Types")
image_tree = partial(acc.tree, "System Image Types", "All System Image Types")
Beispiel #36
0
from cfme.web_ui import Form, Radio, Select, Table, accordion, fill,\
    flash, form_buttons, menu, tabstrip, DHTMLSelect, Input, Tree, AngularSelect
from cfme.web_ui import toolbar as tb
from utils.update import Updateable
from utils.pretty import Pretty
from utils.version import current_version
from utils import version

cfg_btn = partial(tb.select, "Configuration")
accordion_tree = partial(accordion.tree, "Catalog Items")
policy_btn = partial(tb.select, "Policy")
dynamic_tree = Tree(
    "//div[@id='basic_info_div']//ul[@class='dynatree-container']")

template_select_form = Form(
    fields=[('template_table', Table('//div[@id="prov_vm_div"]/table')
             ), ('add_button',
                 form_buttons.add), ('cancel_button', form_buttons.cancel)])

# Forms
basic_info_form = Form(
    fields=[('name_text',
             Input("name")), (
                 'description_text',
                 Input("description")), ('display_checkbox', Input("display")),
            ('select_catalog', Select("//select[@id='catalog_id']")
             ), ('select_dialog', Select("//select[@id='dialog_id']")),
            ('select_orch_template', Select("//select[@id='template_id']")
             ), ('select_provider', Select("//select[@id='manager_id']")),
            ('select_config_template', Select("//select[@id='template_id']")
             ), ('field_entry_point',
from utils.appliance import Navigatable
from utils.appliance.implementations.ui import navigator, CFMENavigateStep, navigate_to

REQUEST_FINISHED_STATES = {'Migrated', 'Finished'}

buttons = Region(locators=dict(
    approve="//*[@title='Approve this Request']",
    deny="//*[@title='Deny this Request']",
    copy="//*[@title='Copy original Request']",
    edit="//*[@title='Edit the original Request']",
    delete="//*[@title='Delete this Request']",
    submit="//span[@id='buttons_on']/a[@title='Submit']",
    cancel="//a[@title='Cancel']",
))

request_table = Table('//*[@id="list_grid"]/table')
fields = Region(
    locators=dict(reason=Input("reason"), request_list=request_table))

match_page = partial(match_location,
                     controller='miq_request',
                     title='Requests')


# TODO Refactor these module methods and their callers for a proper request class
class Request(Navigatable):
    def __init__(self, appliance=None):
        Navigatable.__init__(self, appliance=appliance)


@navigator.register(Request, 'All')
Beispiel #38
0
 def data(self):
     return Table(lambda: sel.element("./div/table[thead]", root=self.root))
Beispiel #39
0
# -*- coding: utf-8 -*-
from functools import partial
from collections import OrderedDict

from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import Form, Radio, Select, Table, accordion, fill, flash, menu, tabstrip
from cfme.web_ui import toolbar as tb
from utils.update import Updateable

cfg_btn = partial(tb.select, "Configuration")
accordion_tree = partial(accordion.tree, "Catalog Items")

template_select_form = Form(
    fields=[('template_table',
             Table('//div[@id="prov_vm_div"]//table[@class="style3"]')
             ), ('add_button', "//img[@title='Add']"
                 ), ('cancel_button', '//*[@id="form_buttons"]/li[2]/img')])

# Forms
basic_info_form = Form(fields=[(
    'name_text',
    "//input[@id='name']"), (
        'description_text', "//input[@id='description']"
    ), ('display_checkbox', "//input[@id='display']"
        ), ('select_catalog', Select("//select[@id='catalog_id']")
            ), ('select_dialog', Select("//select[@id='dialog_id']")
                ), ('edit_button', "//img[@alt='Save Changes']")])

detail_form = Form(fields=[('long_desc',
                            "//textarea[@id='long_description']")])
Beispiel #40
0
from cfme.cloud import provisioning as prov
from collections import OrderedDict
from cfme.web_ui import accordion, tabstrip, Form, Table, Select, fill, flash, form_buttons
from utils.update import Updateable
from utils import version

tb_select = functools.partial(tb.select, "Configuration")
catalog_item_tree = web_ui.Tree(
    version.pick({
        'default': '//div[@id="sandt_tree_box"]//table',
        '9.9.9.9': '//div[@id="sandt_treebox"]//ul'
    }))

template_select_form = Form(
    fields=[('template_table',
             Table('//div[@id="prov_vm_div"]//table[@class="style3"]')
             ), ('add_button',
                 form_buttons.add), ('cancel_button', form_buttons.cancel)])

# Forms
basic_info_form = Form(fields=[(
    'name_text',
    "//input[@id='name']"), (
        'description_text', "//input[@id='description']"
    ), ('display_checkbox', "//input[@id='display']"
        ), ('select_catalog', Select("//select[@id='catalog_id']")
            ), ('select_dialog', Select("//select[@id='dialog_id']")
                ), ('edit_button', "//img[@alt='Save Changes']")])

detail_form = Form(fields=[('long_desc',
                            "//textarea[@id='long_description']")])
Beispiel #41
0
# -*- coding: utf-8 -*-
import pytest
import requests

from cfme.base.ui import Server
from cfme.web_ui import Table
from cfme.utils.appliance.implementations.ui import navigate_to

rss_table = Table("//div[@id='tab_div']/table", header_offset=1)


@pytest.mark.tier(3)
def test_verify_rss_links():
    navigate_to(Server, 'RSS')
    for row in rss_table.rows():
        url = pytest.sel.text(row["feed_url"]).strip()
        req = requests.get(url, verify=False)
        assert 200 <= req.status_code < 400, "The url {} seems malformed".format(
            repr(url))