Пример #1
0
def _get_tasks(location, **filter_kwargs):
    """ Generic function to return contents of the tasks table

    Args:
        location: Location for :py:module:`ui_navigate` where to get the data.
        **filter_kwargs: See :py:meth:`_filter`
    Returns: List of dicts.
    """
    sel.force_navigate(location)
    if any([filter_kwargs[key] is not None for key in filter_kwargs.keys()]):
        _filter(**filter_kwargs)
    tasks = []

    if sel.is_displayed(tasks_table):
        have_next_page = True
        while have_next_page:
            for row in tasks_table.rows():
                tasks.append(
                    dict(updated=parsetime.from_american_with_utc(
                        row.updated.text.encode('utf-8').strip()),
                         started=parsetime.from_american_with_utc(
                             row.started.text.encode('utf-8').strip()),
                         state=row.state.text.encode('utf-8').strip(),
                         message=row.message.text.encode('utf-8').strip(),
                         task_name=row.task_name.text.encode('utf-8').strip(),
                         user=row.user.text.encode('utf-8').strip()))
            if int(paginator.rec_end()) < int(paginator.rec_total()):
                sel.click(paginator.next())
            else:
                have_next_page = False
    return tasks
def test_report_page_per_item(setup_a_provider, set_report):
    """ Tests report items per page

    Metadata:
        test_flag: visuals
    """
    path = ["Configuration Management", "Virtual Machines", "VMs Snapshot Summary"]
    limit = visual.report_view_limit
    report = CannedSavedReport.new(path)
    report.navigate()
    if int(paginator.rec_total()) >= int(limit):
        assert int(paginator.rec_end()) == int(limit), "Reportview Failed!"
def test_list_page_per_item(request, setup_a_provider, page, set_list):
    """ Tests list items per page

    Metadata:
        test_flag: visuals
    """
    request.addfinalizer(lambda: go_to_grid(page))
    limit = visual.list_view_limit
    sel.force_navigate(page)
    tb.select('List View')
    if int(paginator.rec_total()) >= int(limit):
        assert int(paginator.rec_end()) == int(limit), "Listview Failed for page {}!".format(page)
def test_infra_list_page_per_item(request, page, set_list):
    """ Tests list items per page

    Metadata:
        test_flag: visuals
    """
    request.addfinalizer(lambda: go_to_grid(page))
    limit = visual.list_view_limit
    navigate_to(page, 'All')
    tb.select('List View')
    from cfme.web_ui import paginator
    if int(paginator.rec_total()) >= int(limit):
        assert int(paginator.rec_end()) == int(limit), "Listview Failed for page {}!".format(page)
Пример #5
0
def test_infra_tile_page_per_item(request, page, set_tile):
    """ Tests tile items per page

    Metadata:
        test_flag: visuals
    """
    request.addfinalizer(lambda: go_to_grid(page))
    limit = visual.tile_view_limit
    navigate_to(page, 'All')
    tb.select('Tile View')
    if int(paginator.rec_total()) >= int(limit):
        assert int(paginator.rec_end()) == int(
            limit), "Tileview Failed for page {}!".format(page)
def test_cloud_grid_page_per_item(request, page, set_grid):
    """ Tests grid items per page

    Metadata:
        test_flag: visuals
    """
    request.addfinalizer(lambda: go_to_grid(page))
    limit = visual.grid_view_limit
    navigate_to(page, 'All')
    tb.select('Grid View')
    if paginator.rec_total() is not None:
        if int(paginator.rec_total()) >= int(limit):
            assert int(paginator.rec_end()) == int(limit), \
                "Gridview Failed for page {}!".format(page)
def test_paginator(some_dialogs, soft_assert, appliance):
    """ This test tests weird behaviour of the paginator in Service dialogs.

    Prerequisities:
        * There have to be couple of service dialogs, about 16 is recommended.

    Steps:
        * Go to service dialogs page
        * Set the paginator to 50 results per page, then to 5 results per page.
        * Assert there are 5 rows displayed in the table
        * Then cycle through the pages. Note all the dialogs you see, in the end the list of all
            dialogs must contain all idalogs you created before.
        * During the cycling, assert the numbers displayed in the paginator make sense
        * During the cycling, assert the paginator does not get stuck.
    """
    navigate_to(DialogCollection(appliance), 'All')
    from cfme.web_ui import paginator
    paginator.results_per_page(50)
    paginator.results_per_page(5)
    # Now we must have only 5
    soft_assert(
        len(list(dialogs_table.rows())) == 5,
        "Changing number of rows failed!")
    # try to browse
    current_rec_offset = None
    dialogs_found = set()
    for page in paginator.pages():
        if paginator.rec_offset() == current_rec_offset:
            soft_assert(
                False, "Paginator is locked, it does not advance to next page")
            break
        if current_rec_offset is None:
            current_rec_offset = paginator.rec_offset()
        for text in get_relevant_rows(dialogs_table):
            dialogs_found.add(text)

        current_total = paginator.rec_total()
        current_rec_offset = paginator.rec_offset()
        current_rec_end = paginator.rec_end()

        assert current_rec_offset <= current_rec_end <= current_total, \
            "Incorrect paginator value, expected {0} <= {1} <= {2}".format(
                current_rec_offset, current_rec_end, current_total)

    assert {dlg.label for dlg in some_dialogs} <= dialogs_found, \
        "Could not find all dialogs by clicking the paginator!"
def test_cloud_tile_page_per_item(request, page, set_tile, appliance):
    """ Tests tile items per page

    Metadata:
        test_flag: visuals
    """
    if issubclass(page, BaseCollection):
        page = page(appliance)
    request.addfinalizer(lambda: go_to_grid(page))
    limit = visual.tile_view_limit
    navigate_to(page, 'All')
    tb.select('Tile View')
    from cfme.web_ui import paginator
    if paginator.rec_total() is not None:
        if int(paginator.rec_total()) >= int(limit):
            assert int(paginator.rec_end()) == int(limit), \
                "Tileview Failed for page {}!".format(page)