Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified code to work with latest ruby and capybara. #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rvm use 1.9.2@green_onion --create
rvm use ruby-2.2.1@green_onion --create
2 changes: 1 addition & 1 deletion green_onion.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency "capybara-webkit"
gem.add_development_dependency "poltergeist"

gem.add_dependency "capybara", " ~> 1.1"
gem.add_dependency "capybara"
gem.add_dependency "oily_png", "~> 1.0.2"
gem.add_dependency "rainbow"
gem.add_dependency "fileutils"
Expand Down
7 changes: 5 additions & 2 deletions lib/green_onion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require "green_onion/configuration"
require "green_onion/errors"
require "green_onion/browser"
require "rainbow"
require 'rainbow/ext/string'

module GreenOnion
class << self
Expand Down Expand Up @@ -57,11 +57,14 @@ def skin_picker(url, type, threshold=100)
if(@screenshot.paths_hash.length > 1)
puts "\n" + url.color(:cyan)
if type[:percentage]
@compare.percentage_diff(@screenshot.paths_hash[:original], @screenshot.paths_hash[:fresh])
percentage = @compare.percentage_diff(@screenshot.paths_hash[:original], @screenshot.paths_hash[:fresh])
threshold_alert(@compare.percentage_changed, threshold)
percentage
end
if type[:visual]
@compare.visual_diff(@screenshot.paths_hash[:original], @screenshot.paths_hash[:fresh])
percentage = @compare.percentage_diff(@screenshot.paths_hash[:original], @screenshot.paths_hash[:fresh])
percentage
end
else
puts "\n#{url}".color(:cyan) + " has been saved to #{@screenshot.paths_hash[:original]}".color(:yellow)
Expand Down
2 changes: 1 addition & 1 deletion lib/green_onion/drivers/webkit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def initialize

def record(url, path, dimensions)
visit url
page.driver.render(path, dimensions)
page.driver.save_screenshot(path, dimensions)
end

end
Expand Down