cezanne 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/README.md +65 -2
- data/Rakefile +7 -0
- data/lib/cezanne/version.rb +1 -1
- data/lib/cezanne.rb +1 -1
- data/spec/cezanne_image_spec.rb +1 -1
- data/spec/cezanne_rspec_spec.rb +3 -3
- data/spec/cezanne_spec.rb +16 -13
- data/spec/images/different.html +1 -1
- data/spec/images/new.html +1 -1
- data/spec/images/similar.html +1 -1
- metadata +7 -6
- /data/spec/images/{page_name_2_browser.gif → page_name_2_browser_version.gif} +0 -0
- /data/spec/images/{page_name_browser.gif → page_name_browser_version.gif} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 891c5e89caa9580135d9536f8406e58e50f6e994
|
4
|
+
data.tar.gz: 8d7762429284a5570dbe0d219894a50ebaa85c13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71972499b7cf750c379041e50728cf8088ddf23b7caa860e8bed713cda0fa288c1b14e8a572662a5e374d8bf8c696f0a03b5d56fc98f7faf28ff4686f79de302
|
7
|
+
data.tar.gz: 4540b47068fb2e735337656082c3bd6f825d85c88626bb5c6fc4061efd36822489d95cafd9e320e88ed56ccfd568565c59abdb56e051d0cf29f7cca65bbeef8f
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/bskyb-commerce/cezanne.svg?branch=master)](https://travis-ci.org/bskyb-commerce/cezanne)
|
2
|
+
|
1
3
|
# Cezanne
|
2
4
|
|
3
5
|
Visual regression testing tool
|
@@ -16,9 +18,66 @@ Or install it yourself as:
|
|
16
18
|
|
17
19
|
$ gem install cezanne
|
18
20
|
|
19
|
-
## Usage
|
21
|
+
## Usage - RSpec
|
22
|
+
|
23
|
+
In your spec_helper.rb
|
24
|
+
|
25
|
+
require 'cezanne/rspec'
|
26
|
+
|
27
|
+
RSpec.configure do |config|
|
28
|
+
config.include Cezanne
|
29
|
+
config.cezanne = { uid: ENV['build_number'], project_name: 'awesome_app' }
|
30
|
+
end
|
31
|
+
|
32
|
+
The uid should be a unique identifier. We use the build number, but it can be a static string if you don't need
|
33
|
+
to keep multiple versions of the screenshots.
|
34
|
+
|
35
|
+
In your tests
|
36
|
+
|
37
|
+
|
38
|
+
describe 'Mont Sainte-Victoire', screenshots: true do
|
39
|
+
it 'is a masterpiece' do
|
40
|
+
visit 'url-to-painting'
|
41
|
+
check_visual_regression_for 'mont-sainte-victoire'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
Make sure to use a unique name for each screenshot.
|
46
|
+
The associate file will be a gif image named after the parameter ('mont-sainte-victoire' in the example above)
|
47
|
+
and the browser name & version, to make it easy to check visual regressions on multiple browsers.
|
48
|
+
|
49
|
+
## Dependencies
|
50
|
+
|
51
|
+
Cezanne uses ImageMagick to compare images. Check with your package manager.
|
20
52
|
|
21
|
-
|
53
|
+
Screenshots are stored on Dropbox through the Dropscreen gem. Follow the instructions at https://github.com/bskyb-commerce/dropscreen and make sure to export the access_token
|
54
|
+
|
55
|
+
export DROPBOX_ACCESS_TOKEN=**insert dropbox access token here**
|
56
|
+
|
57
|
+
Screenshots are taken using Capybara.
|
58
|
+
|
59
|
+
## (Opinionated) Workflow
|
60
|
+
|
61
|
+
* Reference screenshots are stored on Dropbox
|
62
|
+
* New and different screenshots will be synced to Dropbox at the end of the test suite
|
63
|
+
|
64
|
+
|
65
|
+
```
|
66
|
+
project_name
|
67
|
+
|
|
68
|
+
+-- reference_screenshots
|
69
|
+
|
|
70
|
+
+-- uid
|
71
|
+
| |
|
72
|
+
| +-- new_screenshots
|
73
|
+
| |
|
74
|
+
| +-- different_screenshots
|
75
|
+
|
|
76
|
+
|
|
77
|
+
+-- uid_2
|
78
|
+
|
|
79
|
+
...
|
80
|
+
```
|
22
81
|
|
23
82
|
## Contributing
|
24
83
|
|
@@ -27,3 +86,7 @@ coming soon
|
|
27
86
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
87
|
4. Push to the branch (`git push origin my-new-feature`)
|
29
88
|
5. Create new Pull Request
|
89
|
+
|
90
|
+
## Authors
|
91
|
+
|
92
|
+
Made with <3 by the Sky Haiku team
|
data/Rakefile
CHANGED
data/lib/cezanne/version.rb
CHANGED
data/lib/cezanne.rb
CHANGED
@@ -39,7 +39,7 @@ module Cezanne
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def file_name_for page_name
|
42
|
-
"#{page_name}_#{page.driver.browser.browser.
|
42
|
+
"#{page_name}_#{page.driver.browser.capabilities.browser_name}_#{page.driver.browser.capabilities.version}.gif"
|
43
43
|
end
|
44
44
|
|
45
45
|
def mark_as_new screenshot
|
data/spec/cezanne_image_spec.rb
CHANGED
data/spec/cezanne_rspec_spec.rb
CHANGED
@@ -12,7 +12,7 @@ RSpec.configure do |config|
|
|
12
12
|
config.cezanne = { uid: 'test', project_name: 'cezanne' }
|
13
13
|
end
|
14
14
|
|
15
|
-
describe 'Cezanne RSpec integration', type: :feature, screenshots: true do
|
15
|
+
describe 'Cezanne RSpec integration', type: :feature, screenshots: true, integration: true do
|
16
16
|
|
17
17
|
# wrap each test with before(:all) and after(:all)
|
18
18
|
|
@@ -44,8 +44,8 @@ describe 'Cezanne RSpec integration', type: :feature, screenshots: true do
|
|
44
44
|
|
45
45
|
|
46
46
|
it 'pull reference_screenshots' do
|
47
|
-
expect(File.exist?('artifacts/reference_screenshots/
|
48
|
-
expect(File.exist?('artifacts/reference_screenshots/
|
47
|
+
expect(File.exist?('artifacts/reference_screenshots/similar_firefox_31.0.gif')).to be true
|
48
|
+
expect(File.exist?('artifacts/reference_screenshots/different_firefox_31.0.gif')).to be true
|
49
49
|
end
|
50
50
|
|
51
51
|
end
|
data/spec/cezanne_spec.rb
CHANGED
@@ -7,14 +7,17 @@ describe Cezanne do
|
|
7
7
|
let(:page) { double('page') }
|
8
8
|
let(:driver) { double('driver') }
|
9
9
|
let(:browser) { double('browser') }
|
10
|
+
let(:capabilities) { double('capabilities') }
|
10
11
|
# RMagick mocks
|
11
12
|
let(:picture) { double('Magick::Image') }
|
12
13
|
# Cezanne classes mocks
|
13
14
|
let(:local_files) { double('local_files') }
|
14
15
|
let(:image) { double('Cezanne::Image') }
|
15
|
-
|
16
|
+
|
16
17
|
before(:each) do
|
17
|
-
allow(
|
18
|
+
allow(capabilities).to receive('browser_name').and_return('browser')
|
19
|
+
allow(capabilities).to receive('version').and_return('version')
|
20
|
+
allow(browser).to receive('capabilities').and_return(capabilities)
|
18
21
|
allow(browser).to receive('save_screenshot')
|
19
22
|
allow(driver).to receive('browser').and_return(browser)
|
20
23
|
allow(page).to receive('driver').and_return(driver)
|
@@ -91,8 +94,8 @@ describe Cezanne do
|
|
91
94
|
|
92
95
|
describe '#file_name_for' do
|
93
96
|
|
94
|
-
it 'contains page_name and
|
95
|
-
expect(class_with_cezanne.send(:file_name_for, 'fancy_page_name')).to eq('
|
97
|
+
it 'contains page_name, browser and version' do
|
98
|
+
expect(class_with_cezanne.send(:file_name_for, 'fancy_page_name')).to eq('fancy_page_name_browser_version.gif')
|
96
99
|
end
|
97
100
|
|
98
101
|
end
|
@@ -102,7 +105,7 @@ describe Cezanne do
|
|
102
105
|
let(:screenshot) { image }
|
103
106
|
|
104
107
|
before(:each) do
|
105
|
-
allow(image).to receive('path').and_return('spec/images/
|
108
|
+
allow(image).to receive('path').and_return('spec/images/page_name_browser_version.gif')
|
106
109
|
end
|
107
110
|
|
108
111
|
it 'moves screenshot to the diff folder' do
|
@@ -112,7 +115,7 @@ describe Cezanne do
|
|
112
115
|
end
|
113
116
|
|
114
117
|
after(:each) do
|
115
|
-
FileUtils.mv('spec/images/different.gif', 'spec/images/
|
118
|
+
FileUtils.mv('spec/images/different.gif', 'spec/images/page_name_browser_version.gif')
|
116
119
|
end
|
117
120
|
|
118
121
|
end
|
@@ -123,7 +126,7 @@ describe Cezanne do
|
|
123
126
|
let(:screenshot) { image }
|
124
127
|
|
125
128
|
before(:each) do
|
126
|
-
allow(image).to receive('path').and_return('spec/images/
|
129
|
+
allow(image).to receive('path').and_return('spec/images/page_name_browser_version.gif')
|
127
130
|
end
|
128
131
|
|
129
132
|
it 'moves screenshot to the new folder' do
|
@@ -133,7 +136,7 @@ describe Cezanne do
|
|
133
136
|
end
|
134
137
|
|
135
138
|
after(:each) do
|
136
|
-
FileUtils.mv('spec/images/new.gif', 'spec/images/
|
139
|
+
FileUtils.mv('spec/images/new.gif', 'spec/images/page_name_browser_version.gif')
|
137
140
|
end
|
138
141
|
|
139
142
|
end
|
@@ -145,7 +148,7 @@ describe Cezanne do
|
|
145
148
|
end
|
146
149
|
|
147
150
|
it 'return a Cezanne::Image' do
|
148
|
-
path = 'spec/images/
|
151
|
+
path = 'spec/images/page_name_browser_version.gif'
|
149
152
|
expect(class_with_cezanne.send(:image, path)).to be_instance_of(Cezanne::Image)
|
150
153
|
end
|
151
154
|
|
@@ -154,13 +157,13 @@ describe Cezanne do
|
|
154
157
|
describe '#check_visual_regression_for' do
|
155
158
|
|
156
159
|
before(:each) do
|
157
|
-
allow(class_with_cezanne).to receive('get_reference_screenshot_for').and_return(Cezanne::Image.new('spec/images/
|
160
|
+
allow(class_with_cezanne).to receive('get_reference_screenshot_for').and_return(Cezanne::Image.new('spec/images/page_name_browser_version.gif'))
|
158
161
|
end
|
159
162
|
|
160
163
|
context 'succesful match' do
|
161
164
|
|
162
165
|
it 'does not raise an error' do
|
163
|
-
allow(class_with_cezanne).to receive('take_screenshot').and_return(Cezanne::Image.new('spec/images/
|
166
|
+
allow(class_with_cezanne).to receive('take_screenshot').and_return(Cezanne::Image.new('spec/images/page_name_browser_version.gif'))
|
164
167
|
expect { class_with_cezanne.check_visual_regression_for 'page_name' }.not_to raise_error
|
165
168
|
end
|
166
169
|
|
@@ -168,7 +171,7 @@ describe Cezanne do
|
|
168
171
|
|
169
172
|
context 'failed match' do
|
170
173
|
|
171
|
-
let(:screenshot) { Cezanne::Image.new('spec/images/
|
174
|
+
let(:screenshot) { Cezanne::Image.new('spec/images/page_name_2_browser_version.gif') }
|
172
175
|
|
173
176
|
before(:each) do
|
174
177
|
allow(class_with_cezanne).to receive('take_screenshot').and_return(screenshot)
|
@@ -190,7 +193,7 @@ describe Cezanne do
|
|
190
193
|
|
191
194
|
context 'new screenshot' do
|
192
195
|
|
193
|
-
let(:screenshot) { Cezanne::Image.new('spec/images/
|
196
|
+
let(:screenshot) { Cezanne::Image.new('spec/images/page_name_browser_version.gif') }
|
194
197
|
|
195
198
|
before(:each) do
|
196
199
|
allow(class_with_cezanne).to receive('get_reference_screenshot_for').and_return(false)
|
data/spec/images/different.html
CHANGED
data/spec/images/new.html
CHANGED
data/spec/images/similar.html
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cezanne
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sky Haiku
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -130,6 +130,7 @@ extensions: []
|
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
132
|
- ".gitignore"
|
133
|
+
- ".travis.yml"
|
133
134
|
- Gemfile
|
134
135
|
- LICENSE.txt
|
135
136
|
- README.md
|
@@ -148,8 +149,8 @@ files:
|
|
148
149
|
- spec/cezanne_spec.rb
|
149
150
|
- spec/images/different.html
|
150
151
|
- spec/images/new.html
|
151
|
-
- spec/images/
|
152
|
-
- spec/images/
|
152
|
+
- spec/images/page_name_2_browser_version.gif
|
153
|
+
- spec/images/page_name_browser_version.gif
|
153
154
|
- spec/images/similar.html
|
154
155
|
- spec/spec_helper.rb
|
155
156
|
homepage: ''
|
@@ -183,7 +184,7 @@ test_files:
|
|
183
184
|
- spec/cezanne_spec.rb
|
184
185
|
- spec/images/different.html
|
185
186
|
- spec/images/new.html
|
186
|
-
- spec/images/
|
187
|
-
- spec/images/
|
187
|
+
- spec/images/page_name_2_browser_version.gif
|
188
|
+
- spec/images/page_name_browser_version.gif
|
188
189
|
- spec/images/similar.html
|
189
190
|
- spec/spec_helper.rb
|
File without changes
|
File without changes
|