cornucopia 0.1.32 → 0.1.33
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/lib/cornucopia/rspec_hooks.rb +43 -14
- data/lib/cornucopia/util/configuration.rb +1 -1
- data/lib/cornucopia/version.rb +1 -1
- data/spec/lib/util/configuration_spec.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86528ccc5d87da9371e94a93983b1457aa72b646
|
4
|
+
data.tar.gz: d45cb265ba31b645dd380ad5f5ee2b0948d7828d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59f98d9ad75b0036e9ed3fde158fe01677e4ca326520eacee7afc416875b57267918b602dbdd9fc4879c3d89db224d7f8b56993c177b081879290eca1f75d05e
|
7
|
+
data.tar.gz: 63997a9782f0608bb4b000b887ad4acf0c05099840a925877b08d8e8b3c6c8a500db1bd60a283220e0909e93a5bce90f6ee5c321d87e45e15f0c4adde2c16334
|
@@ -1,8 +1,42 @@
|
|
1
1
|
require ::File.expand_path("../cornucopia", File.dirname(__FILE__))
|
2
|
+
require "singleton"
|
3
|
+
|
2
4
|
load ::File.expand_path("capybara/install_finder_extensions.rb", File.dirname(__FILE__))
|
3
5
|
load ::File.expand_path("capybara/install_matcher_extensions.rb", File.dirname(__FILE__))
|
4
6
|
load ::File.expand_path("site_prism/install_element_extensions.rb", File.dirname(__FILE__))
|
5
7
|
|
8
|
+
module Cornucopia
|
9
|
+
class RSpecHelper
|
10
|
+
include Singleton
|
11
|
+
|
12
|
+
attr_accessor :last_reported_example
|
13
|
+
attr_accessor :context_seed_value
|
14
|
+
attr_accessor :seed_value
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@last_reported_example = nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def end_example(example)
|
21
|
+
unless example == last_reported_example
|
22
|
+
if (example.exception)
|
23
|
+
@last_reported_example = example
|
24
|
+
|
25
|
+
puts("random seed for testing was: #{context_seed_value}, #{seed_value}")
|
26
|
+
|
27
|
+
Cornucopia::Util::ReportBuilder.current_report.
|
28
|
+
within_section("Test Error: #{example.full_description}") do |report|
|
29
|
+
configured_report = Cornucopia::Util::Configuration.report_configuration :rspec
|
30
|
+
|
31
|
+
configured_report.add_report_objects example: example, rspec: RSpec
|
32
|
+
configured_report.generate_report(report)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
6
40
|
RSpec.configure do |config|
|
7
41
|
config.seed = Cornucopia::Util::Configuration.order_seed if Cornucopia::Util::Configuration.order_seed
|
8
42
|
|
@@ -30,10 +64,10 @@ RSpec.configure do |config|
|
|
30
64
|
time = Benchmark.measure do
|
31
65
|
puts "Cornucopia::Hook::before group" if Cornucopia::Util::Configuration.benchmark
|
32
66
|
|
33
|
-
|
67
|
+
Cornucopia::RSpecHelper.instance.context_seed_value = Cornucopia::Util::Configuration.context_seed ||
|
34
68
|
100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)
|
35
69
|
|
36
|
-
srand(
|
70
|
+
srand(Cornucopia::RSpecHelper.instance.context_seed_value)
|
37
71
|
end
|
38
72
|
|
39
73
|
puts "Cornucopia::Hook::before group time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
@@ -52,6 +86,8 @@ RSpec.configure do |config|
|
|
52
86
|
if (test_example.exception)
|
53
87
|
Cornucopia::Capybara::PageDiagnostics.dump_details(section_label: "Page Dump for: #{test_example.full_description}")
|
54
88
|
end
|
89
|
+
|
90
|
+
Cornucopia::RSpecHelper.instance.end_example(test_example)
|
55
91
|
end
|
56
92
|
|
57
93
|
puts "Cornucopia::Hook::page dump time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
@@ -69,10 +105,10 @@ RSpec.configure do |config|
|
|
69
105
|
|
70
106
|
Cornucopia::Util::TestHelper.instance.record_test_start(test_example.full_description)
|
71
107
|
|
72
|
-
|
108
|
+
Cornucopia::RSpecHelper.instance.seed_value = Cornucopia::Util::Configuration.seed ||
|
73
109
|
100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)
|
74
110
|
|
75
|
-
srand(
|
111
|
+
srand(Cornucopia::RSpecHelper.instance.seed_value)
|
76
112
|
|
77
113
|
Cornucopia::Capybara::FinderDiagnostics::FindAction.clear_diagnosed_finders
|
78
114
|
Cornucopia::Capybara::PageDiagnostics.clear_dumped_pages
|
@@ -86,17 +122,9 @@ RSpec.configure do |config|
|
|
86
122
|
time = Benchmark.measure do
|
87
123
|
puts "Cornucopia::Hook::after test" if Cornucopia::Util::Configuration.benchmark
|
88
124
|
|
89
|
-
|
90
|
-
puts("random seed for testing was: #{@context_seed_value}, #{@seed_value}")
|
125
|
+
Cornucopia::RSpecHelper.instance.end_example(test_example)
|
91
126
|
|
92
|
-
|
93
|
-
within_section("Test Error: #{test_example.full_description}") do |report|
|
94
|
-
configured_report = Cornucopia::Util::Configuration.report_configuration :rspec
|
95
|
-
|
96
|
-
configured_report.add_report_objects example: test_example, rspec: RSpec
|
97
|
-
configured_report.generate_report(report)
|
98
|
-
end
|
99
|
-
else
|
127
|
+
unless test_example.exception
|
100
128
|
Cornucopia::Util::ReportBuilder.current_report.test_succeeded
|
101
129
|
end
|
102
130
|
end
|
@@ -105,6 +133,7 @@ RSpec.configure do |config|
|
|
105
133
|
Cornucopia::Capybara::PageDiagnostics.clear_dumped_pages
|
106
134
|
|
107
135
|
Cornucopia::Util::TestHelper.instance.record_test_end(test_example.full_description)
|
136
|
+
Cornucopia::RSpecHelper.instance.last_reported_example = nil
|
108
137
|
end
|
109
138
|
|
110
139
|
puts "Cornucopia::Hook::after test time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
@@ -19,7 +19,7 @@ module Cornucopia
|
|
19
19
|
configurations.user_log_files = {}
|
20
20
|
configurations.default_num_lines = 500
|
21
21
|
configurations.grab_logs = true
|
22
|
-
configurations.backup_logs_on_failure =
|
22
|
+
configurations.backup_logs_on_failure = false
|
23
23
|
configurations.print_timeout_min = 10
|
24
24
|
configurations.selenium_cache_retry_count = 5
|
25
25
|
configurations.analyze_find_exceptions = true
|
data/lib/cornucopia/version.rb
CHANGED
@@ -87,16 +87,16 @@ describe "Cornucopia::Util::Configuration" do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
it "backs up logs on failure by default" do
|
90
|
-
expect(Cornucopia::Util::Configuration.backup_logs_on_failure).to
|
90
|
+
expect(Cornucopia::Util::Configuration.backup_logs_on_failure).to be_falsey
|
91
91
|
end
|
92
92
|
|
93
93
|
it "can set the backup_logs_on_failure value" do
|
94
94
|
begin
|
95
|
-
Cornucopia::Util::Configuration.backup_logs_on_failure =
|
95
|
+
Cornucopia::Util::Configuration.backup_logs_on_failure = true
|
96
96
|
|
97
|
-
expect(Cornucopia::Util::Configuration.backup_logs_on_failure).to
|
97
|
+
expect(Cornucopia::Util::Configuration.backup_logs_on_failure).to be_truthy
|
98
98
|
ensure
|
99
|
-
Cornucopia::Util::Configuration.backup_logs_on_failure =
|
99
|
+
Cornucopia::Util::Configuration.backup_logs_on_failure = false
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cornucopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.33
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RealNobody
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|