cuesmash 0.3.0 → 0.4.0

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: 2c36e405e7913aac8f74cfead621aed03042e134
4
- data.tar.gz: 92cf770512a727db44de69656ae2be89c0ccfa12
3
+ metadata.gz: 9f5afcc77195c37550088258b91cc798effe35cd
4
+ data.tar.gz: 82a4396920644a9287d48c21f9fd586f4d3a3bd8
5
5
  SHA512:
6
- metadata.gz: 95c7053653f4301113b695ab165e31497a5ba57dfdd85cd871234feab371684e9400b74ef08edebe53e18c5efd0999fc1821616f4e440238f3340604f73456fe
7
- data.tar.gz: d65680d7d616249ae8ee301e12ea7411bd8691da122d75d30c9e3bc812e45257ab2ae0abb32615181e179c6311bff4d0aaa322e33662521c0b6b071c86127d8b
6
+ metadata.gz: d45d408c5e264941d3008790e599cf56cc352bc6c80ca4da8c2cc450289e8aca887362076a64591d3914f757011ce509fe01b35dfc3c180647a977566972b734
7
+ data.tar.gz: 77d98e64e724916e0a8098a446d66d78f943aacd4d4230250f659fffaf1a40995d7b931f030a46287ff35cd2c8153733fd0806b019abca9301651c850a58a9d0
data/.cuesmash.yml CHANGED
@@ -2,24 +2,29 @@
2
2
  # iOS Example
3
3
  devices:
4
4
  iPhone 6:
5
- [8.3]
5
+ 8.3: 'bd79098904d9b93a418ac821db8372ee7374cf82'
6
+ 9.0:
6
7
 
7
8
  iPhone 5s:
8
- [7.1, 8.3]
9
+ 7.1:
10
+ 8.3:
9
11
 
10
12
  iPhone 4s:
11
- [7.1, 8.3]
13
+ 7.1:
14
+ 8.3:
12
15
 
13
16
  iPhone 5:
14
- [7.1, 8.3]
17
+ 7.1:
18
+ 8.3:
15
19
 
16
20
  iPhone 6 Plus:
17
- [8.3]
21
+ 8.3:
18
22
 
19
23
  default:
20
24
  os: iPhone 6
21
25
  version: 8.3
22
26
  test_timeout: 120
27
+ uuid: 'bd79098904d9b93a418ac821db8372ee7374cf82'
23
28
 
24
29
  platform: 'iOS'
25
30
  build_configuration: 'Debug'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cuesmash (0.3.0)
4
+ cuesmash (0.4.0)
5
5
  rest-client (~> 1.7.2)
6
6
  thor (>= 0.19.1)
7
7
  xcpretty (>= 0.1.10)
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Alex Fish
1
+ Copyright (c) 2015 ustwo
2
2
 
3
3
  MIT License
4
4
 
data/cuesmash.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "cuesmash"
7
- spec.version = "0.3.0"
7
+ spec.version = "0.4.0"
8
8
  spec.authors = ["Alex Fish", "Jarod McBride", "Tiago Castro"]
9
9
  spec.email = ["fish@ustwo.co.uk", "jarod@ustwo.com", "castro@ustwo.com"]
10
10
  spec.description = "Appium project manager"
@@ -14,10 +14,14 @@ module Cuesmash
14
14
  # Public: the output format for the tests
15
15
  attr_accessor :format
16
16
 
17
+ # Public: uuid of ios device to run test on.
18
+ attr_accessor :ios_uuid
19
+
17
20
  #
18
21
  # Create a new instance of AppiumServer
19
22
  #
20
- def initialize
23
+ def initialize(ios_uuid: nil)
24
+ @ios_uuid = ios_uuid
21
25
  end
22
26
 
23
27
  #
@@ -26,7 +30,8 @@ module Cuesmash
26
30
  def start_server
27
31
  started
28
32
 
29
- command = 'appium --log-level debug'
33
+ command = 'appium --log-level debug '
34
+ command << "--udid #{@ios_uuid} --session-override " unless @ios_uuid.nil?
30
35
 
31
36
  @stdin, @stdout, @stderr, @wait_thr = Open3.popen3(command)
32
37
  Logger.info "Appium running with pid: #{@wait_thr.pid}"
@@ -36,7 +36,8 @@ module Cuesmash
36
36
  app:,
37
37
  profile:,
38
38
  quiet: false,
39
- timeout:)
39
+ timeout:,
40
+ ios_uuid: nil)
40
41
  if debug
41
42
  Logger.level = ::Logger::DEBUG
42
43
  Logger.formatter = proc do |serverity, time, _progname, msg|
@@ -51,7 +52,11 @@ module Cuesmash
51
52
  create_appium_txt(app: app.app_path, device_name: device, platform_version: os, timeout: timeout)
52
53
 
53
54
  # start the appium server
