report_builder 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/report_builder.rb +37 -14
  3. metadata +11 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cef2bf351bdf5be7463f962566206aafa107b004
4
- data.tar.gz: 15625f37e23b438215e391521f46d7be78df55d5
3
+ metadata.gz: fe1d27835431b976a0c3bbbe0525b46e4e736155
4
+ data.tar.gz: 4b3d26fb6693d70fae4578311f292db15a200d82
5
5
  SHA512:
6
- metadata.gz: 4e65e83dff1cba27ac3c41d0da39e415c24ffbc10d390e8f0df4dc0f134e6554cce4687004080db63353ea560b053ea5aa05d746ac2ff335966952b9b305f86f
7
- data.tar.gz: 2c05c1b33da6080344983815b0992f794a03dab088a26230a21c77e607d6e02c92fedb84a090918d6959c08c6a9d9966f2741414a7521915816a7f59877fc53f
6
+ metadata.gz: 98c3051f916e9211286fca1a8ac9900baef4fb2160f3396ca86c15dbb2d6ae222aae44195472963745bf368049ee3b1be999531f7317c889a7fe80de11d11eac
7
+ data.tar.gz: 95c40fb5c1dc531e456814b42e6507ae9671f6ec66a59ac5e65db8111946097a52df3f1e0753b5f62e09c29f568ec8e21c8c0ce427374d06630c963332a715ea
@@ -2,6 +2,10 @@ require 'json'
2
2
  require 'builder'
3
3
  require 'base64'
4
4
 
5
+
6
+ # new lines
7
+
8
+
5
9
  # Add except method to Hash
6
10
  class Hash
7
11
  def except(*keys)
@@ -327,7 +331,7 @@ class ReportBuilder
327
331
 
328
332
  def self.build_output(outputs)
329
333
  outputs.each do |output|
330
- @builder << "<span style='color:#{COLOR[:output]}'>#{output.gsub("\n",'</br>').gsub("\t",'&nbsp;&nbsp;').gsub(' ','&nbsp;')}</span><br/>"
334
+ @builder << "<span style='color:#{COLOR[:output]}'>#{output.to_s.gsub("\n",'</br>').gsub("\t",'&nbsp;&nbsp;').gsub(' ','&nbsp;')}</span><br/>"
331
335
  end if outputs.is_a?(Array)
332
336
  end
333
337
 
@@ -338,7 +342,7 @@ class ReportBuilder
338
342
  @builder.option(value: 'scenario-all') do
339
343
  @builder << 'All'
340
344
  end
341
- tags.each do |tag|
345
+ tags.sort.each do |tag|
342
346
  @builder.option(value: tag.gsub('@','tag-')) do
343
347
  @builder << tag
344
348
  end
@@ -391,27 +395,45 @@ class ReportBuilder
391
395
  def self.build_embedding(embeddings)
392
396
  @embedding_count ||= 0
393
397
  embeddings.each do |embedding|
398
+ src = Base64.decode64(embedding['data'])
394
399
  id = "embedding_#{@embedding_count}"
395
400
  if embedding['mime_type'] =~ /^image\/(png|gif|jpg|jpeg)/
396
- @builder.span(class: 'image') do
397
- @builder.a(href: '', style: 'text-decoration: none;', onclick: "img=document.getElementById('#{id}');img.style.display = (img.style.display == 'none' ? 'block' : 'none');return false") do
398
- @builder.span(style: "color: #{COLOR[:output]}; font-weight: bold; border-bottom: 1px solid #{COLOR[:output]};") do
399
- @builder << 'Screenshot'
401
+ begin
402
+ @builder.span(class: 'image') do
403
+ @builder.a(href: '', style: 'text-decoration: none;', onclick: "img=document.getElementById('#{id}');img.style.display = (img.style.display == 'none' ? 'block' : 'none');return false") do
404
+ @builder.span(style: "color: #{COLOR[:output]}; font-weight: bold; border-bottom: 1px solid #{COLOR[:output]};") do
405
+ @builder << "Screenshot ##{@embedding_count}"
406
+ end
400
407
  end
408
+ @builder << '<br/>'
409
+ @options[:compress_images] ? build_unique_image(embedding, id) : build_image(embedding,id)
401
410
  end
