aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-13 00:30:39 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-13 00:30:39 +0200
commite9a93c21ff28daa6f4017849b42fe073a5ee2005 (patch)
treeff5ff2d507e763f484c0ddb0805f0750c8dd8e18
parent13e7980071ab11b07b5d473e43506c6cb4ab637e (diff)
downloadmeshbay-e9a93c21ff28daa6f4017849b42fe073a5ee2005.tar.gz
test(node): look for Node in the menu under the avatar
Node and Create group left the sidebar for the user menu. A source-reading test still looked for the old `showNode=` expression and failed everywhere; the installed application's end-to-end test waited for "Create group" in the sidebar and would have timed out. Both now check the menu, and the packaging guide says where the two entries are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-rw-r--r--docs/PACKAGING-GUIDE.md5
-rw-r--r--packages/meshbay-node/tests/test_e2e_windows_app.py23
-rw-r--r--packages/meshbay-node/tests/test_windows_node_lifecycle.py5
3 files changed, 23 insertions, 10 deletions
diff --git a/docs/PACKAGING-GUIDE.md b/docs/PACKAGING-GUIDE.md
index 9f5d6cf..5fbf7a7 100644
--- a/docs/PACKAGING-GUIDE.md
+++ b/docs/PACKAGING-GUIDE.md
@@ -95,8 +95,9 @@ alongside it). Nothing to install separately.
Open MeshBay, choose the hub and sign in. **That is all**: the app sets the node
up for the account you signed in with, starts it the way you chose at install,
-and links it to your account. **Node** and **Create group** appear in the
-sidebar; nothing has to be typed in a terminal and no key has to be copied.
+and links it to your account. **Node** and **Create group** appear in the menu
+under your avatar; nothing has to be typed in a terminal and no key has to be
+copied.
Two cases where the app does not do it on its own, because it would undo
something:
diff --git a/packages/meshbay-node/tests/test_e2e_windows_app.py b/packages/meshbay-node/tests/test_e2e_windows_app.py
index da1d251..e457452 100644
--- a/packages/meshbay-node/tests/test_e2e_windows_app.py
+++ b/packages/meshbay-node/tests/test_e2e_windows_app.py
@@ -5,8 +5,8 @@ starts and stops the real node. Everything it asserts was broken at least once
on a real install while every other test passed:
- a fresh account signs in and, with nothing else done, has a node set up,
- started, linked and listed in the sidebar (it used to take `meshbay-node
- init` in a terminal and a key pasted on the profile page);
+ started, linked and offered in the menu under the avatar (it used to take
+ `meshbay-node init` in a terminal and a key pasted on the profile page);
- Stop leaves no meshbay-node.exe behind and only then says "Stopped";
- Start and Restart answer with a running node, a new one for Restart.
@@ -150,8 +150,18 @@ class Page:
def text(self) -> str:
return self.eval("document.body.innerText")
- def sidebar(self) -> str:
- return self.eval("(document.querySelector('aside') || {}).innerText || ''")
+ def user_menu(self) -> str:
+ """What the menu under the avatar offers: opened, read, closed again.
+ Its entries are only in the page while it is open."""
+ return self.eval("""(async () => {
+ const trigger = document.querySelector('.user-menu-trigger');
+ if (!trigger) return '';
+ if (trigger.getAttribute('aria-expanded') !== 'true') trigger.click();
+ await new Promise((r) => setTimeout(r, 200));
+ const text = (document.querySelector('.user-menu-dropdown') || {}).innerText || '';
+ if (trigger.getAttribute('aria-expanded') === 'true') trigger.click();
+ return text;
+ })()""")
def click(self, label: str, timeout: float = 30) -> None:
"""Click a button or link by its label once it is there and enabled."""
@@ -286,8 +296,9 @@ def test_a_fresh_account_gets_its_node_set_up_and_can_stop_it(app, hub):
time.sleep(0.5) # the form's state follows the input events a render later
page.eval(f"({SUBMIT}, 1)")
- # Nothing else done: the node is set up, running, linked, and in the sidebar.
- _wait("the Node section in the sidebar", lambda: "Create group" in page.sidebar(), 120)
+ # Nothing else done: the node is set up, running, linked, and in the menu.
+ _wait("Node and Create group in the menu under the avatar",
+ lambda: (m := page.user_menu()) and "Node" in m and "Create group" in m, 120)
status = _wait("a running node", lambda: (s := _node_status()) and
s.get("status") == "running" and s, 120)
toml = (NODE_HOME / "node.toml").read_text(encoding="utf-8")
diff --git a/packages/meshbay-node/tests/test_windows_node_lifecycle.py b/packages/meshbay-node/tests/test_windows_node_lifecycle.py
index b85b6ea..6ca301b 100644
--- a/packages/meshbay-node/tests/test_windows_node_lifecycle.py
+++ b/packages/meshbay-node/tests/test_windows_node_lifecycle.py
@@ -330,8 +330,9 @@ def test_signing_in_sets_up_this_machines_node():
def test_the_node_section_shows_for_a_node_not_yet_linked():
"""It waited for the hub to hold a node key, which nothing gave it."""
app = _js(STATIC / "app.js")
- assert "showNode=${hasNodeKey || localNode}" in app
- assert "platform.capabilities.nodeAdmin && (hasNodeKey || localNode)" in app
+ shown = "platform.capabilities.nodeAdmin && (hasNodeKey || localNode)"
+ assert "showNode=${" + shown + "}" in app, "the link, in the user menu"
+ assert "route === '/node' && " + shown in app, "and the page it leads to"
effect = app.split("const signedInAs = user ? user.username : null;", 1)[1]
effect = effect.split("}, [signedInAs]);", 1)[0]
assert "platform.node.ensure(" in effect and "platform.node.installed()" in effect