flaky 0.0.6 → 0.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: 12f730870c9c64675c02b19ff57381991a1ef42e
4
- data.tar.gz: a49813af98d00d27ab97a19049e600cd31497271
3
+ metadata.gz: 40c7fce2c960f2266e8f7e3f7931c875974b4b54
4
+ data.tar.gz: c5e46bb2dbe776f720707543915ca8609f8d0afe
5
5
  SHA512:
6
- metadata.gz: 722025d90f0d8a51fc1d19fa99af0241e1a01959eea66b0cf147fa201308b145009f824809e7de56fb08aa80c6963c315222fdfe41c3a183444cad6383b0ee02
7
- data.tar.gz: d2367175c716d5072fce2b709b017340eaf1a6e24a6cd6991daac65ecdfccde418bb1845dbd85c48162ad430997cfbc143e78d02401af28dc5c16196c78ad7bd
6
+ metadata.gz: 9a0ad60c9f831be58811fb5d4d50e330c319ce76a3161c974621825cee3a69cb3fb8409069e265101116f30e7ced90ffe2c6737f30c7124d728cbd865fe313e8
7
+ data.tar.gz: 6b437e86dc50c10d7ebf755040aa72a62517d99a840d961b3a74516e96b7dc6933d290c9808db841521b698a0259cf4eec591782dd139fda6e790012fe0410ea
data/bin/flake CHANGED
@@ -1,7 +1,17 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
3
 
4
- usage_string = 'flaky [count] ios[test_name]'
4
+ usage_string = <<-'MSG'
5
+ flaky [count] ios[test_name]
6
+
7
+ flaky 1 ios[sign_in]
8
+ Run the sign in test one time
9
+
10
+ flaky 3 ios
11
+ Run all iOS tests up to 3 times
12
+ If one run passes or 3 runs fail, then we move onto the next test.
13
+ MSG
14
+
5
15
  raise usage_string unless ARGV && ARGV.length === 2
6
16
 
7
17
  require File.expand_path '../../lib/flaky', __FILE__
@@ -9,8 +19,21 @@ require File.expand_path '../../lib/flaky', __FILE__
9
19
  # flaky 1 ios[test_name]
10
20
 
11
21
  count = ARGV.first
12
- match = ARGV.last.match(/(.+)\[(.*)\]$/)
13
- raise usage_string unless match && match.length === 3
14
- full, os, test_name = match.to_a # rake ios[Ok] => ["ios[Ok]", "ios", "Ok"]
15
22
 
16
- Flaky.run_one_test count: count, os: os, name: test_name
23
+ single_test_match = ARGV.last.match(/(.+)\[(.*)\]$/)
24
+ all_tests_match = ARGV.last.match(/(.+)$/)
25
+
26
+ if single_test_match
27
+ # we're not using full, however we have to capture it anyway.
28
+ full, os, test_name = single_test_match.to_a # rake ios[Ok] => ["ios[Ok]", "ios", "Ok"]
29
+ name = File.basename test_name, '.*'
30
+ puts "Running #{name} #{count}x"
31
+ Flaky.run_one_test count: count, os: os, name: test_name
32
+ elsif all_tests_match
33
+ os = all_tests_match.to_a.last
34
+ puts "Running all #{os} tests #{count}x"
35
+ Flaky.run_all_tests count: count, os: os
36
+ else
37
+ puts usage_string
38
+ exit
39
+ end
@@ -8,8 +8,8 @@ require 'escape_utils'
8
8
  require 'posix/spawn' # http://rubygems.org/gems/posix-spawn
9
9
 
10
10
  module Flaky
11
- VERSION = '0.0.6' unless defined? ::Flaky::VERSION
12
- DATE = '2013-10-03' unless defined? ::Flaky::DATE
11
+ VERSION = '0.0.7' unless defined? ::Flaky::VERSION
12
+ DATE = '2013-10-11' unless defined? ::Flaky::DATE
13
13
 
