yi_appium_caps_util 1.0.7 → 1.0.8

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: 74c28bbcfc62227846b11eee48b0590ed94ba29b
4
- data.tar.gz: 71fe978783b00f7d6b55499b97825346c3fb3647
3
+ metadata.gz: 1ca504ee42f48587e5acd5e8d10a1c885841db14
4
+ data.tar.gz: 1b20fe97ff333588cb7704a7d149e39e251ea383
5
5
  SHA512:
6
- metadata.gz: 2f38e1bfad5f45aa6f6505098a3e135745bdcfbdb3b5fd7a477eba1c39982a5ad946d84c09b58769d198ef53b1fb997a42e1251c458dac050935e01d551ecab9
7
- data.tar.gz: 6b3dfd61bc0a2f86bec5e75ed0a10073db45504e0135b5969b596265cb5b165facce11e4e539fd8da146f5388662ca1d7602b5084f54efa918f37b02bf373ed6
6
+ metadata.gz: 4e3018b3a57f2db7146c5ac8c45162afba2b6258082404d2043349cbb9d4b00587d2726d3fc5ce839b6e34b34c2a7bcfe1d1371013ff7cbe2c596786d1d54d11
7
+ data.tar.gz: f54f8b8db42c996ab8f85c213769709128a143cf88f69d63eeea7e8c9ccc2397fc915ed0db8f640f44919a29b4abe755b4230cbb4ab925e79608ce65c6b5b86b
Binary file
@@ -10,6 +10,8 @@ options = {}
10
10
  OptionParser.new do |opts|
11
11
  opts.banner = "You.i Utility for appium.txt capabilities"
12
12
  puts opts.banner
13
+ platforms = "Supported platforms: ios, android, mac, yimac, yitvos"
14
+ puts platforms
13
15
 
14
16
  opts.on("-cPLATFORM", "--create PLATFORM", "creates the appium.txt file for specified platform") do |c|
15
17
  options[:create_caps] = c
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env ruby
1
2
  require "ipaddress"
2
3
  require 'socket'
3
4
  require 'toml'
@@ -54,7 +55,7 @@ class YiAppiumCapsUtil
54
55
 
55
56
  private
56
57
 
57
- # Helper function used in creating ios specefic caps
58
+ # Helper function used in creating ios specific caps
58
59
  def getTeamID()
59
60
  path = "/Library/MobileDevice/Provisioning Profiles".shellescape
60
61
  `ln -s ~#{path} ./temp`
@@ -96,6 +97,8 @@ class YiAppiumCapsUtil
96
97
  update_mac_caps (output_data)
97
98
  when 'yimac'
98
99
  update_mac_caps (output_data)
100
+ when 'yitvos'
101
+ update_tvos_caps (output_data)
99
102
  else
100
103
  puts "ERROR: platformName '#{platformName_value}' is not supported"
101
104
  exit
@@ -156,9 +159,11 @@ class YiAppiumCapsUtil
156
159
  puts "Launching getIP app"
157
160
  #Launching app and putting (5 seconds of) log into file
158
161
  ipcounter = 1
162
+ sleepSec = 7
159
163
  while ipcounter <= 5 do
160
164
  puts "Try \# #{ipcounter}"
