File tree 5 files changed +62
-3
lines changed
5 files changed +62
-3
lines changed Original file line number Diff line number Diff line change @@ -273,8 +273,9 @@ def quit_driver
273
273
# @core.appium_server_version
274
274
# {
275
275
# "build" => {
276
- # "version" => "0.18.1",
277
- # "revision" => "d242ebcfd92046a974347ccc3a28f0e898595198"
276
+ # "version" => "1.9.2",
277
+ # "git-sha" => "fd7c7fd19d3896719616cd970229d73e63b5271a",
278
+ # "built" => "2018-11-08 12:24:02 +0900"
278
279
# }
279
280
# }
280
281
#
Original file line number Diff line number Diff line change 5
5
# rubocop:disable Style/ClassVars
6
6
class AppiumLibCoreTest
7
7
module Ios
8
+ # @since Appium 1.9.0
9
+ # Need `npm install -g appium opencv4nodejs`
8
10
class ImageComparisionTest < AppiumLibCoreTest ::Function ::TestCase
9
11
def setup
10
12
@@core ||= ::Appium ::Core . for ( Caps . ios )
11
13
@@driver ||= @@core . start_driver
12
14
end
13
15
14
16
def test_image_comparison_match_result
17
+ skip 'Requres `npm install -g appium opencv4nodejs`' if `which opencv4nodejs` . empty?
18
+
15
19
image1 = File . read './test/functional/data/test_normal.png'
16
20
image2 = File . read './test/functional/data/test_has_blue.png'
17
21
@@ -27,6 +31,8 @@ def test_image_comparison_match_result
27
31
end
28
32
29
33
def test_image_comparison_find_result
34
+ skip 'Requres `npm install -g appium opencv4nodejs`' if `which opencv4nodejs` . empty?
35
+
30
36
image1 = File . read './test/functional/data/test_normal.png'
31
37
image2 = File . read './test/functional/data/test_has_blue.png'
32
38
@@ -42,6 +48,8 @@ def test_image_comparison_find_result
42
48
end
43
49
44
50
def test_image_comparison_get_images_result
51
+ skip 'Requres `npm install -g appium opencv4nodejs`' if `which opencv4nodejs` . empty?
52
+
45
53
image1 = File . read './test/functional/data/test_normal.png'
46
54
image2 = File . read './test/functional/data/test_has_blue.png'
47
55
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ def teardown
16
16
17
17
# Can view via http://localhost:9100 by default
18
18
def test_config
19
+ skip 'It requires Appium 1.9.2' unless AppiumLibCoreTest . required_appium_version? ( @@core , '1.9.2' )
20
+
19
21
@@driver . update_settings ( { mjpegServerScreenshotQuality : 10 , mjpegServerFramerate : 1 } )
20
22
@@driver . update_settings ( { mjpegServerScreenshotQuality : 0 , mjpegServerFramerate : -100 } )
21
23
@@driver . update_settings ( { mjpegServerScreenshotQuality : -10 , mjpegServerFramerate : 60 } )
Original file line number Diff line number Diff line change
1
+ require 'test_helper'
2
+
3
+ # $ rake test:func:ios TEST=test/functional/ios/ios/mobile_commands_test.rb
4
+ class AppiumLibCoreTest
5
+ class DriverTest < AppiumLibCoreTest ::Function ::TestCase
6
+ def teardown
7
+ save_reports ( @driver )
8
+ end
9
+
10
+ # @since Appium 1.9.2
11
+ # Requires simulator
12
+ def test_permission
13
+ caps = Caps . ios . dup
14
+ caps [ :caps ] [ :permissions ] = '{"com.example.apple-samplecode.UICatalog": { "calendar": "YES", "photos": "no" }}'
15
+ core = ::Appium ::Core . for ( caps )
16
+ @driver = core . start_driver
17
+
18
+ assert @driver . execute_script ( 'mobile: getPermission' ,
19
+ { service : 'calendar' , bundleId : 'com.example.apple-samplecode.UICatalog' } ) == 'yes'
20
+ assert @driver . execute_script ( 'mobile: getPermission' ,
21
+ { service : 'photos' , bundleId : 'com.example.apple-samplecode.UICatalog' } ) == 'no'
22
+
23
+ @driver . activate_app ( 'com.apple.Preferences' )
24
+ @driver . find_element ( :accessibility_id , 'Privacy' ) . click
25
+
26
+ @driver . find_element ( :accessibility_id , 'Calendars' ) . click
27
+ el = @driver . find_element ( :accessibility_id , 'UICatalog' )
28
+ assert_equal '1' , el . value
29
+
30
+ @driver . back
31
+
32
+ @driver . find_element ( :accessibility_id , 'Photos' ) . click
33
+ el = @driver . find_element ( :accessibility_id , 'Never' )
34
+ assert_equal 'Never' , el . value
35
+ end
36
+ end
37
+ end
Original file line number Diff line number Diff line change @@ -37,6 +37,15 @@ def save_reports(driver)
37
37
end
38
38
39
39
class AppiumLibCoreTest
40
+ def self . required_appium_version? ( core_driver , required )
41
+ version = core_driver . appium_server_version
42
+
43
+ return false if version . empty?
44
+
45
+ v = version [ 'build' ] [ 'version' ] . split ( '-' ) # 1.9.2-beta.2
46
+ v >= required . to_s
47
+ end
48
+
40
49
class Caps
41
50
def self . ios
42
51
new . ios
@@ -67,7 +76,9 @@ def ios
67
76
someCapability : 'some_capability' ,
68
77
newCommandTimeout : 120 ,
69
78
wdaLocalPort : wda_local_port ,
70
- waitForQuiescence : false
79
+ # `true`, which is the default value, is faster to finishing launching part in many cases
80
+ # But sometimes `false` is necessary. It leads regressions sometimes though.
81
+ waitForQuiescence : true
71
82
} ,
72
83
appium_lib : {
73
84
export_session : true ,
You can’t perform that action at this time.
0 commit comments