def collection_has_exact_texts(*expected: str) -> CollectionCondition: def visible_texts(collection: Collection) -> List[str]: return [webelement.text for webelement in collection() if webelement.is_displayed()] return CollectionCondition.raise_if_not_actual( f'has exact texts {expected}', visible_texts, predicate.equals_to_list(expected))
def values(self, *expected: str) -> Condition[Collection]: return CollectionCondition.raise_if_not_actual( f"has attribute '{name}' with values '{expected}'", attribute_values, predicate.equals_to_list(expected), )
def values(self, *expected: str) -> Condition[Collection]: return CollectionCondition.raise_if_not_actual( f"has css property '{name}' with values '{expected}'", property_values, predicate.equals_to_list(expected))
def test_expected_list_is_smaller_and_empty(self): expected = [] actual = ['a'] assert not equals_to_list(expected)(actual)
def test_expected_list_is_smaller(self): expected = ['a'] actual = ['a', 'b'] assert not equals_to_list(expected)(actual)
def test_same_size_and_empty(self): expected = [] actual = [] assert equals_to_list(expected)(actual)
def test_same_size(self): expected = ['a', 'b'] actual = ['a', 'b'] assert equals_to_list(expected)(actual)