blinka-reporter 0.3.5 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blinka_client.rb +8 -2
- data/lib/blinka_minitest.rb +9 -2
- data/lib/blinka_reporter/version.rb +1 -1
- data/lib/minitest/blinka_plugin.rb +29 -4
- metadata +12 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: badbf83646cbee4602ea1dc639afe398237a1932615099a733ff84c1acdbb664
|
4
|
+
data.tar.gz: 19dbdeec9e1c8cbf1a4545426e7b0ad88e86aaa01e53abcf6f451bb9ca8ba832
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 257ec90e005aef2634292bd3f7346e9233f460c830a97adf4349ae89bf27e80c6a67a6b0af961ecb668ed2ec6f58f2777d4b1bc87d95ba5101a55ba812638f5e
|
7
|
+
data.tar.gz: a2795269a1fa2eb0d6716d219c062017f76af7892fdc8c7a390d88f9470583c6d96b448d7a83417fa4877e124bb9c13b5b112e95391974f374d90fe20793d1c2
|
data/lib/blinka_client.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
-
require 'mimemagic'
|
2
1
|
require 'httparty'
|
3
2
|
|
4
3
|
class BlinkaClient
|
5
4
|
DEFAULT_HOST = 'https://www.blinka.app'.freeze
|
5
|
+
SUPPORTED_MIME_TYPES = {
|
6
|
+
jpg: 'image/jpeg',
|
7
|
+
jpeg: 'image/jpeg',
|
8
|
+
png: 'image/png'
|
9
|
+
}
|
6
10
|
|
7
11
|
include HTTParty
|
8
12
|
|
@@ -112,7 +116,9 @@ class BlinkaClient
|
|
112
116
|
|
113
117
|
file = File.open(filepath)
|
114
118
|
filename = File.basename(filepath)
|
115
|
-
|
119
|
+
extension = File.extname(filepath).delete('.').to_sym
|
120
|
+
content_type = SUPPORTED_MIME_TYPES[extension]
|
121
|
+
return if content_type.nil?
|
116
122
|
|
117
123
|
presigned_post =
|
118
124
|
BlinkaClient.presign_image(filename: filename, content_type: content_type)
|
data/lib/blinka_minitest.rb
CHANGED
@@ -44,7 +44,7 @@ class BlinkaMinitest
|
|
44
44
|
elsif @test_result.skipped?
|
45
45
|
:skip
|
46
46
|
elsif @test_result.failure
|
47
|
-
:
|
47
|
+
:fail
|
48
48
|
else
|
49
49
|
:pass
|
50
50
|
end
|
@@ -61,7 +61,14 @@ class BlinkaMinitest
|
|
61
61
|
def image
|
62
62
|
return unless kind == 'system'
|
63
63
|
|
64
|
-
image_path =
|
64
|
+
image_path =
|
65
|
+
if defined?(Capybara) && Capybara.respond_to?(:save_path) &&
|
66
|
+
Capybara.save_path.present?
|
67
|
+
"#{Capybara.save_path}/failures_#{name}.png"
|
68
|
+
else
|
69
|
+
"./tmp/screenshots/failures_#{name}.png"
|
70
|
+
end
|
71
|
+
|
65
72
|
return unless File.exist?(image_path)
|
66
73
|
|
67
74
|
image_path
|
@@ -11,6 +11,7 @@ module Minitest
|
|
11
11
|
def plugin_blinka_options(opts, options); end
|
12
12
|
|
13
13
|
module BlinkaPlugin
|
14
|
+
REPORT_PATH = 'blinka_results.json'.freeze
|
14
15
|
TAP_COMMENT_PAD = 8
|
15
16
|
class Reporter < Minitest::StatisticsReporter
|
16
17
|
attr_accessor :tests
|
@@ -29,7 +30,9 @@ module Minitest
|
|
29
30
|
super
|
30
31
|
|
31
32
|
tap_report if ENV['BLINKA_TAP']
|
32
|
-
|
33
|
+
if ENV['BLINKA_JSON'] || ENV['BLINKA_REPORT']
|
34
|
+
json_report(append: !ENV['BLINKA_APPEND'].nil?)
|
35
|
+
end
|
33
36
|
BlinkaClient.new.report if ENV['BLINKA_REPORT']
|
34
37
|
rescue BlinkaClient::BlinkaError => error
|
35
38
|
puts(error)
|
@@ -37,7 +40,7 @@ module Minitest
|
|
37
40
|
|
38
41
|
private
|
39
42
|
|
40
|
-
def json_report
|
43
|
+
def json_report(append:)
|
41
44
|
result = {
|
42
45
|
total_time: total_time,
|
43
46
|
nbr_tests: count,
|
@@ -48,12 +51,14 @@ module Minitest
|
|
48
51
|
results:
|
49
52
|
tests.map { |test_result| BlinkaMinitest.new(test_result).report }
|
50
53
|
}
|
54
|
+
result = append_previous(result) if append
|
51
55
|
|
52
|
-
File.open(
|
56
|
+
File.open(REPORT_PATH, 'w+') do |file|
|
53
57
|
file.write(JSON.pretty_generate(result))
|
54
58
|
end
|
59
|
+
|
55
60
|
puts
|
56
|
-
puts(
|
61
|
+
puts("Test results written to `#{REPORT_PATH}`")
|
57
62
|
end
|
58
63
|
|
59
64
|
# Based on https://github.com/kern/minitest-reporters/blob/master/lib/minitest/reporters/progress_reporter.rb
|
@@ -95,6 +100,26 @@ module Minitest
|
|
95
100
|
)
|
96
101
|
)
|
97
102
|
end
|
103
|
+
|
104
|
+
private
|
105
|
+
|
106
|
+
def parse_report
|
107
|
+
return unless File.exist?(REPORT_PATH)
|
108
|
+
JSON.parse(File.read(REPORT_PATH))
|
109
|
+
end
|
110
|
+
|
111
|
+
def append_previous(result)
|
112
|
+
previous = parse_report
|
113
|
+
return if previous.nil?
|
114
|
+
return if result[:commit] != previous['commit']
|
115
|
+
return if result[:tag] != previous['tag']
|
116
|
+
|
117
|
+
result[:total_time] += previous['total_time'] || 0
|
118
|
+
result[:nbr_tests] += previous['nbr_tests'] || 0
|
119
|
+
result[:nbr_assertions] += previous['nbr_assertions'] || 0
|
120
|
+
result[:results] += previous['results'] || []
|
121
|
+
result
|
122
|
+
end
|
98
123
|
end
|
99
124
|
end
|
100
125
|
end
|
metadata
CHANGED
@@ -1,43 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blinka-reporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Wessman
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.18.1
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.21.0
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 0.18.1
|
27
|
-
-
|
28
|
-
name: mimemagic
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.3.5
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
30
|
+
- - "<"
|
39
31
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
32
|
+
version: 0.21.0
|
41
33
|
- !ruby/object:Gem::Dependency
|
42
34
|
name: dotenv
|
43
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,7 +119,7 @@ metadata:
|
|
127
119
|
documentation_uri: https://github.com/davidwessman/blinka_reporter
|
128
120
|
changelog_uri: https://github.com/davidwessman/blinka_reporter/main/CHANGELOG.md
|
129
121
|
source_code_uri: https://github.com/davidwessman/blinka_reporter
|
130
|
-
post_install_message:
|
122
|
+
post_install_message:
|
131
123
|
rdoc_options: []
|
132
124
|
require_paths:
|
133
125
|
- lib
|
@@ -143,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
135
|
version: '0'
|
144
136
|
requirements: []
|
145
137
|
rubygems_version: 3.2.7
|
146
|
-
signing_key:
|
138
|
+
signing_key:
|
147
139
|
specification_version: 4
|
148
140
|
summary: Format tests for Blinka
|
149
141
|
test_files: []
|