aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/test_e2e_windows_app.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/tests/test_e2e_windows_app.py')
-rw-r--r--packages/meshbay-node/tests/test_e2e_windows_app.py23
1 files changed, 17 insertions, 6 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")