yi_appium_caps_util 1.0.6 → 1.0.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c24c7da614da4a53449dae6497bc91455ff2c4d2
4
- data.tar.gz: eaaba695007d06ba2c154e0f47568e1386914252
3
+ metadata.gz: 74c28bbcfc62227846b11eee48b0590ed94ba29b
4
+ data.tar.gz: 71fe978783b00f7d6b55499b97825346c3fb3647
5
5
  SHA512:
6
- metadata.gz: a413f8114c8e9d82dde2bf8491317d37a1f55dc034071e151228efec16806ffb89a0a87a19dd6fe14d9fce3e4b305c597b562571c2f50642b24ba7cfbef3faef
7
- data.tar.gz: 596fcbf9eb9b6bb597994753e97ae33461d6cb05a394bef71634e8e970b3ca14d36764daa1584e91a7e00ee0e23acee7c99b4d1d3f7b8ec08f70a42517a9fda1
6
+ metadata.gz: 2f38e1bfad5f45aa6f6505098a3e135745bdcfbdb3b5fd7a477eba1c39982a5ad946d84c09b58769d198ef53b1fb997a42e1251c458dac050935e01d551ecab9
7
+ data.tar.gz: 6b3dfd61bc0a2f86bec5e75ed0a10073db45504e0135b5969b596265cb5b165facce11e4e539fd8da146f5388662ca1d7602b5084f54efa918f37b02bf373ed6
@@ -11,23 +11,29 @@ OptionParser.new do |opts|
11
11
  opts.banner = "You.i Utility for appium.txt capabilities"
12
12
  puts opts.banner
13
13
 
14
- opts.on("-u", "--update [PLATFORM]", "update device ID and IP address") do |p|
15
- options[:update] = true
16
- options[:platform] = p
17
- end
18
14
  opts.on("-cPLATFORM", "--create PLATFORM", "creates the appium.txt file for specified platform") do |c|
19
15
  options[:create_caps] = c
20
16
  end
21
17
  opts.on("-fFILE", "--file FILE", "capabilities path and file name (default: ./appium.txt)") do |f|
22
18
  options[:file] = f
23
19
  end
20
+ opts.on("-u", "--update [PLATFORM]", "update device ID and IP address") do |p|
21
+ options[:update] = true
22
+ options[:platform] = p
23
+ end
24
+ opts.on("-xFORMFACTOR", "--formfactor FORMFACTOR", "update the form factor") do |x|
25
+ options[:form_factor] = x
26
+ end
24
27
  opts.on("-h", "--help", "Prints this help") do
25
28
  puts opts
26
29
  exit
27
30
  end
28
31
  end.parse!
29
32
 
30
- raise "You should pass -u or -c PLATFORM as an input argument. Type -h for help" if options[:update] == nil and options[:create_caps] == nil
33
+ if options[:update] == nil and options[:create_caps] == nil
34
+ puts "You should pass -u or -c PLATFORM as an input argument. Type -h for help"
35
+ exit
36
+ end
31
37
 
32
38
  if options[:update]
33
39
  if options[:file] && options[:platform]
@@ -42,5 +48,9 @@ if options[:update]
42
48
  end
43
49
 
44
50
  if options[:create_caps]
45
- YiAppiumCapsUtil.create(options[:create_caps].downcase)
51
+ if options[:create_caps] && options[:form_factor]
52
+ YiAppiumCapsUtil.create(options[:create_caps].downcase, options[:form_factor].downcase)
53
+ elsif options[:create_caps]
54
+ YiAppiumCapsUtil.create(options[:create_caps].downcase, "handheld")
55
+ end
46
56
  end
@@ -24,12 +24,27 @@ class YiAppiumCapsUtil
24
24
  end
25
25
  end
26
26
 
