@gregoriusrippenstein/erlang-red-unittest 0.11.4 → 0.11.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.
package/README.md CHANGED
@@ -30,6 +30,18 @@ Admittedly the assert status node can be replaced by using a status node followe
30
30
 
31
31
  These nodes have been published because the [Erlang-RED flow testsuite](https://github.com/gorenje/erlang-red-flow-testsuite) utilises them.
32
32
 
33
+ ## Actions
34
+
35
+ This package also defines the following actions that can be mapped to keyboard shortcuts:
36
+
37
+ - Test Current Workspace: triggers all inject buttons on the current workspace. Might well have undesired consequences if run on incorrect workspaces.
38
+ - Send Halt To Test Server: (Erlang-Red only) restarts the server
39
+ - Run All Tests: (Erlang-Red only) run all defined unit tests.
40
+
41
+ ## Tee Time
42
+
43
+ <a href="https://www.buymeacoffee.com/gorenje" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-red.png" alt="Buy Me A Tee" style="height: 42px !important;width: 152px !important;" ></a>
44
+
33
45
  ## Artifacts
34
46
 
35
47
  - [NPMjs Package](https://www.npmjs.com/package/@gregoriusrippenstein/erlang-red-unittest)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gregoriusrippenstein/erlang-red-unittest",
3
- "version": "0.11.4",
3
+ "version": "0.11.6",
4
4
  "dependencies": {
5
5
  },
6
6
 
@@ -264,7 +264,17 @@ function testCurrentWorkspace() {
264
264
  if (RED.comms.isConnected && !RED.comms.isConnected()) {
265
265
  return RED.notify("Not connected to server, websocket down", "error")
266
266
  }
267
- runTestForFlowId(RED.workspaces.active())
267
+ if ( RED.isErlangRed ) {
268
+ runTestForFlowId(RED.workspaces.active())
269
+ } else {
270
+ RED.notify("restarting flow", { type: "info" });
271
+ RED.actions.invoke("core:restart-flows")
272
+
273
+ setTimeout(() => {
274
+ RED.notify("testing current workspace", { type: "info" });
275
+ RED.search.search("type:inject flow:current").map(d => d.node).forEach(d => RED.view.clickNodeButton(d))
276
+ }, 2000)
277
+ }
268
278
  }
269
279
 
270
280
  function sendUnittestngHalt() {
@@ -456,6 +466,12 @@ $('#node-input-unittestingpull-sb-testall-but').on('click', function (e) {
456
466
  runAllTests(dirList)
457
467
  })
458
468
 
469
+ $('#node-input-unittestingpull-sb-test-workspace-but').on('click', function (e) {
470
+ e.preventDefault();
471
+ testCurrentWorkspace()
472
+ })
473
+
474
+
459
475
  let handleTestResult = (event, data) => {
460
476
  if (data.flowid) {
461
477
  if ( data.status == "unknown_testcase") {
@@ -521,19 +537,27 @@ $('#node-input-unittestingpull-sb-refresh-list-but').on('click', function (e) {
521
537
  window.unitTestDirList = dirList;
522
538
  window.fakeTestResult = handleTestResult;
523
539
 
524
- RED.comms.on("connect", () => {
525
- $('#node-input-unittestingpull-sb-testall-but').prop('disabled', false)
526
- $('#node-input-unittestingpull-sb-test-flow-but').prop('disabled', false)
527
- });
540
+ if (RED.comms.on) {
541
+ // RED.comms.on is not available on NR 3.x
542
+ RED.comms.on("connect", () => {
543
+ $('#node-input-unittestingpull-sb-testall-but').prop('disabled', false)
544
+ $('#node-input-unittestingpull-sb-test-flow-but').prop('disabled', false)
545
+ $('#node-input-unittestingpull-sb-test-workspace-but').prop('disabled', false)
546
+ });
528
547
 
529
- RED.comms.on("disconnect", () => {
530
- $('#node-input-unittestingpull-sb-testall-but').prop('disabled', true)
531
- $('#node-input-unittestingpull-sb-test-flow-but').prop('disabled', true)
532
- });
548
+ RED.comms.on("disconnect", () => {
549
+ $('#node-input-unittestingpull-sb-testall-but').prop('disabled', true)
550
+ $('#node-input-unittestingpull-sb-test-flow-but').prop('disabled', true)
551
+ $('#node-input-unittestingpull-sb-test-workspace-but').prop('disabled', true)
552
+ });
533
553
 
534
- if ( !RED.comms.isConnected || RED.comms.isConnected() ) {
535
- $('#node-input-unittestingpull-sb-testall-but').prop('disabled', false)
536
- $('#node-input-unittestingpull-sb-test-flow-but').prop('disabled', false)
554
+ if ( !RED.comms.isConnected || RED.comms.isConnected() ) {
555
+ $('#node-input-unittestingpull-sb-testall-but').prop('disabled', false)
556
+ $('#node-input-unittestingpull-sb-test-flow-but').prop('disabled', false)
557
+ $('#node-input-unittestingpull-sb-test-workspace-but').prop('disabled', false)
558
+ }
559
+ } else {
560
+ $('#node-input-unittestingpull-sb-test-workspace-but').prop('disabled', false)
537
561
  }
538
562
 
539
563
  RED.actions.add("unittesting:send-halt-to-test-server", sendUnittestngHalt)
@@ -611,6 +635,8 @@ $('#node-input-unittestingpull-testresults-row').on('click', 'span.filtrg', (e)
611
635
  class="red-ui-button">Test all</button>
612
636
  <button id="node-input-unittestingpull-sb-test-flow-but" disabled=disabled
613
637
  class="red-ui-button">Test one</button>
638
+ <button id="node-input-unittestingpull-sb-test-workspace-but" disabled=disabled
639
+ style="margin-left: 20px;" class="red-ui-button">Test Current Workspace</button>
614
640
  </div>
615
641
 
616
642
  <div class="form-row" style="margin-left: 10px;">