cyrun 0.1.3 → 0.1.4
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 +4 -4
- data/exe/cyrun +2 -1
- data/lib/cyrun/runner.rb +9 -8
- data/lib/cyrun/spec_group_execution_result.rb +4 -0
- data/lib/cyrun/version.rb +1 -1
- data/sig/runner.rbs +4 -3
- data/sig/spec_group_execution_result.rbs +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e62e6731281630f345c8e1cd166158771fee4ecbd076648922da738eac4242a
|
4
|
+
data.tar.gz: 5dcd1a2da03d3370d916474abc34c25ad978790efa03ab06908528987dea34a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f12fef457aa139ee04dd87b2bf8de75376e1cbb2e2a3ef5ba166212b45879ea288212c88d586740e32c2b3c81c3cee876ee28ddcf13762dcf6bc7c944aeb9a7
|
7
|
+
data.tar.gz: b25ad55b81bba08903b632db69b6d8236243e1dfccb2a26571300bde52b6dc989b55093f762d7a036c98b9d9ffac07fb963310650e95b28ef9fb2da524a61648
|
data/exe/cyrun
CHANGED
@@ -68,10 +68,11 @@ runner = Cyrun::Runner.new(
|
|
68
68
|
base_directory,
|
69
69
|
pattern,
|
70
70
|
screenshots_pattern,
|
71
|
+
screenshots_directory,
|
71
72
|
group_size,
|
72
73
|
npm_task_name,
|
73
74
|
max_retries: max_retries,
|
74
75
|
iterations: iterations
|
75
76
|
)
|
76
77
|
runner.run
|
77
|
-
runner.store_results(results_directory
|
78
|
+
runner.store_results(results_directory)
|
data/lib/cyrun/runner.rb
CHANGED
@@ -7,9 +7,9 @@ module Cyrun
|
|
7
7
|
include Logging
|
8
8
|
|
9
9
|
attr_reader :collector, :group_builder, :task_runner,
|
10
|
-
:overall_results, :max_retries, :iterations
|
10
|
+
:overall_results, :max_retries, :iterations, :screenshots_directory
|
11
11
|
|
12
|
-
def initialize(base_directory, pattern, screenshots_pattern, group_size, npm_task_name, max_retries: nil, iterations: nil)
|
12
|
+
def initialize(base_directory, pattern, screenshots_pattern, screenshots_directory, group_size, npm_task_name, max_retries: nil, iterations: nil)
|
13
13
|
@collector = SpecCollector.new(base_directory, npm_task_name, [pattern])
|
14
14
|
@group_builder = GroupBuilder.new(group_size)
|
15
15
|
@task_runner = TaskRunner.new(screenshots_pattern)
|
@@ -17,6 +17,7 @@ module Cyrun
|
|
17
17
|
@overall_results = SpecGroupExecutionResult.create_empty
|
18
18
|
@max_retries = max_retries
|
19
19
|
@iterations = iterations
|
20
|
+
@screenshots_directory = screenshots_directory
|
20
21
|
end
|
21
22
|
|
22
23
|
def run
|
@@ -26,13 +27,12 @@ module Cyrun
|
|
26
27
|
overall_results
|
27
28
|
end
|
28
29
|
|
29
|
-
def store_results(results_directory
|
30
|
+
def store_results(results_directory)
|
30
31
|
latest_results = overall_results.latest_results
|
31
32
|
invalid_results = latest_results.select { |result| result.result_filename.nil? }
|
32
33
|
valid_results = latest_results - invalid_results
|
33
34
|
|
34
35
|
copy_result_files valid_results, results_directory
|
35
|
-
copy_screenshots overall_results, screenshots_directory
|
36
36
|
|
37
37
|
invalid_results.empty?
|
38
38
|
end
|
@@ -55,16 +55,16 @@ module Cyrun
|
|
55
55
|
success
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
58
|
+
def move_screenshots(results, directory)
|
59
59
|
FileUtils.mkdir_p directory
|
60
60
|
|
61
61
|
success = true
|
62
62
|
|
63
|
-
info "
|
63
|
+
info "Moving #{results.screenshots.size} screenshots to #{directory}"
|
64
64
|
results.screenshots.each do |path|
|
65
|
-
FileUtils.
|
65
|
+
FileUtils.mv(path, "#{directory}/#{SecureRandom.uuid}-#{File.basename(path)}")
|
66
66
|
rescue StandardError => e
|
67
|
-
error "Failed to
|
67
|
+
error "Failed to move screenshot #{path}: #{e.message}"
|
68
68
|
success = false
|
69
69
|
end
|
70
70
|
|
@@ -97,6 +97,7 @@ module Cyrun
|
|
97
97
|
.each(&method(:handle_single_execution_result))
|
98
98
|
|
99
99
|
log_results overall_results
|
100
|
+
move_screenshots results, screenshots_directory
|
100
101
|
end
|
101
102
|
|
102
103
|
def handle_single_execution_result(result)
|
data/lib/cyrun/version.rb
CHANGED
data/sig/runner.rbs
CHANGED
@@ -6,12 +6,13 @@ module Cyrun
|
|
6
6
|
attr_reader iterations: Integer?
|
7
7
|
attr_reader max_retries: Integer?
|
8
8
|
attr_reader npm_task_name: String
|
9
|
+
attr_reader screenshots_directory: String
|
9
10
|
attr_reader overall_results: SpecGroupExecutionResult
|
10
11
|
attr_reader task_runner: TaskRunner
|
11
12
|
|
12
|
-
def initialize: (String, String, String, Integer, String, max_retries: Integer?, iterations: Integer?) -> void
|
13
|
+
def initialize: (String, String, String, String, Integer, String, max_retries: Integer?, iterations: Integer?) -> void
|
13
14
|
|
14
|
-
def store_results: (String
|
15
|
+
def store_results: (String)-> bool
|
15
16
|
|
16
17
|
def run: -> SpecGroupExecutionResult
|
17
18
|
|
@@ -20,7 +21,7 @@ module Cyrun
|
|
20
21
|
def collect_specs: (String) -> void
|
21
22
|
|
22
23
|
def copy_result_files: (Array[SingleSpecExecutionResult], String) -> bool
|
23
|
-
def
|
24
|
+
def move_screenshots: (SpecGroupExecutionResult, String) -> bool
|
24
25
|
|
25
26
|
def handle_single_execution_result: (SingleSpecExecutionResult) -> void
|
26
27
|
def log_results: (SpecGroupExecutionResult) -> void
|
@@ -7,6 +7,9 @@ module Cyrun
|
|
7
7
|
attr_reader single_results: Array[SingleSpecExecutionResult]
|
8
8
|
|
9
9
|
def initialize: (Array[SingleSpecExecutionResult], Array[String], Integer) -> void
|
10
|
+
|
11
|
+
def clear_screenshot_list!: -> void
|
12
|
+
|
10
13
|
def effectiveness: -> Float
|
11
14
|
def merge!: (SpecGroupExecutionResult)-> void
|
12
15
|
def net_time_in_seconds: -> Integer
|