@gregoriusrippenstein/erlang-red-unittest 0.10.3 → 0.10.5

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.
@@ -12,4 +12,16 @@ all tests succeed or some failed. This is an all or one flag.
12
12
  <p>
13
13
  The "assert_failures" array value is set on the message to contain all failures and unsupported features.
14
14
 
15
+ <p>
16
+ <b>Ignore if Succeed</b>
17
+
18
+ <p>
19
+ The <i>ignore failure if succeed</i> flag can be used if the assert value node receives multiple messages however as long as one message succeeded, then the assert values node will succeed and messages that failure will be ignored.
20
+
21
+ <p>
22
+ Normally each message is independent of one another but in the case of an assert values node with the flag "ignore failure" set, the node will remain in success mode until Node-RED, the flow or the node is reset/restarted.
23
+
24
+ <p>
25
+ Failures will still be sent to the debug panel however the node status will remain succeeded.
26
+
15
27
  </script>
@@ -20,7 +20,9 @@
20
20
  "noteql": "not equal __property__",
21
21
  "notset": "not set __property__",
22
22
  "debug": "debug __property__",
23
- "unsupported": "supported rule __property__"
23
+ "unsupported": "supported rule __property__",
24
+
25
+ "ignore_failure_if_succeed": "Ignore failure if matched once"
24
26
  },
25
27
 
26
28
  "action": {
@@ -9,6 +9,9 @@
9
9
  name: {
10
10
  value:"",
11
11
  },
12
+ ignore_failure_if_succeed: {
13
+ value: false
14
+ },
12
15
  rules: {
13
16
  value: [{ t: "eql", p: "payload", pt: "msg", to: "", tot: "str" }],
14
17
  validate: function (rules, opt) {
@@ -276,10 +279,18 @@
276
279
  flex: 1;
277
280
  }
278
281
  </style>
282
+
279
283
  <div class="form-row">
280
284
  <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
281
285
  <input type="text" id="node-input-name" style="width: calc(100% - 105px)" data-i18n="[placeholder]node-red:common.label.name">
282
286
  </div>
287
+
288
+ <div class="form-row">
289
+ <input type="checkbox" id="node-input-ignore_failure_if_succeed"
290
+ style="display:inline-block; width:15px; vertical-align:baseline;">
291
+ <label for="node-input-ignore_failure_if_succeed"><span data-i18n="ut-assert-values.label.ignore_failure_if_succeed"></span></label>
292
+ </div>
293
+
283
294
  <div class="form-row" style="margin-bottom:0;">
284
295
  <label><i class="fa fa-list"></i> <span data-i18n="ut-assert-values.label.rules"></span></label>
285
296
  </div>
@@ -127,22 +127,26 @@ module.exports = function(RED) {
127
127
  }
128
128
  })
129
129
 