14
14
  # https://github.com/appium/ruby_lib/blob/0e203d76610abd519ba9d2fe9c14b50c94df5bbd/lib/appium_lib.rb#L24
15
15
  def self.add_to_path file, path=false
@@ -27,6 +27,6 @@ module Flaky
27
27
  require 'flaky/log'
28
28
  require 'flaky/run'
29
29
 
30
- require 'flaky/run/glob_of_tests'
30
+ require 'flaky/run/all_tests'
31
31
  require 'flaky/run/one_test'
32
32
  end
@@ -53,7 +53,7 @@ module Flaky
53
53
  @tail = nil
54
54
  end
55
55
 
56
- def go
56
+ def start
57
57
  @log = ''
58
58
  self.stop # stop existing process
59
59
  self.class.remove_ios_apps
@@ -61,7 +61,7 @@ module Flaky
61
61
  @@thread.exit if @@thread
62
62
  @@thread = Thread.new do
63
63
  Thread.current.abort_on_exception = true
64
- self.start.wait
64
+ self.launch.wait
65
65
  end
66
66
 
67
67
  while !self.ready
@@ -103,7 +103,7 @@ module Flaky
103
103
  end
104
104
 
105
105
  # Invoked inside a thread by `self.go`
106
- def start
106
+ def launch
107
107
  @log = ''
108
108
  self.end_all_nodes
109
109
  @ready = false
@@ -114,7 +114,7 @@ module Flaky
114
114
  cmd = %Q(cd "#{appium_home}"; node server.js)
115
115
  @pid, @in, @out, @err = popen4 cmd
116
116
  @in.close
117
- self # used to chain `start.wait`
117
+ self # used to chain `launch.wait`
118
118
  end
119
119
 
120
120
  def stop
@@ -0,0 +1,36 @@
1
+ # encoding: utf-8
2
+ module Flaky
3
+ def self.run_all_tests opts={}
4
+ raise 'Must pass :count and :os' unless opts && opts[:count] && opts[:os]
5
+
6
+ count = opts[:count].to_i
7
+ os = opts[:os]
8
+
9
+ raise ':count must be an int' unless count.kind_of?(Integer)
10
+ raise ':os must be a string' unless os.kind_of?(String)
11
+
12
+ flaky = Flaky::Run.new
13
+ appium = Appium.new
14
+
15
+ current_dir = Dir.pwd
16
+ raise "Rakefile doesn't exist in #{current_dir}" unless File.exists?(File.join(current_dir, 'Rakefile'))
17
+
18
+ Dir.glob(File.join current_dir, 'appium', os, 'specs', '**/*.rb') do |test_file|
19
+ file = test_file
20
+ name = File.basename file, '.*'
21
+
22
+ raise "#{test_file} does not exist." if file.empty?
23
+ test_name = file.sub(current_dir + '/appium/', '').gsub('/', '_')
24
+
25
+ count.times do
26
+ appium.start
27
+ run_cmd = "cd #{current_dir}; rake ios['#{name}']"
28
+ passed = flaky.execute run_cmd: run_cmd, test_name: test_name, appium: appium
29
+ break if passed # move onto the next test after one successful run
30
+ end
31
+ end
32
+
33
+ appium.stop
34
+ flaky.report
35
+ end
36
+ end # module Flaky
@@ -29,9 +29,8 @@ module Flaky
29
29
  raise "#{test_file} does not exist." if file.empty?
30
30
  test_name = file.sub(current_dir + '/appium/', '').gsub('/', '_')
31
31
 
32
- puts "Running #{name} #{count}x"
33
32
  count.times do
34
- appium.go # start appium
33
+ appium.start
35
34
  run_cmd = "cd #{current_dir}; rake ios['#{name}']"
36
35
  flaky.execute run_cmd: run_cmd, test_name: test_name, appium: appium
37
36
  end
