appium-uiautomator2-driver 2.4.0 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +27 -32
  2. package/npm-shrinkwrap.json +5218 -37298
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -83,7 +83,7 @@ appium:enforceAppInstall | If set to `true` then the application under test is a
83
83
 
84
84
  Capability Name | Description
85
85
  --- | ---
86
- appium:localeScript | Canonical name of the locale to be set for the app under test, for example `zh-Hans-CN`. See https://developer.android.com/reference/java/util/Locale.html for more details.
86
+ appium:localeScript | Canonical name of the locale to be set for the app under test, for example `Hans` in `zh-Hans-CN`. See https://developer.android.com/reference/java/util/Locale.html for more details.
87
87
  appium:language | Name of the language to extract application strings for. Strings are extracted for the current system language by default. Also sets the language for the app under test. See https://developer.android.com/reference/java/util/Locale.html for more details. Example: en, ja
88
88
  appium:locale | Sets the locale for the app under test. See https://developer.android.com/reference/java/util/Locale.html for more details. Example: EN, JA
89
89
 
@@ -804,8 +804,7 @@ Name | Type | Required | Description | Example
804
804
  resolution | string | no | The resolution of the resulting video, which usually equals to Full HD 1920x1080 on most phones, however you could change it to one of the following supported resolutions: "1920x1080", "1280x720", "720x480", "320x240", "176x144" | 1280x720
805
805
  maxDurationSec | number | no | The maximum number of seconds allowed for the recording to run. 900 seconds by default (15 minutes) | 300
806
806
  priority | string | no | Recording thread priority is set to maximum (`high`) by default. However if you face performance drops during testing with recording enabled, you could reduce the recording priority to `normal` or `low`. | low
807
- filename | string | no | You can type recording video file name as you want,
808
- but recording currently supports only "mp4" format so your filename must end with ".mp4". An invalid file name will fail to start the recording. If not provided then the current timestamp will be used as file name. | screen.mp4
807
+ filename | string | no | You can type recording video file name as you want, but recording currently supports only "mp4" format so your filename must end with ".mp4". An invalid file name will fail to start the recording. If not provided then the current timestamp will be used as file name. | screen.mp4
809
808
 
810
809
  #### Returned Result
811
810
 
@@ -895,42 +894,38 @@ Useful links:
895
894
  import pytest
896
895
 
897
896
  from appium import webdriver
897
+ # Options are available in Python client since v2.6.0
898
+ from appium.options.android import UiAutomator2Options
898
899
 
899
900
 
900
- def generate_caps():
901
+ def generate_options():
901
902
  common_caps = {
902
- # automationName capability presence is mandatory for this UiAutomator2 Driver to be selected
903
- 'appium:automationName': 'UiAutomator2',
904
- 'platformName': 'linux',
905
- # The real device udid could be retrieved from `adb devices -l` output
906
- # If it is omitted then the first available device will be used
903
+ # A real device udid could be retrieved from `adb devices -l` output
904
+ # If it is ommitted then the first available device will be used
907
905
  'appium:udid': '123456',
908
- # Or run the test on the emulator
906
+ # ...or run the test on an emulator
909
907
  # 'appium:avd': 'emulator-5554',
910
908
  }
911
- app_caps = {
912
- **common_caps,
913
- 'appium:app': '/Projects/myapp.apk',
914
- # It might also be necessary to provide more info about app activities
915
- # Read https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md
916
- # for more details
917
- # 'appium:appPackage': 'com.mypackage',
918
- # 'appium:appActivity': '.myMainActivity',
919
- # 'appium:appWaitActivity': '.mySplashScreenActivity',
920
- }
921
- browser_caps = {
922
- **common_caps,
923
- 'browserName': 'chrome',
924
- # Read https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md
925
- # Read https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/hybrid.md
926
- 'appium:chromedriverExecutable': '/Project/chromedriver_linux64',
927
- }
928
- return [app_caps, browser_caps]
929
-
930
-
931
- @pytest.fixture(params=generate_caps())
909
+ app_options = UiAutomator2Options().load_capabilities(common_caps)
910
+ app_options.app = '/Projects/myapp.apk'
911
+ # It might also be necessary to provide more info about app activities
912
+ # Read https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md
913
+ # for more details
914
+ # app_options.appPackage = 'com.mypackage'
915
+ # app_options.appActivity = '.myMainActivity'
916
+ # app_options.appWaitActivity = '.mySplashScreenActivity'
917
+ chrome_options = UiAutomator2Options().load_capabilities(common_caps)
918
+ chrome_options.browser_name = 'chrome'
919
+ # Read https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md
920
+ # Read https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/hybrid.md
921
+ chrome_options.chromedriver_executable = '/Project/chromedriver_linux64'
922
+ return [app_options, chrome_options]
923
+
924
+
925
+ @pytest.fixture(params=generate_options())
932
926
  def driver(request):
933
- drv = webdriver.Remote('http://localhost:4723/wd/hub', request.param)
927
+ # The default URL is http://127.0.0.1:4723/wd/hub in Appium1
928
+ drv = webdriver.Remote('http://localhost:4723', options=request.param)
934
929
  yield drv
935
930
  drv.quit()
936
931