130
- if (failures.length > 0 ) {
131
- node.status({fill: "red", shape: "dot", text: "assert failed"})
132
- msg.assert_succeed = false
133
- msg.assert_failures = failures.concat(unsupported)
130
+ if (node.context().get("succeed") && cfg.ignore_failure_if_succeed) {
131
+ node.status({ fill: "green", shape: "ring", text: "assert succeed" })
134
132
  } else {
135
- if ( unsupported.length > 0) {
136
- node.status({ fill: "yellow", shape: "ring", text: "unsupported errors - check debug" })
133
+ if (failures.length > 0 ) {
134
+ node.status({fill: "red", shape: "dot", text: "assert failed"})
137
135
  msg.assert_succeed = false
138
- msg.assert_failures = failures.concat( unsupported )
136
+ msg.assert_failures = failures.concat(unsupported)
139
137
  } else {
140
- node.status({ fill: "green", shape: "ring", text: "assert succeed" })
141
- msg.assert_succeed = true
142
- delete msg.assert_failures
138
+ if ( unsupported.length > 0) {
139
+ node.status({ fill: "yellow", shape: "ring", text: "unsupported errors - check debug" })
140
+ msg.assert_succeed = false
141
+ msg.assert_failures = failures.concat( unsupported )
142
+ } else {
143
+ node.context().set("succeed",true)
144
+ node.status({ fill: "green", shape: "ring", text: "assert succeed" })
145
+ msg.assert_succeed = true
146
+ delete msg.assert_failures
147
+ }
143
148
  }
144
149
  }
145
-
146
150
  send(msg);
147
151
  done();
148
152
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gregoriusrippenstein/erlang-red-unittest",
3
- "version": "0.10.3",
3
+ "version": "0.10.5",
4
4
  "dependencies": {
5
5
  },
6
6
 
@@ -197,6 +197,7 @@ function highlightTestResult(dirList, flowid, status) {
197
197
  break;
198
198
  }
199
199
 
200
+ $($(dirList.treeList('selected').treeList.container).find('.red-ui-treeList-icon')).data("status", status)
200
201
  $($($(dirList.treeList('selected').treeList.container).find('.red-ui-treeList-icon')).find('i')).prop('class', "fa " + shp).css('color', clr)
201
202
  }
202
203
 
@@ -381,6 +382,7 @@ var dirList = $("#node-input-unittestingpull-sb-target-container-div").css({
381
382
  if ( item.flowid) {
382
383
  $('#unittesting-view-testflow-link').prop('href', `https://flows.red-erik.org/f/${item.flowid}`)
383
384
  $('#unittesting-view-testflow-link').fadeIn(300)
385
+ $('#unittesting-helper-import-text').fadeIn(300)
384
386
  } else {
385
387
  $('#unittesting-view-testflow-link').fadeOut(300)
386
388
  $('#unittesting-view-testflow-link').prop('href', "")
@@ -388,6 +390,7 @@ var dirList = $("#node-input-unittestingpull-sb-target-container-div").css({
388
390
  }).on('treelistconfirm', function (event, item) {
389
391
  if (item.flowid) {
390
392
  doFlowImportForSidebarUnittesting(item.flowid)
393
+ $('#unittesting-helper-import-text').fadeOut(1000, () => { $('#unittesting-helper-import-text').remove() })
391
394
  }
392
395
  });
393
396
 
@@ -401,9 +404,32 @@ var search = $("#node-input-unittestingpull-sb-target-filter").searchBox({
401
404
  dirList.treeList("filter", null);
402
405
  search.searchBox("count", "");
403
406
  } else {
404
- var count = dirList.treeList("filter", function (item) {
405
- return item.label.toLowerCase().indexOf(val) > -1 || item.sublabel.toLowerCase().indexOf(val) > -1
406
- });
407
+ var count = 0
408
+ if ( val == "is:pending" ) {
409
+ count = dirList.treeList("filter", function (item) {
410
+ return $($(item.treeList.container).find('.red-ui-treeList-icon')).data("status") == "pending"
411
+ });
412
+ } else if (val == "is:failed" || val == "is:error") {
413
+ count = dirList.treeList("filter", function (item) {
414
+ return $($(item.treeList.container).find('.red-ui-treeList-icon')).data("status") == "failed"
415
+ });
416
+ } else if (val == "is:passed" || val == "is:success") {
417
+ count = dirList.treeList("filter", function (item) {
418
+ return $($(item.treeList.container).find('.red-ui-treeList-icon')).data("status") == "success"
419
+ });
420
+ } else if (val == "is:untested") {
421
+ count = dirList.treeList("filter", function (item) {
422
+ return !$($(item.treeList.container).find('.red-ui-treeList-icon')).data("status")
423
+ });
424
+ } else if (val == "is:tested") {
425
+ count = dirList.treeList("filter", function (item) {
426
+ return !!$($(item.treeList.container).find('.red-ui-treeList-icon')).data("status")
427
+ });
428
+ } else {
429
+ count = dirList.treeList("filter", function (item) {
430
+ return item.label.toLowerCase().indexOf(val) > -1 || item.sublabel.toLowerCase().indexOf(val) > -1
431
+ });
432
+ }
407
433
  search.searchBox("count", count + " / " + dirList.treeList("data").length);
408
434
  }
409
435
  }
@@ -550,8 +576,13 @@ RED.actions.add("unittesting:run-all-tests", () => { runAllTests(dirList) } )
550
576
  </div>
551
577
  </div>
552
578
 
579
+ <div class="form-row" id="unittesting-helper-import-text" +
580
+ style="margin-left: 10px; margin-top: 15px; display: none;">
581
+ <span>double click on a test case <b>to import that test case</b></span>
582
+ </div>
583
+
553
584
  <div id="node-input-unittestingpull-testresults-row" class="form-row"
554
- style="margin-left: 10px; margin-top: 30px; display: none;">
585
+ style="margin-left: 10px; margin-top: 15px; display: none;">
555
586
  Todo <span class="todo" style="color: purple">0</span>
556
587
  / Succeed <span class="success" style="color: green">0</span>
557
588
  / Pending <span class="pending" style="color: orange">0</span>