161
- logs = %x[ios-deploy --justlaunch --bundle #{myApp} & (idevicesyslog) & sleep 7 ; kill $!]
165
+ puts "Sleep: #{sleepSec} secs"
166
+ logs = %x[ios-deploy --justlaunch --bundle #{myApp} & (idevicesyslog) & sleep #{sleepSec} ; kill $!]
162
167
  File.write('logs.txt', logs)
163
168
  #Getting ip from file
164
169
  ip = %x[grep -Eo "youiEngineAppAddress.*" logs.txt | head -1 | awk '{print $3}'| tr -d '"']
@@ -167,9 +172,10 @@ class YiAppiumCapsUtil
167
172
  puts 'IP Address: ' + ip
168
173
  if (ip == "")
169
174
  ipcounter +=1
175
+ sleepSec +=5
170
176
  else
171
177
  #Found it!
172
- ipcounter = 999
178
+ break
173
179
  end
174
180
  end
175
181
  # Get the device name before deleting the file
@@ -213,6 +219,57 @@ class YiAppiumCapsUtil
213
219
  raise "An error of type #{ex.class} happened, message is #{ex.message}"
214
220
  end
215
221
 
222
+ def update_tvos_caps (output_data)
223
+ #Replace value of deviceName
224
+ output_data['caps']['deviceName'] = "Apple TV"
225
+ output_data['parameters']['formFactor'] = "10foot"
226
+
227
+ if (output_data['caps']['skipYouiEngineAppAddress'] != nil)
228
+ puts
229
+ puts 'Skiping IP check since skipYouiEngineAppAddress is present in appium.txt'
230
+ else
231
+ puts 'Searching for IP, this may take a few seconds...'
232
+
233
+ # uswish/Test/tools/getIOSIP
234
+ myAppFolder = File.dirname(__FILE__) + "/../app/"
235
+ myApp = myAppFolder + "getIP.app"
236
+ myZipApp = myAppFolder + "getIP-tvOS.zip"
237
+ %x[unzip -o #{myZipApp} -d #{myAppFolder}]
238
+
239
+ puts "Launching getIP app"
240
+ #Launching app and putting (5 seconds of) log into file
241
+ ipcounter = 1
242
+ sleepSec = 7
243
+ while ipcounter <= 5 do
244
+ puts "Try \# #{ipcounter}"
245
+ puts "Sleep: #{sleepSec} sec"
246
+ logs = %x[ios-deploy --justlaunch --bundle #{myApp} & (idevicesyslog) & sleep #{sleepSec} ; kill $!]
247
+ File.write('logs.txt', logs)
248
+ #Getting ip from file
249
+ ip = %x[grep -Eo "IPAddress.*" logs.txt | head -1 | awk '{print $3}'| tr -d '"']
250
+ #Remove whitespace
251
+ ip = ip.strip
252
+ puts 'IP Address: ' + ip
253
+ if (ip == "")
254
+ ipcounter +=1
255
+ sleepSec +=5
256
+ else
257
+ #Found it!
258
+ break
259
+ end
260
+ end
261
+ File.delete('logs.txt')
262
+ #Replace value of ip if found
263
+ if (ip != '') then
264
+ output_data['caps']['youiEngineAppAddress'] = ip
265
+ else
266
+ puts "Update ip address manually"
267
+ end
268
+ end
269
+ rescue Exception, RuntimeError => ex
270
+ raise "An error of type #{ex.class} happened, message is #{ex.message}"
271
+ end
272
+
216
273
  def write_caps(caps_file_name, output_data)
217
274
  #Write the new caps to file
218
275
  doc = TOML::Generator.new(output_data).body
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.7
4
+ version: 1.0.8
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: 2018-06-05 00:00:00.000000000 Z
13
+ date: 2018-07-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ipaddress
@@ -40,8 +40,8 @@ dependencies:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
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
43
+ description: This utility updates the caps for iOS, Android macOS and tvOS devices.
44
+ Please refer to homepage for further details on usage
45
45
  email: simon.granger@youi.tv
46
46
  executables:
47
47
  - yi_appium_caps_util
@@ -49,6 +49,7 @@ extensions: []
49
49
  extra_rdoc_files: []
50
50
  files:
51
51
  - app/getIOSIP.zip
52
+ - app/getIP-tvOS.zip
52
53
  - bin/yi_appium_caps_util
53
54
  - lib/yi_appium_caps_util.rb
54
55
  homepage: https://github.com/YOU-i-Labs/yi_appium_caps_util
@@ -74,5 +75,5 @@ rubyforge_project:
74
75
  rubygems_version: 2.6.13
75
76
  signing_key:
76
77
  specification_version: 4
77
- summary: Updates your appium.txt capabilities for iOS and Android
78
+ summary: Updates your appium.txt capabilities for iOS, Android, macOS and tvOS
78
79
  test_files: []