@@ -11,6 +11,21 @@ def __init__(self):
1111 self ._timeout_in_secs = float (5 )
1212
1313 def open_application (self , remote_url , alias = None , ** kwargs ):
14+ """Opens a new application to given Appium server.
15+
16+ *Note*: You must specify automationName capability as 'flutter', so the
17+ FlutterDriver is enabled.
18+
19+ Capabilities of appium server, Android and iOS,
20+ Please check https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/server-args.md
21+ | *Option* | *Man.* | *Description* |
22+ | remote_url | Yes | Appium server url |
23+ | alias | no | alias |
24+
25+ Examples:
26+ | Open Application | http://localhost:4723/wd/hub | alias=Myapp1 | automationName=flutter | platformName=iOS | platformVersion=7.0 | deviceName='iPhone Simulator' | app=your.app |
27+ | Open Application | http://localhost:4723/wd/hub | platformName=Android | automationName=flutter | platformVersion=4.2.2 | deviceName=192.168.56.101:5555 | app=${CURDIR}/demoapp/OrangeDemoApp.apk | appPackage=com.netease.qa.orangedemo | appActivity=MainActivity |
28+ """
1429 desired_caps = kwargs
1530 if desired_caps ['automationName' ] != 'flutter' :
1631 raise ValueError ("Appium Flutter Library only suports flutter automation. Try changing automationName capability to 'flutter'" )
@@ -23,26 +38,73 @@ def reset_application(self):
2338 self ._current_application ().reset ()
2439
2540 def close_all_applications (self ):
41+ """Closes all open applications.
42+
43+ This keyword is meant to be used in test or suite teardown to
44+ make sure all the applications are closed before the test execution
45+ finishes.
46+
47+ After this keyword, the application indices returned by `Open Application`
48+ are reset and start from `1`.
49+ """
2650 self ._debug ("Closing all applications" )
2751 self ._cache .close_all ()
2852
2953 def close_application (self ):
54+ """Closes the current application and also close webdriver session."""
3055 self ._debug ("Closing current apllication" )
3156 self ._cache .close ()
3257
3358 def background_app (self , seconds = 5 ):
59+ """
60+ Puts the application in the background on the device for a certain
61+ duration in seconds.
62+ """
3463 self ._current_application ().background_app (seconds )
3564
3665 def lock (self , seconds = 5 ):
66+ """
67+ Lock the device for a certain period of time. iOS only.
68+ """
3769 self ._current_application ().lock (robot .utils .timestr_to_secs (seconds ))
3870
3971 def portrait (self ):
72+ """
73+ Set the device orientation to PORTRAIT
74+ """
4075 self ._rotate ("PORTRAIT" )
4176
77+ def landscape (self ):
78+ """
79+ Set the device orientation to LANDSCAPE
80+ """
81+ self ._rotate ('LANDSCAPE' )
82+
4283 def touch_id (self , match = True ):
84+ """
85+ Simulate Touch ID on iOS Simulator
86+ `match` (boolean) whether the simulated fingerprint is valid (default true)
87+
88+ New in AppiumLibrary 1.5
89+ """
4390 self ._current_application ().touch_id (match )
4491
4592 def set_appium_timeout (self , seconds ):
93+ """Sets the timeout in seconds used by various keywords.
94+
95+ There are several `Wait ...` keywords that take timeout as an
96+ argument. All of these timeout arguments are optional. The timeout
97+ used by all of them can be set globally using this keyword.
98+
99+ The previous timeout value is returned by this keyword and can
100+ be used to set the old value back later. The default timeout
101+ is 5 seconds, but it can be altered in `importing`.
102+
103+ Example:
104+ | ${orig timeout} = | Set Appium Timeout | 15 seconds |
105+ | Open page that loads slowly |
106+ | Set Appium Timeout | ${orig timeout} |
107+ """
46108 old_timeout = self .get_appium_timeout ()
47109 self ._timeout_in_secs = robot .utils .timestr_to_secs (seconds )
48110 return old_timeout
0 commit comments