Exemple #1
0
 def test_is_element_present_by_image(self):
     mock_desk = MagicMock()
     mock_desk._parse_locator = MagicMock(
         return_value=['image', 'file.png'])
     DesktopLibrary._is_element_present(mock_desk, "image='file.png")
     mock_desk._current_application(
     ).find_elements_by_image.assert_called_with('file.png')
Exemple #2
0
 def test_is_element_present_by_xpath(self):
     mock_desk = MagicMock()
     mock_desk._parse_locator = MagicMock(return_value=['xpath', 'Capture'])
     DesktopLibrary._is_element_present(
         mock_desk, "xpath=//TreeItem[@Name='Capture']")
     mock_desk._current_application(
     ).find_elements_by_xpath.assert_called_with('Capture')
Exemple #3
0
 def test_is_element_present_list_greater_than_0(self):
     mock_desk = MagicMock()
     mock_desk._parse_locator = MagicMock(return_value=['name', 'Capture'])
     mock_desk._current_application().find_elements_by_name = \
         MagicMock(return_value=[MagicMock(), MagicMock()])
     DesktopLibrary._is_element_present(mock_desk, "Name='Capture'")
     mock_desk._current_application(
     ).find_elements_by_name.assert_called_with('Capture')
Exemple #4
0
 def test_is_element_present_by_accessibility_id(self):
     mock_desk = MagicMock()
     mock_desk._parse_locator = MagicMock(
         return_value=['accessibility_id', 'Capture'])
     DesktopLibrary._is_element_present(mock_desk,
                                        "accessibility_id='Capture'")
     mock_desk._current_application(
     ).find_elements_by_accessibility_id.assert_called_with('Capture')
Exemple #5
0
 def test_is_element_present_by_class_name(self):
     mock_desk = MagicMock()
     mock_desk._parse_locator = MagicMock(return_value=['class', 'Capture'])
     DesktopLibrary._is_element_present(mock_desk, "class='Capture'")
     mock_desk._current_application(
     ).find_elements_by_class_name.assert_called_with('Capture')