flaky 0.0.21 → 0.0.22

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: f73dc19cae9ae4a85bf25839a950e4d02cb0e77a
4
- data.tar.gz: bc50f6c1cfe2464ba89466c1423863708cf8912e
3
+ metadata.gz: 5a66676fa3248d3b07816db77305c598ca448155
4
+ data.tar.gz: b02de59738db71d7737d4bdcb03286935965a964
5
5
  SHA512:
6
- metadata.gz: 46c2060cb26e6d710943de2b0be7de1ddff1c28176a9d0802e4d10265c974e7fc8dcf803204e50648d2a5be4a9faa09e91b459691daa1c58cf2d0ae45a7bcb49
7
- data.tar.gz: f79b8b536b0c25c0b5cb402ed88c1350d4a5a0ac12ad36510b326e604b24ad2b1aebb297c96b291a1eaac0f3df9e6c989a4f3dfada30e9b74c24a4d4c543d44a
6
+ metadata.gz: d9f8b2a16dbe1eb018a1e201880a07c46182938b17ff8582664f39fcc4e4189037fa434e78b80e664e3be4311867852bcb99f52446ff1865ba3f7ab9f3ec8242
7
+ data.tar.gz: 48293b05c801107679a43639a022a8e9c20e2d270c1e9bbf92712b7d24fb4955094f397222cc8deadf0f8944e385184dcd32114c9ae3dd2c21b062076d1f7f5a
data/bin/flake CHANGED
@@ -16,33 +16,43 @@ flake 3 ios files.txt
16
16
  If one run passes or 3 runs fail, then we move onto the next test.
17
17
  MSG
18
18
 
19
- if ARGV && ARGV.length === 1 && ARGV.first === 'auth'
19
+ args = ARGV
20
+
21
+ disable_video = args.index '--no-video'
22
+ if disable_video != nil
23
+ Flaky.no_video = true
24
+ args.delete_at(disable_video) # remove flag from args
25
+ end
26
+
27
+ puts "Recording Video: #{!Flaky.no_video}"
28
+
29
+ if args && args.length === 1 && args.first === 'auth'
20
30
  Flaky::AppleScript.beat_security_agent
21
31
  exit
22
- elsif ARGV && ARGV.length === 3
32
+ elsif args && args.length === 3
23
33
  # .to_i will convert any string to 0 so check using a match regex.
24
- if ARGV[0].match(/\d+/) && ARGV[1].match(/\d+/)
25
- raise 'First pass must be 1' unless ARGV[0].to_i == 1
34
+ if args[0].match(/\d+/) && args[1].match(/\d+/)
35
+ raise 'First pass must be 1' unless args[0].to_i == 1
26
36
  # flake 1 2 ios
27
- pass_1 = ARGV[0] # 1
28
- count = ARGV[1] # 2
29
- os = ARGV[2] # ios
37
+ pass_1 = args[0] # 1
38
+ count = args[1] # 2
39
+ os = args[2] # ios
30
40
  puts "Running all #{os} tests 1x #{count}x"
31
41
  Flaky.two_pass count: count, os: os
32
42
  exit
33
43
  else
34
44
  # rake 3 ios files.txt
35
- count = ARGV.first
36
- os = ARGV[1]
37
- file = ARGV.last
38
- raise 'File must end in .txt' unless File.extname(ARGV.last).downcase == '.txt'
45
+ count = args.first
46
+ os = args[1]
47
+ file = args.last
48
+ raise 'File must end in .txt' unless File.extname(args.last).downcase == '.txt'
39
49
  puts "Running select #{os} tests from file #{file} #{count}x"
40
50
  Flaky.run_from_file count: count, os: os, file: file
41
51
  exit
42
52
  end
43
53
 
44
54
  else
45
- unless ARGV && ARGV.length === 2
55
+ unless args && args.length === 2
46
56
  puts usage_string
47
57
  exit
48
58
  end
@@ -50,9 +60,9 @@ end
50
60
 
51
61
  # flaky 1 ios[test_name]
52
62
 
53
- count = ARGV.first
63
+ count = args.first
54
64
 
55
- last = ARGV.last
65
+ last = args.last
56
66
  single_test_match = last.match(/(.+)\[(.*)\]$/)
