Exemplo n.º 1
0
def test_reorder_unsaved_elements(appliance, request):
    # Automate BZ - https://bugzilla.redhat.com/show_bug.cgi?id=1238721
    element_1_data = {
        'ele_label': "ele_" + fauxfactory.gen_alphanumeric(),
        'ele_name': fauxfactory.gen_alphanumeric(),
        'ele_desc': fauxfactory.gen_alphanumeric(),
        'choose_type': "Text Box",
        'default_text_box': "Default text"
    }
    element_2_data = {
        'ele_label': "ele_" + fauxfactory.gen_alphanumeric(),
        'ele_name': fauxfactory.gen_alphanumeric(),
        'ele_desc': fauxfactory.gen_alphanumeric(),
        'choose_type': "Check Box",
        'default_value': True,
        'field_required': True
    }
    service_dialog = DialogCollection(appliance)
    sd = service_dialog.create(label='label_' + fauxfactory.gen_alphanumeric(),
        description="my dialog", submit=True, cancel=True,)
    tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(),
        tab_desc="my tab desc")
    box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(),
        box_desc="my box desc")
    element = box.elements.create(element_data=[element_1_data])
    request.addfinalizer(sd.delete_if_exists)
    element.reorder_elements(True, element_2_data, element_1_data)
def test_delete_dialog_before_parent_item(appliance, catalog_item):
    service_dialog = DialogCollection(appliance)
    dialog = service_dialog.instantiate(label=catalog_item.dialog.label)
    error_message = ('Dialog \"{}\": Error during delete: Dialog cannot be'
        ' deleted because it is connected to other components.').format(catalog_item.dialog.label)
    with error.expected(error_message):
        dialog.delete()
def test_delete_dialog_before_parent_item(appliance, catalog_item):
    service_dialog = DialogCollection(appliance)
    dialog = service_dialog.instantiate(label=catalog_item.dialog.label)
    error_message = ('Dialog \"{}\": Error during delete: Dialog cannot be'
        ' deleted because it is connected to other components.').format(catalog_item.dialog.label)
    with error.expected(error_message):
        dialog.delete()
Exemplo n.º 4
0
def test_reorder_unsaved_elements(appliance, request):
    # Automate BZ - https://bugzilla.redhat.com/show_bug.cgi?id=1238721
    element_1_data = {
        'ele_label': "ele_" + fauxfactory.gen_alphanumeric(),
        'ele_name': fauxfactory.gen_alphanumeric(),
        'ele_desc': fauxfactory.gen_alphanumeric(),
        'choose_type': "Text Box",
        'default_text_box': "Default text"
    }
    element_2_data = {
        'ele_label': "ele_" + fauxfactory.gen_alphanumeric(),
        'ele_name': fauxfactory.gen_alphanumeric(),
        'ele_desc': fauxfactory.gen_alphanumeric(),
        'choose_type': "Check Box",
        'default_value': True,
        'field_required': True
    }
    service_dialog = DialogCollection(appliance)
    sd = service_dialog.create(
        label='label_' + fauxfactory.gen_alphanumeric(),
        description="my dialog",
        submit=True,
        cancel=True,
    )
    tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(),
                         tab_desc="my tab desc")
    box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(),
                           box_desc="my box desc")
    element = box.elements.create(element_data=[element_1_data])
    request.addfinalizer(sd.delete_if_exists)
    element.reorder_elements(True, element_2_data, element_1_data)
Exemplo n.º 5
0
def create_dialog(appliance, element_data, label=None):
    service_dialog = DialogCollection(appliance)
    if label is None:
        label = 'label_' + fauxfactory.gen_alphanumeric()
    sd = service_dialog.create(label=label,
        description="my dialog", submit=True, cancel=True,)
    tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(),
        tab_desc="my tab desc")
    box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(),
        box_desc="my box desc")
    box.elements.create(element_data=[element_data])
    return sd
def create_dialog(appliance, element_data, label=None):
    service_dialog = DialogCollection(appliance)
    if label is None:
        label = 'label_' + fauxfactory.gen_alphanumeric()
    sd = service_dialog.create(label=label,
        description="my dialog", submit=True, cancel=True,)
    tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(),
        tab_desc="my tab desc")
    box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(),
        box_desc="my box desc")
    box.elements.create(element_data=[element_data])
    return sd
