Skip to content

Commit

Permalink
More keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfe1 committed Nov 25, 2020
1 parent d4503c1 commit 157480b
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 36 deletions.
2 changes: 1 addition & 1 deletion docs/APILibraryDocumentation.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/DesktopLibraryDocumentation.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/GUILibraryDocumentation.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/MobileLibraryDocumentation.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/SOAPLibraryDocumentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@
jQuery.extend({highlight:function(e,t,n,r){if(e.nodeType===3){var i=e.data.match(t);if(i){var s=document.createElement(n||"span");s.className=r||"highlight";var o=e.splitText(i.index);o.splitText(i[0].length);var u=o.cloneNode(true);s.appendChild(u);o.parentNode.replaceChild(s,o);return 1}}else if(e.nodeType===1&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&!(e.tagName===n.toUpperCase()&&e.className===r)){for(var a=0;a<e.childNodes.length;a++){a+=jQuery.highlight(e.childNodes[a],t,n,r)}}return 0}});jQuery.fn.unhighlight=function(e){var t={className:"highlight",element:"span"};jQuery.extend(t,e);return this.find(t.element+"."+t.className).each(function(){var e=this.parentNode;e.replaceChild(this.firstChild,this);e.normalize()}).end()};jQuery.fn.highlight=function(e,t){var n={className:"highlight",element:"span",caseSensitive:false,wordsOnly:false};jQuery.extend(n,t);if(e.constructor===String){e=[e]}e=jQuery.grep(e,function(e,t){return e!=""});e=jQuery.map(e,function(e,t){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")});if(e.length==0){return this}var r=n.caseSensitive?"":"i";var i="("+e.join("|")+")";if(n.wordsOnly){i="\\b"+i+"\\b"}var s=new RegExp(i,r);return this.each(function(){jQuery.highlight(this,s,n.element,n.className)})}
</script>
<script type="text/javascript">
libdoc = {"all_tags":[],"contains_tags":false,"doc":"<p>Zoomba SOAP Library\x3c/p>\n<p>This class is the base Library used to generate automated SOAP Tests in the Zoomba Automation Framework.\x3c/p>","generated":"2020-11-25 10:08:12","inits":[],"keywords":[{"args":["action=None","soap_object=None"],"doc":"<p>Call Soap Method. Calls soap method with list object\x3c/p>\n<p>action: (string) SOAP Action to be called.\x3c/p>\n<p>soap_object: (list) Soap Object in list format, list must be ordered wrt schema\x3c/p>","matched":true,"name":"Call Soap Method With List Object","shortdoc":"Call Soap Method. Calls soap method with list object ","tags":[]},{"args":["action=None","**soap_object"],"doc":"<p>Call Soap Method with dictionary object. Calls soap method\x3c/p>\n<p>action: (string) SOAP Action to be called.\x3c/p>\n<p>soap_object: (dict) Soap Object in dict format, dict must contain all required parts of schema object.\x3c/p>","matched":true,"name":"Call Soap Method With Object","shortdoc":"Call Soap Method with dictionary object. Calls soap method ","tags":[]},{"args":["soap_response=None"],"doc":"<p>Convert Soap Response To Dictionary: This keyword builds a dictionary from the sudsLibrary response\x3c/p>\n<p>json_actual_response: (request response object) The response from an API.\x3c/p>\n<p>return: There is no actual returned output, other than error messages when comparisons fail.\x3c/p>","matched":true,"name":"Convert Soap Response To Json","shortdoc":"Convert Soap Response To Dictionary: This keyword builds a dictionary from the sudsLibrary response","tags":[]},{"args":["host=None","endpoint=None","alias=None","**kwargs"],"doc":"<p>Create Soap Session. This Keyword utilizes the WSDL to create a soap client.\x3c/p>\n<p>host: (string) The host url.\x3c/p>\n<p>endpoint: (string) SOAP API endpoint containing the actions to be referenced.\x3c/p>\n<p>**kwargs: (optional) Parameters that could be included to add options to client creation. Current supported parameters are:\x3c/p>\n<p>set_location: http address\x3c/p>","matched":true,"name":"Create Soap Session","shortdoc":"Create Soap Session. This Keyword utilizes the WSDL to create a soap client.","tags":[]},{"args":["host=None","endpoint=None","alias=None","**kwargs"],"doc":"<p>Create Soap Session. This Keyword utilizes the WSDL and directly accesses calls from sudsLibrary.\x3c/p>\n<p>host: (string) The host url.\x3c/p>\n<p>endpoint: (string) SOAP API endpoint containing the actions to be referenced.\x3c/p>\n<p>alias: (string} Sets the alias for the SudsLibrary Framework **kwargs: (optional) Parameters that could be included to add options to client creation. Current supported parameters are:\x3c/p>\n<p>set_location: http address\x3c/p>","matched":true,"name":"Create Soap Session And Fix Wsdl","shortdoc":"Create Soap Session. This Keyword utilizes the WSDL and directly accesses calls from sudsLibrary.","tags":[]},{"args":["host=None","endpoint=None","alias=None","set_location=None","fix=False"],"doc":"<p>Create Soap Session and Set Location. In addition to the client creation, this keyword sets the location as specified.\x3c/p>\n<p>host: (string) The host url.\x3c/p>\n<p>endpoint: (string) SOAP API endpoint containing the actions to be referenced.\x3c/p>\n<p>set_location: (string) If set will overwrite the WSDL location with specified address.\x3c/p>\n<p>If set to None will replace location with host and endpoint specified\x3c/p>","matched":true,"name":"Create Soap Session And Set Location","shortdoc":"Create Soap Session and Set Location. In addition to the client creation, this keyword sets the location as specified.","tags":[]},{"args":["wsdl_type=None","object_dict=None"],"doc":"<p>Create Wsdl Objects. This Keyword utilizes the WSDL to create a WSDL object based on the information provided.\x3c/p>\n<p>wsdl_type: (string) Wsdl object to be created.\x3c/p>\n<p>object_dict: (dict) Python Dictionary containing values and nested dictionaries with construction similar to wsdl defined objects.\x3c/p>\n<p>return: (response object) Returns the SOAP client object.\x3c/p>","matched":true,"name":"Create Wsdl Objects","shortdoc":"Create Wsdl Objects. This Keyword utilizes the WSDL to create a WSDL object based on the information provided.","tags":[]}],"name":"SOAP_Library","named_args":true,"scope":"TEST","version":"2.6.1"};
libdoc = {"all_tags":[],"contains_tags":false,"doc":"<p>Zoomba SOAP Library\x3c/p>\n<p>This class is the base Library used to generate automated SOAP Tests in the Zoomba Automation Framework.\x3c/p>","generated":"2020-11-25 13:23:01","inits":[],"keywords":[{"args":["action=None","soap_object=None"],"doc":"<p>Call Soap Method. Calls soap method with list object\x3c/p>\n<p>action: (string) SOAP Action to be called.\x3c/p>\n<p>soap_object: (list) Soap Object in list format, list must be ordered wrt schema\x3c/p>","matched":true,"name":"Call Soap Method With List Object","shortdoc":"Call Soap Method. Calls soap method with list object ","tags":[]},{"args":["action=None","**soap_object"],"doc":"<p>Call Soap Method with dictionary object. Calls soap method\x3c/p>\n<p>action: (string) SOAP Action to be called.\x3c/p>\n<p>soap_object: (dict) Soap Object in dict format, dict must contain all required parts of schema object.\x3c/p>","matched":true,"name":"Call Soap Method With Object","shortdoc":"Call Soap Method with dictionary object. Calls soap method ","tags":[]},{"args":["soap_response=None"],"doc":"<p>Convert Soap Response To Dictionary: This keyword builds a dictionary from the sudsLibrary response\x3c/p>\n<p>json_actual_response: (request response object) The response from an API.\x3c/p>\n<p>return: There is no actual returned output, other than error messages when comparisons fail.\x3c/p>","matched":true,"name":"Convert Soap Response To Json","shortdoc":"Convert Soap Response To Dictionary: This keyword builds a dictionary from the sudsLibrary response","tags":[]},{"args":["host=None","endpoint=None","alias=None","**kwargs"],"doc":"<p>Create Soap Session. This Keyword utilizes the WSDL to create a soap client.\x3c/p>\n<p>host: (string) The host url.\x3c/p>\n<p>endpoint: (string) SOAP API endpoint containing the actions to be referenced.\x3c/p>\n<p>**kwargs: (optional) Parameters that could be included to add options to client creation. Current supported parameters are:\x3c/p>\n<p>set_location: http address\x3c/p>","matched":true,"name":"Create Soap Session","shortdoc":"Create Soap Session. This Keyword utilizes the WSDL to create a soap client.","tags":[]},{"args":["host=None","endpoint=None","alias=None","**kwargs"],"doc":"<p>Create Soap Session. This Keyword utilizes the WSDL and directly accesses calls from sudsLibrary.\x3c/p>\n<p>host: (string) The host url.\x3c/p>\n<p>endpoint: (string) SOAP API endpoint containing the actions to be referenced.\x3c/p>\n<p>alias: (string} Sets the alias for the SudsLibrary Framework **kwargs: (optional) Parameters that could be included to add options to client creation. Current supported parameters are:\x3c/p>\n<p>set_location: http address\x3c/p>","matched":true,"name":"Create Soap Session And Fix Wsdl","shortdoc":"Create Soap Session. This Keyword utilizes the WSDL and directly accesses calls from sudsLibrary.","tags":[]},{"args":["host=None","endpoint=None","alias=None","set_location=None","fix=False"],"doc":"<p>Create Soap Session and Set Location. In addition to the client creation, this keyword sets the location as specified.\x3c/p>\n<p>host: (string) The host url.\x3c/p>\n<p>endpoint: (string) SOAP API endpoint containing the actions to be referenced.\x3c/p>\n<p>set_location: (string) If set will overwrite the WSDL location with specified address.\x3c/p>\n<p>If set to None will replace location with host and endpoint specified\x3c/p>","matched":true,"name":"Create Soap Session And Set Location","shortdoc":"Create Soap Session and Set Location. In addition to the client creation, this keyword sets the location as specified.","tags":[]},{"args":["wsdl_type=None","object_dict=None"],"doc":"<p>Create Wsdl Objects. This Keyword utilizes the WSDL to create a WSDL object based on the information provided.\x3c/p>\n<p>wsdl_type: (string) Wsdl object to be created.\x3c/p>\n<p>object_dict: (dict) Python Dictionary containing values and nested dictionaries with construction similar to wsdl defined objects.\x3c/p>\n<p>return: (response object) Returns the SOAP client object.\x3c/p>","matched":true,"name":"Create Wsdl Objects","shortdoc":"Create Wsdl Objects. This Keyword utilizes the WSDL to create a WSDL object based on the information provided.","tags":[]}],"name":"SOAP_Library","named_args":true,"scope":"TEST","version":"2.6.1"};
</script>
<title></title>
</head>
Expand Down
18 changes: 16 additions & 2 deletions samples/Appium-DesktopTests.robot
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Documentation Zoomba Desktop Library Tests.
Library Zoomba.DesktopLibrary
Suite Setup Start App
Test Setup Launch Application
Test Teardown Quit Application
Suite Teardown Close All Applications
#Test Teardown Quit Application
#Suite Teardown Close All Applications
Force Tags Windows

*** Variables ***
Expand Down Expand Up @@ -130,6 +130,20 @@ Drag And Drop By Touch Tests
drag and drop by touch offset accessibility_id=AppName 100 100
Maximize Window

Tap Tests
Tap name=Five
Double Tap name=Five
Wait Until Element Contains accessibility_id=CalculatorResults 555

Flick Tests
Select Element From ComboBox accessibility_id=TogglePaneButton accessibility_id=Graphing
Wait Until Page Contains Element accessibility_id=TogglePaneButton
Flick 100 100
Wait For And Click Element accessibility_id=TogglePaneButton
Flick From Element accessibility_id=Standard 0 -100 10
Wait Until Page Contains Element accessibility_id=Standard
Wait For And Click Element accessibility_id=Standard

Switch To Desktop Test
Close Application
Switch Application Desktop
Expand Down
14 changes: 14 additions & 0 deletions samples/WinAppDriver-DesktopTests.robot
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,20 @@ Drag And Drop By Touch Tests
drag and drop by touch offset accessibility_id=AppName 100 100
Maximize Window

Tap Tests
Tap name=Five
Double Tap name=Five
Wait Until Element Contains accessibility_id=CalculatorResults 555

Flick Tests
Select Element From ComboBox accessibility_id=TogglePaneButton accessibility_id=Graphing
Wait Until Page Contains Element accessibility_id=TogglePaneButton
Flick 100 100
Wait For And Click Element accessibility_id=TogglePaneButton
Flick From Element accessibility_id=Standard 0 -100 10
Wait Until Page Contains Element accessibility_id=Standard
Wait For And Click Element accessibility_id=Standard

Switch To Desktop Test
Close Application
Switch Application Desktop
Expand Down
82 changes: 53 additions & 29 deletions src/Zoomba/DesktopLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def get_keyword_names(self):
'capture_page_screenshot', 'save_appium_screenshot', 'select_element_from_combobox',
'driver_setup', 'driver_teardown', 'select_elements_from_menu',
'select_elements_from_context_menu', 'drag_and_drop_by_touch',
'drag_and_drop_by_touch_offset',
'drag_and_drop_by_touch_offset', 'double_tap', 'flick', 'flick_from_element',
'scroll', 'scroll_from_element',
# External Libraries
'clear_text', 'click_button', 'click_element', 'close_all_applications',
'close_application', 'element_attribute_should_match', 'element_should_be_disabled',
Expand Down Expand Up @@ -697,22 +698,6 @@ def select_elements_from_context_menu(self, *args):
count += 1
self.switch_application(original_index)

# @keyword("Tap Down")
# def tap_down(self, locator):
# """"""
# element = self._element_find(locator, True, True)
# action = TouchAction(self._current_application())
# # TouchAction(self._current_application()).move_to()
# action.press(element)
# action.move_to(el=None, x=100, y=100).perform()

# @keyword("Move")
# def move(self):
# """"""
# # element = self._element_find(locator, True, True)
# action = TouchAction(self._current_application())
# action.move_to(x=100, y=100).perform()

@keyword("Drag And Drop by Touch")
def drag_and_drop_by_touch(self, source, target):
"""Drags the element found with ``source`` to the given ``x_offset`` and ``y_offset``
Expand All @@ -736,6 +721,57 @@ def drag_and_drop_by_touch_offset(self, locator, x_offset=0, y_offset=0):
source_y_center = source_element.location.get('y') + (source_element.size.get('height') / 2)
actions.tap_and_hold(source_x_center, source_y_center).release(x_offset, y_offset).perform()

@keyword("Double Tap")
def double_tap(self, locator):
""" Double tap element identified by ``locator``."""
element = self._element_find(locator, True, True)
action = TouchActions(self._current_application())
action.double_tap(element).perform()

@keyword("Flick")
def flick(self, x_speed, y_speed):
""" Flicks from current position.
`xspeed` is the X speed in pixels per second.
`yspeed` is the Y speed in pixels per second."""
action = TouchActions(self._current_application())
action.flick(x_speed, y_speed).perform()

@keyword("Flick From Element")
def flick_from_element(self, locator, x_offset, y_offset, speed):
""" Flicks starting at `locator`.
`xoffset` is X offset to flick to.
`yoffset` is Y offset to flick to.
`speed` is Pixels per second to flick."""
element = self._element_find(locator, True, True)
action = TouchActions(self._current_application())
action.flick_element(element, x_offset, y_offset, speed).perform()

@keyword("Scroll")
def scroll(self, x_offset, y_offset):
""" Scrolls from current position.
`x_offset` is the X offset to scroll to.
`y_offset` is the Y offset to scroll to."""
action = TouchActions(self._current_application())
action.scroll(x_offset, y_offset).perform()

@keyword("Scroll From Element")
def scroll_from_element(self, locator, x_offset, y_offset):
""" Scrolls starting from `locator`.
`x_offset` is the X offset to scroll to.
`y_offset` is the Y offset to scroll to."""
element = self._element_find(locator, True, True)
action = TouchActions(self._current_application())
action.scroll_from_element(element, x_offset, y_offset).perform()

# Private
def _move_to_element(self, actions, element, x_offset=0, y_offset=0):
if x_offset != 0 or y_offset != 0:
Expand Down Expand Up @@ -835,18 +871,6 @@ def _wait_until_page_contains_element(self, locator, timeout=None, error=None):
error = "Element '%s' did not appear in <TIMEOUT>" % locator
self._wait_until(timeout, error, self._is_element_present, locator)

# def _tap_and_hold(self, actions, element):
# # actions._add_action('press', self._get_opts(el, x, y, pressure=pressure))
# # element = self._element_find(locator, True, True)
# actions._actions.append(lambda: actions._driver.execute(Command.TOUCH_DOWN,
# {'element': element.id}))
# return actions
#
# def _move(self, actions, xcoord, ycoord):
# actions._actions.append(
# lambda: actions._driver.execute(Command.TOUCH_MOVE, {'x': int(xcoord), 'y': int(ycoord)}))
# return actions

# Overrides to prevent expensive log_source call
def _wait_until_no_error(self, timeout, wait_func, *args):
timeout = utils.timestr_to_secs(timeout) if timeout is not None else self._timeout_in_secs
Expand Down

0 comments on commit 157480b

Please sign in to comment.