chemistrykit 3.9.0.rc1 → 3.9.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
+ .DS_Store
2
+
1
3
  # Bundler/Rubygems
2
4
  *.gem
3
5
  .bundle
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ #3.9.0-rc.2 (2013-08-14)
2
+ Added Basic Auth Support. Preserving release candidate numbering since there are improvements to be made to HTTP reporting
3
+
1
4
  #3.9.0-rc.1 (2013-08-12)
2
5
  Release candidate with new features including
3
6
  - Consolidated html report
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- #ChemistryKit 3.9.0-rc.1 (2013-08-12)
1
+ #ChemistryKit 3.9.0-rc.2 (2013-08-14)
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
 
@@ -123,7 +123,7 @@ Note that because the `Chemist` is set after the instantiation of your formula b
123
123
  describe "my beaker", :depth => 'shallow' do
124
124
  let(:my_formula) { @formula_lab.using('my_formula').with('admin1').mix }
125
125
  # or
126
- let(:my_other_formula) { @formula_lab.formula.mix('my_other_formula') }
126
+ let(:my_other_formula) { @formula_lab.mix('my_other_formula') }
127
127
  ...
128
128
  end
129
129
  ```
@@ -187,6 +187,14 @@ ChemistryKit is configured by default with a `config.yaml` file that is created
187
187
 
188
188
  `screenshot_on_fail` By default false, set to true to download a screenshot of the failure (supported by sauce labs for now.)
189
189
 
190
+ `basic_auth: username:` The username to access your site with basic HTTP authentication
191
+
192
+ `basic_auth: password:` The password to access your site with basic HTTP authentication
193
+
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
197
+
190
198
  ###new
191
199
  Creates a new ChemistryKit project.
192
200
 
data/chemistrykit.gemspec CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'chemistrykit'
5
- s.version = '3.9.0.rc1'
5
+ s.version = '3.9.0.rc2'
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 chemist composition and consolidated html report building.'
11
+ s.description = 'Added basic http authentication support'
12
12
  s.license = 'MIT'
13
13
 
14
14
  s.files = `git ls-files`.split($/)
@@ -0,0 +1,49 @@
1
+ Feature: Basic Authentication
2
+
3
+ Selenium 2 does not allow header injection. So in order to support basic auth, we will pre-load HTTP and HTTPS URLs with get actions before each test execution in order for the browser to cache this information.
4
+
5
+ This way tests will be able to execute without being prompted by a modal dialog box.
6
+
7
+
8
+ Background:
9
+ Given I run `ckit new basic_auth_harness`
10
+ And I cd to "basic_auth_harness"
11
+ And a file named "beakers/basic_auth_1_beaker.rb" with:
12
+ """
13
+ describe "Basic Auth", :depth => 'shallow' do
14
+ it "works without providing credentials in the URL" do
15
+ @driver.get ENV['BASE_URL']
16
+ end
17
+ end
18
+ """
19
+
20
+ Scenario: Pre-load HTTP before each test
21
+ And a file named "config.yaml" with:
22
+ """
23
+ base_url: 'http://the-internet.herokuapp.com/basic_auth'
24
+ basic_auth:
25
+ username: 'admin'
26
+ password: 'admin'
27
+ http_path: '/'
28
+ """
29
+ When I run `ckit brew`
30
+ Then the stdout should contain "1 example, 0 failures"
31
+
32
+ Scenario: Pre-load HTTP before each test without the http_path set
33
+ And a file named "config.yaml" with:
34
+ """
35
+ base_url: 'http://the-internet.herokuapp.com/basic_auth'
36
+ basic_auth:
37
+ username: 'admin'
38
+ password: 'admin'
39
+ """
40
+ When I run `ckit brew`
41
+ Then the stdout should contain "1 example, 0 failures"
42
+
43
+ Scenario: Works without Basic Auth
44
+ And a file named "config.yaml" with:
45
+ """
46
+ base_url: 'http://google.com'
47
+ """
48
+ When I run `ckit brew`
49
+ Then the stdout should contain "1 example, 0 failures"
@@ -210,6 +210,22 @@ module ChemistryKit
210
210
 
211
211
  example.run
212
212
  end
213
+ c.before(:each) do
214
+ # basic auth caching
215
+ if config.basic_auth[:username]
216
+ if config.basic_auth[:http_path]
217
+ basic_auth_http_url = config.base_url.gsub(%r{http://}, "http:\/\/#{config.basic_auth[:username]}:#{config.basic_auth[:password]}@") + config.basic_auth[:http_path]
218
+ @driver.get basic_auth_http_url
219
+ else
220
+ basic_auth_http_url = config.base_url.gsub(%r{http://}, "http:\/\/#{config.basic_auth[:username]}:#{config.basic_auth[:password]}@")
221
+ @driver.get basic_auth_http_url
222
+ end
223
+ if config.basic_auth[:https_path]
224
+ basic_auth_https_url = config.base_url.gsub(%r{http://}, "https:\/\/#{config.basic_auth[:username]}:#{config.basic_auth[:password]}@") + config.basic_auth[:https_path]
225
+ @driver.get basic_auth_https_url
226
+ end
227
+ end
228
+ end
213
229
  c.after(:each) do
214
230
  if example.exception != nil
215
231
  @job.finish failed: true, failshot: @config.screenshot_on_fail
@@ -10,7 +10,8 @@ module ChemistryKit
10
10
  attr_accessor :base_url,
11
11
  :concurrency,
12
12
  :screenshot_on_fail,
13
- :retries_on_failure
13
+ :retries_on_failure,
14
+ :basic_auth
14
15
 
15
16
  attr_reader :log
16
17
 
@@ -26,6 +27,7 @@ module ChemistryKit
26
27
  @log.path = 'evidence'
27
28
  @log.results_file = 'results_junit.xml'
28
29
  @log.format = 'ChemistryKit::RSpec::JUnitFormatter'
30
+ @basic_auth = {}
29
31
 
30
32
  # overide with argument
31
33
  populate_with_hash hash
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chemistrykit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.0.rc1
4
+ version: 3.9.0.rc2
5
5
  prerelease: 6
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-08-12 00:00:00.000000000 Z
13
+ date: 2013-08-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor
@@ -204,7 +204,7 @@ dependencies:
204
204
  - - ~>
205
205
  - !ruby/object:Gem::Version
206
206
  version: 0.5.2
207
- description: Added chemist composition and consolidated html report building.
207
+ description: Added basic http authentication support
208
208
  email:
209
209
  - dave@arrgyle.com
210
210
  - jason@arrgyle.com
@@ -231,6 +231,7 @@ files:
231
231
  - bin/ckit
232
232
  - chemistrykit.gemspec
233
233
  - exceptions.reek
234
+ - features/basic_auth.feature
234
235
  - features/brew.feature
235
236
  - features/catalyst.feature
236
237
  - features/chemists.feature
@@ -341,12 +342,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
341
342
  version: 1.3.1
342
343
  requirements: []
343
344
  rubyforge_project:
344
- rubygems_version: 1.8.25
345
+ rubygems_version: 1.8.24
345
346
  signing_key:
346
347
  specification_version: 3
347
348
  summary: A simple and opinionated web testing framework for Selenium that follows
348
349
  convention over configuration.
349
350
  test_files:
351
+ - features/basic_auth.feature
350
352
  - features/brew.feature
351
353
  - features/catalyst.feature
352
354
  - features/chemists.feature