57
67
  all_tests_match = last.match(/(.+)$/)
58
68
 
data/lib/flaky.rb CHANGED
@@ -9,8 +9,11 @@ require 'posix/spawn' # http://rubygems.org/gems/posix-spawn
9
9
  require 'digest/md5'
10
10
 
11
11
  module Flaky
12
- VERSION = '0.0.21' unless defined? ::Flaky::VERSION
13
- DATE = '2014-01-02' unless defined? ::Flaky::DATE
12
+ VERSION = '0.0.22' unless defined? ::Flaky::VERSION
13
+ DATE = '2014-01-03' unless defined? ::Flaky::DATE
14
+
15
+ class << self; attr_accessor :no_video; end
16
+ self.no_video = false; # set default value
14
17
 
15
18
  # require internal files
16
19
  require_relative 'flaky/appium'
data/lib/flaky/run.rb CHANGED
@@ -160,8 +160,10 @@ module Flaky
160
160
  FileUtils.mkdir_p File.dirname(movie_path)
161
161
  movie_src = '/tmp/video.mov'
162
162
  if File.exists?(movie_src)
163
- # save movie on failure
164
- FileUtils.copy movie_src, movie_path if !passed
163
+ unless Flaky.no_video
164
+ # save movie on failure
165
+ FileUtils.copy movie_src, movie_path if !passed
166
+ end
165
167
  # always clean up movie
166
168
  File.delete movie_src if File.exists? movie_src
167
169
  end
@@ -28,7 +28,7 @@ module Flaky
28
28
  count.times do
29
29
  File.open('/tmp/flaky/current.txt', 'a') { |f| f.puts "Running: #{test_name} on #{os}" }
30
30
  appium.start unless running_on_sauce
31
- run_cmd = "cd #{current_dir}; rake #{os.downcase}['#{name}']"
31
+ run_cmd = "cd #{current_dir}; rake #{os.downcase}['#{name}',#{Flaky.no_video}]"
32
32
  passed = flaky.execute run_cmd: run_cmd, test_name: test_name, appium: appium, sauce: running_on_sauce
33
33
  break if passed # move onto the next test after one successful run
34
34
  end
@@ -47,7 +47,7 @@ module Flaky
47
47
 
48
48
  count.times do
49
49
  appium.start unless running_on_sauce
50
- run_cmd = "cd #{current_dir}; rake #{os.downcase}['#{name}']"
50
+ run_cmd = "cd #{current_dir}; rake #{os.downcase}['#{name}',#{Flaky.no_video}]"
51
51
  passed = flaky.execute run_cmd: run_cmd, test_name: test_name, appium: appium, sauce: running_on_sauce
52
52
  break if passed # move onto the next test after one successful run
53
53
  end
@@ -34,7 +34,7 @@ module Flaky
34
34
 
35
35
  count.times do
36
36
  appium.start unless running_on_sauce
37
- run_cmd = "cd #{current_dir}; rake #{os.downcase}['#{name}']"
37
+ run_cmd = "cd #{current_dir}; rake #{os.downcase}['#{name}',#{Flaky.no_video}]"
38
38
  flaky.execute run_cmd: run_cmd, test_name: test_name, appium: appium, sauce: running_on_sauce
39
39
  end
40
40
 
@@ -34,7 +34,7 @@ module Flaky
34
34
  count1.times do
35
35
  File.open('/tmp/flaky/current.txt', 'a') { |f| f.puts "Running: #{test_name} on #{os}" }
36
36
  appium.start unless running_on_sauce
37
- run_cmd = "cd #{current_dir}; rake #{os.downcase}['#{name}']"
37
+ run_cmd = "cd #{current_dir}; rake #{os.downcase}['#{name}',#{Flaky.no_video}]"
38
38
  passed = flaky.execute(run_cmd: run_cmd, test_name: test_name, appium: appium, sauce: running_on_sauce)
39
39
  break if passed # move onto the next test after one successful run
40
40
  end
@@ -64,7 +64,7 @@ module Flaky
64
64
  count2.times do
65
65
  File.open('/tmp/flaky/current.txt', 'a') { |f| f.puts "Running: #{test_name} on #{os}" }
