I need Behave to pass full scenario even when at least 1 element is correct and fail when none of them were found.
For example, I have tried something like this but it returns error for elements that were not found and only true for elements it did found.
Scenario Outline: Elements
When Screen loads
Then Element "<element>" is visible
Examples: Consumer Electronics
| element |
| 1 |
| 2 |
| 3 |
# or this:
Scenario: Elements
When Screen loads
Then Element "1" or "2" or "3" is visible
I have found workaround that allowed me to make check for 1 or more elements in Behave and reuse it in later steps. Good thing it doesn't break our codebase as it still works if only one element is checked.
Scenario: Elements
When Screen loads
Then Element "1 or 2 or 3" is visible
@then('Then Element "{element}" is visible')
def step_impl(context, element):
posible_elements = element.split(' or ')
for elem in posible_element:
# make check for each elem
# or save visible element to context.visible_element