@@ -609,7 +609,9 @@ def background_app(duration = 0)
609
609
@bridge . background_app ( duration )
610
610
end
611
611
612
- # Install the given app onto the device
612
+ # Install the given app onto the device.
613
+ # Each options can be snake-case or camel-case. Snake-cases will be converted to camel-case
614
+ # as options value.
613
615
#
614
616
# @param [String] path The absolute local path or remote http URL to an .ipa or .apk file,
615
617
# or a .zip containing one of these.
@@ -623,26 +625,26 @@ def background_app(duration = 0)
623
625
# @param [Boolean] grant_permissions Only for Android. whether to automatically grant application permissions
624
626
# on Android 6+ after the installation completes. +false+ by default
625
627
#
628
+ # Other parameters such as https://github.com/appium/appium-xcuitest-driver#mobile-installapp also can be set.
629
+ # Then, arguments in snake case will be camel case as its request parameters.
630
+ #
626
631
# @example
627
632
#
628
633
# @driver.install_app("/path/to/test.apk")
629
634
# @driver.install_app("/path/to/test.apk", replace: true, timeout: 20000, allow_test_packages: true,
630
635
# use_sdcard: false, grant_permissions: false)
636
+ # @driver.install_app("/path/to/test.ipa", timeoutMs: 20000)
631
637
#
632
- def install_app ( path ,
633
- replace : nil ,
634
- timeout : nil ,
635
- allow_test_packages : nil ,
636
- use_sdcard : nil ,
637
- grant_permissions : nil )
638
- @bridge . install_app ( path ,
639
- replace : replace ,
640
- timeout : timeout ,
641
- allow_test_packages : allow_test_packages ,
642
- use_sdcard : use_sdcard ,
643
- grant_permissions : grant_permissions )
638
+ def install_app ( path , **options )
639
+ options = options . transform_keys { |key | key . to_s . gsub ( /_./ ) { |v | v [ 1 ] . upcase } } unless options . nil?
640
+ @bridge . install_app ( path , options )
644
641
end
645
642
643
+ # def capitalize(s)
644
+ # chars =
645
+ # chars[1:].map(&:capitalize).join
646
+ # end
647
+
646
648
# @param [Strong] app_id BundleId for iOS or package name for Android
647
649
# @param [Boolean] keep_data Only for Android. Whether to keep application data and caches after it is uninstalled.
648
650
# +false+ by default
0 commit comments