66
66
  appium.start unless running_on_sauce
67
- run_cmd = "cd #{current_dir}; rake #{os.downcase}['#{name}']"
67
+ run_cmd = "cd #{current_dir}; rake #{os.downcase}['#{name}',#{Flaky.no_video}]"
68
68
  passed = flaky.execute run_cmd: run_cmd, test_name: test_name, appium: appium, sauce: running_on_sauce
69
69
  break if passed # move onto the next test after one successful run
70
70
  end
@@ -17,6 +17,13 @@ module Flaky
17
17
 
18
18
  raise 'Invalid os. Must be ios or android' unless %w[ios android].include? os
19
19
  raise 'Invalid path. Must end with .mov' unless File.extname(path) == '.mov'
20
+ raise 'Invalid path. Must not be a dir' if File.exists?(path) && File.directory?(path)
21
+
22
+ # ensure we have exactly one screen-recording process
23
+ # wait for killall to complete
24
+ Process::waitpid(spawn('killall', '-9', 'screen-recording', :in => '/dev/null', :out => '/dev/null', :err => '/dev/null'))
25
+
26
+ File.delete(path) if File.exists? path
20
27
 
21
28
  pid = spawn(screen_recording_binary, os, path,
22
29
  :in => '/dev/null', :out => '/dev/null', :err => '/dev/null')
data/readme.md CHANGED
@@ -46,3 +46,45 @@ Run `flake auth` to automatically dismiss security dialogs.
46
46
  - Appium server is restarted
47
47
  - [spec](https://github.com/bootstraponline/spec) test logs are saved and colored
48
48
  - [Appium](https://github.com/appium/appium) logs are saved and colored
49
+
50
+ --
51
+
52
+ #### logs & video
53
+
54
+ ```ruby
55
+ # Sample setup/teardown that saves logs and records videos.
56
+ # Appium::Driver.new(app_path: env_app_path, debug: true,
57
+ # device: device, device_cap: device_cap,
58
+ # export_session: true).start_driver
59
+ #
60
+ # The following code goes after Driver.new.start_driver
61
+
62
+ def save_logs
63
+ file = '/tmp/flaky_logs.txt'
64
+ logs = nil
65
+
66
+ begin
67
+ logs = $driver.driver.manage.logs.get(:logcat)
68
+ rescue # try iOS
69
+ logs = $driver.driver.manage.logs.get(:syslog)
70
+ end
71
+
72
+ File.open(file, 'w') do |f|
73
+ # Save only the message from Selenium::WebDriver::LogEntry
74
+ f.write (logs.map { |line| line.message }).join("\n")
75
+ end
76
+ end
77
+
78
+ puts "Recording #{device} to /tmp/video.mov"
79
+ flaky_screen_recording_pid = Flaky.screen_recording_start os: device, path: '/tmp/video.mov'
80
+
81
+ Minitest.after_run do
82
+ if $driver
83
+ save_logs
84
+ puts "Ending pid: #{flaky_screen_recording_pid}"
85
+ Flaky.screen_recording_stop flaky_screen_recording_pid # save video
86
+ $driver.x
87
+ end
88
+ end
89
+ ```
90
+
data/release_notes.md CHANGED
@@ -1,3 +1,10 @@
1
+ #### v0.0.21 2014-01-02
2
+
3
+ - [10babb7](https://github.com/appium/flaky/commit/10babb7dcee2e811c6fb6a78d5dcf2c6fffba2f2) Release 0.0.21
4
+ - [3d93fb2](https://github.com/appium/flaky/commit/3d93fb2b2bd6dd2b8a453750c5425c73cf3db570) Add screen recording to flaky
5
+ - [ec67868](https://github.com/appium/flaky/commit/ec6786818640f22183ce146f3bd75e868d8deada) Fix spacing
6
+
7
+
1
8
  #### v0.0.20 2013-12-26
2
9
 
3
10
  - [858047e](https://github.com/appium/flaky/commit/858047e530e8d1e4294bfaa91f26492b36a68fda) Release 0.0.20
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.21
4
+ version: 0.0.22
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: 2014-01-02 00:00:00.000000000 Z
11
+ date: 2014-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronic_duration