goggles 0.1.0 → 0.1.1
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/.gitignore +1 -0
- data/README.md +21 -13
- data/lib/goggles/cli.rb +21 -0
- data/lib/goggles/version.rb +1 -1
- data/spec/goggles_spec.rb +7 -0
- metadata +2 -2
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# goggles
|
2
|
+
[](http://badge.fury.io/rb/goggles)
|
2
3
|
|
3
4
|
Goggles is a visual testing tool inspired by [wraith](http://github.com/bbc-news/wraith) and powered by [watir-webdriver](http://github.com/watir/watir-webdriver). It allows you to compare screenshots of your web application in different browsers, and you can execute Ruby scripts to setup as many screenshots as you need.
|
4
5
|
|
@@ -23,27 +24,30 @@ Or install it yourself with:
|
|
23
24
|
|
24
25
|
## Usage
|
25
26
|
|
26
|
-
|
27
|
+
Generate a config file with `swim --init` to point goggles in the right direction.
|
28
|
+
|
29
|
+
$ swim -i /home/configs/config.yaml
|
30
|
+
|
27
31
|
``` yaml
|
28
32
|
# config.yaml
|
29
33
|
# Directory where you want to store your results. Required.
|
30
|
-
results_directory: "/home/results"
|
34
|
+
results_directory: "/home/example/results"
|
31
35
|
|
32
36
|
# Directory where you're storing your scripts. Optional.
|
33
|
-
scripts_directory: "/home/scripts"
|
37
|
+
scripts_directory: "/home/example/scripts"
|
34
38
|
|
35
39
|
# Scripts to execute in the scripts directory. Optional.
|
36
40
|
scripts_to_execute:
|
37
|
-
- "
|
38
|
-
- "
|
41
|
+
- "first_script.rb"
|
42
|
+
- "second_script.rb"
|
39
43
|
|
40
44
|
# Domain to test. Required.
|
41
|
-
domain_under_test: "http://www.
|
45
|
+
domain_under_test: "http://www.google.com"
|
42
46
|
|
43
47
|
# Paths to pages you want to test. Label them with a page name. Required.
|
44
48
|
paths_to_capture:
|
45
49
|
home: "/"
|
46
|
-
|
50
|
+
gmail: "/gmail"
|
47
51
|
|
48
52
|
# Browsers you want to compare. Cannot specify more than two (yet). Required.
|
49
53
|
browsers:
|
@@ -53,14 +57,12 @@ browsers:
|
|
53
57
|
# Widths at which you would like screenshots compared. All screenshots will be taken at a height of 768. Required.
|
54
58
|
browser_widths:
|
55
59
|
- 1024
|
56
|
-
- 600
|
57
|
-
- 320
|
58
60
|
|
59
61
|
# Fuzzing percentage. Play around with this to find the right fit. Required.
|
60
62
|
image_fuzzing: "20%"
|
61
63
|
```
|
62
64
|
|
63
|
-
If you pass scripts to goggles as part of your testing, you **must** specify when screenshots should be taken with the `#grab_screenshot` method.
|
65
|
+
If you pass scripts to goggles as part of your testing, you **must** specify when screenshots should be taken with the `#grab_screenshot` method. If you do not specify scripts in configuration, goggles will open each of your paths and take a screenshot.
|
64
66
|
|
65
67
|
NOTE: I've tried to keep variable names as unlikely to interrupt your code as possible, but `@watir` is reserved for the browser instance currently executing scripts.
|
66
68
|
|
@@ -81,6 +83,12 @@ Execute a goggles test through the command line with `swim --config CONFIG_FILE`
|
|
81
83
|
|
82
84
|
1. Fork it ( http://github.com/jdenen/goggles/fork )
|
83
85
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
84
|
-
3.
|
85
|
-
4.
|
86
|
-
5.
|
86
|
+
3. Code until specs pass (`rspec`)*
|
87
|
+
4. Commit your changes (`git commit -am 'Add some feature'`)
|
88
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
89
|
+
6. Create new Pull Request
|
90
|
+
|
91
|
+
\*Chrome and [ChromeDriver](http://code.google.com/p/selenium/wiki/ChromeDriver) are required to pass specs. Download the latest version and add it to your PATH before running `rspec`.
|
92
|
+
|
93
|
+
## Questions, Comments, Concerns
|
94
|
+
Easiest place to reach me is Twitter, [@jpdenen](http://twitter.com/jpdenen)
|
data/lib/goggles/cli.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'goggles'
|
2
2
|
require 'optparse'
|
3
|
+
require 'pathname'
|
3
4
|
|
4
5
|
module Goggles
|
5
6
|
class CLI
|
@@ -14,6 +15,16 @@ module Goggles
|
|
14
15
|
run_conf(config)
|
15
16
|
end
|
16
17
|
|
18
|
+
opts.on("-i", "--init CONFIG_FILE", "create empty config file") do |config|
|
19
|
+
file = Pathname.new(config)
|
20
|
+
|
21
|
+
if file.exist?
|
22
|
+
puts "Configuration file already exists: #{Pathname.new(config).realpath}"
|
23
|
+
else
|
24
|
+
File.open(file, 'w+') { |f| f.write(YAML::dump(EMPTY_CONFIG)) }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
17
28
|
opts.on("-v", "--version", "Goggles::VERSION") do
|
18
29
|
puts Goggles::VERSION
|
19
30
|
end
|
@@ -34,5 +45,15 @@ module Goggles
|
|
34
45
|
end
|
35
46
|
end
|
36
47
|
|
48
|
+
EMPTY_CONFIG = {
|
49
|
+
'results_directory' => "/home/example/results",
|
50
|
+
'scripts_directory' => "/home/example/scripts",
|
51
|
+
'scripts_to_execute' => ["first_example.rb", "second_example.rb"],
|
52
|
+
'domain_under_test' => "http://www.google.com",
|
53
|
+
'paths_to_capture' => { 'home' => "/", 'gmail' => "/gmail" },
|
54
|
+
'browsers' => ["chrome", "firefox"],
|
55
|
+
'browser_widths' => [1024, 600],
|
56
|
+
'image_fuzzing' => "20%"
|
57
|
+
}
|
37
58
|
end
|
38
59
|
end
|
data/lib/goggles/version.rb
CHANGED
data/spec/goggles_spec.rb
CHANGED
@@ -31,4 +31,11 @@ describe Goggles do
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
describe "creating empty configuration with --init" do
|
35
|
+
Given(:conf) { "spec/support/configs/empty_config.yml" }
|
36
|
+
Given { FileUtils.rm_f conf }
|
37
|
+
When { `swim -i #{conf}` }
|
38
|
+
Then { File.exists?(conf).should be_true }
|
39
|
+
end
|
40
|
+
|
34
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goggles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|