chemistrykit 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +13 -0
- data/CHANGELOG.md +15 -0
- data/CONTRIBUTORS.md +5 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +119 -0
- data/Rakefile +1 -0
- data/TODO.md +16 -0
- data/bin/ckit +8 -0
- data/chemistrykit.gemspec +33 -0
- data/ext/mkrf_conf.rb +22 -0
- data/lib/chemistry_kit.rb +1 -0
- data/lib/chemistrykit/cli/beaker.rb +19 -0
- data/lib/chemistrykit/cli/cli.rb +75 -0
- data/lib/chemistrykit/cli/generators.rb +12 -0
- data/lib/chemistrykit/cli/new.rb +24 -0
- data/lib/chemistrykit/cli/page_object.rb +21 -0
- data/lib/chemistrykit/config.rb +17 -0
- data/lib/chemistrykit/shared_context.rb +94 -0
- data/lib/chemistrykit/version.rb +3 -0
- data/lib/chemistrykit/webdriver.rb +9 -0
- data/lib/templates/beaker.tt +3 -0
- data/lib/templates/beaker_with_page_object.tt +7 -0
- data/lib/templates/chemistrykit/.rspec +1 -0
- data/lib/templates/chemistrykit/_config/chemistrykit.yaml.tt +18 -0
- data/lib/templates/chemistrykit/_config/requires.rb +1 -0
- data/lib/templates/chemistrykit/_config/saucelabs.yaml.example +3 -0
- data/lib/templates/chemistrykit/beakers/.empty_directory +0 -0
- data/lib/templates/chemistrykit/evidence/.empty_directory +0 -0
- data/lib/templates/chemistrykit/formulas/.empty_directory +0 -0
- data/lib/templates/page_object.tt +9 -0
- data/spec/chemistrykit/cli_spec.rb +9 -0
- metadata +196 -0
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
v0.0.1
|
2
|
+
======
|
3
|
+
|
4
|
+
* `ckit new` generates a chemistrykit project
|
5
|
+
* Execute tests in SauceLabs Ondemand
|
6
|
+
* Selenium server test execution
|
7
|
+
* Local test execution via selenium-webdriver
|
8
|
+
* Minimum page object model
|
9
|
+
* Page and beaker generation via `ckit generate`
|
10
|
+
* Discovery via tags
|
11
|
+
* Random execution
|
12
|
+
* Customization via yaml files
|
13
|
+
* Integration hook for CI
|
14
|
+
* Works from 'gem install' on both windows and unix
|
15
|
+
* Wrapper around WebDriver
|
data/CONTRIBUTORS.md
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2012-2013 Arrgyle, LLC
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the "Software"),
|
7
|
+
to deal in the Software without restriction, including without limitation
|
8
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
9
|
+
and/or sell copies of the Software, and to permit persons to whom the
|
10
|
+
Software is furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
19
|
+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
20
|
+
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
21
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/chemistrykit.png)](http://badge.fury.io/rb/chemistrykit)
|
2
|
+
[![Dependency Status](https://gemnasium.com/arrgyle/chemistrykit.png)](https://gemnasium.com/arrgyle/chemistrykit)
|
3
|
+
|
4
|
+
ChemistryKit
|
5
|
+
============================================================
|
6
|
+
|
7
|
+
### A simple and opinionated web testing framework for Selenium built in Ruby
|
8
|
+
|
9
|
+
This framework was designed to help you get started acceptance testing quickly and to help keep your momentum going by following convention over configuration.
|
10
|
+
|
11
|
+
This product is the result of years of experience and real world trial and error.
|
12
|
+
|
13
|
+
For a Python and PHP version, check out [py.saunter and saunter.php](https://github.com/Element-34/). ChemistryKit's inspiration comes from Saunter.
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
gem 'chemistrykit'
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install chemistrykit
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
1. Fork it
|
32
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
33
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
35
|
+
5. Create new Pull Request
|
36
|
+
|
37
|
+
Staying in Character
|
38
|
+
--------------
|
39
|
+
These things => Are called these things
|
40
|
+
Specs/Test scripts => Beakers
|
41
|
+
Page Objects => Formulas
|
42
|
+
Log Output => Evidence
|
43
|
+
|
44
|
+
Spec Discovery
|
45
|
+
--------------
|
46
|
+
|
47
|
+
ChemistryKit is built on top of RSpec. All specs are in the _beaker_ directory and end in _beaker.rb. Rather than being discovered via class or file name as some systems they are by identified by tag.
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
it 'with invalid credentials', :depth => 'shallow' do
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'with invalid credentials', :depth => 'deep' do
|
55
|
+
|
56
|
+
end
|
57
|
+
````
|
58
|
+
All specs should have at least a :depth tag. The depth should either be 'shallow' or 'deep'. Shallow specs are the ones that are the absolute-must-pass ones. And there will only be a few of them typically. Deep ones are everything else.
|
59
|
+
|
60
|
+
You can add multiple tags as well.
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
it 'with invalid credentials', :depth => 'shallow', :authentication => true do
|
64
|
+
|
65
|
+
end
|
66
|
+
````
|
67
|
+
|
68
|
+
By default ChemistryKit will discover and run the _:depth => 'shallow'_ scripts. To run different ones you use the --tag option.
|
69
|
+
|
70
|
+
ckit --tag authentication
|
71
|
+
|
72
|
+
ckit --tag depth:shallow --tag authentication
|
73
|
+
|
74
|
+
To exlude a tag, put a ~ in front of it.
|
75
|
+
|
76
|
+
ckit --tag depth:shallow --tag ~authentication
|
77
|
+
|
78
|
+
A useful trick when developing a script is to use a custom tag.
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
it 'with invalid credentials', :depth => 'shallow', :flyingmonkeybutt => true do
|
82
|
+
|
83
|
+
end
|
84
|
+
````
|
85
|
+
|
86
|
+
Execution Order
|
87
|
+
---------------
|
88
|
+
|
89
|
+
Chemistry Kit executes specs in a random order. This is intentional. Knowing the order a spec will be executed in allows for dependencies between them to creep in. Sometimes unintentionally. By having them go in a random order parallelization becomes a much easier.
|
90
|
+
|
91
|
+
Facade all the Things!
|
92
|
+
----------------------
|
93
|
+
|
94
|
+
Chemistry Kit injects itself between you and WebDriver and various other future components. You should also inject something between your project and Chemistry Kit. Chemistry Kit has started this for you in the following ways:
|
95
|
+
|
96
|
+
- _config/requires.rb: @driver inside your scripts comes from the first line in this file
|
97
|
+
|
98
|
+
Configuration
|
99
|
+
-------------
|
100
|
+
|
101
|
+
Configuration should not be in your script. Nor should it be commit to version control.
|
102
|
+
|
103
|
+
Before and After
|
104
|
+
----------------
|
105
|
+
|
106
|
+
Chemistry Kit uses the 4-phase model for scripts with a chunk of code that gets run before and after each method. By default, it does nothing more than launch a browser instance that your configuration says you want. If you want to do something more than that, just add it to your spec.
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
before(:each) do
|
110
|
+
# something here
|
111
|
+
end
|
112
|
+
```
|
113
|
+
|
114
|
+
You can even nest them inside different describe/context blocks and they will get executed from the outside-in.
|
115
|
+
|
116
|
+
Logs and CI Integration
|
117
|
+
-----------------------
|
118
|
+
|
119
|
+
Each run of Chemistry Kit creates a timestamped directory inside the evidence directory. And in there will be the full set of JUnit Ant XML files. You don't point your CI server at this timestamped directory. Instead you want to point at the _latest_ directory which is a symlink to the latest timestamp directory.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/TODO.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
- browsermob proxy
|
2
|
+
- csv provider
|
3
|
+
- db provider
|
4
|
+
- some site / 'project' that acts as both documentation and test suite
|
5
|
+
- screenshot
|
6
|
+
- on error
|
7
|
+
- on completion
|
8
|
+
- by name
|
9
|
+
- by sequence
|
10
|
+
- on demand
|
11
|
+
- hard vs. soft assert
|
12
|
+
- custom profile
|
13
|
+
- firefox
|
14
|
+
- opera
|
15
|
+
- chrome
|
16
|
+
- flex pilot (for flex/flash support)
|
data/bin/ckit
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'chemistrykit/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "chemistrykit"
|
8
|
+
s.version = ChemistryKit::VERSION
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.authors = ["Dave Haeffner", "Jason Wieringa"]
|
11
|
+
s.email = ["dave@arrgyle.com", "jason@arrgyle.com"]
|
12
|
+
s.homepage = "https://github.com/arrgyle/chemistrykit"
|
13
|
+
s.summary = "Simple and opinionated web testing framework for Selenium that follows convention over configuration -- borrowed from Saunter, built in Ruby"
|
14
|
+
s.license = 'MIT'
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split($/)
|
17
|
+
s.test_files = s.files.grep(%r{^(scripts|spec|features)/})
|
18
|
+
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.required_ruby_version = '>=1.9'
|
22
|
+
|
23
|
+
s.add_dependency "thor", "~> 0.17.0"
|
24
|
+
s.add_dependency "rspec", "~> 2.12.0"
|
25
|
+
s.add_dependency "selenium-webdriver", "~> 2.29.0"
|
26
|
+
s.add_dependency "ci_reporter", "~> 1.8.3"
|
27
|
+
s.add_dependency "rest-client", "~> 1.6.7"
|
28
|
+
|
29
|
+
s.add_development_dependency "rspec", "~> 2.12.0"
|
30
|
+
s.add_development_dependency "rake", "~> 10.0.3"
|
31
|
+
|
32
|
+
s.extensions = 'ext/mkrf_conf.rb'
|
33
|
+
end
|
data/ext/mkrf_conf.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rubygems/command.rb'
|
3
|
+
require 'rubygems/dependency_installer.rb'
|
4
|
+
require 'rbconfig'
|
5
|
+
|
6
|
+
begin
|
7
|
+
Gem::Command.build_args = ARGV
|
8
|
+
rescue NoMethodError
|
9
|
+
end
|
10
|
+
|
11
|
+
inst = Gem::DependencyInstaller.new
|
12
|
+
begin
|
13
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|win|mingw/
|
14
|
+
inst.install "win32-dir", "~> 0.4.1"
|
15
|
+
end
|
16
|
+
rescue
|
17
|
+
exit(1)
|
18
|
+
end
|
19
|
+
|
20
|
+
f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w") # create dummy rakefile to indicate success
|
21
|
+
f.write("task :default\n")
|
22
|
+
f.close
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'chemistrykit/version'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'thor/group'
|
2
|
+
|
3
|
+
module ChemistryKit
|
4
|
+
module CLI
|
5
|
+
class BeakerGenerator < Thor::Group
|
6
|
+
include Thor::Actions
|
7
|
+
argument :name
|
8
|
+
|
9
|
+
def self.source_root
|
10
|
+
File.join(File.dirname(File.expand_path(__FILE__)), '../../templates/')
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_lib_file
|
14
|
+
template('beaker.tt', "./beakers/#{name}_beaker.rb")
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require "thor"
|
2
|
+
require 'chemistrykit/cli/generators'
|
3
|
+
require 'chemistrykit/cli/new'
|
4
|
+
require 'rspec'
|
5
|
+
|
6
|
+
module ChemistryKit
|
7
|
+
module CLI
|
8
|
+
class CKitCLI < Thor
|
9
|
+
check_unknown_options!
|
10
|
+
default_task :help
|
11
|
+
|
12
|
+
register(ChemistryKit::CLI::Generate, 'generate', 'generate <formula> or <beaker> [NAME]', 'generates a page object or script')
|
13
|
+
register(ChemistryKit::CLI::New, 'new', 'new [NAME]', 'Creates a new ChemistryKit project')
|
14
|
+
|
15
|
+
desc "brew", "Run the Chemistry kit"
|
16
|
+
long_desc <<-LONGDESC
|
17
|
+
Runs the Chemistry kit
|
18
|
+
LONGDESC
|
19
|
+
method_option :tag, :default => ['depth:shallow'], :type => :array
|
20
|
+
def brew
|
21
|
+
require 'chemistrykit/config'
|
22
|
+
require 'chemistrykit/shared_context'
|
23
|
+
require 'ci/reporter/rake/rspec_loader'
|
24
|
+
|
25
|
+
# Wow... that feels like a hack...
|
26
|
+
Dir["#{Dir.getwd}/formulas/*.rb"].each {|file| require file }
|
27
|
+
|
28
|
+
tags = {}
|
29
|
+
options['tag'].each do |tag|
|
30
|
+
filter_type = tag.start_with?('~') ? :exclusion_filter : :filter
|
31
|
+
|
32
|
+
name, value = tag.gsub(/^(~@|~|@)/, '').split(':')
|
33
|
+
name = name.to_sym
|
34
|
+
|
35
|
+
value = true if value.nil?
|
36
|
+
|
37
|
+
tags[filter_type] ||= {}
|
38
|
+
tags[filter_type][name] = value
|
39
|
+
end
|
40
|
+
|
41
|
+
log_timestamp = Time.now.strftime("%Y-%m-%d-%H-%M-%S")
|
42
|
+
FileUtils.makedirs(File.join(Dir.getwd, 'evidence', log_timestamp))
|
43
|
+
|
44
|
+
ENV['CI_REPORTS'] = File.join(Dir.getwd, 'evidence', log_timestamp)
|
45
|
+
ENV['CI_CAPTURE'] = CHEMISTRY_CONFIG['chemistrykit']['capture_output'] ? 'on' : 'off'
|
46
|
+
|
47
|
+
RSpec.configure do |c|
|
48
|
+
c.filter_run tags[:filter] unless tags[:filter].nil?
|
49
|
+
c.filter_run_excluding tags[:exclusion_filter] unless tags[:exclusion_filter].nil?
|
50
|
+
c.include ChemistryKit::SharedContext
|
51
|
+
c.order = 'random'
|
52
|
+
c.default_path = 'beakers'
|
53
|
+
c.pattern = '**/*_beaker.rb'
|
54
|
+
end
|
55
|
+
|
56
|
+
exit_code = RSpec::Core::Runner.run(Dir.glob(File.join(Dir.getwd)))
|
57
|
+
|
58
|
+
if RUBY_PLATFORM.downcase.include?("mswin")
|
59
|
+
require 'win32/dir'
|
60
|
+
|
61
|
+
if Dir.junction?(File.join(Dir.getwd, 'evidence', 'latest'))
|
62
|
+
File.delete(File.join(Dir.getwd, 'evidence', 'latest'))
|
63
|
+
end
|
64
|
+
Dir.create_junction(File.join(Dir.getwd, 'evidence', 'latest'), File.join(Dir.getwd, 'evidence', log_timestamp))
|
65
|
+
else
|
66
|
+
if File.symlink?(File.join(Dir.getwd, 'evidence', 'latest'))
|
67
|
+
File.delete(File.join(Dir.getwd, 'evidence', 'latest'))
|
68
|
+
end
|
69
|
+
File.symlink(File.join(Dir.getwd, 'evidence', log_timestamp), File.join(Dir.getwd, 'evidence', 'latest'))
|
70
|
+
end
|
71
|
+
exit_code
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'chemistrykit/cli/page_object'
|
3
|
+
require 'chemistrykit/cli/beaker'
|
4
|
+
|
5
|
+
module ChemistryKit
|
6
|
+
module CLI
|
7
|
+
class Generate < Thor
|
8
|
+
register(ChemistryKit::CLI::PageObjectGenerator, 'formula', 'formula [NAME]', 'generates a page object')
|
9
|
+
register(ChemistryKit::CLI::BeakerGenerator, 'beaker', 'beaker [NAME]', 'generates a beaker')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'thor/group'
|
2
|
+
|
3
|
+
module ChemistryKit
|
4
|
+
module CLI
|
5
|
+
class New < Thor::Group
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
argument :name
|
9
|
+
|
10
|
+
def self.source_root
|
11
|
+
File.join(File.dirname(__FILE__), '..', '..')
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_project
|
15
|
+
directory "templates/chemistrykit", File.join(Dir.getwd, name)
|
16
|
+
end
|
17
|
+
|
18
|
+
def notify
|
19
|
+
say "Your project name has been added to _config/chemistrykit.yaml"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'thor/group'
|
2
|
+
|
3
|
+
module ChemistryKit
|
4
|
+
module CLI
|
5
|
+
class PageObjectGenerator < Thor::Group
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
argument :name
|
9
|
+
|
10
|
+
def self.source_root
|
11
|
+
File.join(File.dirname(File.expand_path(__FILE__)), '../../templates/')
|
12
|
+
end
|
13
|
+
|
14
|
+
def copy_file
|
15
|
+
template "page_object.tt", "./formulas/#{name}.rb"
|
16
|
+
template "beaker_with_page_object.tt", "./beakers/#{name}_beaker.rb"
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module ChemistryKit
|
4
|
+
CHEMISTRY_CONFIG = YAML.load(ERB.new(File.read(File.join(Dir.getwd, '_config', 'chemistrykit.yaml'))).result)
|
5
|
+
|
6
|
+
case
|
7
|
+
when CHEMISTRY_CONFIG['saucelabs']['ondemand'] && CHEMISTRY_CONFIG['chemistrykit']['run_locally']
|
8
|
+
puts "When Sauce Labs OnDemand is enabled, run_locally should be set to false"
|
9
|
+
exit
|
10
|
+
when CHEMISTRY_CONFIG['saucelabs']['ondemand']
|
11
|
+
begin
|
12
|
+
SAUCE_CONFIG = YAML.load(File.read(File.join(Dir.getwd, '_config', 'saucelabs.yaml')))
|
13
|
+
rescue Errno::ENOENT
|
14
|
+
abort('To use Sauce Labs OnDemand you need a _config/saucelabs.yaml with your username and key')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'rspec/core/shared_context'
|
2
|
+
require File.join(Dir.getwd, '_config', 'requires')
|
3
|
+
require 'restclient'
|
4
|
+
|
5
|
+
module ChemistryKit
|
6
|
+
module SharedContext
|
7
|
+
extend RSpec::Core::SharedContext
|
8
|
+
|
9
|
+
def set_sauce_keys
|
10
|
+
@magic_keys = [
|
11
|
+
:caller,
|
12
|
+
:description,
|
13
|
+
:description_args,
|
14
|
+
:example_group,
|
15
|
+
:example_group_block,
|
16
|
+
:execution_result,
|
17
|
+
:file_path,
|
18
|
+
:full_description,
|
19
|
+
:line_number,
|
20
|
+
:location
|
21
|
+
]
|
22
|
+
end
|
23
|
+
|
24
|
+
def capabilities
|
25
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.send(CHEMISTRY_CONFIG['webdriver']['browser'])
|
26
|
+
end
|
27
|
+
|
28
|
+
def driver_for_server(executor, capabilities)
|
29
|
+
@driver = ChemistryKit::WebDriver::Driver.new(:url => executor, :desired_capabilities => capabilities)
|
30
|
+
end
|
31
|
+
|
32
|
+
def driver_for_local
|
33
|
+
@driver = Selenium::WebDriver.for(CHEMISTRY_CONFIG['webdriver']['browser'].to_sym)
|
34
|
+
end
|
35
|
+
|
36
|
+
def executor
|
37
|
+
if CHEMISTRY_CONFIG['saucelabs']['ondemand']
|
38
|
+
"http://#{SAUCE_CONFIG['username']}:#{SAUCE_CONFIG['key']}@ondemand.saucelabs.com:80/wd/hub"
|
39
|
+
else
|
40
|
+
'http://' + CHEMISTRY_CONFIG['webdriver']['server_host'] + ":" + CHEMISTRY_CONFIG['webdriver']['server_port'].to_s + '/wd/hub'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
before(:each) do
|
45
|
+
case
|
46
|
+
when CHEMISTRY_CONFIG['chemistrykit']['run_locally']
|
47
|
+
driver_for_local
|
48
|
+
when CHEMISTRY_CONFIG['saucelabs']['ondemand']
|
49
|
+
if CHEMISTRY_CONFIG['webdriver']['browser'] != 'chrome'
|
50
|
+
capabilities[:version] = CHEMISTRY_CONFIG['saucelabs']['version']
|
51
|
+
else
|
52
|
+
capabilities[:platform] = CHEMISTRY_CONFIG['saucelabs']['platform']
|
53
|
+
end
|
54
|
+
set_sauce_keys
|
55
|
+
executor
|
56
|
+
driver_for_server(executor, capabilities)
|
57
|
+
else
|
58
|
+
executor
|
59
|
+
driver_for_server(executor, capabilities)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
after(:each) do
|
64
|
+
if CHEMISTRY_CONFIG['saucelabs']['ondemand']
|
65
|
+
session_id = @driver.session_id
|
66
|
+
end
|
67
|
+
|
68
|
+
@driver.quit
|
69
|
+
|
70
|
+
if CHEMISTRY_CONFIG['saucelabs']['ondemand']
|
71
|
+
# puts self.example.metadata
|
72
|
+
example_tags = self.example.metadata.collect{ |k, v|
|
73
|
+
if not @magic_keys.include?(k)
|
74
|
+
if v.to_s == 'true'
|
75
|
+
k
|
76
|
+
else
|
77
|
+
"#{k}:#{v}"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
}
|
81
|
+
example_tags.compact!
|
82
|
+
# puts self.example.exception
|
83
|
+
payload = {
|
84
|
+
:tags => example_tags,
|
85
|
+
:name => self.example.metadata[:full_description],
|
86
|
+
:passed => self.example.exception ? false : true
|
87
|
+
}
|
88
|
+
api_url = "http://#{SAUCE_CONFIG['username']}:#{SAUCE_CONFIG['key']}@saucelabs.com:80/rest/v1/#{SAUCE_CONFIG['username']}/jobs/#{session_id}"
|
89
|
+
RestClient.put api_url, payload.to_json, {:content_type => :json}
|
90
|
+
# puts payload.to_json
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
--format CI::Reporter::RSpec
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
chemistrykit: {
|
3
|
+
project: <%= name.capitalize %>,
|
4
|
+
capture_output: false,
|
5
|
+
run_locally: true
|
6
|
+
}
|
7
|
+
|
8
|
+
webdriver: {
|
9
|
+
browser: firefox,
|
10
|
+
server_host: localhost,
|
11
|
+
server_port: 4444
|
12
|
+
}
|
13
|
+
|
14
|
+
saucelabs: {
|
15
|
+
ondemand: false,
|
16
|
+
version: 18,
|
17
|
+
platform: Windows 2008
|
18
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'chemistrykit/webdriver'
|
File without changes
|
File without changes
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chemistrykit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dave Haeffner
|
9
|
+
- Jason Wieringa
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-02-02 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: thor
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.17.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 0.17.0
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: rspec
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 2.12.0
|
39
|
+
type: :runtime
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.12.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: selenium-webdriver
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.29.0
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.29.0
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: ci_reporter
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ~>
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 1.8.3
|
71
|
+
type: :runtime
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ~>
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 1.8.3
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: rest-client
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ~>
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 1.6.7
|
87
|
+
type: :runtime
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ~>
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 1.6.7
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: rspec
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ~>
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 2.12.0
|
103
|
+
type: :development
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.12.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rake
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ~>
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 10.0.3
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ~>
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 10.0.3
|
127
|
+
description:
|
128
|
+
email:
|
129
|
+
- dave@arrgyle.com
|
130
|
+
- jason@arrgyle.com
|
131
|
+
executables:
|
132
|
+
- ckit
|
133
|
+
extensions:
|
134
|
+
- ext/mkrf_conf.rb
|
135
|
+
extra_rdoc_files: []
|
136
|
+
files:
|
137
|
+
- .gitignore
|
138
|
+
- CHANGELOG.md
|
139
|
+
- CONTRIBUTORS.md
|
140
|
+
- Gemfile
|
141
|
+
- LICENSE
|
142
|
+
- README.md
|
143
|
+
- Rakefile
|
144
|
+
- TODO.md
|
145
|
+
- bin/ckit
|
146
|
+
- chemistrykit.gemspec
|
147
|
+
- ext/mkrf_conf.rb
|
148
|
+
- lib/chemistry_kit.rb
|
149
|
+
- lib/chemistrykit/cli/beaker.rb
|
150
|
+
- lib/chemistrykit/cli/cli.rb
|
151
|
+
- lib/chemistrykit/cli/generators.rb
|
152
|
+
- lib/chemistrykit/cli/new.rb
|
153
|
+
- lib/chemistrykit/cli/page_object.rb
|
154
|
+
- lib/chemistrykit/config.rb
|
155
|
+
- lib/chemistrykit/shared_context.rb
|
156
|
+
- lib/chemistrykit/version.rb
|
157
|
+
- lib/chemistrykit/webdriver.rb
|
158
|
+
- lib/templates/beaker.tt
|
159
|
+
- lib/templates/beaker_with_page_object.tt
|
160
|
+
- lib/templates/chemistrykit/.rspec
|
161
|
+
- lib/templates/chemistrykit/_config/chemistrykit.yaml.tt
|
162
|
+
- lib/templates/chemistrykit/_config/requires.rb
|
163
|
+
- lib/templates/chemistrykit/_config/saucelabs.yaml.example
|
164
|
+
- lib/templates/chemistrykit/beakers/.empty_directory
|
165
|
+
- lib/templates/chemistrykit/evidence/.empty_directory
|
166
|
+
- lib/templates/chemistrykit/formulas/.empty_directory
|
167
|
+
- lib/templates/page_object.tt
|
168
|
+
- spec/chemistrykit/cli_spec.rb
|
169
|
+
homepage: https://github.com/arrgyle/chemistrykit
|
170
|
+
licenses:
|
171
|
+
- MIT
|
172
|
+
post_install_message:
|
173
|
+
rdoc_options: []
|
174
|
+
require_paths:
|
175
|
+
- lib
|
176
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ! '>='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '1.9'
|
182
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
|
+
none: false
|
184
|
+
requirements:
|
185
|
+
- - ! '>='
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
requirements: []
|
189
|
+
rubyforge_project:
|
190
|
+
rubygems_version: 1.8.24
|
191
|
+
signing_key:
|
192
|
+
specification_version: 3
|
193
|
+
summary: Simple and opinionated web testing framework for Selenium that follows convention
|
194
|
+
over configuration -- borrowed from Saunter, built in Ruby
|
195
|
+
test_files:
|
196
|
+
- spec/chemistrykit/cli_spec.rb
|