green_onion 0.1.3 → 0.1.4
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.
- data/README.md +12 -6
- data/green_onion.gemspec +6 -6
- data/lib/green_onion.rb +5 -4
- data/lib/green_onion/browser.rb +27 -0
- data/lib/green_onion/cli.rb +2 -0
- data/lib/green_onion/compare.rb +6 -0
- data/lib/green_onion/configuration.rb +14 -1
- data/lib/green_onion/drivers/selenium.rb +17 -0
- data/lib/green_onion/drivers/webkit.rb +18 -0
- data/lib/green_onion/generators/skinner.erb +6 -0
- data/lib/green_onion/screenshot.rb +11 -14
- data/lib/green_onion/version.rb +1 -1
- data/spec/sample_app/public/onion_face_0.jpg +0 -0
- data/spec/sample_app/public/onion_face_1.jpg +0 -0
- data/spec/unit/drivers/selenium_spec.rb +37 -0
- data/spec/unit/drivers/webkit_spec.rb +37 -0
- data/spec/unit/green_onion_spec.rb +26 -0
- data/spec/unit/screenshot_spec.rb +11 -4
- metadata +27 -16
data/README.md
CHANGED
@@ -13,7 +13,7 @@ GreenOnion is a testing library for the UI only. It alerts you when the appearan
|
|
13
13
|
|
14
14
|
## Installation
|
15
15
|
|
16
|
-
|
16
|
+
If you want to use [capybara-webkit](https://github.com/thoughtbot/capybara-webkit), you'll need to get Qt built in your testing environment. [Follow these steps](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit) and `gem install capybara-webkit` to get it up and running. Overwise, you can just use `:driver => :selenium` in the configuration block.
|
17
17
|
|
18
18
|
Add this line to your application's Gemfile:
|
19
19
|
|
@@ -42,8 +42,9 @@ Options
|
|
42
42
|
* `--dir=DIR` - the directory that GreenOnion will store all skins. The namespace for skins is {URI name}.png (original), {URI name}_fresh.png (testing), and {URI name}_diff.png. The default directory will be './spec/skins'
|
43
43
|
* `--method=[p, v, vp]` - the method in which you'd like to compare the skins. `p` is for percentage, `v` is for visual. The default is visual and percentage.
|
44
44
|
* `--threshold=[1-100]` is the percentage of acceptable change that the screenshots can take. This number can always be overwritten for an instance.
|
45
|
-
* `--width=[number]` is the width of the browser window. The default width is 1024.
|
46
|
-
* `--height=[number]` is the height of the browser window. The default height is 768.
|
45
|
+
* `--width=[number]` is the width of the browser window. The default width is 1024. (only when using capybara-webkit)
|
46
|
+
* `--height=[number]` is the height of the browser window. The default height is 768. (only when using capybara-webkit)
|
47
|
+
* `--driver=DRIVER` is the browser driver for Capybara. It is `webkit` by default, but you can also pass in `selenium`.
|
47
48
|
|
48
49
|
#### Generating skinner file
|
49
50
|
|
@@ -66,6 +67,7 @@ For adding GreenOnion to your integration tests in RSpec, add `require 'green_on
|
|
66
67
|
:prefix => nil,
|
67
68
|
:root => "root"
|
68
69
|
}
|
70
|
+
c.driver = :webkit
|
69
71
|
c.dimensions = {
|
70
72
|
:width => 1440,
|
71
73
|
:height => 768
|
@@ -79,6 +81,7 @@ For adding GreenOnion to your integration tests in RSpec, add `require 'green_on
|
|
79
81
|
* `:replace` - the string that replaces what is matched. These options are just abstractions of String.gsub in GreenOnion::Screenshot.
|
80
82
|
* `:prefix` - a value that will be concatenated to the front of the filename. A good example would be if you wanted to add a timestamp: `:prefix => Time.now.strftime("%m_%Y_")`.
|
81
83
|
* `:root` - the string that will be used to name the root of a domain.
|
84
|
+
* `driver` is a string for the browser driver to use. The default is `'webkit'`. You could also pass in `'selenium'` instead.
|
82
85
|
* `dimensions` is a hash with the height and width of the browser window. The default dimensions are 1024x768.
|
83
86
|
* `threshold` is the percentage of acceptable change that the screenshots can take. This number can always be overwritten for an instance.
|
84
87
|
|
@@ -128,13 +131,16 @@ The best way to run the specs is with...
|
|
128
131
|
|
129
132
|
Much of this work could not be completed without these people and projects
|
130
133
|
|
131
|
-
### Jeff Kreeftmeijer
|
134
|
+
### [Jeff Kreeftmeijer](http://jeffkreeftmeijer.com)
|
132
135
|
This is the post that got the wheels in motion: http://jeffkreeftmeijer.com/2011/comparing-images-and-creating-image-diffs/. Most of the GreenOnion::Compare class is based on this work alone. Great job Jeff!
|
133
136
|
|
134
|
-
### Compatriot
|
137
|
+
### [Compatriot](https://github.com/carols10cents/compatriot)
|
135
138
|
Carol Nichols saw the same post, and worked on an excellent gem for cross-browser testing. That gem greatly influenced design decisions with GreenOnion.
|
136
139
|
|
137
|
-
###
|
140
|
+
### [VCR](https://github.com/myronmarston/vcr)
|
141
|
+
Many patterns and ideas also came from VCR, because of its flexibility in allowing users to pick what gems to work with.
|
142
|
+
|
143
|
+
### [Capybara](https://github.com/jnicklas/capybara), [ChunkyPNG](https://github.com/wvanbergen/chunky_png), [Thor](https://github.com/wycats/thor), and [OilyPNG](https://github.com/wvanbergen/oily_png)
|
138
144
|
The land on which we sow our bulbs.
|
139
145
|
|
140
146
|
## Contributor
|
data/green_onion.gemspec
CHANGED
@@ -11,13 +11,13 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.add_development_dependency "rake"
|
12
12
|
gem.add_development_dependency "rspec"
|
13
13
|
gem.add_development_dependency "sinatra"
|
14
|
+
gem.add_development_dependency "capybara-webkit"
|
14
15
|
|
15
|
-
gem.add_dependency "capybara", "1.1
|
16
|
-
gem.add_dependency "
|
17
|
-
gem.add_dependency "
|
18
|
-
gem.add_dependency "
|
19
|
-
gem.add_dependency "
|
20
|
-
gem.add_dependency "thor", "0.15.4"
|
16
|
+
gem.add_dependency "capybara", " ~> 1.1"
|
17
|
+
gem.add_dependency "oily_png", "~> 1.0.2"
|
18
|
+
gem.add_dependency "rainbow"
|
19
|
+
gem.add_dependency "fileutils"
|
20
|
+
gem.add_dependency "thor", ">= 0.14.6"
|
21
21
|
|
22
22
|
gem.files = `git ls-files`.split($\)
|
23
23
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/lib/green_onion.rb
CHANGED
@@ -3,6 +3,7 @@ require "green_onion/screenshot"
|
|
3
3
|
require "green_onion/compare"
|
4
4
|
require "green_onion/configuration"
|
5
5
|
require "green_onion/errors"
|
6
|
+
require "green_onion/browser"
|
6
7
|
require "rainbow"
|
7
8
|
|
8
9
|
module GreenOnion
|
@@ -16,17 +17,17 @@ module GreenOnion
|
|
16
17
|
end
|
17
18
|
|
18
19
|
def configuration
|
19
|
-
@configuration ||=
|
20
|
+
@configuration ||= Configuration.new
|
20
21
|
end
|
21
22
|
|
22
23
|
# Bring the Screenshot and Compare classes together to create a skin
|
23
24
|
def skin(url)
|
24
25
|
@screenshot = Screenshot.new(
|
25
26
|
:dir => @configuration.skins_dir,
|
26
|
-
:
|
27
|
-
:
|
27
|
+
:skin_name => @configuration.skin_name,
|
28
|
+
:browser => @configuration.browser
|
28
29
|
)
|
29
|
-
@compare =
|
30
|
+
@compare = Compare.new
|
30
31
|
|
31
32
|
@screenshot.test_screenshot(url)
|
32
33
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module GreenOnion
|
2
|
+
class Browser
|
3
|
+
|
4
|
+
attr_reader :driver, :dimensions
|
5
|
+
|
6
|
+
def initialize(params={})
|
7
|
+
@driver = params[:driver]
|
8
|
+
@dimensions = params[:dimensions]
|
9
|
+
load_driver
|
10
|
+
end
|
11
|
+
|
12
|
+
def load_driver
|
13
|
+
begin
|
14
|
+
require "green_onion/drivers/#{driver}"
|
15
|
+
@driver_obj = GreenOnion.const_get(@driver.capitalize).new
|
16
|
+
rescue LoadError => e
|
17
|
+
raise e unless e.message.include?("green_onion/drivers")
|
18
|
+
raise ArgumentError.new("#{@driver} is not supported by GreenOnion.")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def snap_screenshot(url, path)
|
23
|
+
@driver_obj.record(url, path, @dimensions)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
data/lib/green_onion/cli.rb
CHANGED
@@ -12,6 +12,7 @@ module GreenOnion
|
|
12
12
|
desc "skin <url>", "Creates skins from <url> and compares them"
|
13
13
|
method_option :method, :aliases => "-m", :type => :string
|
14
14
|
method_option :threshold, :aliases => "-t", :type => :numeric
|
15
|
+
method_option :browser, :aliases => "-b", :type => :string
|
15
16
|
method_option :width, :aliases => "-w", :type => :numeric
|
16
17
|
method_option :height, :aliases => "-h", :type => :numeric
|
17
18
|
def skin(url)
|
@@ -19,6 +20,7 @@ module GreenOnion
|
|
19
20
|
c.skins_dir = options[:dir] if options[:dir]
|
20
21
|
c.threshold = options[:threshold] if options[:threshold]
|
21
22
|
c.dimensions = { :width => options[:width], :height => options[:height] } if options[:width] && options[:height]
|
23
|
+
c.driver = options[:driver].to_sym if options[:driver]
|
22
24
|
end
|
23
25
|
case options[:method]
|
24
26
|
when "v"
|
data/lib/green_onion/compare.rb
CHANGED
@@ -23,6 +23,7 @@ module GreenOnion
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
# Run through all of the pixels on both org image, and fresh image. Change the pixel color accordingly.
|
26
27
|
def diff_iterator
|
27
28
|
@images.first.height.times do |y|
|
28
29
|
@images.first.row(y).each_with_index do |pixel, x|
|
@@ -34,6 +35,7 @@ module GreenOnion
|
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
38
|
+
# Changes the pixel color to be the opposite RGB value
|
37
39
|
def pixel_difference_filter(pixel, x, y)
|
38
40
|
chans = []
|
39
41
|
[:r, :b, :g].each do |chan|
|
@@ -42,10 +44,12 @@ module GreenOnion
|
|
42
44
|
@images.last[x,y] = ChunkyPNG::Color.rgb(chans[0], chans[1], chans[2])
|
43
45
|
end
|
44
46
|
|
47
|
+
# Interface to run the R, G, B methods on ChunkyPNG
|
45
48
|
def channel_difference(chan, pixel, x, y)
|
46
49
|
ChunkyPNG::Color.send(chan, pixel) + ChunkyPNG::Color.send(chan, @images.last[x,y]) - 2 * [ChunkyPNG::Color.send(chan, pixel), ChunkyPNG::Color.send(chan, @images.last[x,y])].min
|
47
50
|
end
|
48
51
|
|
52
|
+
# Returns the numeric results of the diff of 2 images
|
49
53
|
def percentage_diff(org, fresh)
|
50
54
|
diff_images(org, fresh)
|
51
55
|
@total_px = @images.first.pixels.length
|
@@ -53,11 +57,13 @@ module GreenOnion
|
|
53
57
|
@percentage_changed = ( (@diff_index.length.to_f / @images.first.pixels.length) * 100 ).round(2)
|
54
58
|
end
|
55
59
|
|
60
|
+
# Returns the visual results of the diff of 2 images
|
56
61
|
def visual_diff(org, fresh)
|
57
62
|
diff_images(org, fresh)
|
58
63
|
save_visual_diff(org, fresh)
|
59
64
|
end
|
60
65
|
|
66
|
+
# Saves the visual diff as a separate file
|
61
67
|
def save_visual_diff(org, fresh)
|
62
68
|
x, y = @diff_index.map{ |xy| xy[0] }, @diff_index.map{ |xy| xy[1] }
|
63
69
|
@diffed_image = org.insert(-5, '_diff')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module GreenOnion
|
2
2
|
class Configuration
|
3
3
|
|
4
|
-
attr_writer :threshold, :skins_dir
|
4
|
+
attr_writer :threshold, :skins_dir, :driver
|
5
5
|
|
6
6
|
def dimensions=(options)
|
7
7
|
@dimensions = options
|
@@ -19,6 +19,18 @@ module GreenOnion
|
|
19
19
|
@skins_dir ||= './spec/skins'
|
20
20
|
end
|
21
21
|
|
22
|
+
def driver
|
23
|
+
@driver ||= :webkit
|
24
|
+
end
|
25
|
+
|
26
|
+
# Uses the driver and dimensions configuration vars to return a Browser object
|
27
|
+
def browser
|
28
|
+
@browser = Browser.new(
|
29
|
+
:dimensions => dimensions,
|
30
|
+
:driver => driver
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
22
34
|
def skin_name=(options)
|
23
35
|
@skin_name = skin_namespace_hash(options)
|
24
36
|
end
|
@@ -27,6 +39,7 @@ module GreenOnion
|
|
27
39
|
@skin_name ||= skin_namespace_hash
|
28
40
|
end
|
29
41
|
|
42
|
+
# Serves as a template for skin_name getter/setter
|
30
43
|
def skin_namespace_hash(options = {})
|
31
44
|
{
|
32
45
|
:match => options[:match] ? options[:match] : /[\/]/,
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'capybara/dsl'
|
2
|
+
|
3
|
+
module GreenOnion
|
4
|
+
class Selenium
|
5
|
+
include Capybara::DSL
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
Capybara.default_driver = :selenium
|
9
|
+
end
|
10
|
+
|
11
|
+
def record(url, path, dimensions=nil)
|
12
|
+
visit url
|
13
|
+
page.driver.browser.save_screenshot(path)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'capybara/dsl'
|
2
|
+
require 'capybara-webkit'
|
3
|
+
|
4
|
+
module GreenOnion
|
5
|
+
class Webkit
|
6
|
+
include Capybara::DSL
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
Capybara.default_driver = :webkit
|
10
|
+
end
|
11
|
+
|
12
|
+
def record(url, path, dimensions)
|
13
|
+
visit url
|
14
|
+
page.driver.render(path, dimensions)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -11,6 +11,12 @@ GreenOnion.configure do |c|
|
|
11
11
|
# c.skins_dir = "#{::Rails.root}/spec/skins"
|
12
12
|
# c.threshold = 100
|
13
13
|
# c.dimensions = { :width => 1024, :height => 768 }
|
14
|
+
# c.skin_name = {
|
15
|
+
# :match => /[\/]/,
|
16
|
+
# :replace => "_",
|
17
|
+
# :prefix => nil,
|
18
|
+
# :root => "root"
|
19
|
+
# }
|
14
20
|
end
|
15
21
|
|
16
22
|
all_routes = Rails.application.routes.routes
|
@@ -1,30 +1,21 @@
|
|
1
|
-
require 'capybara/dsl'
|
2
|
-
require 'capybara-webkit'
|
3
1
|
require "fileutils"
|
4
2
|
|
5
3
|
module GreenOnion
|
6
4
|
class Screenshot
|
7
|
-
include Capybara::DSL
|
8
5
|
|
9
|
-
|
10
|
-
attr_reader :paths_hash
|
6
|
+
attr_reader :paths_hash, :browser, :dir, :skin_name, :dimensions
|
11
7
|
|
12
|
-
def initialize(params
|
13
|
-
Capybara.default_driver = :webkit
|
14
|
-
@dimensions = params[:dimensions]
|
8
|
+
def initialize(params={})
|
15
9
|
@dir = params[:dir]
|
16
10
|
@skin_name = params[:skin_name]
|
11
|
+
@browser = params[:browser]
|
17
12
|
@paths_hash = {}
|
18
13
|
end
|
19
14
|
|
20
|
-
def snap_screenshot(url, path)
|
21
|
-
visit url
|
22
|
-
Capybara.page.driver.render(path, @dimensions)
|
23
|
-
end
|
24
|
-
|
25
15
|
def test_screenshot(url)
|
26
16
|
url_to_path(url)
|
27
|
-
|
17
|
+
create_dir(@dir)
|
18
|
+
@browser.snap_screenshot(url, @shot_path)
|
28
19
|
end
|
29
20
|
|
30
21
|
def url_to_path(url)
|
@@ -53,6 +44,12 @@ module GreenOnion
|
|
53
44
|
@paths_hash[:original] = "#{@dir}/#{@filename}.png"
|
54
45
|
end
|
55
46
|
|
47
|
+
def create_dir(dir)
|
48
|
+
unless Dir.exist?(dir)
|
49
|
+
FileUtils.mkdir(dir)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
56
53
|
def get_path(url)
|
57
54
|
url_matcher(url)
|
58
55
|
if @filename.empty? || @filename == '/'
|
data/lib/green_onion/version.rb
CHANGED
Binary file
|
Binary file
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe 'Using Selenium' do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@url = 'http://localhost:8070'
|
7
|
+
@url_w_uri = @url + '/fake_uri'
|
8
|
+
@tmp_path = './spec/tmp'
|
9
|
+
@browser = GreenOnion::Browser.new(
|
10
|
+
:dimensions => { :width => 1024, :height => 768 },
|
11
|
+
:driver => "selenium"
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
@screenshot = GreenOnion::Screenshot.new(
|
17
|
+
:browser => @browser,
|
18
|
+
:dir => @tmp_path,
|
19
|
+
:skin_name => {
|
20
|
+
:match => /[\/]/,
|
21
|
+
:replace => "_",
|
22
|
+
:prefix => nil,
|
23
|
+
:root => "root"
|
24
|
+
}
|
25
|
+
)
|
26
|
+
@file = "#{@tmp_path}/fake_uri.png"
|
27
|
+
end
|
28
|
+
|
29
|
+
after(:each) do
|
30
|
+
FileUtils.rm_r(@tmp_path, :force => true)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should snap and save screenshot w/ Selenium" do
|
34
|
+
@screenshot.test_screenshot(@url_w_uri)
|
35
|
+
File.exist?(@file).should be_true
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe 'Using Webkit' do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@url = 'http://localhost:8070'
|
7
|
+
@url_w_uri = @url + '/fake_uri'
|
8
|
+
@tmp_path = './spec/tmp'
|
9
|
+
@browser = GreenOnion::Browser.new(
|
10
|
+
:dimensions => { :width => 1024, :height => 768 },
|
11
|
+
:driver => "webkit"
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
@screenshot = GreenOnion::Screenshot.new(
|
17
|
+
:browser => @browser,
|
18
|
+
:dir => @tmp_path,
|
19
|
+
:skin_name => {
|
20
|
+
:match => /[\/]/,
|
21
|
+
:replace => "_",
|
22
|
+
:prefix => nil,
|
23
|
+
:root => "root"
|
24
|
+
}
|
25
|
+
)
|
26
|
+
@file = "#{@tmp_path}/fake_uri.png"
|
27
|
+
end
|
28
|
+
|
29
|
+
after(:each) do
|
30
|
+
FileUtils.rm_r(@tmp_path, :force => true)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should snap and save screenshot w/ Webkit" do
|
34
|
+
@screenshot.test_screenshot(@url_w_uri)
|
35
|
+
File.exist?(@file).should be_true
|
36
|
+
end
|
37
|
+
end
|
@@ -176,5 +176,31 @@ describe GreenOnion do
|
|
176
176
|
it "should raise error for when threshold is out of range for skin_visual_and_percentage" do
|
177
177
|
expect { GreenOnion.skin_visual_and_percentage(@url, 101) }.to raise_error(GreenOnion::Errors::ThresholdOutOfRange)
|
178
178
|
end
|
179
|
+
|
180
|
+
it "should raise error for when unknown driver is assigned" do
|
181
|
+
GreenOnion.configure do |c|
|
182
|
+
c.skins_dir = @tmp_path
|
183
|
+
c.driver = :foo
|
184
|
+
end
|
185
|
+
expect { GreenOnion.skin_percentage(@url) }.to raise_error(ArgumentError)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
|
190
|
+
describe "Skins with custom driver" do
|
191
|
+
before(:each) do
|
192
|
+
GreenOnion.configure do |c|
|
193
|
+
c.skins_dir = @tmp_path
|
194
|
+
c.driver = "selenium"
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
after(:each) do
|
199
|
+
FileUtils.rm_r(@tmp_path, :force => true)
|
200
|
+
end
|
201
|
+
|
202
|
+
it "should allow custom browser driver" do
|
203
|
+
GreenOnion.configuration.browser.driver.should eq("selenium")
|
204
|
+
end
|
179
205
|
end
|
180
206
|
end
|
@@ -6,15 +6,18 @@ describe GreenOnion::Screenshot do
|
|
6
6
|
@url = 'http://localhost:8070'
|
7
7
|
@url_w_uri = @url + '/fake_uri'
|
8
8
|
@tmp_path = './spec/tmp'
|
9
|
-
@
|
9
|
+
@browser = GreenOnion::Browser.new(
|
10
|
+
:dimensions => { :width => 1024, :height => 768 },
|
11
|
+
:driver => "webkit"
|
12
|
+
)
|
10
13
|
end
|
11
14
|
|
12
15
|
describe 'Snap single screenshot' do
|
13
16
|
|
14
17
|
before(:each) do
|
15
18
|
@screenshot = GreenOnion::Screenshot.new(
|
19
|
+
:browser => @browser,
|
16
20
|
:dir => @tmp_path,
|
17
|
-
:dimensions => @dimensions,
|
18
21
|
:skin_name => {
|
19
22
|
:match => /[\/]/,
|
20
23
|
:replace => "",
|
@@ -42,7 +45,7 @@ describe GreenOnion::Screenshot do
|
|
42
45
|
end
|
43
46
|
|
44
47
|
it 'should snap and save screenshot' do
|
45
|
-
@screenshot.snap_screenshot(@url_w_uri, @file)
|
48
|
+
@screenshot.browser.snap_screenshot(@url_w_uri, @file)
|
46
49
|
File.exist?(@file).should be_true
|
47
50
|
end
|
48
51
|
|
@@ -56,8 +59,8 @@ describe GreenOnion::Screenshot do
|
|
56
59
|
|
57
60
|
before(:each) do
|
58
61
|
@screenshot = GreenOnion::Screenshot.new(
|
62
|
+
:browser => @browser,
|
59
63
|
:dir => @tmp_path,
|
60
|
-
:dimensions => @dimensions,
|
61
64
|
:skin_name => {
|
62
65
|
:match => /[\/]/,
|
63
66
|
:replace => "",
|
@@ -100,6 +103,7 @@ describe GreenOnion::Screenshot do
|
|
100
103
|
|
101
104
|
it "should allow users to create a naming convention" do
|
102
105
|
@screenshot = GreenOnion::Screenshot.new(
|
106
|
+
:browser => @browser,
|
103
107
|
:dir => @tmp_path,
|
104
108
|
:skin_name => {
|
105
109
|
:match => /[\/]/,
|
@@ -115,6 +119,7 @@ describe GreenOnion::Screenshot do
|
|
115
119
|
it "should allow filenames to have a timestamp" do
|
116
120
|
this_month = Time.now.strftime("%m_%Y_")
|
117
121
|
@screenshot = GreenOnion::Screenshot.new(
|
122
|
+
:browser => @browser,
|
118
123
|
:dir => @tmp_path,
|
119
124
|
:skin_name => {
|
120
125
|
:match => /[\/]/,
|
@@ -129,6 +134,7 @@ describe GreenOnion::Screenshot do
|
|
129
134
|
|
130
135
|
it "should allow renaming for root skins" do
|
131
136
|
@screenshot = GreenOnion::Screenshot.new(
|
137
|
+
:browser => @browser,
|
132
138
|
:dir => @tmp_path,
|
133
139
|
:skin_name => {
|
134
140
|
:match => /[\/]/,
|
@@ -141,4 +147,5 @@ describe GreenOnion::Screenshot do
|
|
141
147
|
@screenshot.paths_hash[:original].should eq("#{@tmp_path}/first.png")
|
142
148
|
end
|
143
149
|
end
|
150
|
+
|
144
151
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: green_onion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ted O'Meara
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-08-
|
13
|
+
date: 2012-08-17 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -46,25 +46,25 @@ dependencies:
|
|
46
46
|
type: :development
|
47
47
|
version_requirements: *id003
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name: capybara
|
49
|
+
name: capybara-webkit
|
50
50
|
prerelease: false
|
51
51
|
requirement: &id004 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
|
-
- - "
|
54
|
+
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
57
|
-
type: :
|
56
|
+
version: "0"
|
57
|
+
type: :development
|
58
58
|
version_requirements: *id004
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
|
-
name: capybara
|
60
|
+
name: capybara
|
61
61
|
prerelease: false
|
62
62
|
requirement: &id005 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - ~>
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: "1.1"
|
68
68
|
type: :runtime
|
69
69
|
version_requirements: *id005
|
70
70
|
- !ruby/object:Gem::Dependency
|
@@ -73,7 +73,7 @@ dependencies:
|
|
73
73
|
requirement: &id006 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - ~>
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: 1.0.2
|
79
79
|
type: :runtime
|
@@ -84,9 +84,9 @@ dependencies:
|
|
84
84
|
requirement: &id007 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: "0"
|
90
90
|
type: :runtime
|
91
91
|
version_requirements: *id007
|
92
92
|
- !ruby/object:Gem::Dependency
|
@@ -95,9 +95,9 @@ dependencies:
|
|
95
95
|
requirement: &id008 !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
97
97
|
requirements:
|
98
|
-
- - "
|
98
|
+
- - ">="
|
99
99
|
- !ruby/object:Gem::Version
|
100
|
-
version: "0
|
100
|
+
version: "0"
|
101
101
|
type: :runtime
|
102
102
|
version_requirements: *id008
|
103
103
|
- !ruby/object:Gem::Dependency
|
@@ -106,9 +106,9 @@ dependencies:
|
|
106
106
|
requirement: &id009 !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|
109
|
-
- - "
|
109
|
+
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: 0.
|
111
|
+
version: 0.14.6
|
112
112
|
type: :runtime
|
113
113
|
version_requirements: *id009
|
114
114
|
description: UI testing/screenshot diffing tool
|
@@ -132,13 +132,18 @@ files:
|
|
132
132
|
- bin/green_onion
|
133
133
|
- green_onion.gemspec
|
134
134
|
- lib/green_onion.rb
|
135
|
+
- lib/green_onion/browser.rb
|
135
136
|
- lib/green_onion/cli.rb
|
136
137
|
- lib/green_onion/compare.rb
|
137
138
|
- lib/green_onion/configuration.rb
|
139
|
+
- lib/green_onion/drivers/selenium.rb
|
140
|
+
- lib/green_onion/drivers/webkit.rb
|
138
141
|
- lib/green_onion/errors.rb
|
139
142
|
- lib/green_onion/generators/skinner.erb
|
140
143
|
- lib/green_onion/screenshot.rb
|
141
144
|
- lib/green_onion/version.rb
|
145
|
+
- spec/sample_app/public/onion_face_0.jpg
|
146
|
+
- spec/sample_app/public/onion_face_1.jpg
|
142
147
|
- spec/sample_app/sample_app.rb
|
143
148
|
- spec/skins/spec_shot.png
|
144
149
|
- spec/skins/spec_shot_fresh.png
|
@@ -146,6 +151,8 @@ files:
|
|
146
151
|
- spec/spec_helper.rb
|
147
152
|
- spec/unit/cli_spec.rb
|
148
153
|
- spec/unit/compare_spec.rb
|
154
|
+
- spec/unit/drivers/selenium_spec.rb
|
155
|
+
- spec/unit/drivers/webkit_spec.rb
|
149
156
|
- spec/unit/green_onion_spec.rb
|
150
157
|
- spec/unit/screenshot_spec.rb
|
151
158
|
homepage: http://intridea.github.com/green_onion
|
@@ -176,6 +183,8 @@ signing_key:
|
|
176
183
|
specification_version: 3
|
177
184
|
summary: Regressions in the view making you cry? Have more confidence with GreenOnion.
|
178
185
|
test_files:
|
186
|
+
- spec/sample_app/public/onion_face_0.jpg
|
187
|
+
- spec/sample_app/public/onion_face_1.jpg
|
179
188
|
- spec/sample_app/sample_app.rb
|
180
189
|
- spec/skins/spec_shot.png
|
181
190
|
- spec/skins/spec_shot_fresh.png
|
@@ -183,6 +192,8 @@ test_files:
|
|
183
192
|
- spec/spec_helper.rb
|
184
193
|
- spec/unit/cli_spec.rb
|
185
194
|
- spec/unit/compare_spec.rb
|
195
|
+
- spec/unit/drivers/selenium_spec.rb
|
196
|
+
- spec/unit/drivers/webkit_spec.rb
|
186
197
|
- spec/unit/green_onion_spec.rb
|
187
198
|
- spec/unit/screenshot_spec.rb
|
188
199
|
has_rdoc:
|