def dialog(appliance, provider, template):
    template, dialog_name = template
    service_name = fauxfactory.gen_alphanumeric()
    element_data = dict(ele_label="ele_" + fauxfactory.gen_alphanumeric(),
                        ele_name="service_name",
                        ele_desc="my ele desc",
                        choose_type="Text Box",
                        default_text_box=service_name)
    dialog = DialogCollection(appliance)
    sd = dialog.instantiate(label=dialog_name)
    tab = sd.tabs.instantiate(tab_label="Basic Information")
    box = tab.boxes.instantiate(box_label="Options")
    element = box.elements.instantiate(element_data=element_data)
    element.add_another_element(element_data)
    yield template, sd, service_name
Exemplo n.º 8
0
def dialog(appliance, provider, template):
    template, dialog_name = template
    service_name = fauxfactory.gen_alphanumeric()
    element_data = dict(
        ele_label="ele_" + fauxfactory.gen_alphanumeric(),
        ele_name="service_name",
        ele_desc="my ele desc",
        choose_type="Text Box",
        default_text_box=service_name
    )
    dialog = DialogCollection(appliance)
    sd = dialog.instantiate(label=dialog_name)
    tab = sd.tabs.instantiate(tab_label="Basic Information")
    box = tab.boxes.instantiate(box_label="Options")
    element = box.elements.instantiate(element_data=element_data)
    element.add_another_element(element_data)
    yield template, sd, service_name
def some_dialogs(appliance, request):
    to_delete = []
    request.addfinalizer(lambda: map(lambda obj: obj.delete(), to_delete))
    for i in range(6):
        random_str = fauxfactory.gen_alphanumeric(16)
        element_data = dict(ele_label='ele_label_{}'.format(random_str),
                            ele_name='ele_name_{}'.format(random_str),
                            choose_type='Check Box')
        service_dialogs = DialogCollection(appliance)
        sd = service_dialogs.create(label='test_paginator_{}'.format(random_str),
                description="my dialog", submit=True, cancel=True,)
        tab = sd.tabs.create(tab_label='tab_{}'.format(random_str),
                tab_desc="my tab desc")
        box = tab.boxes.create(box_label='box_{}'.format(random_str),
                box_desc="my box desc")
        box.elements.create(element_data=[element_data])
        to_delete.append(sd)
    return to_delete
def dialog(appliance, copy_instance, create_method):
    service_dialogs = DialogCollection(appliance)
    dialog = "dialog_" + fauxfactory.gen_alphanumeric()
    element_data = {
        'ele_label': "ele_" + fauxfactory.gen_alphanumeric(),
        'ele_name': fauxfactory.gen_alphanumeric(),
        'ele_desc': fauxfactory.gen_alphanumeric(),
        'choose_type': "Drop Down List",
        'dynamic_chkbox': True
    }
    sd = service_dialogs.create(label=dialog,
        description="my dialog", submit=True, cancel=True,)
    tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(),
        tab_desc="my tab desc")
    box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(),
        box_desc="my box desc")
    box.elements.create(element_data=[element_data])
    yield sd
Exemplo n.º 11
0
def dialog():
    service_dialogs = DialogCollection()
    dialog = "dialog_{}".format(fauxfactory.gen_alphanumeric())
    element_data = dict(
        ele_label="ele_{}".format(fauxfactory.gen_alphanumeric()),
        ele_name=fauxfactory.gen_alphanumeric(),
        ele_desc="my ele desc",
        choose_type="Text Box",
        default_text_box="default value"
    )
    service_dialog = service_dialogs.create(label=dialog,
        description="my dialog", submit=True, cancel=True,)
    tab = service_dialog.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(),
        tab_desc="my tab desc")
    box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(),
        box_desc="my box desc")
    box.elements.create(element_data=[element_data])
    return service_dialog
def tagcontrol_dialog(appliance):
    service_dialogs = DialogCollection(appliance)
    dialog = "dialog_" + fauxfactory.gen_alphanumeric()
    element_data = {
        'ele_label': "Service Level",
        'ele_name': "service_level",
        'ele_desc': "service_level_desc",
        'choose_type': "Tag Control",
        'field_category': "Service Level",
        'field_required': True
    }
    sd = service_dialogs.create(label=dialog,
        description="my dialog", submit=True, cancel=True,)
    tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(),
        tab_desc="my tab desc")
    box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(),
        box_desc="my box desc")
    box.elements.create(element_data=[element_data])
    yield sd
