Ejemplo n.º 1
0
def test_is_element_visible_and_contains_text_no_elements_found():
    mock_finder = MagicMock()
    mock_finder.visible_elements.return_value = []
    interrogate = Interrogator(None, mock_finder, None)

    result = interrogate.is_element_visible_and_contains_text(
        default_page_element, "test-text")

    assert_that(result, equal_to(False), "No elements should be found")
Ejemplo n.º 2
0
def test_is_element_visible_and_contains_text_expected_text_not_found():
    mock_element_1 = MagicMock()
    mock_element_2 = MagicMock()
    mock_element_1.text = "1234"
    mock_element_2.text = "abcd"
    mock_finder = MagicMock()
    mock_finder.visible_elements.return_value = [
        mock_element_1, mock_element_2
    ]
    interrogate = Interrogator(None, mock_finder, None)

    result = interrogate.is_element_visible_and_contains_text(
        default_page_element, "test-text")

    assert_that(result, equal_to(False), "Expected text should not be found")