diff --git a/samples/DesktopTests.robot b/samples/DesktopTests.robot index 93164a34..d102a2cc 100644 --- a/samples/DesktopTests.robot +++ b/samples/DesktopTests.robot @@ -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 diff --git a/src/Zoomba/DesktopLibrary.py b/src/Zoomba/DesktopLibrary.py index 06c82fd9..acefed04 100644 --- a/src/Zoomba/DesktopLibrary.py +++ b/src/Zoomba/DesktopLibrary.py @@ -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 " % locator + self._wait_until(timeout, error, self._element_find, locator, True) diff --git a/src/Zoomba/Helpers/AppiumCommon.py b/src/Zoomba/Helpers/AppiumCommon.py index e3eda2a6..cdac9743 100644 --- a/src/Zoomba/Helpers/AppiumCommon.py +++ b/src/Zoomba/Helpers/AppiumCommon.py @@ -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 " % 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. diff --git a/src/Zoomba/MobileLibrary.py b/src/Zoomba/MobileLibrary.py index 31c9e731..6145a297 100644 --- a/src/Zoomba/MobileLibrary.py +++ b/src/Zoomba/MobileLibrary.py @@ -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 " % locator + self._wait_until(timeout, error, self._is_element_present, locator) diff --git a/test/Desktop/test_desktop.py b/test/Desktop/test_desktop.py index ac32b83c..d59a9c14 100644 --- a/test/Desktop/test_desktop.py +++ b/test/Desktop/test_desktop.py @@ -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 " - "", unittest.mock.ANY, 'some_element') + "", unittest.mock.ANY, 'some_element', + True)