chemistrykit 3.9.0.rc3 → 3.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,18 @@
1
+ #3.9.0 (2013-08-26)
2
+ Improved reporting features and configuration for sauce permissions
3
+
4
+ - Bumped version to 3.9.0 to prepare for release.
5
+ - updated rake file to override build verify in special cases
6
+ - final fix to a test
7
+ - fixed issues causing tests to fail
8
+ - updated docs to reflect recent changes and future release
9
+ - updated report generation to include dom dumps for all available windows
10
+ - upgraded SC version and added hooks to handle tagging sauce jobs and setting the team permission via a beaker tag, plus tests
11
+ - screenshots front and center, hiding of success
12
+ - now hiding success by default with off switch
13
+ - removed specific log specification from system tests, cleaned up log configuration to just default to evidence and refactoried the cli a small bit to support it.
14
+ - updated bundle and fixed new code quality error
15
+
1
16
  #3.9.0-rc.3 (2013-08-19)
2
17
  - added toggle for parts of html reports
3
18
  - added a fix to allow jenkins ci server to show the html report images
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- #ChemistryKit 3.9.0.rc3 (2013-08-19)
1
+ #ChemistryKit 3.9.0 (2013-08-26)
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/chemistrykit.png)](http://badge.fury.io/rb/chemistrykit) [![Build Status](https://travis-ci.org/arrgyle/chemistrykit.png?branch=develop)](https://travis-ci.org/jrobertfox/chef-broiler-platter) [![Code Climate](https://codeclimate.com/github/arrgyle/chemistrykit.png)](https://codeclimate.com/github/arrgyle/chemistrykit) [![Coverage Status](https://coveralls.io/repos/arrgyle/chemistrykit/badge.png?branch=develop)](https://coveralls.io/r/arrgyle/chemistrykit?branch=develop)
4
4
 
@@ -74,7 +74,11 @@ To exclude a tag, put a ~ in front of it.
74
74
  During development it is often helpful to just run a specific beaker, this can be accomplished with the `--beakers` flag:
75
75
 
76
76
  ckit brew --beakers=beakers/wip_beaker.rb
77
+
78
+ ####Special Tags
79
+ There are some tags that can be used to control various aspects of the harness. The following are supported:
77
80
 
81
+ - `public: SOME_VALUE` - If you are running your harness against sauce labs, then you can control how the permissions are set for a particular beaker according to the visibility options detailed at the bottom of [this page](https://saucelabs.com/docs/additional-config). For example if you wanted a test to be private you could add `public: 'private'` to your beaker tags.
78
82
 
79
83
  ###Formula Loading
80
84
  Code in the `formula` directory can be used to build out page objects and helper functions to facilitate your testing. The files are loaded in a particular way:
@@ -162,38 +166,41 @@ end
162
166
 
163
167
  You can even nest them inside different describe/context blocks and they will get executed from the outside-in.
164
168
 
165
- ###Logs and CI Integration
166
- Each run of Chemistry Kit saves logging and test output to the _evidence_ directory by default. And in there will be the full set of JUnit Ant XML files that may be consumed by your CI.
169
+ ###Reporting and CI Integration
170
+ Each run of Chemistry Kit saves logging and test output to the _evidence_ directory. And in there will be the full set of JUnit XML files that may be consumed by your CI as well as a `final_results.html` report file with a full review of all the tests.
167
171
 
168
- Assets generated by selenium (logs, screenshots, etc.) are stored in a subfolder with a name matching the describe block in your beaker, slugifyed like: `my_beaker_name`. This is to provide some organization but also allow the integration with jenkins using [this plugin](https://wiki.jenkins-ci.org/display/JENKINS/JUnit+Attachments+Plugin).
172
+ Assets generated by Selenium (logs, screenshots, etc.) are stored in a subfolder with a name matching the describe block in your beaker, slugifyed like: `my_beaker_name`. This is to provide some organization but also allow the integration with jenkins using [this plugin](https://wiki.jenkins-ci.org/display/JENKINS/JUnit+Attachments+Plugin).
169
173
 
170
174
  ##Configuration
171
175
  ChemistryKit is configured by default with a `config.yaml` file that is created for you when you scaffold out a test harness. Relevant configuration options are detailed below:
172
176
 
173
- `base_url:` The base url of your app, stored to the ENV for access in your beakers and formulas.
177
+ ###Basic Options
178
+ - `base_url:` The base url of your app, stored to the ENV for access in your beakers and formulas.
179
+ - `retries_on_failure:` Defaults to 1, set the number of times a test should be retried on failure
180
+ - `concurrency:` You may override the default concurrency of 1 to run the tests in parallel
174
181
 
175
- `retries_on_failure:` Defaults to 1, set the number of times a test should be retried on failure
182
+ - `screenshot_on_fail` By default false, set to true to download a screenshot of the failure (supported by sauce labs for now.)
176
183
 
177
- `concurrency:` You may override the default concurrency of 1 to run the tests in parallel
184
+ ###Selenium Connect Options
178
185
 
179
- `log: path:` You may override the default log path 'evidence'
186
+ `selenium_connect:` Options under this node override the defaults for the [Selenium Connect](https://github.com/arrgyle/selenium-connect) gem. See that documentation for specifics.
180
187
 
181
- `log: results_file:` You may override the default file name 'results_junit.xml'
188
+ ###Basic Auth Options
189
+ `basic_auth:` Options under this node allow you to configure your test harness to authenticate prior to executing a test. This is helpful for testing against restricted development environments. The options include:
182
190
 
183
- `log: format:` You may override the default format 'junit' to an alternative like 'doc' or 'html'
191
+ - `username:` The username to access your site with basic HTTP authentication.
192
+ - `password:` The password to access your site with basic HTTP authentication.
193
+ - `http_path:` An HTTP end-point loaded before each test run to cache the credentials for the test run.
194
+ - `https_path:` An HTTPS end-point loaded before each test run to cache the credentials for the test run.
184
195
 
185
- `selenium_connect:` Options in this node override the defaults for the [Selenium Connect](https://github.com/arrgyle/selenium-connect) gem.
186
- ##Command Line Usage
187
-
188
- `screenshot_on_fail` By default false, set to true to download a screenshot of the failure (supported by sauce labs for now.)
196
+ ###Split Testing Options
197
+ `split_testing:` Currently ChemistryKit supports opting out of [Optimizely](https://www.optimizely.com/) A/B testing. The available options are:
189
198
 
190
- `basic_auth: username:` The username to access your site with basic HTTP authentication
199
+ - `provider:` Currently only `optimizely` is supported.
200
+ - `opt_out:` A value of `true` will opt you out of the A/B testing
191
201
 
192
- `basic_auth: password:` The password to access your site with basic HTTP authentication
193
202
 
194
- `basic_auth: http_path:` An HTTP end-point loaded before each test run to cache the credentials for the test run
195
-
196
- `basic_auth: https_path:` An HTTPS end-point loaded before each test run to cache the credentials for the test run
203
+ ##Command Line Usage
197
204
 
198
205
  ###new
199
206
  Creates a new ChemistryKit project.
@@ -215,7 +222,6 @@ Available options for the `brew` command:
215
222
  -a, --all Run every beaker regardless of tag.
216
223
  -b, --beakers [BEAKERS] Pass a list of beaker paths to be executed.
217
224
  -c, --config [PATH] Pass the path to an alternative config.yaml file.
218
- -r, --results_file [NAME] Specify the name of your results file.
219
225
  --tag [TAGS] Specify a list of tags to run or exclude.
220
226
  --params [HASH] Send a list of "key:value" parameters to the ENV.
221
227
  -x, --retry [INT] How many times should a failing test be retried.
data/Rakefile CHANGED
@@ -75,7 +75,7 @@ end
75
75
 
76
76
  # TODO This could probably be more cleanly automated
77
77
  desc 'Start a release (Requires Git Flow)'
78
- task :release_start, :version do |t, args|
78
+ task :release_start, [:version, :no_verify] do |t, args|
79
79
  version = args['version']
80
80
 
81
81
  # make sure we have the latest stuff
@@ -90,7 +90,7 @@ task :release_start, :version do |t, args|
90
90
  system 'git pull --no-edit origin develop'
91
91
 
92
92
  # next assure all the tests run
93
- task(:build_full).invoke
93
+ task(:build_full).invoke unless !!args['no_verify']
94
94
 
95
95
  # start the release process
96
96
  system "git flow release start #{version}"
@@ -2,13 +2,13 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'chemistrykit'
5
- s.version = '3.9.0.rc3'
5
+ s.version = '3.9.0'
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ['Dave Haeffner', 'Jason Fox']
8
8
  s.email = ['dave@arrgyle.com', 'jason@arrgyle.com']
9
9
  s.homepage = 'https://github.com/arrgyle/chemistrykit'
10
10
  s.summary = 'A simple and opinionated web testing framework for Selenium that follows convention over configuration.'
11
- s.description = 'Added basic http authentication support'
11
+ s.description = 'Improved reporting features and configuration for sauce permissions'
12
12
  s.license = 'MIT'
13
13
 
14
14
  s.files = `git ls-files`.split($/)
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_dependency 'builder', '~> 3.2.2'
25
25
  s.add_dependency 'selenium-webdriver', '~> 2.29.0'
26
26
  s.add_dependency 'rest-client', '~> 1.6.7'
27
- s.add_dependency 'selenium-connect', '~> 3.6.0'
27
+ s.add_dependency 'selenium-connect', '~> 3.7.0'
28
28
  s.add_dependency 'parallel_tests', '~> 0.15.0'
29
29
  s.add_dependency 'parallel', '~> 0.7.0'
30
30
  s.add_dependency 'rspec-retry', '~> 0.2.1'
@@ -1,3 +1,4 @@
1
+ @announce
1
2
  Feature: Brewing a ChemistryKit project
2
3
 
3
4
  Running ckit brew runs the suite of tests.
@@ -34,20 +35,18 @@ Feature: Brewing a ChemistryKit project
34
35
  Given a file named "config.yaml" with:
35
36
  """
36
37
  selenium_connect:
37
- log: 'evidence'
38
38
  host: 'localhost'
39
39
  """
40
40
  When I run `ckit brew`
41
41
  Then the stdout should contain "1 example, 0 failures"
42
42
  And the following files should exist:
43
- | evidence/junit.xml |
43
+ | evidence/junit_0.xml |
44
44
  | evidence/bookie/bookie_loads_an_external_web_page/server.log |
45
45
 
46
46
  Scenario: Brew a single beaker
47
47
  Given a file named "config.yaml" with:
48
48
  """
49
49
  selenium_connect:
50
- log: 'evidence'
51
50
  host: 'localhost'
52
51
  """
53
52
  And a file named "beakers/other_beaker.rb" with:
@@ -67,7 +66,6 @@ Feature: Brewing a ChemistryKit project
67
66
  Given a file named "config.yaml" with:
68
67
  """
69
68
  selenium_connect:
70
- log: 'evidence'
71
69
  host: 'localhost'
72
70
  """
73
71
  And a file named "beakers/other_beaker.rb" with:
@@ -88,7 +86,6 @@ Feature: Brewing a ChemistryKit project
88
86
  """
89
87
  screenshot_on_fail: true
90
88
  selenium_connect:
91
- log: 'evidence'
92
89
  host: 'saucelabs'
93
90
  browser: 'iexplore'
94
91
  os: 'windows 2003'
@@ -117,7 +114,6 @@ Feature: Brewing a ChemistryKit project
117
114
  """
118
115
  retries_on_failure: 3
119
116
  selenium_connect:
120
- log: 'evidence'
121
117
  host: 'localhost'
122
118
  """
123
119
  And a file named "beakers/other_beaker.rb" with:
@@ -81,7 +81,6 @@ Catalyst: n. A pocket of data (consumed from a CSV file) used to drive a test th
81
81
  And a file named "config.yaml" with:
82
82
  """
83
83
  selenium_connect:
84
- log: 'evidence'
85
84
  host: 'localhost'
86
85
  """
87
86
  When I run `ckit brew`
@@ -15,7 +15,6 @@ Feature: Brewing a ChemistryKit project
15
15
  """
16
16
  screenshot_on_fail: true
17
17
  selenium_connect:
18
- log: 'evidence'
19
18
  browser: 'firefox'
20
19
  """
21
20
  And a file named "formulas/basic_formula.rb" with:
@@ -32,7 +32,6 @@ Feature: Support for concurency
32
32
  """
33
33
  concurrency: 4
34
34
  selenium_connect:
35
- log: 'evidence'
36
35
  host: 'saucelabs'
37
36
  browser: 'firefox'
38
37
  sauce_username: 'testing_arrgyle'
@@ -6,7 +6,6 @@ Feature: Exit Status
6
6
  And a file named "config.yaml" with:
7
7
  """
8
8
  selenium_connect:
9
- log: 'evidence'
10
9
  host: 'localhost'
11
10
  """
12
11
 
@@ -19,7 +19,6 @@ Feature: Initialize a global configuration
19
19
  """
20
20
  base_url: http://www.google.com
21
21
  selenium_connect:
22
- log: 'evidence'
23
22
  host: 'localhost'
24
23
  """
25
24
  When I run `ckit brew`
@@ -7,7 +7,6 @@ Formulas should be loaded in the correct order with thier dependencies
7
7
  And a file named "config.yaml" with:
8
8
  """
9
9
  selenium_connect:
10
- log: 'evidence'
11
10
  host: 'localhost'
12
11
  """
13
12
  And a file named "formulas/big.rb" with:
@@ -1,3 +1,4 @@
1
+ @announce
1
2
  Feature: Support for multiple configuration files
2
3
  In order to quickly change between different configurations
3
4
  As a chemistry kit harness developer
@@ -58,13 +59,11 @@ Feature: Support for multiple configuration files
58
59
  And a file named "alternate.yaml" with:
59
60
  """
60
61
  concurrency: 4
61
- log:
62
- path: 'evidence_alternate'
63
62
  selenium_connect:
63
+ log: 'evidence_alternate'
64
64
  host: 'localhost'
65
65
  """
66
66
  When I run `ckit brew --config alternate.yaml`
67
67
  Then the stdout should contain "1 example, 0 failures"
68
- And there should be "1" unique results files in the "evidence_alternate" directory
69
68
  And the following files should exist:
70
69
  | evidence_alternate/cheese/cheese_loads_an_external_web_page/server.log |
@@ -1,3 +1,4 @@
1
+ @announce
1
2
  Feature: Advanced HTML Reports
2
3
  In order to quickly know the status of the application
3
4
  As a chemistry kit harness user
@@ -44,7 +45,6 @@ Feature: Advanced HTML Reports
44
45
  """
45
46
  screenshot_on_fail: true
46
47
  selenium_connect:
47
- log: 'evidence'
48
48
  browser: 'firefox'
49
49
  """
50
50
 
@@ -60,7 +60,6 @@ Feature: Advanced HTML Reports
60
60
  concurrency: 2
61
61
  screenshot_on_fail: true
62
62
  selenium_connect:
63
- log: 'evidence'
64
63
  browser: 'chrome'
65
64
  """
66
65
  When I run `ckit brew`
@@ -74,7 +73,6 @@ Feature: Advanced HTML Reports
74
73
  concurrency: 2
75
74
  screenshot_on_fail: true
76
75
  selenium_connect:
77
- log: 'evidence'
78
76
  host: 'saucelabs'
79
77
  browser: 'firefox'
80
78
  sauce_username: 'testing_arrgyle'
@@ -100,3 +98,18 @@ Feature: Advanced HTML Reports
100
98
  And the following files should exist:
101
99
  | evidence/final_results.html |
102
100
 
101
+ Scenario: I capture the dom from all open windows
102
+ Given a file named "beakers/fifth_beaker.rb" with:
103
+ """
104
+ describe "Reporting Beaker 5", :depth => 'shallow' do
105
+ it "loads two windows, from 5" do
106
+ @driver.get 'http://the-internet.herokuapp.com/windows'
107
+ @driver.find_element(css: '.example a').click
108
+ @driver.title.should include("Google")
109
+ end
110
+ end
111
+ """
112
+ When I run `ckit brew --beakers=beakers/fifth_beaker.rb`
113
+ And the following files should exist:
114
+ | evidence/final_results.html |
115
+
@@ -0,0 +1,46 @@
1
+ @announce
2
+ Feature: Sauce specific feature tests
3
+
4
+ Background:
5
+ Given I run `ckit new sauce-test`
6
+ And I cd to "sauce-test"
7
+ And a file named "beakers/first_beaker.rb" with:
8
+ """
9
+ describe "Sauce Beaker", :depth => 'shallow' do
10
+ it "test" do
11
+ @driver.get "http://www.google.com"
12
+ @driver.title.should include("Google")
13
+ end
14
+ end
15
+ """
16
+ And I overwrite config.yaml with:
17
+ """
18
+ screenshot_on_fail: true
19
+ selenium_connect:
20
+ host: 'saucelabs'
21
+ browser: 'firefox'
22
+ sauce_username: 'testing_arrgyle'
23
+ sauce_api_key: 'ab7a6e17-16df-42d2-9ef6-c8d2539cc38a'
24
+ sauce_opts:
25
+ public: 'private'
26
+ """
27
+
28
+ Scenario: Default permission config should work
29
+ When I run `ckit brew`
30
+ Then the stdout should contain "1 example, 0 failures"
31
+ And the file "evidence/sauce_beaker/sauce_beaker_test/sauce_job.log" should contain "private"
32
+
33
+ Scenario: I can set a specific permission with a tag
34
+ Given I overwrite "beakers/first_beaker.rb" with:
35
+ """
36
+ describe "Sauce Beaker", :depth => 'shallow', :public => 'share', :crazy => 'test_tag' do
37
+ it "test" do
38
+ @driver.get "http://www.google.com"
39
+ @driver.title.should include("Google")
40
+ end
41
+ end
42
+ """
43
+ When I run `ckit brew`
44
+ Then the stdout should contain "1 example, 0 failures"
45
+ And the file "evidence/sauce_beaker/sauce_beaker_test/sauce_job.log" should contain "share"
46
+ And the file "evidence/sauce_beaker/sauce_beaker_test/sauce_job.log" should contain "crazy:test_tag"
@@ -17,7 +17,6 @@ Background:
17
17
  screenshot_on_fail: true
18
18
  base_url: 'http://the-internet.herokuapp.com/abtest'
19
19
  selenium_connect:
20
- log: 'evidence'
21
20
  browser: 'firefox'
22
21
  split_testing:
23
22
  provider: 'optimizely'
@@ -27,7 +27,7 @@ module ChemistryKit
27
27
  private
28
28
 
29
29
  def validate_key(key)
30
- raise "Unknown \"#{key}\"" unless @data.has_key?(key.to_sym)
30
+ raise "Unknown \"#{key}\"" unless @data.key?(key.to_sym)
31
31
  end
32
32
  end
33
33
  end
@@ -50,7 +50,7 @@ module ChemistryKit
50
50
  c.add_setting :used_tags
51
51
  c.before(:suite) { ::RSpec.configuration.used_tags = [] }
52
52
  c.around(:each) do |example|
53
- standard_keys = [:example_group, :example_group_block, :description_args, :caller, :execution_result]
53
+ standard_keys = [:example_group, :example_group_block, :description_args, :caller, :execution_result, :full_description]
54
54
  example.metadata.each do |key, value|
55
55
  tag = "#{key}:#{value}" unless standard_keys.include?(key)
56
56
  ::RSpec.configuration.used_tags.push tag unless ::RSpec.configuration.used_tags.include?(tag) || tag.nil?
@@ -135,7 +135,6 @@ module ChemistryKit
135
135
 
136
136
  def override_configs(options, config)
137
137
  # TODO: expand this to allow for more overrides as needed
138
- config.log.results_file = options['results_file'] if options['results_file']
139
138
  config.retries_on_failure = options['retry'].to_i if options['retry']
140
139
  config
141
140
  end
@@ -197,6 +196,23 @@ module ChemistryKit
197
196
  test_path = File.join(Dir.getwd, sc_config[:log])
198
197
  Dir.mkdir test_path unless File.exists?(test_path)
199
198
 
199
+ # set the tags and permissions if sauce
200
+ if sc_config[:host] == 'saucelabs'
201
+ tags = example.metadata.reject do |key, value|
202
+ [:example_group, :example_group_block, :description_args, :caller, :execution_result, :full_description].include? key
203
+ end
204
+ sauce_opts = {}
205
+ sauce_opts.merge!(public: tags.delete(:public)) if tags.key?(:public)
206
+ sauce_opts.merge!(tags: tags.map { |key, value| "#{key}:#{value}"}) unless tags.empty?
207
+
208
+ if sc_config[:sauce_opts]
209
+ sc_config[:sauce_opts].merge!(sauce_opts) unless sauce_opts.empty?
210
+ else
211
+ sc_config[:sauce_opts] = sauce_opts unless sauce_opts.empty?
212
+ end
213
+
214
+ end
215
+
200
216
  # configure and start sc
201
217
  configuration = SeleniumConnect::Configuration.new sc_config
202
218
  @sc = SeleniumConnect.start configuration
@@ -237,16 +253,16 @@ module ChemistryKit
237
253
 
238
254
  html_log_name = options[:parallel] ? "results_#{options[:parallel]}.html" : 'results_0.html'
239
255
 
240
- c.add_formatter(ChemistryKit::RSpec::HtmlFormatter, File.join(Dir.getwd, config.log.path, html_log_name))
241
- # c.add_formatter(::RSpec::Core::Formatters::HtmlFormatter, File.join(Dir.getwd, config.log.path, html_log_name))
256
+ c.add_formatter(ChemistryKit::RSpec::HtmlFormatter, File.join(Dir.getwd, config.reporting.path, html_log_name))
242
257
 
243
258
  # for rspec-retry
244
259
  c.verbose_retry = true # for rspec-retry
245
260
  c.default_retry_count = config.retries_on_failure
246
261
 
262
+ # TODO: this is messy... there should be a cleaner way to hook various reporter things.
247
263
  if config.concurrency == 1 || options['parallel']
248
- junit_log_name = options[:parallel] ? "junit_#{options[:parallel]}.xml" : 'junit.xml'
249
- c.add_formatter(ChemistryKit::RSpec::JUnitFormatter, File.join(Dir.getwd, config.log.path, junit_log_name))
264
+ junit_log_name = options[:parallel] ? "junit_#{options[:parallel]}.xml" : 'junit_0.xml'
265
+ c.add_formatter(ChemistryKit::RSpec::JUnitFormatter, File.join(Dir.getwd, config.reporting.path, junit_log_name))
250
266
  end
251
267
  end
252
268
  end
@@ -0,0 +1,14 @@
1
+ # Encoding: utf-8
2
+
3
+ module ChemistryKit
4
+ module Config
5
+ # Simple logging configuration class to encapsulate logging settings in the same pattern
6
+ # as others.
7
+ class Reporting
8
+
9
+ def path
10
+ 'evidence'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -5,6 +5,7 @@ require 'ostruct'
5
5
 
6
6
  require 'chemistrykit/config/basic_auth'
7
7
  require 'chemistrykit/config/split_testing'
8
+ require 'chemistrykit/config/reporting'
8
9
 
9
10
  module ChemistryKit
10
11
  # Default configuration class
@@ -15,7 +16,7 @@ module ChemistryKit
15
16
  :screenshot_on_fail,
16
17
  :retries_on_failure
17
18
 
18
- attr_reader :log, :basic_auth, :split_testing
19
+ attr_reader :reporting, :basic_auth, :split_testing
19
20
 
20
21
  attr_writer :selenium_connect
21
22
 
@@ -25,10 +26,7 @@ module ChemistryKit
25
26
  @retries_on_failure = 1
26
27
  @selenium_connect = {}
27
28
  @screenshot_on_fail = false
28
- @log = OpenStruct.new
29
- @log.path = 'evidence'
30
- @log.results_file = 'results_junit.xml'
31
- @log.format = 'ChemistryKit::RSpec::JUnitFormatter'
29
+ @reporting = ChemistryKit::Config::Reporting.new
32
30
  @basic_auth = nil
33
31
  @split_testing = nil
34
32
 
@@ -36,13 +34,6 @@ module ChemistryKit
36
34
  populate_with_hash hash
37
35
  end
38
36
 
39
- def log=(log_hash)
40
- log_hash.each do |key, value|
41
- value = 'ChemistryKit::RSpec::JUnitFormatter' if key == :format && value =~ /junit/i
42
- @log.send("#{key}=", value) unless value.nil?
43
- end
44
- end
45
-
46
37
  def basic_auth=(basic_auth_hash)
47
38
  @basic_auth = ChemistryKit::Config::BasicAuth.new(basic_auth_hash.merge(base_url: base_url))
48
39
  end
@@ -54,7 +45,7 @@ module ChemistryKit
54
45
  def selenium_connect
55
46
  # return the default log unless the sc log is set
56
47
  if @selenium_connect[:log].nil?
57
- @selenium_connect[:log] = @log.path
48
+ @selenium_connect[:log] = @reporting.path
58
49
  return @selenium_connect
59
50
  end
60
51
  @selenium_connect
@@ -115,9 +115,14 @@ module ChemistryKit
115
115
  end
116
116
  doc.div(class: 'large-6 columns') do
117
117
  doc.div(class: "#{type}-switch") do
118
- doc.input(id: "show-#{type}", onclick: "toggle#{type.capitalize}();", name: "switch-show-#{type}", type: 'radio', checked: 'checked')
118
+ opts = { onclick: "toggle#{type.capitalize}();", name: "switch-show-#{type}", type: 'radio' }
119
+ top = opts.merge(id: "show-#{type}")
120
+ bot = opts.merge(id: "show-#{type}1")
121
+ top.merge!(checked: 'checked') unless type == 'passing'
122
+ bot.merge!(checked: 'checked') if type == 'passing'
123
+ doc.input(top)
119
124
  doc.label(for: "show-#{type}") { doc.text 'Hide' }
120
- doc.input(id: "show-#{type}1", onclick: "toggle#{type.capitalize}();", name: "switch-show-#{type}", type: 'radio')
125
+ doc.input(bot)
121
126
  doc.label(for: "show-#{type}1") { doc.text 'Show' }
122
127
  doc.span
123
128
  end
@@ -34,7 +34,8 @@ module ChemistryKit
34
34
 
35
35
  def example_group_finished(example_group)
36
36
  @output_html << build_fragment do |doc|
37
- doc.div(class: "row example-group #{@example_group_status}") do
37
+ show = @example_group_status == 'passing' ? 'show' : ''
38
+ doc.div(class: "row example-group #{@example_group_status} #{show}") do
38
39
  doc.div(class: 'large-12 columns') do
39
40
  doc.h3 do
40
41
  doc.i(class: 'icon-beaker')
@@ -99,13 +100,13 @@ module ChemistryKit
99
100
  doc.div(class: 'row extra-content') do
100
101
  doc.div(class: 'large-12 columns') do
101
102
  doc.div(class: 'section-container auto', 'data-section' => '') do
103
+ doc << render_failshot_if_found(example)
102
104
  doc << render_stack_trace(example)
103
105
  doc << render_log_if_found(example, 'server.log')
104
106
  doc << render_log_if_found(example, 'chromedriver.log')
105
107
  doc << render_log_if_found(example, 'firefox.log')
106
108
  doc << render_log_if_found(example, 'sauce_job.log')
107
109
  doc << render_dom_html_if_found(example)
108
- doc << render_failshot_if_found(example)
109
110
  end
110
111
  end
111
112
  end
@@ -116,12 +117,18 @@ module ChemistryKit
116
117
  # TODO: pull out the common code for checking if the log file exists
117
118
  beaker_folder = slugify(@example_group.description)
118
119
  example_folder = slugify(@example_group.description + '_' + example.description)
119
- path = File.join(Dir.getwd, 'evidence', beaker_folder, example_folder, 'dom.html')
120
- if File.exist?(path)
121
- render_section('Dom Html') do |doc|
122
- doc << Pygments.highlight(File.read(path), lexer: 'html')
120
+ paths = Dir.glob(File.join(Dir.getwd, 'evidence', beaker_folder, example_folder, 'dom_*.html'))
121
+ number = 0
122
+ sections = ''
123
+ paths.each do |path|
124
+ if File.exist?(path)
125
+ sections << render_section("Dom HTML #{number}") do |doc|
126
+ doc << Pygments.highlight(File.read(path), lexer: 'html')
127
+ end
128
+ number += 1
123
129
  end
124
130
  end
131
+ sections
125
132
  end
126
133
 
127
134
  # TODO: replace the section id with a uuid or something....
@@ -190,7 +197,8 @@ module ChemistryKit
190
197
 
191
198
  def render_example(status, example)
192
199
  build_fragment do |doc|
193
- doc.div(class: "row example #{status}") do
200
+ show = status == 'passing' ? 'hide' : ''
201
+ doc.div(class: "row example #{status} #{show}") do
194
202
  doc.div(class: 'large-12 columns') do
195
203
  doc.div(class: 'row example-heading') do
196
204
  doc.div(class: 'large-9 columns') do
@@ -3,10 +3,6 @@
3
3
  base_url: http://google.com
4
4
  concurrency: 1
5
5
  screenshot_on_fail:
6
- log:
7
- path: 'evidence'
8
- results_file: 'results_junit.xml'
9
- format: 'junit'
10
6
  selenium_connect:
11
7
  log: 'evidence'
12
8
  host: 'localhost'
@@ -0,0 +1,21 @@
1
+ # Encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+ require 'chemistrykit/config/reporting'
5
+
6
+ describe ChemistryKit::Config::Reporting do
7
+
8
+ VALID_REPORTS_PATH = 'evidence'
9
+
10
+ before(:each) do
11
+ @reporting = ChemistryKit::Config::Reporting.new
12
+ end
13
+
14
+ it 'should be initialized with no arguments' do
15
+ @reporting.should be_an_instance_of ChemistryKit::Config::Reporting
16
+ end
17
+
18
+ it 'should return "evidence" for the log path' do
19
+ @reporting.path.should eq VALID_REPORTS_PATH
20
+ end
21
+ end
@@ -9,19 +9,14 @@ describe ChemistryKit::Configuration do
9
9
  VALID_CONCURRENCY = 1
10
10
  VALID_RETRIES_ON_FAILURE = 1
11
11
  VALID_CONFIG_FILE = 'config.yaml'
12
- VALID_LOG_PATH = 'evidence'
13
- VALID_JUNIT = 'results_junit.xml'
14
- VALID_FORMAT_JUNIT = 'junit'
15
- VALID_JUNIT_FORMAT_OUT = 'ChemistryKit::RSpec::JUnitFormatter'
12
+ VALID_REPORTING_PATH = 'evidence'
16
13
 
17
14
  before(:each) do
18
15
  @valid_selenium_connect_hash = { log: 'evidence', host: 'localhost' }
19
- @valid_log_hash = { path: VALID_LOG_PATH, results_file: VALID_JUNIT, format: VALID_FORMAT_JUNIT }
20
16
  @valid_config_hash = {
21
17
  base_url: VALID_BASE_URL,
22
18
  concurrency: VALID_CONCURRENCY,
23
19
  selenium_connect: @valid_selenium_connect_hash,
24
- log: @valid_log_hash,
25
20
  retries_on_failure: VALID_RETRIES_ON_FAILURE
26
21
  }
27
22
  end
@@ -32,10 +27,8 @@ describe ChemistryKit::Configuration do
32
27
  config.retries_on_failure.should eq VALID_RETRIES_ON_FAILURE
33
28
  config.base_url.should eq VALID_BASE_URL
34
29
 
35
- # log configurations
36
- config.log.path.should eq VALID_LOG_PATH
37
- config.log.results_file.should eq VALID_JUNIT
38
- config.log.format.should eq VALID_JUNIT_FORMAT_OUT
30
+ # reporting configurations
31
+ config.reporting.path.should eq VALID_REPORTING_PATH
39
32
 
40
33
  # selenium connect configurations
41
34
  config.selenium_connect.should eq @valid_selenium_connect_hash
@@ -49,10 +42,8 @@ describe ChemistryKit::Configuration do
49
42
  config = ChemistryKit::Configuration.new({})
50
43
  config.concurrency.should eq VALID_CONCURRENCY
51
44
  config.retries_on_failure.should eq VALID_RETRIES_ON_FAILURE
52
- config.log.path.should eq VALID_LOG_PATH
53
- config.log.results_file.should eq VALID_JUNIT
54
- config.log.format.should eq VALID_JUNIT_FORMAT_OUT
55
- config.selenium_connect.should eq({ log: VALID_LOG_PATH })
45
+ config.reporting.path.should eq VALID_REPORTING_PATH
46
+ config.selenium_connect.should eq({ log: VALID_REPORTING_PATH })
56
47
  config.basic_auth.should be_nil
57
48
  config.split_testing.should be_nil
58
49
  end
@@ -72,18 +63,13 @@ describe ChemistryKit::Configuration do
72
63
  end.to raise_error ArgumentError, 'The config key: "bad" is unknown!'
73
64
  end
74
65
 
75
- it 'should correct the format to JUnit' do
76
- config = ChemistryKit::Configuration.new(@valid_config_hash)
77
- config.log.format.should eq VALID_JUNIT_FORMAT_OUT
78
- end
79
-
80
66
  it 'selenium_connect log should default to the main log' do
81
- config = ChemistryKit::Configuration.new({ log: { path: 'main-path' } })
82
- config.selenium_connect.should eq({ log: 'main-path' })
67
+ config = ChemistryKit::Configuration.new({})
68
+ config.selenium_connect.should eq({ log: VALID_REPORTING_PATH })
83
69
  end
84
70
 
85
71
  it 'mainlog should not overide selenium_connect log' do
86
- config = ChemistryKit::Configuration.new({ log: { path: 'main-path' }, selenium_connect: { log: 'sc-log' } })
72
+ config = ChemistryKit::Configuration.new selenium_connect: { log: 'sc-log' }
87
73
  config.selenium_connect.should eq({ log: 'sc-log' })
88
74
  end
89
75
 
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chemistrykit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.0.rc3
5
- prerelease: 6
4
+ version: 3.9.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dave Haeffner
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-08-19 00:00:00.000000000 Z
13
+ date: 2013-08-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor
@@ -99,7 +99,7 @@ dependencies:
99
99
  requirements:
100
100
  - - ~>
101
101
  - !ruby/object:Gem::Version
102
- version: 3.6.0
102
+ version: 3.7.0
103
103
  type: :runtime
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
@@ -107,7 +107,7 @@ dependencies:
107
107
  requirements:
108
108
  - - ~>
109
109
  - !ruby/object:Gem::Version
110
- version: 3.6.0
110
+ version: 3.7.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: parallel_tests
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -204,7 +204,7 @@ dependencies:
204
204
  - - ~>
205
205
  - !ruby/object:Gem::Version
206
206
  version: 0.5.2
207
- description: Added basic http authentication support
207
+ description: Improved reporting features and configuration for sauce permissions
208
208
  email:
209
209
  - dave@arrgyle.com
210
210
  - jason@arrgyle.com
@@ -239,10 +239,10 @@ files:
239
239
  - features/exit_status.feature
240
240
  - features/global-config.feature
241
241
  - features/load_page_objects.feature
242
- - features/logging.feature
243
242
  - features/multi-config.feature
244
243
  - features/new.feature
245
244
  - features/reporting.feature
245
+ - features/sauce.feature
246
246
  - features/split_testing.feature
247
247
  - features/step_definitions/steps.rb
248
248
  - features/support/env.rb
@@ -257,6 +257,7 @@ files:
257
257
  - lib/chemistrykit/cli/helpers/formula_loader.rb
258
258
  - lib/chemistrykit/cli/new.rb
259
259
  - lib/chemistrykit/config/basic_auth.rb
260
+ - lib/chemistrykit/config/reporting.rb
260
261
  - lib/chemistrykit/config/split_testing.rb
261
262
  - lib/chemistrykit/configuration.rb
262
263
  - lib/chemistrykit/formula/base.rb
@@ -323,6 +324,7 @@ files:
323
324
  - spec/unit/lib/chemistrykit/chemist_spec.rb
324
325
  - spec/unit/lib/chemistrykit/cli/helpers/formula_loader_spec.rb
325
326
  - spec/unit/lib/chemistrykit/config/basic_auth_spec.rb
327
+ - spec/unit/lib/chemistrykit/config/reporting_spec.rb
326
328
  - spec/unit/lib/chemistrykit/config/split_testing_spec.rb
327
329
  - spec/unit/lib/chemistrykit/configuration_spec.rb
328
330
  - spec/unit/lib/chemistrykit/formula/base_spec.rb
@@ -347,9 +349,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
347
349
  required_rubygems_version: !ruby/object:Gem::Requirement
348
350
  none: false
349
351
  requirements:
350
- - - ! '>'
352
+ - - ! '>='
351
353
  - !ruby/object:Gem::Version
352
- version: 1.3.1
354
+ version: '0'
355
+ segments:
356
+ - 0
357
+ hash: -3683118535885590803
353
358
  requirements: []
354
359
  rubyforge_project:
355
360
  rubygems_version: 1.8.25
@@ -366,10 +371,10 @@ test_files:
366
371
  - features/exit_status.feature
367
372
  - features/global-config.feature
368
373
  - features/load_page_objects.feature
369
- - features/logging.feature
370
374
  - features/multi-config.feature
371
375
  - features/new.feature
372
376
  - features/reporting.feature
377
+ - features/sauce.feature
373
378
  - features/split_testing.feature
374
379
  - features/step_definitions/steps.rb
375
380
  - features/support/env.rb
@@ -395,6 +400,7 @@ test_files:
395
400
  - spec/unit/lib/chemistrykit/chemist_spec.rb
396
401
  - spec/unit/lib/chemistrykit/cli/helpers/formula_loader_spec.rb
397
402
  - spec/unit/lib/chemistrykit/config/basic_auth_spec.rb
403
+ - spec/unit/lib/chemistrykit/config/reporting_spec.rb
398
404
  - spec/unit/lib/chemistrykit/config/split_testing_spec.rb
399
405
  - spec/unit/lib/chemistrykit/configuration_spec.rb
400
406
  - spec/unit/lib/chemistrykit/formula/base_spec.rb
@@ -1,98 +0,0 @@
1
- #logging.feature
2
-
3
- ## NOTE Pending until after release candidate
4
-
5
- # Feature: Log handling
6
- # In order to examine the results of my test suite
7
- # As a test harness user
8
- # I want to see all of the logs in a central location
9
-
10
- # Background: Setup the project
11
- # Given I run `ckit new logging-test`
12
- # And I cd to "logging-test"
13
- # And a file named "formulas/bookie.rb" with:
14
- # """
15
- # module Formulas
16
- # class Bookie < Formula
17
- # def open(url)
18
- # @driver.get url
19
- # end
20
- # end
21
- # end
22
- # """
23
- # And a file named "beakers/first_beaker.rb" with:
24
- # """
25
- # describe "First", :depth => 'shallow' do
26
- # let(:book) { Formulas::Bookie.new(@driver) }
27
-
28
- # it "loads an external web page" do
29
- # book.open "http://www.google.com"
30
- # end
31
- # end
32
- # """
33
- # And a file named "beakers/second_beaker.rb" with:
34
- # """
35
- # describe "Second", :depth => 'shallow' do
36
- # let(:book) { Formulas::Bookie.new(@driver) }
37
-
38
- # it "loads an external web page" do
39
- # book.open "http://www.google.com"
40
- # end
41
- # end
42
- # """
43
-
44
- # Scenario: I can output junit xml results by default
45
- # When I run `ckit brew`
46
- # Then the stdout should contain "2 examples, 0 failures"
47
- # And the following files should exist:
48
- # | evidence/results_junit.xml |
49
-
50
- # Scenario: I can output custom junit xml results
51
- # Given a file named "config.yaml" with:
52
- # """
53
- # log:
54
- # path: 'my_evidence'
55
- # results_file: 'my_results.xml'
56
- # format: 'junit'
57
- # selenium_connect:
58
- # log: 'evidence'
59
- # host: 'localhost'
60
- # """
61
- # When I run `ckit brew`
62
- # Then the stdout should contain "2 examples, 0 failures"
63
- # And the following files should exist:
64
- # | my_evidence/my_results.xml |
65
-
66
- # Scenario: I can output html results
67
- # Given a file named "config.yaml" with:
68
- # """
69
- # log:
70
- # results_file: 'report.html'
71
- # format: 'html'
72
- # """
73
- # And I run `ckit brew`
74
- # Then the stdout should contain "2 examples, 0 failures"
75
- # And the following files should exist:
76
- # | evidence/report.html |
77
-
78
- # Scenario: I define one log location to rule them all
79
- # Given a file named "config.yaml" with:
80
- # """
81
- # log:
82
- # path: 'my_evidence'
83
- # selenium_connect:
84
- # host: 'localhost'
85
- # """
86
- # When I run `ckit brew`
87
- # Then the stdout should contain "2 examples, 0 failures"
88
- # And the following files should exist:
89
- # | my_evidence/results_junit.xml |
90
- # | my_evidence/first/first_loads_an_external_web_page/server.log |
91
- # | my_evidence/second/second_loads_an_external_web_page/server.log |
92
-
93
- # Scenario: I can runtime override the results output file name
94
- # When I run `ckit brew --results_file results_junit_01.xml`
95
- # Then the stdout should contain "2 examples, 0 failures"
96
- # And the following files should exist:
97
- # | evidence/results_junit_01.xml |
98
-