27
- def create (platform_name)
27
+ def create (platform_name, form_factor)
28
+ form_factors = ["handheld", "tablet", "10foot"]
29
+
30
+ found = false
31
+ form_factors.each do |i|
32
+ if i == form_factor
33
+ found = true
34
+ end
35
+ end
36
+
37
+ if found == false
38
+ puts "ERROR: formFactor: '#{form_factor}' is not supported (#{form_factors})"
39
+ exit
40
+ end
41
+
28
42
  template = {"caps"=>{"app"=>"",
29
43
  "automationName"=>"YouiEngine",
30
44
  "deviceName"=>"DeviceName",
31
45
  "platformName"=>"#{platform_name}",
32
- "youiEngineAppAddress"=>""}}
46
+ "youiEngineAppAddress"=>""},
47
+ "parameters"=>{"formFactor"=>"#{form_factor}"}}
33
48
 
34
49
  File.open("./appium.txt","w") do |f|
35
50
  f.puts(TOML::Generator.new(template).body)
@@ -77,8 +92,13 @@ class YiAppiumCapsUtil
77
92
  update_android_caps (output_data)
78
93
  when 'ios'
79
94
  update_ios_caps (output_data)
95
+ when 'mac'
96
+ update_mac_caps (output_data)
97
+ when 'yimac'
98
+ update_mac_caps (output_data)
80
99
  else
81
- raise 'platformName: ' + platformName_value + ' is not supported'
100
+ puts "ERROR: platformName '#{platformName_value}' is not supported"
101
+ exit
82
102
  end
83
103
  return output_data
84
104
  end
@@ -102,12 +122,10 @@ class YiAppiumCapsUtil
102
122
  #Replace value of youiEngineAppAddress
103
123
  output_data['caps']['youiEngineAppAddress'] = new_address[0]
104
124
  puts 'IP address: ' + new_address[0]
105
- rescue RuntimeError => ex
106
- puts ex.message
107
- raise
108
- rescue Exception => ex
109
- puts "An error of type #{ex.class} happened, message is #{ex.message}"
110
- raise
125
+ #Add fullReset to have app reinstalled between runs
126
+ output_data['caps']['fullReset'] = true
127
+ rescue Exception, RuntimeError => ex
128
+ raise "An error of type #{ex.class} happened, message is #{ex.message}"
111
129
  end
112
130
 
113
131
  def update_ios_caps (output_data)
@@ -181,11 +199,18 @@ class YiAppiumCapsUtil
181
199
  elsif (xcodeBuildVersion.to_f>8) then
182
200
  puts "Change to xcode version to xcode 7! Current version is: "+xcodeBuildVersion
183
201
  end
202
+ end
203
+ rescue Exception, RuntimeError => ex
204
+ raise "An error of type #{ex.class} happened, message is #{ex.message}"
184
205
  end
185
206
 
186
- rescue Exception => ex
187
- puts "An error of type #{ex.class} happened, message is #{ex.message}"
188
- exit
207
+ def update_mac_caps (output_data)
208
+ #Replace value of deviceName
209
+ output_data['caps']['deviceName'] = "macOS device"
210
+ #Replace value of youiEngineAppAddress
211
+ output_data['caps']['youiEngineAppAddress'] = "localhost"
212
+ rescue Exception, RuntimeError => ex
213
+ raise "An error of type #{ex.class} happened, message is #{ex.message}"
189
214
  end
190
215
 
191
216
  def write_caps(caps_file_name, output_data)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yi_appium_caps_util
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Granger
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-11-21 00:00:00.000000000 Z
13
+ date: 2018-06-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ipaddress
@@ -32,16 +32,16 @@ dependencies:
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: 0.1.2
35
+ version: 0.2.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: 0.1.2
43
- description: This utility updates the caps for iOS and Android devices. Please refer
44
- to homepage for ruther details on usage
42
+ version: 0.2.0
43
+ description: This utility updates the caps for iOS, Android and macOS devices. Please
44
+ refer to homepage for ruther details on usage
45
45
  email: simon.granger@youi.tv
46
46
  executables:
47
47
  - yi_appium_caps_util
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  version: '0'
72
72
  requirements: []
73
73
  rubyforge_project:
74
- rubygems_version: 2.4.5.1
74
+ rubygems_version: 2.6.13
75
75
  signing_key:
76
76
  specification_version: 4
77
77
  summary: Updates your appium.txt capabilities for iOS and Android