Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions cmux-tui/scripts/smoke-tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,20 @@ def rpc(cmd):
def tree():
return rpc({"id": 999, "cmd": "list-workspaces"})["data"]["workspaces"]

def sidebar_order():
"""The sidebar's workspace order, as resource ids. With the sidebar document
(sidebar-doc-v1) a row drag is a sidebar.move: it changes this order, not
the session order list-workspaces reports."""
listing = subprocess.run(
[BIN, "--socket", SOCK, "--json", "workspace", "list", "--order", "personal"],
capture_output=True,
text=True,
timeout=15,
check=False,
)
assert listing.returncode == 0, (listing.returncode, listing.stdout, listing.stderr)
return [workspace["id"] for workspace in json.loads(listing.stdout)]

def active_screen(ws):
return next(s for s in ws["screens"] if s["active"])

Expand Down Expand Up @@ -947,18 +961,20 @@ def assert_snapshot_parser_controls():
# row 1 blank, rows 2-3 workspace 1, row 4 blank, rows 5-6 workspace 2
# (SGR mouse coordinates are 1-based).
original_ws = ws_id
original_resource = next(w["resource_id"] for w in tree() if w["id"] == original_ws)
write_all(fd, b"\x1b[<0;2;3M\x1b[<32;2;7M\x1b[<0;2;7m")
drain(1.0)
workspaces = tree()
assert [w["id"] for w in workspaces] == [w["id"] for w in workspaces if w["id"] != original_ws] + [original_ws], workspaces
order = sidebar_order()
assert order == [r for r in order if r != original_resource] + [original_resource], (order, workspaces)
print("sidebar workspace drag reorder ok")

# Click the moved original workspace's sidebar entry.
shared_workspace = next(workspace["id"] for workspace in workspaces if workspace["active"])
write_all(fd, b"\x1b[<0;2;6M\x1b[<0;2;6m")
drain(1.0)
workspaces = tree()
assert workspaces[1]["id"] == original_ws, workspaces
assert sidebar_order()[1] == original_resource, (sidebar_order(), workspaces)
assert next(workspace["id"] for workspace in workspaces if workspace["active"]) == shared_workspace
original_workspace = next(workspace for workspace in workspaces if workspace["id"] == original_ws)
original_surfaces = {
Expand Down
Loading