def test_element_find_by_text_ios(self): mock_desk = MagicMock() mock_desk._is_ios = MagicMock(return_value=True) webdriver.Remote = WebdriverRemoteMock mock_desk._element_find = MagicMock() MobileLibrary._element_find_by_text(mock_desk, "some_text") mock_desk._element_find.assert_called_with('some_text', True, False)
def test_element_find_by_text_ios_exact(self): mock_desk = MagicMock() mock_desk._is_ios = MagicMock(return_value=True) webdriver.Remote = WebdriverRemoteMock mock_desk._element_find = MagicMock(return_value=False) MobileLibrary._element_find_by_text(mock_desk, "some_text", True) mock_desk._element_find.assert_called_with( '//*[@value="some_text" or @label="some_text"]', True, True)
def test_element_find_by_text_android_not_exact(self): mock_desk = MagicMock() mock_desk._is_ios = MagicMock(return_value=False) mock_desk._is_android = MagicMock(return_value=True) webdriver.Remote = WebdriverRemoteMock mock_desk._element_find = MagicMock(return_value=False) MobileLibrary._element_find_by_text(mock_desk, "some_text", False) mock_desk._element_find.assert_called_with( '//*[contains(@text,"some_text")]', True, True)