54
- app_server = AppiumServer.new
55
+ if @ios_uuid
56
+ app_server = AppiumServer.new(ios_uuid: ios_uuid)
57
+ else
58
+ app_server = AppiumServer.new
59
+ end
55
60
  app_server.start_server
56
61
 
57
62
  # Run the tests
@@ -11,7 +11,8 @@ module Cuesmash
11
11
  # Public: the path to the dir containing the built app i.e. /tmp/MyAppQWERQW/Build/Products/Debug-iphonesimulator/
12
12
  attr_reader :app_dir
13
13
 
14
- # Public: the full path including the built app i.e. /tmp/MyAppQWERQW/Build/Products/Debug-iphonesimulator/MyApp.app"
14
+ # Public: the full path including the built app
15
+ # i.e. /tmp/MyAppQWERQW/Build/Products/Debug-iphonesimulator/MyApp.app"
15
16
  attr_reader :app_path
16
17
 
17
18
  # Public: the app name i.e. MyApp.app
@@ -23,18 +24,23 @@ module Cuesmash
23
24
  #
24
25
  # Create a new App instance
25
26
  #
26
- # @param file_name [String] The usually is the scheme of the xcode project
27
- # @param build_configuration [String] which iOS build configuration to run i.e. Release, Debug
27
+ # @param [String] file_name: This usually is the scheme of the xcode project
28
+ # @param [String] build_configuration: which iOS build configuration to run i.e. Release, Debug
29
+ # @param [String] app_name: name of the app
30
+ # @param [String] device: nil the UUID of the device to run on or nil if running on simulator
28
31
  #
29
- # @return [App] A app instance
30
- def initialize(file_name:, build_configuration:, app_name:)
32
+ def initialize(file_name:, build_configuration:, app_name:, device: nil)
31
33
  app_name = file_name if app_name.nil?
32
34
 
33
35
  @app_name = "#{app_name}" << '.app'
34
36
  @tmp_dir = Dir.mktmpdir(app_name)
35
37
  @build_configuration = build_configuration
36
38
 
37
- @app_dir = "#{@tmp_dir}" << "/#{@build_configuration}-iphonesimulator/"
39
+ if device.nil?
40
+ @app_dir = "#{@tmp_dir}" << "/#{@build_configuration}-iphonesimulator/"
41
+ else
42
+ @app_dir = "#{@tmp_dir}" << "/#{@build_configuration}-iphoneos/"
43
+ end
38
44
 
39
45
  @app_path = "#{@app_dir}" << "#{@app_name}"
40
46
  end
@@ -11,10 +11,11 @@ module Cuesmash
11
11
  attr_accessor :tmp_dir
12
12
  attr_accessor :build_configuration
13
13
 
14
- def initialize(scheme:, tmp_dir:, build_configuration:)
14
+ def initialize(scheme:, tmp_dir:, build_configuration:, device: nil)
15
15
  @scheme = scheme
16
16
  @tmp_dir = tmp_dir
17
17
  @build_configuration = build_configuration
18
+ @device = device
18
19
  end
19
20
 
20
21
  #
@@ -23,7 +24,16 @@ module Cuesmash
23
24
  #
24
25
  # @return [String] The full xcode build command with args
25
26
  def command
26
- xcode_command = "set -o pipefail && xcodebuild #{workspace} -scheme '#{@scheme}' -derivedDataPath #{@tmp_dir.shellescape} -configuration #{@build_configuration} OBJROOT=#{@tmp_dir.shellescape} SYMROOT=#{@tmp_dir.shellescape} -sdk iphonesimulator build | bundle exec xcpretty -c"
27
+ xcode_command = 'set -o pipefail '
28
+ xcode_command << "&& xcodebuild #{workspace} "
29
+ xcode_command << "-scheme '#{@scheme}' "
30
+ xcode_command << "-derivedDataPath #{@tmp_dir.shellescape} "
31
+ xcode_command << "-configuration #{@build_configuration} "
32
+ xcode_command << "OBJROOT=#{@tmp_dir.shellescape} "
33
+ xcode_command << "SYMROOT=#{@tmp_dir.shellescape} "
34
+ xcode_command << '-sdk iphonesimulator ' if @device.nil?
35
+ xcode_command << 'build '
36
+ xcode_command << '| bundle exec xcpretty -c'
27
37
 
28
38
  Logger.info "xcode_command == #{xcode_command}"
29
39
  xcode_command
@@ -16,6 +16,9 @@ module Cuesmash
16
16
 
17
17
  # For information on how this class works see the thor documentation https://github.com/erikhuda/thor/wiki
18
18
  class Start < Thor
19
+ package_name 'cuesmash'
20
+ class_option :version, aliases: '-v', desc: 'The version of cuesmash running'
21
+
19
22
  desc 'init', 'set up the project'
20
23
  def init
21
24
  Cuesmash::Setup.setup