402
- @builder << '<br/>'
403
- @options[:compress_images] ? build_unique_image(embedding, id) : build_image(embedding,id) rescue puts 'Image embedding failed!'
411
+ rescue => e
412
+ puts 'Image embedding failed!'
413
+ puts [e.class, e.message, e.backtrace[0..10].join("\n")].join("\n")
404
414
  end
405
415
  elsif embedding['mime_type'] =~ /^text\/plain/
406
- @builder.span(class: 'link') do
407
- src = Base64.decode64(embedding['data'])
408
- @builder.a(id: id, style: 'text-decoration: none;', href: src, title: 'Link') do
409
- @builder.span(style: "color: #{COLOR[:output]}; font-weight: bold; border-bottom: 1px solid #{COLOR[:output]};") do
416
+ begin
417
+ if src.include?('|||')
418
+ title, link = src.split('|||')
419
+ @builder.span(class: 'link') do
420
+ @builder.a(id: id, style: 'text-decoration: none;', href: link, title: title) do
421
+ @builder.span(style: "color: #{COLOR[:output]}; font-weight: bold; border-bottom: 1px solid #{COLOR[:output]};") do
422
+ @builder << title
423
+ end
424
+ end
425
+ @builder << '<br/>'
426
+ end
427
+ else
428
+ @builder.span(class: 'info') do
410
429
  @builder << src
430
+ @builder << '<br/>'
411
431
  end
412
432
  end
413
- @builder << '<br/>'
414
- end rescue puts('Link embedding skipped!')
433
+ rescue => e
434
+ puts('Link embedding skipped!')
435
+ puts [e.class, e.message, e.backtrace[0..10].join("\n")].join("\n")
436
+ end
415
437
  end
416
438
  @embedding_count += 1
417
439
  end if embeddings.is_a?(Array)
@@ -519,6 +541,7 @@ class ReportBuilder
519
541
  }.sort_by!{|feature| feature['name']}.each{|feature|
520
542
  if feature['elements'][0]['type'] == 'background'
521
543
  (0..feature['elements'].size-1).step(2) do |i|
544
+ feature['elements'][i]['steps'] ||= []
522
545
  feature['elements'][i]['steps'].each{|step| step['name']+=(' ('+feature['elements'][i]['keyword']+')')}
523
546
  feature['elements'][i+1]['steps'] = feature['elements'][i]['steps'] + feature['elements'][i+1]['steps']
524
547
  feature['elements'][i+1]['before'] = feature['elements'][i]['before'] if feature['elements'][i]['before']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: report_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajat Thareja
@@ -14,40 +14,34 @@ dependencies:
14
14
  name: builder
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.2'
20
- - - ">="
20
+ - - '>='
21
21
  - !ruby/object:Gem::Version
22
22
  version: 3.2.2
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: '3.2'
30
- - - ">="
30
+ - - '>='
31
31
  - !ruby/object:Gem::Version
32
32
  version: 3.2.2
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: json
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '1.8'
40
- - - ">="
37
+ - - '>='
41
38
  - !ruby/object:Gem::Version
42
39
  version: 1.8.1
43
40
  type: :runtime
44
41
  prerelease: false
45
42
  version_requirements: !ruby/object:Gem::Requirement
46
43
  requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '1.8'
50
- - - ">="
44
+ - - '>='
51
45
  - !ruby/object:Gem::Version
52
46
  version: 1.8.1
53
47
  description: Merge Cucumber JSON reports and build single HTML Test Report
@@ -76,19 +70,20 @@ require_paths:
76
70
  - lib
77
71
  required_ruby_version: !ruby/object:Gem::Requirement
78
72
  requirements:
79
- - - ">="
73
+ - - '>='
80
74
  - !ruby/object:Gem::Version
81
75
  version: 1.9.1
82
76
  required_rubygems_version: !ruby/object:Gem::Requirement
83
77
  requirements:
84
- - - ">="
78
+ - - '>='
85
79
  - !ruby/object:Gem::Version
86
80
  version: '0'
87
81
  requirements:
88
82
  - Cucumber >= 2.1.0 test results in JSON format
89
83
  rubyforge_project:
90
- rubygems_version: 2.5.1
84
+ rubygems_version: 2.4.6
91
85
  signing_key:
92
86
  specification_version: 4
93
87
  summary: ReportBuilder
94
88
  test_files: []
89
+ has_rdoc: