@gregoriusrippenstein/erlang-red-unittest 0.10.4 → 0.10.6

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 succeed 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.4",
3
+ "version": "0.10.6",
4
4
  "dependencies": {
5
5
  },
6
6
 
@@ -413,11 +413,11 @@ var search = $("#node-input-unittestingpull-sb-target-filter").searchBox({
413
413
  count = dirList.treeList("filter", function (item) {
414
414
  return $($(item.treeList.container).find('.red-ui-treeList-icon')).data("status") == "failed"
415
415
  });
416
- } else if (val == "is:passed" || val == "is:success") {
416
+ } else if (val == "is:passed" || val == "is:success" || val == "is:succeed") {
417
417
  count = dirList.treeList("filter", function (item) {
418
418
  return $($(item.treeList.container).find('.red-ui-treeList-icon')).data("status") == "success"
419
419
  });
420
- } else if (val == "is:untested") {
420
+ } else if (val == "is:untested" || val == "is:todo") {
421
421
  count = dirList.treeList("filter", function (item) {
422
422
  return !$($(item.treeList.container).find('.red-ui-treeList-icon')).data("status")
423
423
  });
@@ -537,6 +537,19 @@ RED.actions.add("unittesting:send-halt-to-test-server", sendUnittestngHalt)
537
537
  RED.actions.add("unittesting:test-current-workspace", testCurrentWorkspace)
538
538
  RED.actions.add("unittesting:run-all-tests", () => { runAllTests(dirList) } )
539
539
 
540
+ $('#node-input-unittestingpull-testresults-row').on('click', 'span.filtrg', (e) => {
541
+ e.preventDefault();
542
+ if ( $(e.target).data('filter') == "") {
543
+ $('#node-input-unittestingpull-sb-target-filter').val('').trigger('keyup', { keyCode: 13})
544
+ } else {
545
+ let newVal = `is:${$(e.target).data('filter')}`
546
+ let currVal = $('#node-input-unittestingpull-sb-target-filter').val()
547
+
548
+ if ( newVal == currVal) { newVal = "" } // toggle between filter and all
549
+ $('#node-input-unittestingpull-sb-target-filter').val(newVal).trigger('keyup', { keyCode: 13})
550
+ }
551
+ })
552
+
540
553
  };
541
554
 
542
555
  RED.events.on('runtime-state', initialiseConfigNodeOnce);
@@ -583,11 +596,11 @@ RED.actions.add("unittesting:run-all-tests", () => { runAllTests(dirList) } )
583
596
 
584
597
  <div id="node-input-unittestingpull-testresults-row" class="form-row"
585
598
  style="margin-left: 10px; margin-top: 15px; display: none;">
586
- Todo <span class="todo" style="color: purple">0</span>
587
- / Succeed <span class="success" style="color: green">0</span>
588
- / Pending <span class="pending" style="color: orange">0</span>
589
- / Failed <span class="failed" style="color: red">0</span>
590
- / Done <span class='total'>0</span>
599
+ <span class='filtrg'data-filter="todo">Todo <span class="todo" style="color: purple">0</span></span>
600
+ / <span class='filtrg'data-filter="succeed">Succeed <span class="success" style="color: green">0</span></span>
601
+ / <span class='filtrg'data-filter="pending">Pending <span class="pending" style="color: orange">0</span></span>
602
+ / <span class='filtrg'data-filter="failed">Failed <span class="failed" style="color: red">0</span></span>
603
+ / <span class='filtrg'data-filter="tested">Done <span class='total'>0</span></span>
591
604
  </div>
592
605
 
593
606
  <div class="form-row" style="margin-left: 10px; margin-top: 30px;">