@@ -62,26 +65,36 @@ module Cuesmash
62
65
 
63
66
  # Compile the project
64
67
  if @config['platform'] == 'iOS'
65
-
66
- setup_ios
67
-
68
68
  # enumerate over each device / OS combination and run the tests.
69
69
  @config['devices'].each do |device, oses|
70
- oses.each do |os|
71
- say 'Cleaning up iOS Simulator'
72
- reset_ios_simulator
73
-
74
- say "\n============================\ntesting iOS #{os} on #{device}", :green
75
- Cuesmash::Command.execute(device: device,
76
- os: os,
77
- scheme: options[:scheme],
78
- tags: options[:tags],
79
- debug: options[:debug],
80
- app: @app,
81
- profile: options[:profile],
82
- quiet: options[:quiet],
83
- timeout: @config['default']['test_timeout'].to_s)
84
- end
70
+ oses.each do |os_number, ios_uuid|
71
+ setup_ios(device: ios_uuid)
72
+ case
73
+ when ios_uuid.nil?
74
+ say "\n============================\ntesting iOS #{os_number} on #{device}", :green
75
+ Cuesmash::Command.execute(device: device,
76
+ os: os_number,
77
+ scheme: options[:scheme],
78
+ tags: options[:tags],
79
+ debug: options[:debug],
80
+ app: @app,
81
+ profile: options[:profile],
82
+ quiet: options[:quiet],
83
+ timeout: @config['default']['test_timeout'].to_s)
84
+ else
85
+ say "\n============================\ntesting iOS #{os_number} on #{device}", :green
86
+ Cuesmash::Command.execute(device: device,
87
+ os: os_number,
88
+ scheme: options[:scheme],
89
+ tags: options[:tags],
90
+ debug: options[:debug],
91
+ app: @app,
92
+ profile: options[:profile],
93
+ quiet: options[:quiet],
94
+ timeout: @config['default']['test_timeout'].to_s,
95
+ ios_uuid: @config)
96
+ end # case
97
+ end # os each
85
98
  end # device each
86
99
 
87
100
  # clean up the temp dir
@@ -151,7 +164,7 @@ module Cuesmash
151
164
  end
152
165
 
153
166
  if @config['platform'] == 'iOS'
154
- setup_ios
167
+ setup_ios(device: @config['default']['uuid'])
155
168
  elsif @config['platform'] == 'Android'
156
169
  say 'Setting up android'
157
170
  setup_android
@@ -179,21 +192,25 @@ module Cuesmash
179
192
  end # load_config
180
193
 
181
194
  #
182
- # helper methods
195
+ # helper method to setup and compile the iOS app
196
+ #
197
+ # @param [string] device: nil <the UUID of the device to run on or nil if running on simulator>
183
198
  #
184
- def setup_ios
199
+ def setup_ios(device: nil)
185
200
  @app = IosApp.new(file_name: options[:scheme].join(' '),
186
201
  build_configuration: @config['build_configuration'],
187
- app_name: @config['app_name'])
202
+ app_name: @config['app_name'],
203
+ device: device)
188
204
 
189
205
  # Compile the project
190
206
  compiler = Cuesmash::IosCompiler.new(scheme: options[:scheme].join(' '),
191
207
  tmp_dir: @app.tmp_dir,
192
- build_configuration: @config['build_configuration'])
208
+ build_configuration: @config['build_configuration'],
209
+ device: device)
193
210
  compiler.compile
194
211
 
195
212
  ios_appium_text
196
- end
213
+ end # setup_ios
197
214
 
198
215
  #
199
216
  # helper method for setting up android build
@@ -208,7 +225,7 @@ module Cuesmash
208
225
  compiler.compile
209
226
 
210
227
  android_appium_text
211
- end
228
+ end # setup_android
212
229
 
213
230
  #
214
231
  # iOS Appium text file set up
@@ -220,7 +237,7 @@ module Cuesmash
220
237
  app: @app.app_path,
221
238
  new_command_timeout: @config['default']['test_timeout'].to_s)
222
239
  appium.execute
223
- end
240
+ end # ios_appium_text
224
241
 
225
242
  #
226
243
  # Android Appium text file set up
@@ -231,16 +248,7 @@ module Cuesmash
231
248
  app: @app.app_path,
232
249
  new_command_timeout: @config['default']['test_timeout'].to_s)
233
250
  appium.execute
234
- end
235
-
236
- # android_appium_text
237
-
238
- #
239
- # Removes the settings and contents for the iOS simulator.
240
- #
241
- # @return [type] [description]
242
- def reset_ios_simulator
243
- end
251
+ end # android_appium_text
244
252
  end # no_commands
245
253
  end # Start class
246
254
  end # module Cuesmash
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuesmash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Fish
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-06-30 00:00:00.000000000 Z
13
+ date: 2015-07-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler