Skip to content

Commit

Permalink
Merge 8fe53a7 into dfdad3e
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfe1 committed Jul 19, 2019
2 parents dfdad3e + 8fe53a7 commit 7f51e52
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 18 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/SOAPLibraryDocumentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,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":"2019-07-18 16:28:56","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":["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>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 case","version":""};
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":"2019-07-19 13:54:43","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":["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>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 case","version":""};
</script>
<title></title>
</head>
Expand Down
108 changes: 95 additions & 13 deletions src/Zoomba/DesktopLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def get_keyword_names(self):
return [
'maximize_window', 'open_application', 'wait_for_and_clear_text', 'wait_for_and_click_element',
'wait_for_and_click_text', 'wait_for_and_input_password', 'wait_for_and_input_text',
'wait_for_and_long_press',
'wait_for_and_long_press', 'wait_until_element_contains', 'wait_until_element_does_not_contain',
'wait_until_element_is_enabled', 'wait_until_element_is_disabled',
# External Libraries
'capture_page_screenshot', 'clear_text', 'click_a_point', 'click_button', 'click_element',
'click_element_at_coordinates', 'click_text', 'close_all_applications', 'close_application',
Expand Down Expand Up @@ -102,52 +103,133 @@ def open_application(self, remote_url, alias=None, window_name=None, **kwargs):
return self._cache.register(application, alias)

@keyword("Wait For And Clear Text")
def wait_for_and_clear_text(self, locator):
def wait_for_and_clear_text(self, locator, timeout=None, error=None):
"""Wait for and then clear the text field identified by `locator`.
Fails if `timeout` expires before the element appears.
`error` can be used to override the default error message.
See `introduction` for details about locating elements."""
self.wait_until_page_contains_element(locator)
self.wait_until_page_contains_element(locator, timeout, error)
self.clear_text(locator)

@keyword("Wait For And Click Element")
def wait_for_and_click_element(self, locator):
def wait_for_and_click_element(self, locator, timeout=None, error=None):
"""Wait for and click the element identified by `locator`.
Fails if `timeout` expires before the element appears.
`error` can be used to override the default error message.
See `introduction` for details about locating elements."""
self.wait_until_page_contains_element(locator)
self.wait_until_page_contains_element(locator, timeout, error)
self.click_element(locator)

@keyword("Wait For And Click Text")
def wait_for_and_click_text(self, text, exact_match=False):
def wait_for_and_click_text(self, text, exact_match=False, timeout=None, error=None):
"""Wait for and click text identified by ``text``.
Fails if `timeout` expires before the element appears.
`error` can be used to override the default error message.
By default tries to click first text involves given ``text``, if you would
like to click exactly matching text, then set ``exact_match`` to `True`."""
self.wait_until_page_contains(text)
self.wait_until_page_contains(text, timeout, error)
self.click_text(text, exact_match)

@keyword("Wait For And Input Password")
def wait_for_and_input_password(self, locator, text):
def wait_for_and_input_password(self, locator, text, timeout=None, error=None):
"""Wait for and type the given password into the text field identified by `locator`.
Fails if `timeout` expires before the element appears.
`error` can be used to override the default error message.
The difference between this keyword and `Wait For And Input Text` is that this keyword
does not log the given password. See `introduction` for details about locating elements."""
self.wait_until_page_contains_element(locator)
self.wait_until_page_contains_element(locator, timeout, error)
self.input_password(locator, text)

@keyword("Wait For And Input Text")
def wait_for_and_input_text(self, locator, text):
def wait_for_and_input_text(self, locator, text, timeout=None, error=None):
"""Wait for and type the given `text` into text field identified by `locator`.
Fails if `timeout` expires before the element appears.
`error` can be used to override the default error message.
See `introduction` for details about locating elements."""
self.wait_until_page_contains_element(locator)
self.wait_until_page_contains_element(locator, timeout, error)
self.input_text(locator, text)

@keyword("Wait For And Long Press")
def wait_for_and_long_press(self, locator, duration=10000):
def wait_for_and_long_press(self, locator, duration=10000, timeout=None, error=None):
"""Wait for and long press the element identified by `locator` with optional duration.
Fails if `timeout` expires before the element appears.
`error` can be used to override the default error message.
See `introduction` for details about locating elements."""
self.wait_until_page_contains_element(locator)
self.wait_until_page_contains_element(locator, timeout, error)
self.long_press(locator, duration)

@keyword("Wait Until Element Contains")
def wait_until_element_contains(self, locator, text, timeout=None, error=None):
"""Waits until element specified with `locator` contains 'text'.
Fails if `timeout` expires before the element appears.
`error` can be used to override the default error message.
See also `Wait Until Page Contains`,
`Wait Until Page Does Not Contain`
`Wait Until Page Does Not Contain Element`
"""
self.wait_until_page_contains_element(locator, timeout, error)
self.element_should_contain_text(locator, text, error)

@keyword("Wait Until Element Does Not Contain")
def wait_until_element_does_not_contain(self, locator, text, timeout=None, error=None):
"""Waits until element specified with `locator` does not contain 'text'.
Fails if `timeout` expires before the element appears.
`error` can be used to override the default error message.
See also 'Wait Until Element Contains,
`Wait Until Page Contains`,
`Wait Until Page Does Not Contain`
`Wait Until Page Does Not Contain Element`
"""
self.wait_until_page_contains_element(locator, timeout, error)
self.element_should_not_contain_text(locator, text, error)

@keyword("Wait Until Element Is Enabled")
def wait_until_element_is_enabled(self, locator, timeout=None, error=None):
"""Waits until element specified with `locator` is enabled.
Fails if `timeout` expires before the element appears.
`error` can be used to override the default error message.
See also 'Wait Until Element Is Disabled'
"""
self.wait_until_page_contains_element(locator, timeout, error)
self.element_should_be_enabled(locator)

@keyword("Wait Until Element Is Disabled")
def wait_until_element_is_disabled(self, locator, timeout=None, error=None):
"""Waits until element specified with `locator` is disabled.
Fails if `timeout` expires before the element appears.
`error` can be used to override the default error message.
See also 'Wait Until Element Is Disabled'
"""
self.wait_until_page_contains_element(locator, timeout, error)
self.element_should_be_disabled(locator)

7 changes: 6 additions & 1 deletion test/Desktop/DesktopTests.robot
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ Wait For And Long Press Keyword Test

Wait For And Input Password Keyword Test
Wait For And Input Password accessibility_id=CalculatorResults 12345
Wait Until Page Contains 12,345
Wait Until Element Contains accessibility_id=CalculatorResults 12,345
Wait Until Element Does Not Contain accessibility_id=CalculatorResults 0

Wait Until Element is Enabled / Disabled Keyword Test
Wait Until Element Is Enabled accessibility_id=MemPlus
Wait Until Element Is Disabled accessibility_id=MemRecall


24 changes: 24 additions & 0 deletions test/Desktop/test_desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,27 @@ def test_wait_for_and_long_press(self):
appium.webdriver.Remote = WebdriverRemoteMock
DesktopLibrary.open_application(mock_desk, 'remote_url')
DesktopLibrary.wait_for_and_long_press(mock_desk, "some_locator", 1000)

def test_wait_until_element_contains(self):
mock_desk = MagicMock()
appium.webdriver.Remote = WebdriverRemoteMock
DesktopLibrary.open_application(mock_desk, 'remote_url')
DesktopLibrary.wait_until_element_contains(mock_desk, "some_locator", 'test_text')

def test_wait_until_element_does_not_contain(self):
mock_desk = MagicMock()
appium.webdriver.Remote = WebdriverRemoteMock
DesktopLibrary.open_application(mock_desk, 'remote_url')
DesktopLibrary.wait_until_element_does_not_contain(mock_desk, "some_locator", 'test_text')

def test_wait_until_element_is_enabled(self):
mock_desk = MagicMock()
appium.webdriver.Remote = WebdriverRemoteMock
DesktopLibrary.open_application(mock_desk, 'remote_url')
DesktopLibrary.wait_until_element_is_enabled(mock_desk, "some_locator", 'test_text')

def test_wait_until_element_is_disabled(self):
mock_desk = MagicMock()
appium.webdriver.Remote = WebdriverRemoteMock
DesktopLibrary.open_application(mock_desk, 'remote_url')
DesktopLibrary.wait_until_element_is_disabled(mock_desk, "some_locator", 'test_text')

0 comments on commit 7f51e52

Please sign in to comment.