From 55118f6601eb27f9bf61354ecbf811fc9d243a9c Mon Sep 17 00:00:00 2001 From: Serhat Bolsu Date: Mon, 30 Oct 2017 02:09:28 +0400 Subject: [PATCH] Launch Application and Quit Application added --- .../keywords/_applicationmanagement.py | 42 ++++++++++++++++++- AppiumLibrary/version.py | 2 +- docs/AppiumLibrary.html | 2 +- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/AppiumLibrary/keywords/_applicationmanagement.py b/AppiumLibrary/keywords/_applicationmanagement.py index 0b67ee6e..6f2e811d 100644 --- a/AppiumLibrary/keywords/_applicationmanagement.py +++ b/AppiumLibrary/keywords/_applicationmanagement.py @@ -18,7 +18,7 @@ def __init__(self): # Public, open and close def close_application(self): - """Closes the current application.""" + """Closes the current application and also close webdriver session.""" self._debug('Closing application with session id %s' % self._current_application().session_id) self._cache.close() @@ -81,8 +81,46 @@ def switch_application(self, index_or_alias): self._cache.switch(index_or_alias) return old_index + def launch_application(self): + """ Launch application. Application can be launched while Appium session running. + This keyword can be used to launch application during test case or between test cases. + + This keyword works while `Open Application` has a test running. This is good practice to `Launch Application` + and `Quit Application` between test cases. As Suite Setup is `Open Application`, `Test Setup` can be used to `Launch Application` + + Example (syntax is just a representation, refer to RF Guide for usage of Setup/Teardown): + | [Setup Suite] | + | | Open Application | http://localhost:4723/wd/hub | platformName=Android | deviceName=192.168.56.101:5555 | app=${CURDIR}/demoapp/OrangeDemoApp.apk | + | [Test Setup] | + | | Launch Application | + | | | <<>> | + | | | <<>> | + | [Test Teardown] | + | | Quit Application | + | [Suite Teardown] | + | | Close Application | + + See `Quit Application` for quiting application but keeping Appium sesion running. + + New in AppiumLibrary 1.4.6 + """ + driver = self._current_application() + driver.launch_app() + + def quit_application(self): + """ Quit application. Application can be quit while Appium session is kept alive. + This keyword can be used to close application during test case or between test cases. + + See `Launch Application` for an explanation. + + New in AppiumLibrary 1.4.6 + """ + driver = self._current_application() + driver.close_app() + def reset_application(self): - """ Reset application """ + """ Reset application. Open Application can be reset while Appium session is kept alive. + """ driver = self._current_application() driver.reset() diff --git a/AppiumLibrary/version.py b/AppiumLibrary/version.py index 84e30c1c..85402ffe 100644 --- a/AppiumLibrary/version.py +++ b/AppiumLibrary/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -VERSION = '1.4.5.6' +VERSION = '1.4.6' diff --git a/docs/AppiumLibrary.html b/docs/AppiumLibrary.html index 54159dde..d593ce1f 100644 --- a/docs/AppiumLibrary.html +++ b/docs/AppiumLibrary.html @@ -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