nxgreport 0.6.1 → 0.7.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nxgreport.rb +177 -6
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f7daedeb4a5bf253f6253bd5c27a169f4cf982284f53ca2140f0f30533cd39d
4
- data.tar.gz: 35dc08d19c86bf080e72840f12cd5eb9f78a8008f75182711d91977eedde1e90
3
+ metadata.gz: ee73dbd088457ecad4c7ed59c99a742695751cb67023d46277f414f931a52bc8
4
+ data.tar.gz: 3c983d5cf26640573530d1a4e53341687ad4caf4728d91b89a5878537760b362
5
5
  SHA512:
6
- metadata.gz: afbf4843a3b1cad53c102d72bd3a1856708b0b6132cb030b00817bc7996e8877f78d1efcedee75dd8e02892c7ba408feb5c1e96d92d11139afce5fc7e4dc6509
7
- data.tar.gz: e2779082fe179f97216e14cebd7c01b53dc411e0ee54a0b94c08f39a6b170a15cd7cf191c13e969bd861ebb36d4eefca489352848372d02395b5f8b97b2bd2e4
6
+ metadata.gz: e8ec091e72cce90ba3a24fc7a469a9fd70a023bdd6461fc173057598b15a086ac73ebbcb0790ec0fb628f9bf3a53a7cf9f131dcd3d2487eb7cb0c4ca6a0992ef
7
+ data.tar.gz: '059139b83469493d20bd83ebb5c2f621084f959b0c2a040c710b1c9b2a010982b6c92af1cb383966f21e2f39f3607fbd0bef2b23878abff1b2aa4b3a0f02cd6f'
@@ -2,12 +2,12 @@ require 'fileutils'
2
2
 
3
3
  class NxgReport
4
4
 
5
- attr_reader :nxg_report_path, :auto_open, :title, :features
6
-
7
5
  def setup(location: "./NxgReport.html", title: "Features Summary")
8
6
  @nxg_report_path = location.empty? ? "./NxgReport.html" : location
9
7
  folder_check()
10
8
  @title = title
9
+ @title_color = ''
10
+ @execution_configuration = Hash.new()
11
11
  @auto_open = false
12
12
  @features = Hash.new()
13
13
  end
@@ -16,11 +16,60 @@ class NxgReport
16
16
  @auto_open = value
17
17
  end
18
18
 
19
- def log_test(feature_name, test_status)
19
+ def set_envrionment(name: "")
20
+ if name.empty?()
21
+ return
22
+ end
23
+ @execution_configuration[:environment] = name
24
+ end
25
+
26
+ def set_app_version(no: "")
27
+ if no.empty?()
28
+ return
29
+ end
30
+ version_no = no.downcase.gsub("app", "").gsub("version", "").strip
31
+ @execution_configuration[:app_version] = "App Version #{version_no}"
32
+ end
33
+
34
+ def set_release(name: "")
35
+ if name.empty?()
36
+ return
37
+ end
38
+ @execution_configuration[:release_name] = name
39
+ end
40
+
41
+ def set_os(name: "")
42
+ if name.empty?()
43
+ return
44
+ end
45
+ @execution_configuration[:os] = name
46
+ end
47
+
48
+ def set_device(name: "")
49
+ if name.empty?()
50
+ return
51
+ end
52
+ @execution_configuration[:device] = name
53
+ end
54
+
55
+ def set_execution(date: "")
56
+ if date.empty?()
57
+ return
58
+ end
59
+ @execution_configuration[:execution_date] = date
60
+ end
61
+
62
+ def log_test(feature_name: "", test_status: "")
20
63
  if feature_name.nil?() || feature_name.strip.empty?()
21
64
  log("Feature name cannot be empty.")
22
65
  return
23
66
  end
67
+
68
+ if test_status.nil?() || test_status.strip.empty?()
69
+ log("Test status cannot be empty.")
70
+ return
71
+ end
72
+
24
73
  test_pass = test_status.downcase.include?('pass')
25
74
  name = feature_name.strip()
26
75
 
@@ -130,7 +179,7 @@ class NxgReport
130
179
 
131
180
  .wrapper {
132
181
  display: grid;
133
- grid-template-rows: auto 1fr;
182
+ grid-template-rows: auto auto 1fr;
134
183
  height: 100vh;
135
184
  width: 100vw;
136
185
  }
@@ -139,7 +188,25 @@ class NxgReport
139
188
  display: grid;
140
189
  grid-template-columns: 6fr 1fr;
141
190
  text-align: center;
142
- background: linear-gradient(to bottom right, #ff644e, #cb3018);
191
+ #{@title_color.empty?() ? "background: linear-gradient(to bottom right, #ff644e, #cb3018);" : "background-color: #{@title_color}"}
192
+ }
193
+
194
+ .test-config-area {
195
+ padding-top: 2em;
196
+ display: flex;
197
+ flex-wrap: wrap;
198
+ justify-content: space-around;
199
+ text-align: center;
200
+ }
201
+
202
+ .config-item {
203
+ display: flex;
204
+
205
+ }
206
+
207
+ .config-item-icon {
208
+ font-size: 2em;
209
+ padding-right: 0.5em;
143
210
  }
