# How to do Black Box UI Testing of Nodes?

**URL:** <https://discourse.nodered.org/t/how-to-do-black-box-ui-testing-of-nodes/100212>\
**Category:** Developing Nodes\
**Created:** [21 January 2026 19:40 UTC](https://discourse.nodered.org/t/how-to-do-black-box-ui-testing-of-nodes/100212 "2026-01-21T19:40:06Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris927](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chris927/32/102089_2.png) [@Chris927](https://discourse.nodered.org/u/Chris927)\
**Post date:** [21 January 2026 19:40 UTC](https://discourse.nodered.org/t/how-to-do-black-box-ui-testing-of-nodes/100212/1 "2026-01-21T19:40:06Z")

</div>

In [node-red-contrib-victron](https://github.com/victronenergy/node-red-contrib-victron/) we have non-trivial javascript logic in the node's html, e.g. [here](https://github.com/victronenergy/node-red-contrib-victron/blob/50de39a52bf0e7bdbc357dd99cf3dba1d6681519/src/nodes/victron-virtual-switch.html#L70).

To avoid bugs and regressions, we want to add automated tests for such logic.

How to approach this?

1. I would like to avoid browser-based testing, if possible. Is there documentation, or are there examples, on how to do this?
2. I found [node-red-node-test-helper](https://github.com/node-red/node-red-node-test-helper), but I don't see how I could use this to test javascript included in the html of a node. Can I?
3. If it has to be browser-based testing, I found [this test](https://github.com/node-red/node-red/blob/1019d52f785788314ce04ce491f005ef523d6264/test/editor/specs/editor/workspace_uispec.js) in node-red itself; when trying to run it with `grunt test-ui`, it prompts me to install "UI test dependencies". The install script fails on my MacOS M1 laptop with "Only Mac 64 bits supported", which allegedly is due to outdated (deprecated, unmaintained) dependencies ("chromedriver" and others). Are these tests running and succeeding, if I am on a different architecture (e.g. linux)?

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [21 January 2026 20:25 UTC](https://discourse.nodered.org/t/how-to-do-black-box-ui-testing-of-nodes/100212/2 "2026-01-21T20:25:25Z")

</div>

I can add another testing suite - [unit testing](https://flows.nodered.org/node/@gregoriusrippenstein/erlang-red-unittest) which does flow-based testing, i.e. you create a flow that tests expected behaviour. Basically input message expected to produce output message. They work best as part of the [Erlang-Red](https://github.com/gorenje/erlang-red) project.

I used those nodes to create a suite of [tests](https://github.com/gorenje/erlang-red-flow-testsuite) for the basic Node-RED functionality. That's their intended use case which might or might not match your use case.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [21 January 2026 20:58 UTC](https://discourse.nodered.org/t/how-to-do-black-box-ui-testing-of-nodes/100212/3 "2026-01-21T20:58:43Z")

</div>

Not sure I really have much of an _answer_ here. However, might be worth noting that for my own nodes, I split out the node's Editor JavaScript to a separate resource file and simply use a script link to load it. This has, in my view, several advantages. Firstly, I can use ES Modules instead of legacy JavaScript which gives better code isolation and access to modern syntax.

But more pertinent to this question, it would allow you to load the module to a test harness script. This wouldn't let you test everything (e.g. the node-red specific parts), it would let you do unit testing on functions - hopefully, you are breaking everything out into separate functions? You would still need to do some mocking since there is quite a bit of assumed data structures. But it should be possible.

I also break out code that is common to multiple nodes out into a separate resource file and that would also be quite testable. Check out [GitHub - TotallyInformation/Node-RED-Testbed: A blank canvas to test out ideas for Node-RED custom nodes](https://github.com/TotallyInformation/Node-RED-Testbed) for how I do this and to see if any of it is useful to you.

Bottom line is that _some_ things should be testable as long as:

- You are using testable functions, not lumping processes into long code runs.
- You can mock out some key node-red specific data and functions.

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [21 January 2026 22:04 UTC](https://discourse.nodered.org/t/how-to-do-black-box-ui-testing-of-nodes/100212/4 "2026-01-21T22:04:33Z")

</div>

> [@TotallyInformation](#):
>
> use a script link to load it.

It's really a pity to see (pun intended), not only here but also in the [backup](https://discourse.nodered.org/t/backup-script-not-working/100189) thread, that folks seem to think in scripts and not flows.

To test the functionality of a visual tool, we use textual scripts instead of making the effort of creating a _visual_ solution.

My approach has been to explore visual approaches first and if that fails, to fall (fail?) back to an exec node i.e. script solution or worse case makefile. The advantage is that you _learn_ something about a new paradigm, instead of using the old and trusted textual approach. Plus a visual approach means I don't constantly switch between Node-RED and my Emacs editor - it's all done in NR.

At the end of the day, I don't really care what others do. If the trusted scripting solution plus a bit of AI is your thing, alright sounds lovely. I prefer to find a visual approach and challenge myself to think out-of-the-box, the scripting solution is always available.

Btw I also create my nodes using a [node development package](https://flows.nodered.org/node/@gregoriusrippenstein/node-red-contrib-nodedev). So the obvious interjection: _but its a node package with html + js code_ doesn't really apply since all my code is a flow anyway. I haven't tried adding unit tests to the flows that represent my node packages, but it wouldn't be rocket science.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [22 January 2026 00:35 UTC](https://discourse.nodered.org/t/how-to-do-black-box-ui-testing-of-nodes/100212/5 "2026-01-22T00:35:45Z")

</div>

> [@gregorius](#):
>
> It's really a pity to see (pun intended), not only here but also in the [backup](https://discourse.nodered.org/t/backup-script-not-working/100189) thread, that folks seem to think in scripts and not flows.

I think you may have misunderstood this one. 🙂

Here is an example of what I mean, this is the html file for the new markweb node (not yet released):

```html
<script type="module" async src="./resources/node-red-contrib-uibuilder/uib-markweb.js"></script>

<script type="text/html" data-template-name="uib-markweb">
    <div id="ti-edit-panel">
        .......
    </div>
</script>

```

As you can see, while many people put the Editor JS code for a node in the same file, I dislike that, and it makes testing hard. So in my nodes, the JS is in a resource file. Simples.

> [@gregorius](#):
>
> To test the functionality of a visual tool, we use textual scripts instead of making the effort of creating a _visual_ solution.

Here, we are talking about using standard web-development test tooling like Jest or similar. By all means use flows if you want. But then you may have a bunch of test flows cluttering up your node-red flows and that is not always appropriate, especially in customer situations. And even more especially if you already have existing web testing tools in use by a development team. You might be wanting your customers to use Node-RED flows but have an experienced dev team - the two do not have to be intimately connected.

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [22 January 2026 01:17 UTC](https://discourse.nodered.org/t/how-to-do-black-box-ui-testing-of-nodes/100212/6 "2026-01-22T01:17:17Z")

</div>

No I think you might have misunderstood, all you are saying is if you have the right team … html code is visual … test flows cluttering …

I’m saying find a flow based solution first.

I know you’re going to point to some JS code or something and say that’s visual. It’s not what I mean and something you don’t want to understand - it seems. Fine. You like coding html and JS - I don’t, I want a visual abstraction layer.

No wonder that Node-Red hasn’t moved out of the home assistant or IoT spaces because that is all the NR can do - apparently.

- Visual unit testing? Nope.
- Visual code management? Nope.
- Visual web development? Nope.
- Visual robotics? Nope.
- Visual code comparison? Nope.

Besides proper process management doesn’t exist in NR either, it’s just one process. So no need for process management.

But that’s fine because it’s always been that way, so no need to change anything. Steady state until n8n addresses these features.

Remember, flow based programming isn’t solely applicable to IoT, so there is nothing - going by the underlying paradigm - blocking NR from doing the things I mention above. Except a lack of imagination.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 January 2026 07:10 UTC](https://discourse.nodered.org/t/how-to-do-black-box-ui-testing-of-nodes/100212/7 "2026-01-22T07:10:24Z")

</div>

It is certainly possible to do end to end (E2E) tests. We use `cypress` in `@flowfuse/node-red-dashboard` (source is available in GitHub)

---

<div class="post-metadata">

**Author:** ![Chris927](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chris927/32/102089_2.png) [@Chris927](https://discourse.nodered.org/u/Chris927)\
**Post date:** [22 January 2026 07:10 UTC](https://discourse.nodered.org/t/how-to-do-black-box-ui-testing-of-nodes/100212/8 "2026-01-22T07:10:57Z")

</div>

Hey thanks for your input, @gregorius and @TotallyInformation !

@TotallyInformation, we are, step by step, extracting javascript logic from the html files, to make them unit-testable.

My remaining concern is Black Box testing, though: Black box testing is, [by definition](https://en.wikipedia.org/wiki/Black-box_testing), a testing approach "without peering into its [the application's] internal structures or workings". So, in practice, I want to assert correctness of test scenarios **through the browser** , and in an environment that (in our case) includes more than just Node-RED (it runs on a [Venus](https://github.com/victronenergy/venus) device with certain libraries present, it communicates with external hardware in a test environment, etc.)

Coming back to question 3, and [the test in the node-red code base](https://github.com/node-red/node-red/blob/1019d52f785788314ce04ce491f005ef523d6264/test/editor/specs/editor/workspace_uispec.js#L43): The test adds two nodes, connects them, and deploys the flow, then asserts that some debug output occurred.

How can I test such a scenario? I want to assert, through the browser, that those steps (adding nodes, connecting them, deploying) don't fail, and that I get resulting debug output.

I still want to avoid browser-based testing as much as possible, but for some scenarios it is unavoidable. So, I'm looking for help on how to do browser based testing here.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [22 January 2026 09:20 UTC](https://discourse.nodered.org/t/how-to-do-black-box-ui-testing-of-nodes/100212/9 "2026-01-22T09:20:30Z")

</div>

> [@Chris927](#):
>
> Coming back to question 3, and [the test in the node-red code base](https://github.com/node-red/node-red/blob/1019d52f785788314ce04ce491f005ef523d6264/test/editor/specs/editor/workspace_uispec.js#L43): The test adds two nodes, connects them, and deploys the flow, then asserts that some debug output occurred.

The UI tests in the core Node-RED code base are not maintained; they were a contribution to the project and the contributors who worked on them aren't involved any more. In a perfect world, we would of course dust them off and getting them working. But we just don't have the bandwidth in the core contributor team.

---

<div class="post-metadata">

**Author:** ![Chris927](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chris927/32/102089_2.png) [@Chris927](https://discourse.nodered.org/u/Chris927)\
**Post date:** [22 January 2026 09:41 UTC](https://discourse.nodered.org/t/how-to-do-black-box-ui-testing-of-nodes/100212/10 "2026-01-22T09:41:34Z")

</div>

Thanks for the clarification, @knolleary !

@Steve-Mcl the approach you have in `@flowfuse/node-red-dashboard` looks very close to what I'm looking for. It's not a true black box test (because you somehow intercept API calls for deploying flows, as I understand it), but it looks close. Thanks for the pointer!

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [22 January 2026 11:20 UTC](https://discourse.nodered.org/t/how-to-do-black-box-ui-testing-of-nodes/100212/11 "2026-01-22T11:20:18Z")

</div>

> [@Steve-Mcl](#):
>
> cypress

If you prefer full open source, TestCafe seems very popular and somewhat simpler to use than some other UI test suites. And, of course, Playwright is extremely powerful if you need to do cross-browser testing.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 February 2026 11:20 UTC](https://discourse.nodered.org/t/how-to-do-black-box-ui-testing-of-nodes/100212/12 "2026-02-05T11:20:21Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
