9
9
10
10
class _ApplicationManagementKeyWords (KeywordGroup ):
11
11
def __init__ (self ):
12
- self ._cache = ApplicationCache
12
+ self ._cache = ApplicationCache ()
13
13
self ._timeout_in_secs = float (5 )
14
14
15
- def open_application (self , remote_url , alias = None , ** kwargs ):
15
+ def close_application (self ):
16
+ self ._cache .close ()
17
+
18
+ def open_application (self , remote_url , alias = None , ** kwargs ):
16
19
desired_caps = kwargs
17
- application = Remote (str (remote_url ), dict ( desired_caps ) )
20
+ application = Remote (str (remote_url ), desired_caps )
18
21
19
22
return self ._cache .register (application , alias )
20
23
21
- def login_to_application (self , remote_url , alias = None , ** kwargs ):
22
- driver = Remote ('http://localhost:4723/wd/hub' , dict (
23
- platformName = 'android' ,
24
- automationName = 'flutter' ,
25
- udid = 'emulator-5554' ,
26
- app = '/home/igortavtib/Projects/robotframework-appiumflutterlibrary/app-prod-debug.apk'
27
- ))
28
-
29
- finder = FlutterFinder ()
30
-
31
- key_finder = finder .by_value_key ('input-user' )
32
- input_element = FlutterElement (driver , key_finder )
33
- key_finder = finder .by_value_key ('input-password' )
34
- password_element = FlutterElement (driver , key_finder )
35
- driver .execute_script ('flutter:waitFor' , input_element )
36
- input_element .send_keys ('igoraugsto@gmail.com' )
37
- password_element .send_keys ('senha123' )
38
-
39
24
def set_appium_timeout (self , seconds ):
40
25
old_timeout = self .get_appium_timeout ()
41
26
self ._timeout_in_secs = robot .utils .timestr_to_secs (seconds )
@@ -45,4 +30,11 @@ def get_appium_timeout(self):
45
30
"""Gets the timeout in seconds that is used by various keywords.
46
31
47
32
See `Set Appium Timeout` for an explanation."""
48
- return robot .utils .secs_to_timestr (self ._timeout_in_secs )
33
+ return robot .utils .secs_to_timestr (self ._timeout_in_secs )
34
+
35
+ # Private
36
+
37
+ def _current_application (self ):
38
+ if not self ._cache .current :
39
+ raise RuntimeError ('No application is open' )
40
+ return self ._cache .current
0 commit comments