144
211
 
145
212
  .mc {
@@ -244,6 +311,10 @@ class NxgReport
244
311
  color: var(--dark-primary);
245
312
  }
246
313
 
314
+ body.dark > .wrapper > .test-config-area > .config-item {
315
+ color: var(--dark-font);
316
+ }
317
+
247
318
  body.dark > .wrapper > .footer > p > span > a {
248
319
  color: var(--dark-font);
249
320
  }
@@ -286,6 +357,10 @@ class NxgReport
286
357
  color: var(--light-primary);
287
358
  }
288
359
 
360
+ body > .wrapper > .test-config-area > .config-item {
361
+ color: var(--light-font);
362
+ }
363
+
289
364
  body > .wrapper > .footer > p > span > a {
290
365
  color: var(--light-font);
291
366
  }
@@ -323,6 +398,7 @@ class NxgReport
323
398
  </button>
324
399
  </div>
325
400
  </div>
401
+ #{config_htmlize()}
326
402
  <div class=\"mc\">
327
403
  #{htmlize(@features)}
328
404
  </div>
@@ -372,7 +448,102 @@ class NxgReport
372
448
  template.close()
373
449
  end
374
450
 
375
- private :log, :clean, :write, :htmlize, :report_success
451
+ def config_htmlize()
452
+
453
+ if @execution_configuration.length == 0
454
+ return
455
+ end
456
+
457
+ return "
458
+ <div class=\"test-config-area\">
459
+ #{execution_date_htmllize()}
460
+ #{device_htmllize()}
461
+ #{os_htmllize()}
462
+ #{release_name_htmllize()}
463
+ #{app_version_htmllize()}
464
+ #{environment_htmllize()}
465
+ </div>"
466
+ end
467
+
468
+ def environment_htmllize()
469
+ if !@execution_configuration.key?(:environment)
470
+ return
471
+ end
472
+
473
+ return "<div class=\"config-item\">
474
+ <i class=\"config-item-icon material-icons\" id=\"theme-switch-icon\"
475
+ >layers</i
476
+ >
477
+ <h5>#{@execution_configuration[:environment]}</h5>
478
+ </div>"
479
+ end
480
+
481
+ def app_version_htmllize()
482
+ if !@execution_configuration.key?(:app_version)
483
+ return
484
+ end
485
+
486
+ return "<div class=\"config-item\">
487
+ <i class=\"config-item-icon material-icons\" id=\"theme-switch-icon\"
488
+ >info</i
489
+ >
490
+ <h5>#{@execution_configuration[:app_version]}</h5>
491
+ </div>"
492
+ end
493
+
494
+ def release_name_htmllize()
495
+ if !@execution_configuration.key?(:release_name)
496
+ return
497
+ end
498
+
499
+ return "<div class=\"config-item\">
500
+ <i class=\"config-item-icon material-icons\" id=\"theme-switch-icon\"
501
+ >bookmark</i
502
+ >
503
+ <h5>#{@execution_configuration[:release_name]}</h5>
504
+ </div>"
505
+ end
506
+
507
+ def os_htmllize()
508
+ if !@execution_configuration.key?(:os)
509
+ return
510
+ end
511
+
512
+ return "<div class=\"config-item\">
513
+ <i class=\"config-item-icon material-icons\" id=\"theme-switch-icon\"
514
+ >settings</i
515
+ >
516
+ <h5>#{@execution_configuration[:os]}</h5>
517
+ </div>"
518
+ end
519
+
520
+ def device_htmllize()
521
+ if !@execution_configuration.key?(:device)
522
+ return
523
+ end
524
+
525
+ return "<div class=\"config-item\">
526
+ <i class=\"config-item-icon material-icons\" id=\"theme-switch-icon\"
527
+ >devices_other</i
528
+ >
529
+ <h5>#{@execution_configuration[:device]}</h5>
530
+ </div>"
531
+ end
532
+
533
+ def execution_date_htmllize()
534
+ if !@execution_configuration.key?(:execution_date)
535
+ return
536
+ end
537
+
538
+ return "<div class=\"config-item\">
539
+ <i class=\"config-item-icon material-icons\" id=\"theme-switch-icon\"
540
+ >date_range</i
541
+ >
542
+ <h5>#{@execution_configuration[:execution_date]}</h5>
543
+ </div>"
544
+ end
545
+
546
+ private :log, :clean, :write, :htmlize, :report_success, :config_htmlize
376
547
  end
377
548
 
378
549
  $NxgReport = NxgReport.new()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nxgreport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Balabharathi Jayaraman