aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/meshbay-node/tests/test_e2e_windows_app.py23
-rw-r--r--packages/meshbay-node/tests/test_windows_node_lifecycle.py5
2 files changed, 20 insertions, 8 deletions
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