rainforest-cli 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,20 +6,35 @@ A command line interface to interact with RainforestQA.
6
6
 
7
7
  $ gem install rainforest-cli
8
8
 
9
- ## Usage
9
+ ## Basic Usage
10
10
  To use the cli client, you'll need your API token from a test settings page from inside [Rainforest](https://app.rainforestqa.com/).
11
11
 
12
12
  Run all of your tests
13
13
 
14
14
  rainforest run all --token YOUR_TOKEN_HERE
15
15
 
16
- Run and report
16
+ Run all in the foreground and report
17
17
 
18
- rainforest run --fg all --token YOUR_TOKEN_HERE
18
+ rainforest run all --fg --token YOUR_TOKEN_HERE
19
19
 
20
20
  Run all tests with tag 'run-me' and abort previous in-progress runs.
21
21
 
22
- rainforest run --tag run-me --conflict abort --token YOUR_TOKEN_HERE
22
+ rainforest run --tag run-me --fg --conflict abort --token YOUR_TOKEN_HERE
23
+
24
+
25
+ ## Options
26
+
27
+ Required:
28
+ - `--token <your-rainforest-token>` - you must supply your token (get it from any tests API tab)
29
+
30
+ The options are:
31
+
32
+ - `--browsers ie8` or `--browsers ie8,chrome` - specficy the browsers you wish to run against. This overrides the test own settings. Valid browsers are ie8, ie9, chrome, firefox and safari.
33
+ - `--tag run-me` - only run tests which have this tag (recommended if you have lots of [test-steps](http://docs.rainforestqa.com/pages/example-test-suite.html#test_steps))!)
34
+ - `--conflict abort` - if you trigger rainforest more than once, anything running will be aborted and a fresh run started
35
+ - `--fail-fast` - fail the build as soon as the first failed result comes in. If you don't pass this it will wait until 100% of the run is done
36
+ - `--fg` - results in the foreground - this is what you want to make the build pass / fail dependent on rainforest results
37
+
23
38
 
24
39
  ## Contributing
25
40
 
@@ -18,6 +18,7 @@ module Rainforest
18
18
  end
19
19
 
20
20
  post_opts[:conflict] = @options.conflict if @options.conflict
21
+ post_opts[:browsers] = @options.browsers if @options.browsers
21
22
 
22
23
  puts "Issuing run"
23
24
 
@@ -2,14 +2,25 @@ require 'optparse'
2
2
 
3
3
  module Rainforest
4
4
  module Cli
5
+ class BrowserException < Exception
6
+ def initialize browsers
7
+ invalid_browsers = browsers - OptionParser::VALID_BROWSERS
8
+ super "#{invalid_browsers.join(', ')} is not valid. Valid browsers: #{OptionParser::VALID_BROWSERS.join(', ')}"
9
+ end
10
+ end
11
+
5
12
  class OptionParser
6
- attr_reader :command, :token, :tags, :conflict
13
+ attr_reader :command, :token, :tags, :conflict, :browsers
14
+
15
+ VALID_BROWSERS = %w{chrome firefox safari ie8 ie9}.freeze
7
16
 
8
17
  def initialize(args)
9
18
  @args = args.dup
10
19
  @tags = []
20
+ @browsers = nil
11
21
 
12
22
  @parsed = ::OptionParser.new do |opts|
23
+ puts opts.inspect
13
24
  opts.on("--fg", "Run the tests in foreground.") do |value|
14
25
  @foreground = value
15
26
  end
@@ -22,10 +33,16 @@ module Rainforest
22
33
  @token = value
23
34
  end
24
35
 
25
- opts.on("--tag TOKEN", String, "A tag to run the tests with") do |value|
36
+ opts.on("--tag TAG", String, "A tag to run the tests with") do |value|
26
37
  @tags << value
27
38
  end
28
39
 
40
+ opts.on("--browsers LIST", "Run against the specified browsers") do |value|
41
+ @browsers = value.split(',').map{|x| x.strip.downcase }.uniq
42
+
43
+ raise BrowserException, @browsers unless (@browsers - VALID_BROWSERS).empty?
44
+ end
45
+
29
46
  opts.on("--conflict MODE", String, "How should Rainforest handle existing in progress runs?") do |value|
30
47
  @conflict = value
31
48
  end
@@ -1,5 +1,5 @@
1
1
  module Rainforest
2
2
  module Cli
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
data/spec/options_spec.rb CHANGED
@@ -13,6 +13,24 @@ describe Rainforest::Cli::OptionParser do
13
13
  its(:tags) { should == ["run-me"]}
14
14
  end
15
15
 
16
+ context "only run in specific browsers" do
17
+ let(:args) { ["run", "--browsers", "ie8"] }
18
+ its(:browsers) { should == ["ie8"]}
19
+ end
20
+
21
+ context "raises errors with invalid browsers" do
22
+ let(:args) { ["run", "--browsers", "lulbrower"] }
23
+
24
+ it "raises an exception" do
25
+ expect{subject}.to raise_error(Rainforest::Cli::BrowserException)
26
+ end
27
+ end
28
+
29
+ context "accepts multiple browsers" do
30
+ let(:args) { ["run", "--browsers", "ie8,chrome"] }
31
+ its(:browsers) { should == ["ie8", "chrome"]}
32
+ end
33
+
16
34
  context "it parses the --fg flag" do
17
35
  let(:args) { ["run", "--fg", "all"] }
18
36
  its(:tests) { should == ["all"]}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rainforest-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-09-13 00:00:00.000000000 Z
13
+ date: 2013-09-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty