本文整理匯總了Python中widgetastic_patternfly.Dropdown.item_select方法的典型用法代碼示例。如果您正苦於以下問題:Python Dropdown.item_select方法的具體用法?Python Dropdown.item_select怎麽用?Python Dropdown.item_select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類widgetastic_patternfly.Dropdown
的用法示例。
在下文中一共展示了Dropdown.item_select方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_open_url
# 需要導入模塊: from widgetastic_patternfly import Dropdown [as 別名]
# 或者: from widgetastic_patternfly.Dropdown import item_select [as 別名]
def test_open_url(request, setup_obj, button_group, method):
""" Test Open url functionality of custom button.
Polarion:
assignee: ndhandre
initialEstimate: 1/2h
caseimportance: high
caseposneg: positive
testtype: functional
startsin: 5.9
casecomponent: CustomButton
tags: custom_button
testSteps:
1. Appliance with Infra provider
2. Create ruby method for url functionality
3. Create custom button group with the Object type
4. Create a custom button with open_url option and respective method
5. Navigate to object Detail page
6. Execute custom button
7. Check new tab open or not with respective url
"""
group, obj_type = button_group
button = group.buttons.create(
text=fauxfactory.gen_alphanumeric(),
hover=fauxfactory.gen_alphanumeric(),
open_url=True,
display_for="Single entity",
system="Request",
request=method.name,
)
request.addfinalizer(button.delete_if_exists)
view = navigate_to(setup_obj, "Details")
custom_button_group = Dropdown(view, group.hover)
assert custom_button_group.has_item(button.text)
# TODO: Move windows handling functionality to browser
initial_count = len(view.browser.selenium.window_handles)
main_window = view.browser.selenium.current_window_handle
custom_button_group.item_select(button.text)
wait_for(
lambda: len(view.browser.selenium.window_handles) > initial_count,
timeout=120,
message="Check for window open",
)
open_url_window = set(view.browser.selenium.window_handles) - {main_window}
view.browser.selenium.switch_to_window(open_url_window.pop())
@request.addfinalizer
def _reset_window():
if view.browser.selenium.current_window_handle != main_window:
view.browser.selenium.close()
view.browser.selenium.switch_to_window(main_window)
assert "example.com" in view.browser.url
示例2: test_custom_button_quotes
# 需要導入模塊: from widgetastic_patternfly import Dropdown [as 別名]
# 或者: from widgetastic_patternfly.Dropdown import item_select [as 別名]
def test_custom_button_quotes(appliance, provider, setup_provider, dialog, request):
""" Test custom button and group allows quotes or not
Polarion:
assignee: ndhandre
initialEstimate: 1/6h
caseimportance: medium
caseposneg: positive
testtype: nonfunctional
startsin: 5.8
casecomponent: CustomButton
tags: custom_button
setup: Simple TextInput service dialog
testSteps:
1. Create custom button group with single quote in name like "Group's"
2. Create a custom button with quote in name like "button's"
3. Navigate to object Details page
4. Check for button group and button
5. Select/execute button from group dropdown for selected entities
6. Fill dialog and submit Check for the flash message related to button execution
Bugzilla:
1646905
"""
# ToDo: collect test for 5.9; If developer backport BZ-1646905
collection = appliance.collections.button_groups
group = collection.create(
text="Group's", hover="Group's Hover", type=getattr(collection, "PROVIDER")
)
request.addfinalizer(group.delete_if_exists)
button = group.buttons.create(
text="Button's",
hover="Button's Hover",
dialog=dialog,
system="Request",
request="InspectMe",
)
request.addfinalizer(button.delete_if_exists)
view = navigate_to(provider, "Details")
custom_button_group = Dropdown(view, group.hover)
assert custom_button_group.has_item(button.text)
custom_button_group.item_select(button.text)
dialog_view = view.browser.create_view(TextInputDialogView, wait='60s')
dialog_view.service_name.fill("Custom Button Execute")
dialog_view.submit.click()
view.flash.assert_message("Order Request was Submitted")
示例3: test_custom_button_events_cloud_obj
# 需要導入模塊: from widgetastic_patternfly import Dropdown [as 別名]
# 或者: from widgetastic_patternfly.Dropdown import item_select [as 別名]
def test_custom_button_events_cloud_obj(request, dialog, setup_objs, button_group, btn_dialog):
"""Test custom button events
Polarion:
assignee: ndhandre
caseimportance: medium
initialEstimate: 1/4h
caseposneg: positive
testtype: functional
startsin: 5.10
casecomponent: CustomButton
tags: custom_button
testSteps:
1. Create a Button Group
2. Create custom button [with dialog/ without dialog]
2. Execute button from respective location
3. Assert event count
Bugzilla:
1668023
1702490
1680525
"""
group, obj_type = button_group
dialog_ = dialog if btn_dialog else None
button = group.buttons.create(
text="btn_{}".format(fauxfactory.gen_alphanumeric(3)),
hover="btn_hover{}".format(fauxfactory.gen_alphanumeric(3)),
dialog=dialog_,
system="Request",
request="InspectMe",
)
request.addfinalizer(button.delete_if_exists)
for setup_obj in setup_objs:
initial_count = len(setup_obj.get_button_events())
view = navigate_to(setup_obj, "Details")
custom_button_group = Dropdown(view, group.hover)
custom_button_group.item_select(button.text)
if btn_dialog:
dialog_view = view.browser.create_view(TextInputDialogView, wait="10s")
dialog_view.submit.click()
view.browser.refresh()
current_count = len(setup_obj.get_button_events())
assert current_count == (initial_count + 1)
示例4: test_custom_button_automate
# 需要導入模塊: from widgetastic_patternfly import Dropdown [as 別名]
# 或者: from widgetastic_patternfly.Dropdown import item_select [as 別名]
def test_custom_button_automate(appliance, request, submit, setup_objs, button_group):
""" Test custom button for automate and requests count as per submit
Polarion:
assignee: ndhandre
initialEstimate: 1/4h
caseimportance: high
caseposneg: positive
testtype: functional
startsin: 5.9
casecomponent: CustomButton
tags: custom_button
testSteps:
1. Create custom button group with the Object type
2. Create a custom button with specific submit option and Single and list display
3. Navigate to object type pages (All and Details)
4. Check for button group and button
5. Select/execute button from group dropdown for selected entities
6. Check for the proper flash message related to button execution
7. Check automation log requests. Submitted as per selected submit option or not.
8. Submit all: single request for all entities execution
9 One by one: separate requests for all entities execution
Bugzilla:
1628224, 1642147
"""
group, obj_type = button_group
button = group.buttons.create(
text=fauxfactory.gen_alphanumeric(),
hover=fauxfactory.gen_alphanumeric(),
display_for="Single and list",
submit=submit,
system="Request",
request="InspectMe",
)
request.addfinalizer(button.delete_if_exists)
for setup_obj in setup_objs:
for destination in ["All", "Details"]:
obj = setup_obj.parent if destination == "All" else setup_obj
view = navigate_to(obj, destination)
custom_button_group = Dropdown(view, group.hover)
assert custom_button_group.has_item(button.text)
# Entity count depends on the destination for `All` available entities and
# `Details` means a single entity.
# To-Do: remove Manager check as BZ-1642147 fix
if destination == "All":
try:
paginator = view.paginator
except AttributeError:
paginator = view.entities.paginator
entity_count = min(paginator.items_amount, paginator.items_per_page)
# Work around for BZ-1642147
try:
if "Manager" in setup_obj.name:
entity_count = 1
except AttributeError:
pass
paginator.check_all()
else:
entity_count = 1
# Clear the automation log
assert appliance.ssh_client.run_command(
'echo -n "" > ' "/var/www/miq/vmdb/log/automation.log"
)
custom_button_group.item_select(button.text)
view.flash.assert_message('"{}" was executed'.format(button.text))
# Submit all: single request for all entity execution
# One by one: separate requests for all entity execution
expected_count = 1 if submit == "Submit all" else entity_count
try:
wait_for(
log_request_check,
[appliance, expected_count],
timeout=300,
message="Check for expected request count",
delay=10,
)
except TimedOutError:
assert False, "Expected {} requests not found in automation log".format(
str(expected_count)
)
示例5: test_custom_button_dialog
# 需要導入模塊: from widgetastic_patternfly import Dropdown [as 別名]
# 或者: from widgetastic_patternfly.Dropdown import item_select [as 別名]
def test_custom_button_dialog(appliance, dialog, request, setup_objs, button_group):
""" Test custom button with dialog and InspectMe method
Polarion:
assignee: ndhandre
initialEstimate: 1/4h
caseimportance: high
caseposneg: positive
testtype: functional
startsin: 5.9
casecomponent: CustomButton
tags: custom_button
testSteps:
1. Simple TextInput service dialog
2. Create custom button group with the Object type
3. Create a custom button with service dialog
4. Navigate to object Details page
5. Check for button group and button
6. Select/execute button from group dropdown for selected entities
7. Fill dialog and submit
8. Check for the proper flash message related to button execution
Bugzilla:
1635797, 1555331, 1574403, 1640592
"""
group, obj_type = button_group
# Note: No need to set display_for dialog only work with Single entity
button = group.buttons.create(
text=fauxfactory.gen_alphanumeric(),
hover=fauxfactory.gen_alphanumeric(),
dialog=dialog,
system="Request",
request="InspectMe",
)
request.addfinalizer(button.delete_if_exists)
for setup_obj in setup_objs:
view = navigate_to(setup_obj, "Details")
custom_button_group = Dropdown(view, group.hover)
assert custom_button_group.has_item(button.text)
custom_button_group.item_select(button.text)
dialog_view = view.browser.create_view(TextInputDialogView, wait="10s")
dialog_view.service_name.fill("Custom Button Execute")
# Clear the automation log
assert appliance.ssh_client.run_command(
'echo -n "" > /var/www/miq/vmdb/log/automation.log'
)
# Submit order request
dialog_view.submit.click()
view.flash.assert_message("Order Request was Submitted")
# Check for request in automation log
try:
wait_for(
log_request_check,
[appliance, 1],
timeout=300,
message="Check for expected request count",
delay=20,
)
except TimedOutError:
assert False, "Expected 1 requests not found in automation log"
示例6: test_custom_button_automate
# 需要導入模塊: from widgetastic_patternfly import Dropdown [as 別名]
# 或者: from widgetastic_patternfly.Dropdown import item_select [as 別名]
def test_custom_button_automate(request, appliance, context, submit, objects, button_group):
""" Test custom button for automate and requests count as per submit
Polarion:
assignee: ndhandre
initialEstimate: 1/4h
caseimportance: high
caseposneg: positive
testtype: functional
startsin: 5.9
casecomponent: CustomButton
tags: custom_button
testSteps:
1. Create custom button group with the Object type
2. Create a custom button with specific submit option and Single and list display
3. Navigate to object type pages (All and Details)
4. Check for button group and button
5. Select/execute button from group dropdown for selected entities
6. Check for the proper flash message related to button execution
7. Check automation log requests. Submitted as per selected submit option or not.
8. Submit all: single request for all entities execution
9. One by one: separate requests for all entities execution
Bugzilla:
1650066
"""
group, obj_type = button_group
with appliance.context.use(ViaUI):
button = group.buttons.create(
text=fauxfactory.gen_alphanumeric(),
hover=fauxfactory.gen_alphanumeric(),
display_for="Single and list",
submit=submit,
system="Request",
request="InspectMe",
)
request.addfinalizer(button.delete_if_exists)
with appliance.context.use(context):
navigate_to = ssui_nav if context is ViaSSUI else ui_nav
# BZ-1650066: no custom button on All page
destinations = (
["Details"]
if context == ViaSSUI and BZ(1650066, forced_streams=["5.9", "5.10"]).blocks
else ["All", "Details"]
)
for destination in destinations:
obj = objects[obj_type][destination][0]
dest_name = objects[obj_type][destination][1]
view = navigate_to(obj, dest_name)
custom_button_group = Dropdown(view, group.text)
assert custom_button_group.has_item(button.text)
# Entity count depends on the destination for `All` available entities and
# `Details` means a single entity.
if destination == "All":
try:
paginator = view.paginator
except AttributeError:
paginator = view.entities.paginator
entity_count = min(paginator.items_amount, paginator.items_per_page)
view.entities.paginator.check_all()
else:
entity_count = 1
# Clear the automation log
assert appliance.ssh_client.run_command(
'echo -n "" > /var/www/miq/vmdb/log/automation.log'
)
custom_button_group.item_select(button.text)
# SSUI not support flash messages
if context is ViaUI:
view.flash.assert_message('"{button}" was executed'.format(button=button.text))
# Submit all: single request for all entity execution
# One by one: separate requests for all entity execution
expected_count = 1 if submit == "Submit all" else entity_count
try:
wait_for(
log_request_check,
[appliance, expected_count],
timeout=600,
message="Check for expected request count",
delay=20,
)
except TimedOutError:
assert False, "Expected {count} requests not found in automation log".format(
count=str(expected_count)
)
示例7: test_custom_button_automate_infra_obj
# 需要導入模塊: from widgetastic_patternfly import Dropdown [as 別名]
# 或者: from widgetastic_patternfly.Dropdown import item_select [as 別名]
def test_custom_button_automate_infra_obj(appliance, request, submit, setup_obj, button_group):
""" Test custom button for automate and requests count as per submit
Polarion:
assignee: ndhandre
initialEstimate: 1/4h
caseimportance: high
caseposneg: positive
testtype: functional
startsin: 5.9
casecomponent: CustomButton
tags: custom_button
testSteps:
1. Create custom button group with the Object type
2. Create a custom button with specific submit option and Single and list display
3. Navigate to object type pages (All and Details)
4. Check for button group and button
5. Select/execute button from group dropdown for selected entities
6. Check for the proper flash message related to button execution
7. Check automation log requests. Submitted as per selected submit option or not.
8. Submit all: single request for all entities execution
9. One by one: separate requests for all entities execution
Bugzilla:
1628224
"""
group, obj_type = button_group
button = group.buttons.create(
text=fauxfactory.gen_alphanumeric(),
hover=fauxfactory.gen_alphanumeric(),
display_for="Single and list",
submit=submit,
system="Request",
request="InspectMe",
)
request.addfinalizer(button.delete_if_exists)
for destination in ["All", "Details"]:
obj = setup_obj.parent if destination == "All" else setup_obj
# Note: For VM, custom button not display on `All page` but only `VM page`.
if obj_type == "VM_INSTANCE" and destination == "All":
destination = "VMsOnly"
# Note: For VM Template, custom button not display on All page but only TemplatesOnly.
if obj_type == "TEMPLATE_IMAGE" and destination == "All":
destination = "TemplatesOnly"
view = navigate_to(obj, destination)
custom_button_group = Dropdown(view, group.hover)
assert custom_button_group.has_item(button.text)
# Entity count depends on the destination for `All` available entities and
# `Details` means a single entity.
if destination in ["All", "VMsOnly", "TemplatesOnly"]:
try:
paginator = view.paginator
except AttributeError:
paginator = view.entities.paginator
entity_count = min(paginator.items_amount, paginator.items_per_page)
paginator.check_all()
else:
entity_count = 1
# Clear the automation log
assert appliance.ssh_client.run_command(
'echo -n "" > /var/www/miq/vmdb/log/automation.log'
)
custom_button_group.item_select(button.text)
diff = "executed" if appliance.version < "5.10" else "launched"
view.flash.assert_message('"{btn}" was {diff}'.format(btn=button.text, diff=diff))
# Submit all: single request for all entity execution
# One by one: separate requests for all entity execution
expected_count = 1 if submit == "Submit all" else entity_count
try:
wait_for(
log_request_check,
[appliance, expected_count],
timeout=600,
message="Check for expected request count",
delay=20,
)
except TimedOutError:
assert False, "Expected {} requests not found in automation log".format(
str(expected_count)
)
示例8: test_custom_button_dialog_service_obj
# 需要導入模塊: from widgetastic_patternfly import Dropdown [as 別名]
# 或者: from widgetastic_patternfly.Dropdown import item_select [as 別名]
def test_custom_button_dialog_service_obj(
appliance, dialog, request, context, objects, button_group
):
""" Test custom button with dialog and InspectMe method
Polarion:
assignee: ndhandre
initialEstimate: 1/4h
caseimportance: medium
caseposneg: positive
testtype: functional
startsin: 5.9
casecomponent: CustomButton
tags: custom_button
testSteps:
1. Create custom button group with the Object type
2. Create a custom button with service dialog
3. Navigate to object Details page
4. Check for button group and button
5. Select/execute button from group dropdown for selected entities
6. Fill dialog and submit
7. Check for the proper flash message related to button execution
Bugzilla:
1574774
"""
group, obj_type = button_group
with appliance.context.use(ViaUI):
button = group.buttons.create(
text="btn_{}".format(fauxfactory.gen_alphanumeric(3)),
hover="btn_hover_{}".format(fauxfactory.gen_alphanumeric(3)),
dialog=dialog,
system="Request",
request="InspectMe",
)
request.addfinalizer(button.delete_if_exists)
with appliance.context.use(context):
navigate_to = ssui_nav if context is ViaSSUI else ui_nav
obj = objects[obj_type]["Details"][0]
dest_name = objects[obj_type]["Details"][1]
view = navigate_to(obj, dest_name)
custom_button_group = Dropdown(view, group.text)
assert custom_button_group.has_item(button.text)
# Clear the automation log
assert appliance.ssh_client.run_command(
'echo -n "" > /var/www/miq/vmdb/log/automation.log'
)
custom_button_group.item_select(button.text)
_dialog_view = TextInputDialogView if context is ViaUI else TextInputDialogSSUIView
dialog_view = view.browser.create_view(_dialog_view, wait="10s")
assert dialog_view.service_name.fill("Custom Button Execute")
dialog_view.submit.click()
# SSUI not support flash messages
if context is ViaUI:
view.flash.assert_message("Order Request was Submitted")
# check request in log
try:
wait_for(
log_request_check,
[appliance, 1],
timeout=600,
message="Check for expected request count",
delay=20,
)
except TimedOutError:
assert False, "Expected {count} requests not found in automation log".format(
count=str(1)
)