kontrast 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +262 -0
- data/Rakefile +2 -0
- data/bin/kontrast +111 -0
- data/lib/kontrast.rb +97 -0
- data/lib/kontrast/config/template.rb +27 -0
- data/lib/kontrast/configuration.rb +124 -0
- data/lib/kontrast/exceptions.rb +5 -0
- data/lib/kontrast/gallery/template.erb +76 -0
- data/lib/kontrast/gallery_creator.rb +164 -0
- data/lib/kontrast/image_handler.rb +119 -0
- data/lib/kontrast/runner.rb +141 -0
- data/lib/kontrast/selenium_handler.rb +84 -0
- data/lib/kontrast/test_builder.rb +25 -0
- data/lib/kontrast/version.rb +3 -0
- data/spec/configuration_spec.rb +53 -0
- data/spec/gallery_creator_spec.rb +105 -0
- data/spec/image_handler_spec.rb +52 -0
- data/spec/runner_spec.rb +37 -0
- data/spec/spec_helper.rb +44 -0
- data/spec/test_builder_spec.rb +52 -0
- metadata +202 -0
data/spec/runner_spec.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
describe Kontrast::Runner do
|
2
|
+
before :all do
|
3
|
+
Kontrast.configure do |config|
|
4
|
+
# Set up some tests
|
5
|
+
config.pages(1280) do |page|
|
6
|
+
page.home "/"
|
7
|
+
page.products "/"
|
8
|
+
end
|
9
|
+
config.pages(320) do |page|
|
10
|
+
page.home "/"
|
11
|
+
page.products "/"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
before :each do
|
17
|
+
@runner = Kontrast::Runner.new
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "split_run" do
|
21
|
+
it "return all tests when there is only one node" do
|
22
|
+
expect(@runner.split_run(1, 0)).to eql(Kontrast.test_suite.tests)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "returns a subset of the tests when there are multiple nodes" do
|
26
|
+
tests = @runner.split_run(4, 0)
|
27
|
+
|
28
|
+
expect(tests).not_to eql Kontrast.test_suite.tests
|
29
|
+
expect(tests).to eql({
|
30
|
+
1280 => {
|
31
|
+
"home" => "/"
|
32
|
+
},
|
33
|
+
320 => {}
|
34
|
+
})
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require "kontrast"
|
2
|
+
require "pry"
|
3
|
+
|
4
|
+
RSpec.configure do |config|
|
5
|
+
# Print the 10 slowest examples and example groups at the
|
6
|
+
# end of the spec run, to help surface which specs are running
|
7
|
+
# particularly slow.
|
8
|
+
# config.profile_examples = 10
|
9
|
+
|
10
|
+
# Run specs in random order to surface order dependencies. If you find an
|
11
|
+
# order dependency and want to debug it, you can fix the order by providing
|
12
|
+
# the seed, which is printed after each run.
|
13
|
+
# --seed 1234
|
14
|
+
config.order = :random
|
15
|
+
|
16
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
17
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
18
|
+
# test failures related to randomization by passing the same `--seed` value
|
19
|
+
# as the one that triggered the failure.
|
20
|
+
Kernel.srand config.seed
|
21
|
+
|
22
|
+
# rspec-expectations config goes here. You can use an alternate
|
23
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
24
|
+
# assertions if you prefer.
|
25
|
+
config.expect_with :rspec do |expectations|
|
26
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
27
|
+
# For more details, see:
|
28
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
29
|
+
expectations.syntax = :expect
|
30
|
+
end
|
31
|
+
|
32
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
33
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
34
|
+
config.mock_with :rspec do |mocks|
|
35
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
36
|
+
# For more details, see:
|
37
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
38
|
+
mocks.syntax = :expect
|
39
|
+
|
40
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
41
|
+
# a real object. This is generally recommended.
|
42
|
+
mocks.verify_partial_doubles = true
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
describe Kontrast::TestBuilder do
|
2
|
+
before :each do
|
3
|
+
# Reset the test suite
|
4
|
+
Kontrast.test_suite = nil
|
5
|
+
end
|
6
|
+
|
7
|
+
it "can build a test suite" do
|
8
|
+
Kontrast.configure do |config|
|
9
|
+
config.pages(1280) do |page|
|
10
|
+
page.home "/"
|
11
|
+
page.products "/products"
|
12
|
+
end
|
13
|
+
config.pages(320) do |page|
|
14
|
+
page.home "/"
|
15
|
+
page.other_stuff = "/other-stuff"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
expect(Kontrast.test_suite.tests).to eql({
|
19
|
+
1280 => {
|
20
|
+
"home" => "/",
|
21
|
+
"products" => "/products"
|
22
|
+
},
|
23
|
+
320 => {
|
24
|
+
"home" => "/",
|
25
|
+
"other_stuff=" => "/other-stuff"
|
26
|
+
}
|
27
|
+
})
|
28
|
+
end
|
29
|
+
|
30
|
+
it "can build a test suite with only one set of pages" do
|
31
|
+
Kontrast.configure do |config|
|
32
|
+
config.pages(1280) do |page|
|
33
|
+
page.home "/"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
expect(Kontrast.test_suite.tests).to eql({
|
37
|
+
1280 => {
|
38
|
+
"home" => "/"
|
39
|
+
}
|
40
|
+
})
|
41
|
+
end
|
42
|
+
|
43
|
+
it "does not accept the test name 'tests'" do
|
44
|
+
expect {
|
45
|
+
Kontrast.configure do |config|
|
46
|
+
config.pages(1280) do |page|
|
47
|
+
page.tests "/"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
}.to raise_error(/not a valid name/)
|
51
|
+
end
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kontrast
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ilya Rubnich
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '10.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '10.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.6'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: selenium-webdriver
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: workers
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.2'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.2'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rmagick
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.13.2
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 2.13.2
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: fog
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ~>
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.0'
|
139
|
+
description: Kontrast is a testing tool that lets you build a frontend test suite
|
140
|
+
to run against your test and production websites. It uses Selenium to take screenshots
|
141
|
+
and ImageMagick to compare them. Kontrast then produces a detailed gallery of its
|
142
|
+
test results.
|
143
|
+
email:
|
144
|
+
- ilya@harrys.com
|
145
|
+
executables:
|
146
|
+
- kontrast
|
147
|
+
extensions: []
|
148
|
+
extra_rdoc_files: []
|
149
|
+
files:
|
150
|
+
- LICENSE.txt
|
151
|
+
- README.md
|
152
|
+
- Rakefile
|
153
|
+
- bin/kontrast
|
154
|
+
- lib/kontrast.rb
|
155
|
+
- lib/kontrast/config/template.rb
|
156
|
+
- lib/kontrast/configuration.rb
|
157
|
+
- lib/kontrast/exceptions.rb
|
158
|
+
- lib/kontrast/gallery/template.erb
|
159
|
+
- lib/kontrast/gallery_creator.rb
|
160
|
+
- lib/kontrast/image_handler.rb
|
161
|
+
- lib/kontrast/runner.rb
|
162
|
+
- lib/kontrast/selenium_handler.rb
|
163
|
+
- lib/kontrast/test_builder.rb
|
164
|
+
- lib/kontrast/version.rb
|
165
|
+
- spec/configuration_spec.rb
|
166
|
+
- spec/gallery_creator_spec.rb
|
167
|
+
- spec/image_handler_spec.rb
|
168
|
+
- spec/runner_spec.rb
|
169
|
+
- spec/spec_helper.rb
|
170
|
+
- spec/test_builder_spec.rb
|
171
|
+
homepage: https://github.com/harrystech/kontrast
|
172
|
+
licenses:
|
173
|
+
- MIT
|
174
|
+
metadata: {}
|
175
|
+
post_install_message:
|
176
|
+
rdoc_options: []
|
177
|
+
require_paths:
|
178
|
+
- lib
|
179
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - '>='
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - '>='
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
requirements: []
|
190
|
+
rubyforge_project:
|
191
|
+
rubygems_version: 2.4.1
|
192
|
+
signing_key:
|
193
|
+
specification_version: 4
|
194
|
+
summary: An automated testing tool for comparing visual differences between two versions
|
195
|
+
of a website.
|
196
|
+
test_files:
|
197
|
+
- spec/configuration_spec.rb
|
198
|
+
- spec/gallery_creator_spec.rb
|
199
|
+
- spec/image_handler_spec.rb
|
200
|
+
- spec/runner_spec.rb
|
201
|
+
- spec/spec_helper.rb
|
202
|
+
- spec/test_builder_spec.rb
|