Skip to content

Commit

Permalink
Speed improvement to the search functionality when dealing with large…
Browse files Browse the repository at this point in the history
… apps or the desktop
  • Loading branch information
Wolfe1 committed Oct 19, 2020
1 parent 17dc365 commit 25a7a48
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions samples/DesktopTests.robot
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,5 @@ Select Element From Combobox Test
Switch To Desktop Test
Close Application
Switch Application Desktop
Click Element name=Start
Click Element name=Start
Wait For And Click Element name=Start
Wait For And Click Element name=Start
4 changes: 3 additions & 1 deletion src/Zoomba/DesktopLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,4 +669,6 @@ def _wait_until_page_contains(self, text, timeout=None, error=None):

def _wait_until_page_contains_element(self, locator, timeout=None, error=None):
"""Internal version to avoid duplicate screenshots"""
AppiumCommon.wait_until_page_contains_element(self, locator, timeout, error)
if not error:
error = "Element '%s' did not appear in <TIMEOUT>" % locator
self._wait_until(timeout, error, self._element_find, locator, True)
7 changes: 0 additions & 7 deletions src/Zoomba/Helpers/AppiumCommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@ def wait_until_page_contains(self, text, timeout=None, error=None):
self._wait_until(timeout, error, self._is_text_present, text)


def wait_until_page_contains_element(self, locator, timeout=None, error=None):
"""Internal version to avoid duplicate screenshots"""
if not error:
error = "Element '%s' did not appear in <TIMEOUT>" % locator
self._wait_until(timeout, error, self._is_element_present, locator)


def wait_for_and_long_press(self, locator, duration=5000, timeout=None, error=None):
"""Wait for and long press the element identified by ``locator`` with optional duration.
Expand Down
4 changes: 3 additions & 1 deletion src/Zoomba/MobileLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,4 +314,6 @@ def _wait_until_page_contains(self, text, timeout=None, error=None):

def _wait_until_page_contains_element(self, locator, timeout=None, error=None):
"""Internal version to avoid duplicate screenshots"""
AppiumCommon.wait_until_page_contains_element(self, locator, timeout, error)
if not error:
error = "Element '%s' did not appear in <TIMEOUT>" % locator
self._wait_until(timeout, error, self._is_element_present, locator)
3 changes: 2 additions & 1 deletion test/Desktop/test_desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,4 +471,5 @@ def test_wait_until_page_contains_element_private(self):
mock_desk = MagicMock()
DesktopLibrary._wait_until_page_contains_element(mock_desk, 'some_element', 5)
mock_desk._wait_until.assert_called_with(5, "Element 'some_element' did not appear in "
"<TIMEOUT>", unittest.mock.ANY, 'some_element')
"<TIMEOUT>", unittest.mock.ANY, 'some_element',
True)

0 comments on commit 25a7a48

Please sign in to comment.