Skip to content

Commit

Permalink
Drag and Drop by Offset not actually using an offset (#221)
Browse files Browse the repository at this point in the history
* test file upload

* like so?

* ???

* ?

* test

* test and env

* hmmm

* test

* commit

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* ok test like this

* test

* print path

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* ugh

* yup...that was it...cleaning up

* remove extra s

* test it out

* try that

* test

* test

* test

* test

* Ok mobile tests should run now

* test with edge included

* wrong dependency name

* with build numbers

* Speed up and report results better

* randomize the suites again

* test running edge in just github actions

* without pabot for edge

* screen size edit for windows

* Ok remove edge from run in sauce

* 2.11.3

* test out ios tests as well

* Cleanup for now, will log bugs

* moving some docs around

* test with broken tag

* send broken tags rather than commented out code

* make drag by offset actually drag by offset

* forgot there was a test over here as well

* test

* ok this one maybe?
  • Loading branch information
Wolfe1 authored Aug 12, 2021
1 parent 1968306 commit 1594e67
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 19 deletions.
7 changes: 4 additions & 3 deletions docs/APILibraryDocumentation.html

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions docs/DesktopLibraryDocumentation.html

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions docs/GUILibraryDocumentation.html

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions docs/MobileLibraryDocumentation.html

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions docs/SOAPLibraryDocumentation.html

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/Zoomba/Helpers/AppiumCommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ def drag_and_drop_by_offset(self, locator, x_offset=0, y_offset=0):
"""
element = self._element_find(locator, True, True)
zoomba.log('Dragging element "%s" by offset (%s, %s).' % (locator, x_offset, y_offset))
x_center = element.location['x'] + element.size['width'] / 2
y_center = element.location['y'] + element.size['height'] / 2
actions = TouchAction(self._current_application())
actions.press(element)
actions.move_to(x=x_offset, y=y_offset)
actions.move_to(x=x_center + x_offset, y=y_center + y_offset)
actions.release().perform()
2 changes: 1 addition & 1 deletion test/Desktop/test_desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ def test_drag_and_drop_with_offset(self):
TouchAction.release = MagicMock()
DesktopLibrary.drag_and_drop_by_offset(mock_desk, "some_locator", x_offset=100, y_offset=100)
TouchAction.press.assert_called()
TouchAction.move_to.assert_called_with(x=100, y=100)
TouchAction.move_to.assert_called_with(x=unittest.mock.ANY, y=unittest.mock.ANY)
TouchAction.release.assert_called()

@patch("selenium.webdriver.common.action_chains.ActionChains")
Expand Down
5 changes: 4 additions & 1 deletion test/Mobile/AndroidMobileTests.robot
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ Drag and Drop By Offset Keyword Test
Wait For And Click Element accessibility_id=Search
Wait For And Input Text com.touchboarder.android.api.demos:id/search_src_text drag
wait for and click text Graphics/Shadow Card Drag
Drag and Drop By Offset com.touchboarder.android.api.demos:id/card 200 200
Drag and Drop By Offset com.touchboarder.android.api.demos:id/card 100 100
# Not sure why here but it moves 150 pixels rather than 100...may be limitation of testing app
${location}= Get Element Location com.touchboarder.android.api.demos:id/card
Should Be Equal "${location}" "{'x': 150, 'y': 310}"

Wait Until Element Contains
Wait For And Click Element accessibility_id=Search
Expand Down
2 changes: 1 addition & 1 deletion test/Mobile/test_mobile.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def test_drag_and_drop_with_offset(self):
MobileLibrary.open_application(mock_desk, 'remote_url')
MobileLibrary.drag_and_drop_by_offset(mock_desk, "some_locator", x_offset=100, y_offset=100)
TouchAction.press.assert_called()
TouchAction.move_to.assert_called_with(x=100, y=100)
TouchAction.move_to.assert_called_with(x=unittest.mock.ANY, y=unittest.mock.ANY)
TouchAction.release.assert_called()

def test_drag_and_drop_with_offset_missing_locator(self):
Expand Down

0 comments on commit 1594e67

Please sign in to comment.