flaky 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aec17b5e5abd6c3698c2b5888db960a6366f0d77
4
- data.tar.gz: add4521290cec54027742252bc4afbfc4121f49c
3
+ metadata.gz: f73dc19cae9ae4a85bf25839a950e4d02cb0e77a
4
+ data.tar.gz: bc50f6c1cfe2464ba89466c1423863708cf8912e
5
5
  SHA512:
6
- metadata.gz: d15d2721d5119b385fc06b96eb0791bbfbe99e1cfa2d9d98a4e2490bc93ca5d25427c89812b9aa79e98ac42e3a2630775f67b88a0dca4e5ce16bfd7e3df25a93
7
- data.tar.gz: e243b5c9e240f198ce0ee8e1c1c86d3269b5f6af901f9e2ff33b1e92b19c247e9d5f08caba5112f74c22ecc0b2fc5e984c1781a1216e097162265ead0b27ce99
6
+ metadata.gz: 46c2060cb26e6d710943de2b0be7de1ddff1c28176a9d0802e4d10265c974e7fc8dcf803204e50648d2a5be4a9faa09e91b459691daa1c58cf2d0ae45a7bcb49
7
+ data.tar.gz: f79b8b536b0c25c0b5cb402ed88c1350d4a5a0ac12ad36510b326e604b24ad2b1aebb297c96b291a1eaac0f3df9e6c989a4f3dfada30e9b74c24a4d4c543d44a
data/bin/flake CHANGED
@@ -20,7 +20,8 @@ if ARGV && ARGV.length === 1 && ARGV.first === 'auth'
20
20
  Flaky::AppleScript.beat_security_agent
21
21
  exit
22
22
  elsif ARGV && ARGV.length === 3
23
- if ARGV[0].to_i.kind_of?(Integer) && ARGV[1].to_i.kind_of?(Integer)
23
+ # .to_i will convert any string to 0 so check using a match regex.
24
+ if ARGV[0].match(/\d+/) && ARGV[1].match(/\d+/)
24
25
  raise 'First pass must be 1' unless ARGV[0].to_i == 1
25
26
  # flake 1 2 ios
26
27
  pass_1 = ARGV[0] # 1
data/lib/flaky.rb CHANGED
@@ -9,8 +9,8 @@ require 'posix/spawn' # http://rubygems.org/gems/posix-spawn
9
9
  require 'digest/md5'
10
10
 
11
11
  module Flaky
12
- VERSION = '0.0.20' unless defined? ::Flaky::VERSION
13
- DATE = '2013-12-26' unless defined? ::Flaky::DATE
12
+ VERSION = '0.0.21' unless defined? ::Flaky::VERSION
13
+ DATE = '2014-01-02' unless defined? ::Flaky::DATE
14
14
 
15
15
  # require internal files
16
16
  require_relative 'flaky/appium'
data/lib/flaky/run.rb CHANGED
@@ -86,7 +86,7 @@ module Flaky
86
86
  out += "\nFinished in #{duration}\n"
87
87
  time_format = '%b %d %l:%M %P'
88
88
  time_format2 = '%l:%M %P'
89
- out += "#{@start_time.strftime(time_format)} -#{time_now.strftime(time_format2)}"
89
+ out += "#{@start_time.strftime(time_format)} - #{time_now.strftime(time_format2)}"
90
90
  out += "\n--\n"
91
91
 
92
92
  if save_file
@@ -156,13 +156,23 @@ module Flaky
156
156
  # end
157
157
 
158
158
  unless sauce
159
+ movie_path = log_file.name("#{postfix}.mov")
160
+ FileUtils.mkdir_p File.dirname(movie_path)
161
+ movie_src = '/tmp/video.mov'
162
+ if File.exists?(movie_src)
163
+ # save movie on failure
164
+ FileUtils.copy movie_src, movie_path if !passed
165
+ # always clean up movie
166
+ File.delete movie_src if File.exists? movie_src
167
+ end
168
+
159
169
  src_system_log = '/tmp/flaky_logs.txt'
160
170
  if File.exists? src_system_log
161
171
  # postfix is required! or the log will be saved to an incorrect path
162
172
  system_log_path = log_file.name("#{postfix}.system.txt")