Exemplo n.º 13
0
def dialog(appliance):
    service_dialogs = DialogCollection(appliance)
    dialog = fauxfactory.gen_alphanumeric()
    element_data = dict(
        ele_label="ele_" + fauxfactory.gen_alphanumeric(),
        ele_name="service_name",
        ele_desc="my ele desc",
        choose_type="Text Box",
        default_text_box=dialog
    )

    sd = service_dialogs.create(label=dialog,
        description="my dialog", submit=True, cancel=True,)
    tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(),
        tab_desc="my tab desc")
    box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(),
        box_desc="my box desc")
    box.elements.create(element_data=[element_data])
    yield sd
def tagcontrol_dialog(appliance):
    service_dialogs = DialogCollection(appliance)
    dialog = "dialog_" + fauxfactory.gen_alphanumeric()
    element_data = {
        'ele_label': "Service Level",
        'ele_name': "service_level",
        'ele_desc': "service_level_desc",
        'choose_type': "Tag Control",
        'field_category': "Service Level",
        'field_required': True
    }
    sd = service_dialogs.create(label=dialog,
        description="my dialog", submit=True, cancel=True,)
    tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(),
        tab_desc="my tab desc")
    box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(),
        box_desc="my box desc")
    box.elements.create(element_data=[element_data])
    yield sd
Exemplo n.º 15
0
def dialog(appliance):
    service_dialogs = DialogCollection(appliance)
    dialog = fauxfactory.gen_alphanumeric()
    element_data = dict(ele_label="ele_" + fauxfactory.gen_alphanumeric(),
                        ele_name="service_name",
                        ele_desc="my ele desc",
                        choose_type="Text Box",
                        default_text_box=dialog)

    sd = service_dialogs.create(
        label=dialog,
        description="my dialog",
        submit=True,
        cancel=True,
    )
    tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(),
                         tab_desc="my tab desc")
    box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(),
                           box_desc="my box desc")
    box.elements.create(element_data=[element_data])
    yield sd
def dialog(appliance, copy_instance, create_method):
    service_dialogs = DialogCollection(appliance)
    dialog = "dialog_" + fauxfactory.gen_alphanumeric()
    element_data = {
        'ele_label': "ele_" + fauxfactory.gen_alphanumeric(),
        'ele_name': fauxfactory.gen_alphanumeric(),
        'ele_desc': fauxfactory.gen_alphanumeric(),
        'choose_type': "Drop Down List",
        'dynamic_chkbox': True
    }
    sd = service_dialogs.create(
        label=dialog,
        description="my dialog",
        submit=True,
        cancel=True,
    )
    tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(),
                         tab_desc="my tab desc")
    box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(),
                           box_desc="my box desc")
    box.elements.create(element_data=[element_data])
    yield sd
def some_dialogs(appliance, request):
    to_delete = []
    request.addfinalizer(lambda: map(lambda obj: obj.delete(), to_delete))
    for i in range(6):
        random_str = fauxfactory.gen_alphanumeric(16)
        element_data = dict(ele_label='ele_label_{}'.format(random_str),
                            ele_name='ele_name_{}'.format(random_str),
                            choose_type='Check Box')
        service_dialogs = DialogCollection(appliance)
        sd = service_dialogs.create(
            label='test_paginator_{}'.format(random_str),
            description="my dialog",
            submit=True,
            cancel=True,
        )
        tab = sd.tabs.create(tab_label='tab_{}'.format(random_str),
                             tab_desc="my tab desc")
        box = tab.boxes.create(box_label='box_{}'.format(random_str),
                               box_desc="my box desc")
        box.elements.create(element_data=[element_data])
        to_delete.append(sd)
    return to_delete
Exemplo n.º 18
0
def dialog():
    service_dialogs = DialogCollection()
    dialog = "dialog_{}".format(fauxfactory.gen_alphanumeric())
    element_data = dict(ele_label="ele_{}".format(
        fauxfactory.gen_alphanumeric()),
                        ele_name=fauxfactory.gen_alphanumeric(),
                        ele_desc="my ele desc",
                        choose_type="Text Box",
                        default_text_box="default value")
    service_dialog = service_dialogs.create(
        label=dialog,
        description="my dialog",
        submit=True,
        cancel=True,
    )
    tab = service_dialog.tabs.create(tab_label='tab_' +
                                     fauxfactory.gen_alphanumeric(),
                                     tab_desc="my tab desc")
    box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(),
                           box_desc="my box desc")
    box.elements.create(element_data=[element_data])
    return service_dialog
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!"