data/readme.md CHANGED
@@ -22,5 +22,5 @@ This only works with:
22
22
  - All `iPhone Simulator/6.1/Applications/*` are removed
23
23
  - Appium server is restarted
24
24
  - [spec](https://github.com/bootstraponline/spec) test logs are saved and colored
25
- - Appium logs are saved and colored
26
- - iOS Simulator logs are saved `/var/log/system.log`
25
+ - [Appium](https://github.com/appium/appium) logs are saved and colored
26
+ - iOS Simulator logs are saved `/var/log/system.log`
@@ -1,3 +1,15 @@
1
+ #### v0.0.6 2013-10-03
2
+
3
+ - [86d8137](https://github.com/appium/flaky/commit/86d8137e3f1f348be8ee76e42bea0de36280d5a5) Release 0.0.6
4
+ - [0ed637c](https://github.com/appium/flaky/commit/0ed637c213ba59d82fe72a6eb8a22567a9f06a60) Don't escape the iOS simulator logs
5
+ - [6a16eef](https://github.com/appium/flaky/commit/6a16eefde288b68a6695e2e093693c68274fb4f5) Add todo
6
+ - [b8395d7](https://github.com/appium/flaky/commit/b8395d7fc78b75a11a5517f1e6b4c8784522ecee) Save tail of /var/log/system.log
7
+ - [d153c91](https://github.com/appium/flaky/commit/d153c91d072d691d2e499b633f69f10751f8e9bd) Stop appium once we're done
8
+ - [a80dbb1](https://github.com/appium/flaky/commit/a80dbb1062ee11ad53a092c3f3f5a5796d987d84) Update readme.md
9
+ - [6b3ebe8](https://github.com/appium/flaky/commit/6b3ebe8a5ee432206c582f4b0d1e9f877d712ae3) Explain what the gem does
10
+ - [125f960](https://github.com/appium/flaky/commit/125f9608b49a8c939d74699ad3e73f743638bf57) Update links
11
+
12
+
1
13
  #### v0.0.5 2013-09-30
2
14
 
3
15
  - [f4c64f7](https://github.com/appium/flaky/commit/f4c64f721f80bc0ce6519ce3f115486cd097d4e0) Release 0.0.5
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.6
4
+ version: 0.0.7
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-10-03 00:00:00.000000000 Z
11
+ date: 2013-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronic_duration
@@ -82,7 +82,7 @@ files:
82
82
  - lib/flaky/appium.rb
83
83
  - lib/flaky/log.rb
84
84
  - lib/flaky/run.rb
85
- - lib/flaky/run/glob_of_tests.rb
85
+ - lib/flaky/run/all_tests.rb
86
86
  - lib/flaky/run/one_test.rb
87
87
  - readme.md
88
88
  - release_notes.md
@@ -1,28 +0,0 @@
1
- # encoding: utf-8
2
- module Flaky
3
- # TODO: Rewrite to run without system specific dependencies.
4
- def self.run_glob_of_tests
5
- flaky = Flaky::Run.new
6
-
7
- txt = File.join File.expand_path('../..', __FILE__), 'automation.txt'
8
- dir = File.readlines(txt)[0].strip
9
- spec_dir = File.join dir, 'appium', 'ios', 'specs'
10
- ios = File.join spec_dir, '**', '*.rb'
11
-
12
- appium = Appium.new
13
-
14
- Dir.glob(ios) do |file|
15
- next unless file.include?('view_album')
16
- next unless File.extname(file).downcase == '.rb'
17
-
18
- appium.go
19
-
20
- rake_file = File.basename file, '.*'
21
- run_cmd = "cd #{dir}; rake ios['#{rake_file}']"
22
- flaky.execute run_cmd: run_cmd, test_name: file.sub(dir, '').gsub('/', '_')
23
- end
24
-
25
- appium.stop
26
- flaky.report
27
- end
28
- end # module Flaky