163
173
  FileUtils.mkdir_p File.dirname(system_log_path)
164
174
  FileUtils.copy_file src_system_log, system_log_path
165
- File.delete src_system_log
175
+ File.delete src_system_log if File.exists? src_system_log
166
176
  end
167
177
 
168
178
  # appium server log
@@ -170,7 +180,7 @@ module Flaky
170
180
  FileUtils.mkdir_p File.dirname(appium_server_path)
171
181
 
172
182
  tmp_file = appium.flush_buffer
173
- if !tmp_file.nil? && !tmp_file.empty?
183
+ if File.exists?(tmp_file) && !tmp_file.nil? && !tmp_file.empty?
174
184
  FileUtils.copy_file tmp_file, appium_server_path
175
185
  end
176
186
  File.delete tmp_file if File.exists? tmp_file
@@ -208,10 +218,10 @@ module Flaky
208
218
 
209
219
  passed = _execute run_cmd, test_name, runs, appium, sauce
210
220
  unless sauce
211
- print cyan("\n #{test_name} ") if @last_test.nil? ||
221
+ print cyan("\n #{test_name} ") if @last_test.nil? ||
212
222
  @last_test != test_name
213
223
 
214
- print passed ? green(' ✓') : red(' ✖')
224
+ print passed ? green(' ✓') : red(' ✖')
215
225
  else
216
226
  print cyan("\n #{test_name} ")
217
227
  print passed ? green(' ✓') : red(' ✖')
Binary file
@@ -0,0 +1,34 @@
1
+ # encoding: utf-8
2
+ require 'rubygems'
3
+ require 'posix-spawn'
4
+
5
+ module Flaky
6
+ class << self
7
+
8
+ def screen_recording_binary
9
+ @screen_recording_binary ||= File.expand_path('../screen-recording', __FILE__)
10
+ end
11
+
12
+ def screen_recording_start opts={}
13
+ os = opts[:os]
14
+ path = opts[:path]
15
+ raise ':os is required' unless os
16
+ raise ':path is required' unless path
17
+
18
+ raise 'Invalid os. Must be ios or android' unless %w[ios android].include? os
19
+ raise 'Invalid path. Must end with .mov' unless File.extname(path) == '.mov'
20
+
21
+ pid = spawn(screen_recording_binary, os, path,
22
+ :in => '/dev/null', :out => '/dev/null', :err => '/dev/null')
23
+ pid
24
+ end
25
+
26
+ def screen_recording_stop pid
27
+ Process.kill(:SIGINT, pid)
28
+ # Must wait 5 seconds for the video to end.
29
+ # If we don't wait, the movie will be corrupt.
30
+ # See: https://github.com/bootstraponline/screen_recording/blob/master/screen-recording/main.m#L137
31
+ sleep 5
32
+ end
33
+ end
34
+ end
data/release_notes.md CHANGED
@@ -1,3 +1,10 @@
1
+ #### v0.0.20 2013-12-26
2
+
3
+ - [858047e](https://github.com/appium/flaky/commit/858047e530e8d1e4294bfaa91f26492b36a68fda) Release 0.0.20
4
+ - [cb621f2](https://github.com/appium/flaky/commit/cb621f2c885ef30da3b257d1394eda6104c11147) First attempt at 1x 2x
5
+ - [f2fa23c](https://github.com/appium/flaky/commit/f2fa23c662cfd9a72f619191f6990d435e422671) Flush to file immediately
6
+
7
+
1
8
  #### v0.0.19 2013-12-23
2
9
 
3
10
  - [25630f1](https://github.com/appium/flaky/commit/25630f1d536715db8539c2d96adba15f5b35d5e4) Release 0.0.19
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flaky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - code@bootstraponline.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-26 00:00:00.000000000 Z
11
+ date: 2014-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronic_duration
@@ -76,6 +76,8 @@ files:
76
76
  - lib/flaky/run/from_file.rb
77
77
  - lib/flaky/run/one_test.rb
78
78
  - lib/flaky/run/two_pass.rb
79
+ - lib/screen-recording
80
+ - lib/screen_recording.rb
79
81
  - readme.md
80
82
  - release_notes.md
81
83
  - test/all_tests.rb