gatling 1.0.7 → 1.0.8
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 -1
- data/Gemfile +0 -7
- data/README.rdoc +35 -27
- data/Rakefile +15 -5
- data/gatling.gemspec +9 -5
- data/lib/gatling.rb +34 -17
- data/lib/gatling/capture_element.rb +3 -2
- data/lib/gatling/comparison.rb +10 -14
- data/lib/gatling/config.rb +32 -27
- data/lib/gatling/image.rb +24 -20
- data/lib/gatling/image_wrangler.rb +2 -4
- data/lib/gatling/version.rb +1 -1
- data/spec/acceptance/gatling_acceptance_spec.rb +94 -0
- data/spec/acceptance/rspec_matcher_spec.rb +39 -0
- data/spec/comparison_spec.rb +9 -8
- data/spec/configuration_spec.rb +55 -13
- data/spec/gatling_spec.rb +64 -59
- data/spec/image_spec.rb +64 -30
- data/spec/integration/gatling_integration_spec.rb +37 -0
- data/spec/support/assets/fruit_app.html +11 -0
- metadata +55 -20
- data/.rbenv-version +0 -1
- data/lib/gatling/file_helper.rb +0 -17
- data/spec/file_helper_spec.rb +0 -18
data/spec/image_spec.rb
CHANGED
@@ -3,19 +3,22 @@ require 'spec_helper'
|
|
3
3
|
describe Gatling::Image do
|
4
4
|
|
5
5
|
before :all do
|
6
|
-
|
6
|
+
ref_path = './image_tests'
|
7
|
+
Gatling::Configuration.reference_image_path = ref_path
|
8
|
+
@expected_path = File.join ref_path, 'temp'
|
9
|
+
@expected_full_path = File.join @expected_path, 'image.png'
|
7
10
|
end
|
8
11
|
|
9
12
|
describe 'should initialize from' do
|
10
13
|
|
11
14
|
it 'image file type' do
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
+
File.stub(:exists?).and_return true
|
16
|
+
image_mock = mock(Magick::Image)
|
17
|
+
Magick::Image.should_receive(:read).with('./image_tests/image.png').and_return([image_mock])
|
15
18
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
subject = Gatling::ImageFromFile.new("image.png")
|
20
|
+
subject.image.should == image_mock
|
21
|
+
subject.file_name.should == 'image.png'
|
19
22
|
end
|
20
23
|
|
21
24
|
it 'web element type' do
|
@@ -25,38 +28,69 @@ describe Gatling::Image do
|
|
25
28
|
|
26
29
|
Gatling::CaptureElement.should_receive(:new).and_return mock_capture_element
|
27
30
|
mock_capture_element.should_receive(:capture).and_return mock_image
|
28
|
-
subject = Gatling::
|
31
|
+
subject = Gatling::ImageFromElement.new(mock_element, "image.png")
|
29
32
|
subject.image.should == mock_image
|
30
33
|
subject.file_name.should == 'image.png'
|
31
34
|
end
|
32
35
|
|
33
36
|
it 'diff image' do
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
mock_image = mock(Magick::Image)
|
38
|
+
subject = Gatling::Image.new(mock_image, 'image.png')
|
39
|
+
subject.image.should == mock_image
|
40
|
+
subject.file_name.should == 'image.png'
|
38
41
|
end
|
39
42
|
end
|
40
43
|
|
41
|
-
|
42
|
-
pending
|
43
|
-
end
|
44
|
+
describe "Images file handling" do
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
46
|
+
before :each do
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'will save an image to the correct path for the type' do
|
51
|
+
mock_image = mock(Magick::Image)
|
52
|
+
mock_image.should_receive(:write).with('./image_tests/temp/image.png').and_return()
|
53
|
+
subject = Gatling::Image.new(mock_image, 'image.png')
|
54
|
+
subject.image = mock_image
|
55
|
+
subject.file_name = 'image.png'
|
56
|
+
subject.save(:as => :temp)
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'will create directory, then save and image if directory doesnt exist' do
|
60
|
+
|
61
|
+
mock_image = stub(Magick::Image)
|
62
|
+
mock_image.should_receive(:write).with(@expected_full_path).and_return()
|
54
63
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
64
|
+
File.should_receive(:exists?).with(@expected_path).and_return(false)
|
65
|
+
FileUtils.should_receive(:mkdir_p).with(@expected_path)
|
66
|
+
subject = Gatling::Image.new(mock_image, 'image.png')
|
67
|
+
|
68
|
+
subject.save(:as => :temp)
|
69
|
+
subject.path.should == @expected_full_path
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'will save and image if directory exista' do
|
73
|
+
mock_image = stub(Magick::Image)
|
74
|
+
mock_image.should_receive(:write).with(@expected_full_path).and_return()
|
75
|
+
|
76
|
+
File.should_receive(:exists?).with(@expected_path).and_return(true)
|
77
|
+
FileUtils.should_not_receive(:mkdir_p)
|
78
|
+
subject = Gatling::Image.new(mock_image, 'image.png')
|
79
|
+
|
80
|
+
subject.save(:as => :temp)
|
81
|
+
subject.path.should == @expected_full_path
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should check if a file exists, with the file name and type' do
|
85
|
+
mock_image = mock(Magick::Image)
|
86
|
+
File.should_receive(:exists?).with './image_tests/image.png'
|
87
|
+
subject = Gatling::Image.new(mock_image, 'image.png')
|
88
|
+
subject.file_name = 'image.png'
|
89
|
+
subject.exists?
|
90
|
+
end
|
61
91
|
end
|
92
|
+
|
93
|
+
|
62
94
|
end
|
95
|
+
|
96
|
+
describe Gatling::ImageFromElement
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
include Capybara::DSL
|
3
|
+
|
4
|
+
describe 'Gatling' do
|
5
|
+
|
6
|
+
before(:all) do
|
7
|
+
@spec_support_root = spec_support_root
|
8
|
+
@black_box = 'black.png'
|
9
|
+
@red_box = 'red.png'
|
10
|
+
end
|
11
|
+
|
12
|
+
before(:each) do
|
13
|
+
@ref_path = Gatling::Configuration.reference_image_path = File.join(spec_support_root, 'ref_path')
|
14
|
+
end
|
15
|
+
|
16
|
+
after(:each) do
|
17
|
+
remove_refs(@ref_path)
|
18
|
+
Gatling::Configuration.trainer_toggle = false
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'Gatling, when no reference image exists' do
|
22
|
+
|
23
|
+
it "will notify that no reference image exists and create a candidate image" do
|
24
|
+
pending
|
25
|
+
mock_element = mock
|
26
|
+
mock_element.stub(:native).and_return(mock_element)
|
27
|
+
|
28
|
+
expected_error = "The design reference #{@black_box} does not exist, #{@ref_path}/candidate/#{@black_box} " +
|
29
|
+
"is now available to be used as a reference. " +
|
30
|
+
"Copy candidate to root reference_image_path to use as reference"
|
31
|
+
|
32
|
+
expect {Gatling.matches?(@black_box, mock_element)}.should raise_error(RuntimeError, expected_error)
|
33
|
+
|
34
|
+
File.exists?(File.join(@ref_path, 'candidate', @black_box)).should be_true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -2,10 +2,21 @@
|
|
2
2
|
"http://www.w3.org/TR/html4/loose.dtd">
|
3
3
|
<html>
|
4
4
|
<head>
|
5
|
+
<style type="text/css">
|
6
|
+
div.ex
|
7
|
+
{
|
8
|
+
width:220px;
|
9
|
+
padding:10px;
|
10
|
+
border:5px solid gray;
|
11
|
+
margin:0px;
|
12
|
+
}
|
13
|
+
</style>
|
5
14
|
<title>The Smiley Site</title>
|
6
15
|
</head>
|
7
16
|
<body>
|
17
|
+
<div class='ex' id="box">
|
8
18
|
<img src='./black.png' id="black"/>
|
9
19
|
<img src='./red.png' id="red"/>
|
20
|
+
</div>
|
10
21
|
</body>
|
11
22
|
</html>
|
metadata
CHANGED
@@ -1,60 +1,93 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gatling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
- Gabriel Rotbart, Amanda Koh
|
8
|
+
- Gabriel Rotbart, Amanda Koh, Mike Bain
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rmagick
|
16
|
-
requirement: &
|
16
|
+
requirement: &70304962876040 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 2.13.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70304962876040
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec-core
|
27
|
-
requirement: &
|
27
|
+
requirement: &70304962875260 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 2.8.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70304962875260
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70304962874240 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 2.8.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70304962874240
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: capybara
|
49
|
-
requirement: &
|
49
|
+
requirement: &70304962873720 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 1.1.2
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70304962873720
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rake
|
60
|
+
requirement: &70304962873040 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.9.2
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70304962873040
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-instafail
|
71
|
+
requirement: &70304962872180 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.1.8
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70304962872180
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: pry
|
82
|
+
requirement: &70304962920060 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 0.9.8.2
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70304962920060
|
58
91
|
description: Add visual comparison matchers for rspec
|
59
92
|
email:
|
60
93
|
- grotbart@gmail.com
|
@@ -64,7 +97,6 @@ extra_rdoc_files: []
|
|
64
97
|
files:
|
65
98
|
- .DS_Store
|
66
99
|
- .gitignore
|
67
|
-
- .rbenv-version
|
68
100
|
- .rvmrc
|
69
101
|
- Gemfile
|
70
102
|
- Gemfile.lock
|
@@ -76,20 +108,21 @@ files:
|
|
76
108
|
- lib/gatling/capture_element.rb
|
77
109
|
- lib/gatling/comparison.rb
|
78
110
|
- lib/gatling/config.rb
|
79
|
-
- lib/gatling/file_helper.rb
|
80
111
|
- lib/gatling/image.rb
|
81
112
|
- lib/gatling/image_wrangler.rb
|
82
113
|
- lib/gatling/matchers/look_like_matcher.rb
|
83
114
|
- lib/gatling/version.rb
|
84
115
|
- pkg/gatling-0.0.1.gem
|
85
116
|
- reports/rspec_unit_test_output.html
|
117
|
+
- spec/acceptance/gatling_acceptance_spec.rb
|
118
|
+
- spec/acceptance/rspec_matcher_spec.rb
|
86
119
|
- spec/capture_spec.rb
|
87
120
|
- spec/comparison_spec.rb
|
88
121
|
- spec/configuration_spec.rb
|
89
|
-
- spec/file_helper_spec.rb
|
90
122
|
- spec/gatling_spec.rb
|
91
123
|
- spec/image_spec.rb
|
92
124
|
- spec/image_wrangler_spec.rb
|
125
|
+
- spec/integration/gatling_integration_spec.rb
|
93
126
|
- spec/rspec_matcher_spec.rb
|
94
127
|
- spec/spec.opts
|
95
128
|
- spec/spec_helper.rb
|
@@ -114,18 +147,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
147
|
version: '0'
|
115
148
|
requirements: []
|
116
149
|
rubyforge_project: gatling
|
117
|
-
rubygems_version: 1.8.
|
150
|
+
rubygems_version: 1.8.11
|
118
151
|
signing_key:
|
119
152
|
specification_version: 3
|
120
153
|
summary: Automated visual testing
|
121
154
|
test_files:
|
155
|
+
- spec/acceptance/gatling_acceptance_spec.rb
|
156
|
+
- spec/acceptance/rspec_matcher_spec.rb
|
122
157
|
- spec/capture_spec.rb
|
123
158
|
- spec/comparison_spec.rb
|
124
159
|
- spec/configuration_spec.rb
|
125
|
-
- spec/file_helper_spec.rb
|
126
160
|
- spec/gatling_spec.rb
|
127
161
|
- spec/image_spec.rb
|
128
162
|
- spec/image_wrangler_spec.rb
|
163
|
+
- spec/integration/gatling_integration_spec.rb
|
129
164
|
- spec/rspec_matcher_spec.rb
|
130
165
|
- spec/spec.opts
|
131
166
|
- spec/spec_helper.rb
|
data/.rbenv-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.9.3-p125
|
data/lib/gatling/file_helper.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
module Gatling
|
2
|
-
class FileHelper
|
3
|
-
class << self
|
4
|
-
|
5
|
-
def make_required_directories
|
6
|
-
Gatling::Configuration.paths.each { | key, directory | make_dir directory }
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
def make_dir(path)
|
12
|
-
FileUtils::mkdir_p(File.join(path))
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/spec/file_helper_spec.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gatling::FileHelper do
|
4
|
-
|
5
|
-
describe ':make_dir' do
|
6
|
-
before :all do
|
7
|
-
Gatling::Configuration.reference_image_path = './gatling'
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'should make required directories' do
|
11
|
-
FileUtils.should_receive(:mkdir_p).with './gatling/candidate'
|
12
|
-
FileUtils.should_receive(:mkdir_p).with './gatling/diff'
|
13
|
-
FileUtils.should_receive(:mkdir_p).with './gatling'
|
14
|
-
FileUtils.should_receive(:mkdir_p).with './gatling/temp'
|
15
|
-
Gatling::FileHelper.make_required_directories
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|