Esempio n. 1
0
 def test_drag_and_drop_ios(self):
     mock_desk = MagicMock()
     mock_desk._get_platform = MagicMock(return_value='ios')
     webdriver.Remote = WebdriverRemoteMock
     TouchAction.move_to = MagicMock()
     TouchAction.release = MagicMock()
     MobileLibrary.open_application(mock_desk, 'remote_url')
     MobileLibrary.drag_and_drop(mock_desk, "some_locator",
                                 "some_other_locator")
     mock_desk._platform_dependant_press.assert_called()
     TouchAction.move_to.assert_called_with(unittest.mock.ANY)
     TouchAction.release.assert_called()
Esempio n. 2
0
 def test_drag_and_drop_with_offset(self):
     mock_desk = MagicMock()
     webdriver.Remote = WebdriverRemoteMock
     TouchAction.move_to = MagicMock()
     TouchAction.release = MagicMock()
     MobileLibrary.open_application(mock_desk, 'remote_url')
     MobileLibrary.drag_and_drop_by_offset(mock_desk,
                                           "some_locator",
                                           x_offset=100,
                                           y_offset=100)
     mock_desk._platform_dependant_press.assert_called()
     TouchAction.move_to.assert_called_with(x=unittest.mock.ANY,
                                            y=unittest.mock.ANY)
     TouchAction.release.assert_called()
Esempio n. 3
0
 def test_is_text_visible(self):
     mock_desk = MagicMock()
     webdriver.Remote = WebdriverRemoteMock
     mock_desk._element_find_by_text().is_displayed = MagicMock(
         return_value=True)
     result = MobileLibrary._is_text_visible(mock_desk, "some_text")
     self.assertTrue(result)
Esempio n. 4
0
 def test_scroll_to_text_android_scroll(self):
     mock_desk = MagicMock()
     webdriver.Remote = WebdriverRemoteMock
     mock_desk._is_android = MagicMock(return_value=True)
     mock_desk._is_ios = MagicMock(return_value=False)
     mock_desk._is_text_present = MagicMock(side_effect=[False, True])
     result = MobileLibrary._scroll_to_text(mock_desk, "some_text", "down")
     self.assertTrue(result)
Esempio n. 5
0
 def test_scroll_to_text_android_visible_no_scroll(self):
     mock_desk = MagicMock()
     webdriver.Remote = WebdriverRemoteMock
     mock_desk._is_ios = MagicMock(return_value=False)
     mock_desk._is_android = MagicMock(return_value=True)
     mock_desk._is_text_present = MagicMock(return_value=True)
     result = MobileLibrary._scroll_to_text(mock_desk, "some_text", "up")
     self.assertTrue(result)
Esempio n. 6
0
 def test_wait_for_and_click_text_exact(self):
     mock_desk = MagicMock()
     webdriver.Remote = WebdriverRemoteMock
     MobileLibrary.open_application(mock_desk, 'remote_url')
     MobileLibrary.wait_for_and_click_text(mock_desk, "some_text", True)
     mock_desk.click_text.assert_called_with("some_text", True)
Esempio n. 7
0
 def test_wait_until_page_contains_element_private(self):
     mock_desk = MagicMock()
     MobileLibrary._wait_until_page_contains_element(
         mock_desk, 'some_element', 5)
     mock_desk._wait_until.asser_called_with('some_element', 5)
Esempio n. 8
0
 def test_save_appium_screenshot(self):
     mock_desk = MagicMock()
     MobileLibrary.save_appium_screenshot(mock_desk)
     mock_desk.capture_page_screenshot.assert_called()
Esempio n. 9
0
 def test_capture_page_screenshot(self):
     mock_desk = MagicMock()
     mock_desk._get_screenshot_paths = MagicMock(
         return_value=['path', 'link'])
     MobileLibrary.capture_page_screenshot(mock_desk)
     mock_desk._get_screenshot_paths.assert_called()
Esempio n. 10
0
 def test_wait_for_and_tap_multiple(self):
     mock_desk = MagicMock()
     webdriver.Remote = WebdriverRemoteMock
     MobileLibrary.open_application(mock_desk, 'remote_url')
     MobileLibrary.wait_for_and_tap(mock_desk, "some_locator", count=4)
     mock_desk.tap.assert_called_with("some_locator", None, None, 4)
Esempio n. 11
0
 def test_wait_for_and_input_text_simple(self):
     mock_desk = MagicMock()
     webdriver.Remote = WebdriverRemoteMock
     MobileLibrary.open_application(mock_desk, 'remote_url')
     MobileLibrary.wait_for_and_clear_text(mock_desk, "some_locator")
     mock_desk.clear_text.assert_called_with("some_locator")
Esempio n. 12
0
 def test_import_defaults(self):
     MobileLibrary()
Esempio n. 13
0
 def test_wait_until_element_is_disabled(self):
     mock_desk = MagicMock()
     webdriver.Remote = WebdriverRemoteMock
     MobileLibrary.open_application(mock_desk, 'remote_url')
     MobileLibrary.wait_until_element_is_disabled(mock_desk, "some_locator")
     mock_desk.element_should_be_disabled.assert_called_with("some_locator")
Esempio n. 14
0
 def test_is_text_visible_not_found(self):
     mock_desk = MagicMock()
     webdriver.Remote = WebdriverRemoteMock
     mock_desk._element_find_by_text = MagicMock(return_value=None)
     result = MobileLibrary._is_text_visible(mock_desk, "some_text")
     self.assertIsNone(result)
Esempio n. 15
0
 def test_platform_dependant_press_ios_private(self):
     mock_desk = MagicMock()
     mock_desk._is_ios = MagicMock(return_value=True)
     MobileLibrary._platform_dependant_press(mock_desk, MagicMock(),
                                             'some_element')
Esempio n. 16
0
 def test_wait_for_and_click_button(self):
     mock_desk = MagicMock()
     webdriver.Remote = WebdriverRemoteMock
     MobileLibrary.open_application(mock_desk, 'remote_url')
     MobileLibrary.wait_for_and_click_button(mock_desk, "some_button")
     mock_desk.click_button.assert_called_with("some_button")
Esempio n. 17
0
 def test_wait_for_and_long_press(self):
     mock_desk = MagicMock()
     webdriver.Remote = WebdriverRemoteMock
     MobileLibrary.open_application(mock_desk, 'remote_url')
     MobileLibrary.wait_for_and_long_press(mock_desk, "some_locator", 1000)
     mock_desk.long_press.assert_called_with("some_locator", 1000)
Esempio n. 18
0
 def test_import_overrides(self):
     MobileLibrary(timeout=10, run_on_failure='Capture Page Screenshot')