dotdiff 3.0.0-java → 3.0.1-java
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71b526f51b6093e3f063d2f815732d847ecf1d7291a91a2d1583ed14dc3ef4a8
|
4
|
+
data.tar.gz: e3c1b43efb9fa443ccbd9046dc1e6f955cdaf64ae3632924a16eda32e9f54306
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ccb5dc9b760784bdb78e4beac587dcc8a6f90773a7e5a5fcf5b5bc4edec21e16e6457f9c7ba1185c09b988175e8c08db873aa98810f9ede037653f989001d9d
|
7
|
+
data.tar.gz: f8e2d98a43bbe5d5ed63a14195d5b592aaca31405c2a6823fb191e670ca5ebdaaa14fcf895ed37f637cfb02fb1b3287cf5b4834f900eedac26d922c3fcded070
|
data/lib/dotdiff/comparer.rb
CHANGED
@@ -11,12 +11,30 @@ module DotDiff
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def result
|
14
|
+
comparer = build_comparer
|
15
|
+
|
16
|
+
if comparer.nil?
|
17
|
+
raise ArgumentError, "Unknown element class received: #{element.class.name}"
|
18
|
+
end
|
19
|
+
|
20
|
+
passed, msg = comparer.run
|
21
|
+
write_failure_imgs(comparer.new_image_path) if !passed && DotDiff.failure_image_path
|
22
|
+
|
23
|
+
[passed, msg]
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def write_failure_imgs(new_image_path)
|
29
|
+
FileUtils.mkdir_p(snapshot.failure_path)
|
30
|
+
FileUtils.mv(new_image_path, snapshot.new_file, force: true)
|
31
|
+
end
|
32
|
+
|
33
|
+
def build_comparer
|
14
34
|
if element.is_a?(Capybara::Session)
|
15
|
-
DotDiff::Comparible::PageComparer.
|
35
|
+
DotDiff::Comparible::PageComparer.new(snapshot, nil)
|
16
36
|
elsif element.is_a?(Capybara::Node::Base)
|
17
|
-
DotDiff::Comparible::ElementComparer.
|
18
|
-
else
|
19
|
-
raise ArgumentError, "Unknown element class received: #{element.class.name}"
|
37
|
+
DotDiff::Comparible::ElementComparer.new(snapshot, ElementMeta.new(page, element))
|
20
38
|
end
|
21
39
|
end
|
22
40
|
end
|
@@ -14,14 +14,13 @@ module DotDiff
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
attr_reader :snapshot, :element_meta
|
17
|
+
attr_reader :snapshot, :element_meta
|
18
18
|
|
19
19
|
def compare(compare_to_image)
|
20
|
-
@new_image = compare_to_image
|
21
20
|
return [false, img_container.dimensions_mismatch_msg] unless img_container.both_images_same_dimensions?
|
22
21
|
|
23
22
|
cmd = CommandWrapper.new
|
24
|
-
cmd.run(snapshot.basefile,
|
23
|
+
cmd.run(snapshot.basefile, new_image_path, snapshot.diff_file)
|
25
24
|
return [cmd.passed?, cmd.message] if cmd.failed?
|
26
25
|
|
27
26
|
calculate_result(cmd.pixels)
|
@@ -34,23 +33,15 @@ module DotDiff
|
|
34
33
|
diff_pixels
|
35
34
|
)
|
36
35
|
|
37
|
-
|
38
|
-
write_failure_imgs if !passed && DotDiff.failure_image_path
|
39
|
-
|
40
|
-
[passed, calc.message]
|
36
|
+
[calc.under_threshold?, calc.message]
|
41
37
|
end
|
42
38
|
|
43
39
|
def img_container
|
44
40
|
@img_container ||= DotDiff::Image::Container.new(
|
45
41
|
snapshot.basefile,
|
46
|
-
|
42
|
+
new_image_path
|
47
43
|
)
|
48
44
|
end
|
49
|
-
|
50
|
-
def write_failure_imgs
|
51
|
-
FileUtils.mkdir_p(snapshot.failure_path)
|
52
|
-
FileUtils.mv(new_image, snapshot.new_file, force: true)
|
53
|
-
end
|
54
45
|
end
|
55
46
|
end
|
56
47
|
end
|
data/lib/dotdiff/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dotdiff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Jon Normington
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|