Skip to content
This repository was archived by the owner on Apr 7, 2022. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 25 additions & 43 deletions cfme/tests/services/test_dialog_regex_validation_in_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@

@pytest.fixture(scope="function")
def dialog_cat_item(appliance, catalog, request):
default_data = {"choose_type": "Text Box", "validation": "^([a-z0-9]+_*)*[a-z0-9]+$"}
data = getattr(request, "param", default_data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, this pattern is much better.


service_dialog = appliance.collections.service_dialogs
dialog = fauxfactory.gen_alphanumeric(12, start="dialog_")

element_data = {
'element_information': {
'ele_label': fauxfactory.gen_alphanumeric(15, start="ele_label_"),
'ele_name': fauxfactory.gen_alphanumeric(15, start="ele_name_"),
'ele_desc': fauxfactory.gen_alphanumeric(15, start="ele_desc_"),
'choose_type': "Text Box"
"element_information": {
"ele_label": fauxfactory.gen_alphanumeric(15, start="ele_label_"),
"ele_name": fauxfactory.gen_alphanumeric(15, start="ele_name_"),
"ele_desc": fauxfactory.gen_alphanumeric(15, start="ele_desc_"),
"choose_type": data.get("choose_type", default_data["choose_type"]),
},
"options": {
"validation_switch": True,
"validation": data.get("validation", default_data["validation"]),
},
'options': {
'validation_switch': True,
'validation': request.param["validation"]
}
}

if appliance.version < '5.10':
element_data["options"].pop("validation_switch", None)
sd = service_dialog.create(label=dialog, description="my dialog")
tab = sd.tabs.create(tab_label=fauxfactory.gen_alphanumeric(start="tab_"),
tab_desc="my tab desc")
box = tab.boxes.create(box_label=fauxfactory.gen_alphanumeric(start="box_"),
box_desc="my box desc")
tab = sd.tabs.create(
tab_label=fauxfactory.gen_alphanumeric(start="tab_"), tab_desc="my tab desc"
)
box = tab.boxes.create(
box_label=fauxfactory.gen_alphanumeric(start="box_"), box_desc="my box desc"
)
box.elements.create(element_data=[element_data])

catalog_item = appliance.collections.catalog_items.create(
Expand All @@ -48,15 +48,20 @@ def dialog_cat_item(appliance, catalog, request):
description="my catalog",
display_in=True,
catalog=catalog,
dialog=sd)
dialog=sd,
)
yield catalog_item, element_data, sd
if catalog_item.exists:
catalog_item.delete()
sd.delete_if_exists()


@pytest.mark.parametrize("dialog_cat_item", [{"validation": "^([a-z0-9]+_*)*[a-z0-9]+$"}],
indirect=True)
@pytest.mark.parametrize(
"dialog_cat_item",
[{"choose_type": "Text Box"}, {"choose_type": "Text Area"}],
indirect=["dialog_cat_item"], ids=["Text Box", "Text Area"],
)
@pytest.mark.meta(automates=[1518971])
def test_dialog_element_regex_validation(appliance, dialog_cat_item):
"""Tests Service Dialog Elements with regex validation.

Expand All @@ -78,29 +83,6 @@ def test_dialog_element_regex_validation(appliance, dialog_cat_item):
wait_for(lambda: not view.submit_button.disabled, timeout=7)


@pytest.mark.manual
@pytest.mark.tier(1)
def test_dialog_text_area_element_regex_validation():
""" Tests Service Dialog Elements with regex validation

Polarion:
assignee: nansari
casecomponent: Services
initialEstimate: 1/4h
startsin: 5.10
caseimportance: high
testSteps:
1. Create a dialog. Set regex_validation in text area
2. Use the dialog in a catalog.
3. Order catalog.
expectedResults:
1.
2.
3. Regex validation should work
"""
pass


@pytest.mark.meta(automates=[1720245])
@pytest.mark.ignore_stream("5.10")
@pytest.mark.tier(2)
Expand Down