82d417b9e6
Fresh start for the StarlingX automation framework. Change-Id: Ie265e0791024f45f71faad6315c2b91b022934d1
39 lines
994 B
Python
39 lines
994 B
Python
from framework.web.condition.web_condition import WebCondition
|
|
|
|
|
|
class MockWebCondition(WebCondition):
|
|
"""
|
|
This class mocks a Web Condition.
|
|
"""
|
|
|
|
def __init__(self, number_of_expected_fails: int = 0):
|
|
"""
|
|
Constructor which will instantiate the driver object.
|
|
Args:
|
|
number_of_expected_fails: Number of times to throw and exception when perform_action is called.
|
|
"""
|
|
super().__init__(None)
|
|
self.number_of_expected_fails = number_of_expected_fails
|
|
|
|
def is_condition_satisfied(self, webdriver) -> bool:
|
|
"""
|
|
This function will evaluate to True after the number_of_expected_fails.
|
|
|
|
Returns:
|
|
|
|
"""
|
|
|
|
if self.number_of_expected_fails > 0:
|
|
self.number_of_expected_fails -= 1
|
|
return False
|
|
|
|
return True
|
|
|
|
def __str__(self):
|
|
"""
|
|
Nice String representation for this condition.
|
|
Returns:
|
|
|
|
"""
|
|
return "MockCondition"
|