capydash 0.2.1 → 0.2.2
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/capydash/rspec.rb +165 -13
- data/lib/capydash/templates/report.html.erb +6 -1
- data/lib/capydash/version.rb +1 -1
- data/lib/capydash.rb +10 -2
- 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: bb913ca0b0dce3912a15dd5eb2f1fd2673671771ff34b485f4b1c5567240faa7
|
|
4
|
+
data.tar.gz: '0794e75f2f6d2d3c6e50cb0d49370c71d7f571c87a93519fc04947ff16c3c71b'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 153585a1af8f9ef4415a509a53c265f552bdfc496ae20409f38ce850e09624259211f53af41e13ad59bb4384936df2cdaeab3a83aab34e22dece0401fd1b4b57
|
|
7
|
+
data.tar.gz: 6079967d5cb84f6d3867a5d8ae6a996df16c8db45a800811e0c218a3d954a6615a86aea31fed07cdb2a92f0629a5d0c8e1a5eebecf0ac880af5ed4bc09307e77
|
data/lib/capydash/rspec.rb
CHANGED
|
@@ -6,28 +6,43 @@ module CapyDash
|
|
|
6
6
|
module RSpec
|
|
7
7
|
class << self
|
|
8
8
|
def setup!
|
|
9
|
-
return unless
|
|
9
|
+
return unless rspec_available?
|
|
10
10
|
return if @configured
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
begin
|
|
13
|
+
@configured = true
|
|
14
|
+
@results = []
|
|
15
|
+
@started_at = nil
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
::RSpec.configure do |config|
|
|
18
|
+
config.before(:suite) do
|
|
19
|
+
CapyDash::RSpec.start_run
|
|
20
|
+
end
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
config.after(:each) do |example|
|
|
23
|
+
CapyDash::RSpec.record_example(example)
|
|
24
|
+
end
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
config.after(:suite) do
|
|
27
|
+
CapyDash::RSpec.generate_report
|
|
28
|
+
end
|
|
27
29
|
end
|
|
30
|
+
rescue => e
|
|
31
|
+
# If RSpec isn't ready, silently fail - it will be set up later
|
|
32
|
+
@configured = false
|
|
28
33
|
end
|
|
29
34
|
end
|
|
30
35
|
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def rspec_available?
|
|
39
|
+
return false unless defined?(::RSpec)
|
|
40
|
+
return false unless ::RSpec.respond_to?(:configure)
|
|
41
|
+
true
|
|
42
|
+
rescue
|
|
43
|
+
false
|
|
44
|
+
end
|
|
45
|
+
|
|
31
46
|
def start_run
|
|
32
47
|
@results = []
|
|
33
48
|
@started_at = Time.now
|
|
@@ -184,6 +199,58 @@ module CapyDash
|
|
|
184
199
|
.header .subtitle {
|
|
185
200
|
color: #666;
|
|
186
201
|
font-size: 0.9rem;
|
|
202
|
+
margin-bottom: 1rem;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.search-container {
|
|
206
|
+
margin-top: 1rem;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.search-input {
|
|
210
|
+
width: 100%;
|
|
211
|
+
padding: 0.75rem 1rem;
|
|
212
|
+
border: 2px solid #ddd;
|
|
213
|
+
border-radius: 6px;
|
|
214
|
+
font-size: 1rem;
|
|
215
|
+
transition: border-color 0.2s;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.search-input:focus {
|
|
219
|
+
outline: none;
|
|
220
|
+
border-color: #3498db;
|
|
221
|
+
box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.test-method.hidden {
|
|
225
|
+
display: none;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.test-class.hidden {
|
|
229
|
+
display: none;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.method-status {
|
|
233
|
+
padding: 0.25rem 0.75rem;
|
|
234
|
+
border-radius: 4px;
|
|
235
|
+
font-size: 0.75rem;
|
|
236
|
+
font-weight: 600;
|
|
237
|
+
text-transform: uppercase;
|
|
238
|
+
letter-spacing: 0.5px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.method-status-passed {
|
|
242
|
+
background: #27ae60;
|
|
243
|
+
color: white;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.method-status-failed {
|
|
247
|
+
background: #e74c3c;
|
|
248
|
+
color: white;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.method-status-pending {
|
|
252
|
+
background: #f39c12;
|
|
253
|
+
color: white;
|
|
187
254
|
}
|
|
188
255
|
|
|
189
256
|
.summary {
|
|
@@ -274,6 +341,38 @@ module CapyDash
|
|
|
274
341
|
flex: 1;
|
|
275
342
|
}
|
|
276
343
|
|
|
344
|
+
.test-method.hidden {
|
|
345
|
+
display: none;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.test-class.hidden {
|
|
349
|
+
display: none;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.method-status {
|
|
353
|
+
padding: 0.25rem 0.75rem;
|
|
354
|
+
border-radius: 4px;
|
|
355
|
+
font-size: 0.75rem;
|
|
356
|
+
font-weight: 600;
|
|
357
|
+
text-transform: uppercase;
|
|
358
|
+
letter-spacing: 0.5px;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.method-status-passed {
|
|
362
|
+
background: #27ae60;
|
|
363
|
+
color: white;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.method-status-failed {
|
|
367
|
+
background: #e74c3c;
|
|
368
|
+
color: white;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.method-status-pending {
|
|
372
|
+
background: #f39c12;
|
|
373
|
+
color: white;
|
|
374
|
+
}
|
|
375
|
+
|
|
277
376
|
.expand-toggle {
|
|
278
377
|
background: none;
|
|
279
378
|
border: none;
|
|
@@ -408,6 +507,59 @@ module CapyDash
|
|
|
408
507
|
}
|
|
409
508
|
}
|
|
410
509
|
}
|
|
510
|
+
|
|
511
|
+
// Search functionality
|
|
512
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
513
|
+
const searchInput = document.getElementById('searchInput');
|
|
514
|
+
if (!searchInput) return;
|
|
515
|
+
|
|
516
|
+
searchInput.addEventListener('input', function(e) {
|
|
517
|
+
const query = e.target.value.toLowerCase().trim();
|
|
518
|
+
const testMethods = document.querySelectorAll('.test-method');
|
|
519
|
+
const testClasses = document.querySelectorAll('.test-class');
|
|
520
|
+
|
|
521
|
+
// Determine if query is a status filter
|
|
522
|
+
const isStatusFilter = query === 'pass' || query === 'fail' ||
|
|
523
|
+
query === 'passed' || query === 'failed' ||
|
|
524
|
+
query === 'pending';
|
|
525
|
+
|
|
526
|
+
testMethods.forEach(function(method) {
|
|
527
|
+
const name = method.getAttribute('data-name') || '';
|
|
528
|
+
const status = method.getAttribute('data-status') || '';
|
|
529
|
+
|
|
530
|
+
let shouldShow = false;
|
|
531
|
+
|
|
532
|
+
if (!query) {
|
|
533
|
+
// No query - show all
|
|
534
|
+
shouldShow = true;
|
|
535
|
+
} else if (isStatusFilter) {
|
|
536
|
+
// Status filter - check status
|
|
537
|
+
shouldShow = (query === 'pass' && status === 'passed') ||
|
|
538
|
+
(query === 'fail' && status === 'failed') ||
|
|
539
|
+
query === status;
|
|
540
|
+
} else {
|
|
541
|
+
// Name filter - check if name contains query
|
|
542
|
+
shouldShow = name.includes(query);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
if (shouldShow) {
|
|
546
|
+
method.classList.remove('hidden');
|
|
547
|
+
} else {
|
|
548
|
+
method.classList.add('hidden');
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
// Hide test classes if all methods are hidden
|
|
553
|
+
testClasses.forEach(function(testClass) {
|
|
554
|
+
const visibleMethods = testClass.querySelectorAll('.test-method:not(.hidden)');
|
|
555
|
+
if (visibleMethods.length === 0) {
|
|
556
|
+
testClass.classList.add('hidden');
|
|
557
|
+
} else {
|
|
558
|
+
testClass.classList.remove('hidden');
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
});
|
|
562
|
+
});
|
|
411
563
|
JS
|
|
412
564
|
end
|
|
413
565
|
end
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
<div class="header">
|
|
12
12
|
<h1>CapyDash Test Report</h1>
|
|
13
13
|
<div class="subtitle">Generated on <%= created_at.strftime('%B %d, %Y at %I:%M %p') %></div>
|
|
14
|
+
|
|
15
|
+
<div class="search-container">
|
|
16
|
+
<input type="text" id="searchInput" placeholder="Search tests or type 'pass' or 'fail' to filter..." class="search-input" autocomplete="off">
|
|
17
|
+
</div>
|
|
14
18
|
</div>
|
|
15
19
|
|
|
16
20
|
<div class="summary">
|
|
@@ -34,12 +38,13 @@
|
|
|
34
38
|
<h2><%= test_class[:class_name] %></h2>
|
|
35
39
|
|
|
36
40
|
<% test_class[:methods].each do |method| %>
|
|
37
|
-
<div class="test-method">
|
|
41
|
+
<div class="test-method" data-status="<%= method[:status] %>" data-name="<%= method[:name].downcase %>">
|
|
38
42
|
<div class="test-method-header">
|
|
39
43
|
<button class="expand-toggle" onclick="toggleTestMethod('<%= method[:safe_id] %>')">
|
|
40
44
|
<span class="expand-icon">▶</span>
|
|
41
45
|
</button>
|
|
42
46
|
<h3><%= method[:name] %></h3>
|
|
47
|
+
<span class="method-status method-status-<%= method[:status] %>"><%= method[:status] %></span>
|
|
43
48
|
</div>
|
|
44
49
|
<div class="steps collapsed" id="steps-<%= method[:safe_id] %>">
|
|
45
50
|
<% method[:steps].each do |step| %>
|
data/lib/capydash/version.rb
CHANGED
data/lib/capydash.rb
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
require "capydash/version"
|
|
2
2
|
|
|
3
|
-
# Auto-setup RSpec integration if RSpec is present
|
|
4
|
-
if defined?(RSpec)
|
|
3
|
+
# Auto-setup RSpec integration if RSpec is present and ready
|
|
4
|
+
if defined?(RSpec) && RSpec.respond_to?(:configure)
|
|
5
5
|
require "capydash/rspec"
|
|
6
6
|
CapyDash::RSpec.setup!
|
|
7
|
+
elsif defined?(Rails)
|
|
8
|
+
# In Rails, RSpec might load after the gem, so set up a hook
|
|
9
|
+
Rails.application.config.after_initialize do
|
|
10
|
+
if defined?(RSpec) && RSpec.respond_to?(:configure)
|
|
11
|
+
require "capydash/rspec" unless defined?(CapyDash::RSpec)
|
|
12
|
+
CapyDash::RSpec.setup!
|
|
13
|
+
end
|
|
14
|
+
end
|
|
7
15
|
end
|