diff --git a/crates/tinyclient/src/gui/layout.rs b/crates/tinyclient/src/gui/layout.rs index 60d5779a..37b9af43 100644 --- a/crates/tinyclient/src/gui/layout.rs +++ b/crates/tinyclient/src/gui/layout.rs @@ -17,6 +17,7 @@ use gpui::{ Rgba, SharedString, Window, WindowControlArea, }; use protocol::{CallState, Conversation, Key, Link, Network, Notify, Presence}; +use std::collections::HashMap; use std::rc::Rc; use std::time::Duration; @@ -157,6 +158,11 @@ pub struct State { pub floating: bool, pub resizing: Option, pub menu: Option, + /// The list of servers or workspaces that hangs off a rail icon while the pointer rests on it. + pub flyout: Option, + /// Keyboard focus while the rail's workspace/server menu is open. + pub flyout_focus: gpui::FocusHandle, + pub rail_focus: HashMap, pub right: Option, /// The row of the first-launch card that has the keyboard. pub first_run: usize, @@ -175,8 +181,8 @@ pub struct State { main_top: Rc>, } -impl Default for State { - fn default() -> Self { +impl State { + pub(super) fn new(flyout_focus: gpui::FocusHandle, rail_focus: HashMap) -> Self { State { sidebar_width: SIDEBAR_WIDTH, right_width: RIGHT_WIDTH, @@ -184,6 +190,9 @@ impl Default for State { floating: false, resizing: None, menu: None, + flyout: None, + flyout_focus, + rail_focus, right: None, first_run: 0, details_channels: false, @@ -2554,6 +2563,7 @@ impl Render for Shell { // With no sidebar dock in view (collapsed, hidden, or narrow Tiny page), float incoming calls here. .children(self.call_incoming_overlay(snapshot, cx)) .children(self.menu_layer(snapshot, actual_sidebar_width, overview, top_offset, window, cx).map(super::components::focus_scope)) + .children(self.rail_flyout_layer(window, cx)) .children(self.meeting_layer(window, cx)) .children(self.story_viewer_layer(window, cx)) .children(self.toast_layer(width, cx)) diff --git a/crates/tinyclient/src/gui/rail.rs b/crates/tinyclient/src/gui/rail.rs index 7000e126..716c6aa2 100644 --- a/crates/tinyclient/src/gui/rail.rs +++ b/crates/tinyclient/src/gui/rail.rs @@ -8,11 +8,12 @@ use super::phone::tokens; use super::people::presence; use super::sidebar::Mode; use super::state::{Shell, Snapshot}; -use super::theme; +use super::theme::{self, Type}; use gpui::{ - div, prelude::*, px, AnyElement, Context, Div, ElementId, MouseButton, SharedString, Stateful, + div, prelude::*, px, AnyElement, Bounds, Context, Div, ElementId, MouseButton, Pixels, SharedString, Stateful, Window, }; +use std::time::Duration; use protocol::{Link, Network}; /// What a rail button's tooltip says after its name. @@ -25,6 +26,22 @@ fn waiting(attention: u32, unread: bool) -> String { } } +/// Servers a rail list shows before it says how many more there are. +const FLYOUT_SHOWN: usize = 5; + +/// A list of servers hanging off a rail icon. `button` and `list`: the pointer is on the icon, on +/// the list. `shown`: the beat before it appears has passed. +#[derive(Clone, Debug)] +pub struct Flyout { + pub network: Network, + pub at: Bounds, + pub button: bool, + pub list: bool, + pub shown: bool, + pub keyboard: bool, + pub opener: Option, +} + /// One button of the rail. struct Place { mode: Mode, @@ -57,10 +74,15 @@ impl Shell { let phone = super::phone::active(); const KEYS: [&str; 9] = ["⌘1", "⌘2", "⌘3", "⌘4", "⌘5", "⌘6", "⌘7", "⌘8", "⌘9"]; let label = format!("{name}{}", waiting(attention, unread)); + let flies = !phone + && matches!(mode, Mode::Network(net @ (Network::Slack | Network::Mattermost | Network::Discord)) + if self.spaces.iter().filter(|s| s.key.network == net).count() >= if net == Network::Discord { 1 } else { 2 }); + let flyout_open = matches!(mode, Mode::Network(network) if self.layout_state.flyout.as_ref().is_some_and(|flyout| flyout.network == network)); div() .id(id) .role(gpui::Role::Button) .aria_label(label.clone()) + .aria_expanded(flyout_open) .when(lit, |row| row.aria_description("Current place")) .tab_index(0) .focus_visible(|style| style.shadow(theme::focus_ring_inset())) @@ -75,7 +97,19 @@ impl Shell { .when(lit, |button| button.bg(theme::selected())) .when(!lit && !phone, |button| button.hover(|style| style.bg(theme::hover()))) .when(phone, |button| button.active(|style| style.bg(theme::pressed()))) - .tooltip(tip(label, KEYS.get(place).copied())) + .when(!flies, |button| button.tooltip(tip(label, KEYS.get(place).copied()))) + .when_some(flies.then_some(mode.clone()), |button, mode| { + let Mode::Network(network) = mode else { return button }; + button + .track_focus(self.layout_state.rail_focus.get(&network).expect("eligible network has a rail focus handle")) + .on_hover(cx.listener(move |this, over: &bool, window, cx| this.rail_hover(network, *over, window, cx))) + .on_key_down(cx.listener(move |this, event: &gpui::KeyDownEvent, window, cx| { + if event.keystroke.key == "down" { + cx.stop_propagation(); + this.rail_keyboard_open(network, window, cx); + } + })) + }) .on_click(cx.listener(move |this, _, window, cx| this.visit(mode.clone(), window, cx))) .child(div().when(faint, |content| content.opacity(0.4)).child(content)) .children(rail_badge(attention, unread, mention, counted)) @@ -94,6 +128,211 @@ impl Shell { }) } + /// Open the flyout from the keyboard when its rail button is focused. Centering the anchor in + /// the rail keeps it visible even when the focused button is in a scrolled server list. + fn rail_keyboard_open(&mut self, network: Network, window: &mut Window, cx: &mut Context) { + let y = f32::from(window.viewport_size().height) / 2. - 22.; + let at = super::components::place::anchor(0., y.max(0.), super::layout::RAIL_WIDTH, 44.); + let opener = self.layout_state.rail_focus.get(&network).cloned(); + self.layout_state.flyout = Some(Flyout { network, at, button: false, list: false, shown: true, keyboard: true, opener }); + window.focus(&self.layout_state.flyout_focus, cx); + self.rail_flyout_lapse(network, window.window_handle(), Duration::from_millis(200), cx); + cx.notify(); + } + + /// The pointer came to rest on a network's rail icon, or left it: after a beat the list of + /// that network's servers or workspaces hangs off the icon, and goes when the pointer has + /// left both. + fn rail_hover(&mut self, network: Network, over: bool, window: &mut Window, cx: &mut Context) { + const WAIT: Duration = Duration::from_millis(250); + const GRACE: Duration = Duration::from_millis(200); + if over { + let y = f32::from(window.mouse_position().y) - 22.; + let at = super::components::place::anchor(0., y.max(0.), super::layout::RAIL_WIDTH, 44.); + let shown = self.layout_state.flyout.as_ref().is_some_and(|f| f.shown); + self.layout_state.flyout = Some(Flyout { network, at, button: true, list: false, shown, keyboard: false, opener: None }); + cx.spawn(async move |this, cx| { + cx.background_executor().timer(if shown { Duration::ZERO } else { WAIT }).await; + let _ = this.update(cx, |this, cx| { + if let Some(flyout) = this.layout_state.flyout.as_mut().filter(|f| f.network == network && f.button) { + flyout.shown = true; + cx.notify(); + } + }); + }) + .detach(); + } else { + if let Some(flyout) = self.layout_state.flyout.as_mut().filter(|f| f.network == network) { + flyout.button = false; + } + self.rail_flyout_lapse(network, window.window_handle(), GRACE, cx); + } + } + + /// After a grace, drop the flyout if the pointer is on neither the icon nor the list. + fn rail_flyout_lapse(&mut self, network: Network, window: gpui::AnyWindowHandle, grace: Duration, cx: &mut Context) { + cx.spawn(async move |this, cx| { + cx.background_executor().timer(grace).await; + let _ = cx.update_window(window, |_, window, cx| { + let _ = this.update(cx, |this, cx| { + if let Some(flyout) = this.layout_state.flyout.as_ref().filter(|f| f.network == network && !f.button && !f.list) { + if flyout.keyboard && this.layout_state.flyout_focus.contains_focused(window, cx) { + this.rail_flyout_lapse(network, window.window_handle(), Duration::from_millis(200), cx); + return; + } + this.layout_state.flyout = None; + cx.notify(); + } + }); + }); + }) + .detach(); + } + + /// The list that hangs off a rail icon: the network's servers (Discord, Mattermost) or + /// workspaces (Slack), the current one marked. Picking one goes there. + pub(super) fn rail_flyout_layer(&self, window: &mut Window, cx: &mut Context) -> Option { + let flyout = self.layout_state.flyout.as_ref().filter(|f| f.shown)?; + let network = flyout.network; + let here: Vec<&protocol::Space> = self.spaces.iter().filter(|s| s.key.network == network).collect(); + let single = network != Network::Discord; + if here.len() < if single { 2 } else { 1 } { + return None; + } + let current = match (&self.sidebar_state.mode, single) { + (Mode::Space(key), _) => Some(key.clone()), + (_, true) => self.workspace_space(network), + _ => None, + }; + let mut menu = super::components::menu().w(px(260.)).child(super::components::menu_label(format!("{} · {}", network.label(), if network == Network::Slack { "Workspaces" } else { "Servers" }))); + let more = here.len().saturating_sub(FLYOUT_SHOWN); + for (ix, space) in here.iter().take(FLYOUT_SHOWN).enumerate() { + let key = space.key.clone(); + let click_key = key.clone(); + let keyboard_key = key.clone(); + let icon = self.media_path(&space.key, space.icon.as_ref()); + menu = menu.child( + div() + .id(("rail-flyout-row", ix)) + .role(gpui::Role::MenuItem) + .aria_label(space.name.clone()) + .tab_index(0) + .focus_visible(|style| style.shadow(theme::focus_ring_inset())) + .h(px(28.)) + .px(px(8.)) + .mx(px(4.)) + .rounded(px(theme::R_CONTROL)) + .flex() + .items_center() + .gap(px(8.)) + .cursor_pointer() + .when(current.as_ref() == Some(&space.key), |row| row.bg(theme::selected())) + .hover(|style| style.bg(theme::hover())) + .on_click(cx.listener(move |this, _, window, cx| { + this.choose_rail_space(network, click_key.clone(), window, cx); + })) + .on_key_down(cx.listener(move |this, event: &gpui::KeyDownEvent, window, cx| { + if matches!(event.keystroke.key.as_str(), "enter" | "space") { + cx.stop_propagation(); + this.choose_rail_space(network, keyboard_key.clone(), window, cx); + } + })) + .child(Avatar::new(&space.key, &space.name, 20.).shape(Shape::Place).image_at(icon).build()) + .child(div().flex_1().min_w_0().truncate().type_ui().text_color(theme::text()).child(space.name.clone())) + .children(super::components::rollup_badge(space.attention, space.unread)), + ); + } + if more > 0 { + menu = menu.child( + div() + .id("rail-flyout-more") + .role(gpui::Role::MenuItem) + .aria_label(format!("Show all {}", network.label())) + .tab_index(0) + .focus_visible(|style| style.shadow(theme::focus_ring_inset())) + .h(px(28.)) + .px(px(8.)) + .mx(px(4.)) + .rounded(px(theme::R_CONTROL)) + .flex() + .items_center() + .gap(px(8.)) + .cursor_pointer() + .hover(|style| style.bg(theme::hover())) + .on_click(cx.listener(move |this, _, window, cx| { + this.show_all_rail_spaces(network, window, cx); + })) + .on_key_down(cx.listener(move |this, event: &gpui::KeyDownEvent, window, cx| { + if matches!(event.keystroke.key.as_str(), "enter" | "space") { + cx.stop_propagation(); + this.show_all_rail_spaces(network, window, cx); + } + })) + .child(div().size(px(20.)).flex_none().flex().items_center().justify_center().child(glyph("icons/ellipsis.svg", 14., theme::text_faint()))) + .child(div().flex_1().min_w_0().type_ui().text_color(theme::text_soft()).child(format!("{more} more"))) + .child(glyph("icons/chevron-right.svg", 12., theme::text_faint())), + ); + } + let menu = menu + .id("rail-flyout-list") + .role(gpui::Role::Menu) + .aria_label(format!("{} {}", network.label(), if network == Network::Slack { "workspaces" } else { "servers" })) + .tab_index(0) + .track_focus(&self.layout_state.flyout_focus) + .on_key_down(cx.listener(|this, event: &gpui::KeyDownEvent, window, cx| { + match event.keystroke.key.as_str() { + "down" => window.focus_next(cx), + "up" => window.focus_prev(cx), + "escape" => { + let opener = this.layout_state.flyout.take().and_then(|flyout| flyout.opener); + if let Some(opener) = opener.as_ref() { + window.focus(opener, cx); + } + cx.notify(); + } + _ => return, + } + cx.stop_propagation(); + cx.notify(); + })) + .on_hover(cx.listener(move |this, over: &bool, window, cx| { + if let Some(flyout) = this.layout_state.flyout.as_mut().filter(|flyout| flyout.network == network) { + flyout.list = *over; + } + if !*over { + this.rail_flyout_lapse(network, window.window_handle(), Duration::from_millis(200), cx); + } + })); + Some(super::components::placed("rail-flyout", super::components::Place::Beside(flyout.at), super::components::Layer::Popover, window, menu)) + } + + fn close_rail_flyout(&mut self, window: &mut Window, cx: &mut Context) { + let opener = self.layout_state.flyout.take().and_then(|flyout| flyout.keyboard.then_some(flyout.opener).flatten()); + if let Some(opener) = opener.as_ref() { + window.focus(opener, cx); + } + } + + fn choose_rail_space(&mut self, network: Network, key: protocol::Key, window: &mut Window, cx: &mut Context) { + self.close_rail_flyout(window, cx); + if network == Network::Discord { + self.visit(Mode::Space(key), window, cx); + } else { + match network { + Network::Slack => self.sidebar_state.slack = Some(key), + Network::Mattermost => self.sidebar_state.mattermost = Some(key), + _ => return, + } + self.visit(Mode::Network(network), window, cx); + self.show_mode(cx); + } + } + + fn show_all_rail_spaces(&mut self, network: Network, window: &mut Window, cx: &mut Context) { + self.close_rail_flyout(window, cx); + self.visit(Mode::Network(network), window, cx); + } + /// A rail click: the place opens in the sidebar. In a window too narrow to keep the /// sidebar in the row, it floats over the conversation. pub(super) fn visit(&mut self, mode: Mode, window: &mut Window, cx: &mut Context) { diff --git a/crates/tinyclient/src/gui/state.rs b/crates/tinyclient/src/gui/state.rs index c7436862..a1e32d0d 100644 --- a/crates/tinyclient/src/gui/state.rs +++ b/crates/tinyclient/src/gui/state.rs @@ -344,7 +344,13 @@ impl Shell { call_dock: Some(call::dock), search: Some(Self::open_message_search), }, - layout_state: layout::State::default(), + layout_state: layout::State::new( + cx.focus_handle().tab_index(0).tab_stop(true), + [Network::Slack, Network::Mattermost, Network::Discord] + .into_iter() + .map(|network| (network, cx.focus_handle().tab_index(0).tab_stop(true))) + .collect(), + ), sidebar_state: sidebar::State::new(cx), phone_state: super::phone::State::default(), conversation_state: conversation::State::default(), diff --git a/e2e/scenarios/rail-workspace-switcher/drive.linux.sh b/e2e/scenarios/rail-workspace-switcher/drive.linux.sh new file mode 100755 index 00000000..63dc78a7 --- /dev/null +++ b/e2e/scenarios/rail-workspace-switcher/drive.linux.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -euo pipefail +python3 "$(dirname "$0")/drive.py" linux diff --git a/e2e/scenarios/rail-workspace-switcher/drive.macos.sh b/e2e/scenarios/rail-workspace-switcher/drive.macos.sh new file mode 100755 index 00000000..ff2e3e54 --- /dev/null +++ b/e2e/scenarios/rail-workspace-switcher/drive.macos.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -euo pipefail +python3 "$(dirname "$0")/drive.py" macos diff --git a/e2e/scenarios/rail-workspace-switcher/drive.py b/e2e/scenarios/rail-workspace-switcher/drive.py new file mode 100644 index 00000000..721e1db4 --- /dev/null +++ b/e2e/scenarios/rail-workspace-switcher/drive.py @@ -0,0 +1,244 @@ +#!/usr/bin/env python3 +"""Use the real desktop app to open the Slack rail's workspace quick switcher. + +The live demo seeds two independent Slack workspaces. The driver hovers the Slack rail button, +checks that both workspaces appear, chooses Fernhill Collective, and verifies the new workspace +is open. The base build has no hover list, so the first check fails there. +""" + +import csv +import ctypes +from ctypes import wintypes +import io +import json +import os +from pathlib import Path +import subprocess +import sys +import tempfile +import time + +import pyautogui + +OUT = Path(os.environ["E2E_OUT"]) +T0 = float(os.environ.get("E2E_T0") or time.time()) +PLATFORM = sys.argv[1] + + +def record(name, ok, shot=None): + entry = {"t": round(time.time() - T0, 2), "step": name, "ok": bool(ok)} + if shot: + entry["shot"] = shot + with (OUT / "steps.jsonl").open("a", encoding="utf-8") as log: + log.write(json.dumps(entry) + "\n") + print(("[ok] " if ok else "[FAILED] ") + name, flush=True) + if not ok: + raise RuntimeError(name) + + +def words(shot): + image = pyautogui.screenshot() + image.save(shot) + width, height = pyautogui.size() + scale_x, scale_y = width / image.width, height / image.height + result = [] + proc = subprocess.run( + ["tesseract", str(shot), "stdout", "tsv"], capture_output=True, check=True, + text=True, encoding="utf-8", timeout=20, + ) + for row in csv.DictReader(io.StringIO(proc.stdout), delimiter="\t"): + text = row["text"].casefold().strip(".,·•:;#?!") + if text: + x = (int(row["left"]) + int(row["width"]) / 2) * scale_x + y = (int(row["top"]) + int(row["height"]) / 2) * scale_y + result.append((text, round(x), round(y))) + return result + + +def contains(found, phrase): + text = " ".join(word for word, _, _ in found) + return phrase.casefold() in text + + +def wait_for(phrase, name, timeout=15): + shot = OUT / f"{name}.png" + deadline = time.monotonic() + timeout + found = [] + while time.monotonic() < deadline: + found = words(shot) + if contains(found, phrase): + record(name, True, shot.name) + return found + time.sleep(0.4) + record(name, False, shot.name) + raise RuntimeError(f"expected {phrase!r}") + + +def stop(process): + if process is None or process.poll() is not None: + return + process.terminate() + try: + process.wait(timeout=5) + except subprocess.TimeoutExpired: + process.kill() + process.wait(timeout=5) + + +def window_bounds(pid): + """Return the app window bounds, even when it is not maximized.""" + if PLATFORM == "macos": + helper = os.environ["E2E_HELPER"] + log = OUT / "window-bounds.txt" + with log.open("w", encoding="utf-8") as output: + subprocess.run( + ["open", "-W", "-n", "--stdout", str(log), "--stderr", str(log), + "-a", helper, "--args", "windows", "--pid", str(pid)], + check=True, timeout=30, + ) + lines = log.read_text(encoding="utf-8").splitlines() + info = next((json.loads(line) for line in lines if line.startswith("{")), None) + if info: + return tuple(int(info[key]) for key in ("x", "y", "w", "h")) + raise RuntimeError("could not read the app window position from the lab helper") + if PLATFORM == "windows": + user32 = ctypes.windll.user32 + rect_type = wintypes.RECT + found = [] + + @ctypes.WINFUNCTYPE(ctypes.c_bool, wintypes.HWND, wintypes.LPARAM) + def visit(hwnd, _): + owner = wintypes.DWORD() + user32.GetWindowThreadProcessId(hwnd, ctypes.byref(owner)) + if owner.value == pid and user32.IsWindowVisible(hwnd): + rect = rect_type() + if user32.GetWindowRect(hwnd, ctypes.byref(rect)): + found.append((rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top)) + return True + + user32.EnumWindows(visit, 0) + if found: + return found[0] + raise RuntimeError("could not read the app window position") + + ids = subprocess.run( + ["xdotool", "search", "--onlyvisible", "--pid", str(pid)], + capture_output=True, text=True, check=True, timeout=10, + ).stdout.splitlines() + if not ids: + raise RuntimeError("could not find the app window") + geometry = subprocess.run( + ["xdotool", "getwindowgeometry", "--shell", ids[0]], + capture_output=True, text=True, check=True, timeout=10, + ).stdout + values = {} + for line in geometry.splitlines(): + if "=" in line: + key, value = line.split("=", 1) + if key in {"X", "Y", "WIDTH", "HEIGHT"}: + values[key] = int(value) + if not {"X", "Y", "WIDTH", "HEIGHT"} <= values.keys(): + raise RuntimeError("could not read the app window position") + return values["X"], values["Y"], values["WIDTH"], values["HEIGHT"] + + +def run(data): + app_dir = Path(os.environ["E2E_APP_DIR"]).resolve() + if PLATFORM == "macos": + app_dir /= "Contents" / "MacOS" + suffix = ".exe" if PLATFORM == "windows" else "" + env = dict(os.environ, TINYCLIENT_DIR=str(data)) + daemon = app = None + with (OUT / "app.log").open("wb") as log: + try: + daemon = subprocess.Popen( + [str(app_dir / ("chatd" + suffix)), "--seed-demo=live"], env=env, + stdout=log, stderr=log, + ) + ready = False + deadline = time.monotonic() + 25 + while time.monotonic() < deadline: + if daemon.poll() is not None: + break + try: + ready = subprocess.run( + [str(app_dir / ("tinyclient" + suffix)), "--text"], env=env, + capture_output=True, timeout=5, + ).returncode == 0 + except subprocess.SubprocessError: + ready = False + if ready: + break + time.sleep(0.25) + record("demo service starts", ready) + if not ready: + raise RuntimeError("the demo service did not start") + app = subprocess.Popen([str(app_dir / ("tinyclient" + suffix))], env=env, stdout=log, stderr=log) + (OUT / "app.pid").write_text(str(app.pid), encoding="utf-8") + time.sleep(5) + + # Give the shared rail a stable screen origin before scanning its network buttons. + if PLATFORM == "windows": + pyautogui.hotkey("win", "up") + elif PLATFORM == "macos": + pyautogui.hotkey("ctrl", "command", "f") + else: + pyautogui.hotkey("alt", "f10") + time.sleep(2) + + _, screen_height = pyautogui.size() + left, top, _, window_height = window_bounds(app.pid) + rail_x = left + 36 + rail_top = top + 48 + rail_bottom = min(top + window_height - 80, top + 680, screen_height - 40) + # The shared desktop rail is a 72-point strip at the left edge of the window. Scan + # its account slots until the Slack flyout's two fixture workspaces are visible. + point = None + button_point = None + deadline = time.monotonic() + 20 + while time.monotonic() < deadline and point is None: + for y in range(rail_top, rail_bottom, 20): + pyautogui.moveTo(rail_x, y, duration=0.05) + time.sleep(0.35) + found = words(OUT / "probe.png") + if contains(found, "Harbor Labs") and contains(found, "Fernhill Collective"): + point = next(((x, yy) for text, x, yy in found if text == "Fernhill"), None) + if point: + button_point = (rail_x, y) + break + record("the Slack rail icon opens both workspace choices", point is not None, "probe.png") + if not point: + raise RuntimeError("the Slack workspace flyout did not appear") + + pyautogui.click(*point) + wait_for("volunteers", "selected-workspace") + time.sleep(1) + + # Keyboard path: focus the Slack rail button, open its menu with Down, then select + # Harbor Labs with Down and Enter. This keeps switching usable without a pointer. + pyautogui.click(*button_point) + pyautogui.press("down") + menu_words = wait_for("Workspaces", "keyboard-menu") + harbor_y = next(y for text, _, y in menu_words if text == "harbor") + fernhill_y = next(y for text, _, y in menu_words if text == "fernhill") + pyautogui.press("down", presses=1 if harbor_y < fernhill_y else 2) + pyautogui.press("enter") + wait_for("announcements", "keyboard-selected-workspace") + finally: + stop(app) + stop(daemon) + + +def main(): + OUT.mkdir(parents=True, exist_ok=True) + (OUT / "steps.jsonl").write_text("", encoding="utf-8") + with tempfile.TemporaryDirectory(prefix="rail-workspace-switcher-") as data: + run(Path(data)) + + +if __name__ == "__main__": + try: + main() + except (OSError, RuntimeError, subprocess.SubprocessError, ValueError) as error: + print(error, file=sys.stderr, flush=True) + raise SystemExit(1) diff --git a/e2e/scenarios/rail-workspace-switcher/drive.windows.ps1 b/e2e/scenarios/rail-workspace-switcher/drive.windows.ps1 new file mode 100644 index 00000000..75e56433 --- /dev/null +++ b/e2e/scenarios/rail-workspace-switcher/drive.windows.ps1 @@ -0,0 +1,3 @@ +$ErrorActionPreference = 'Stop' +python "$PSScriptRoot\drive.py" windows +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } diff --git a/e2e/scenarios/rail-workspace-switcher/scenario.json b/e2e/scenarios/rail-workspace-switcher/scenario.json new file mode 100644 index 00000000..6f6c9132 --- /dev/null +++ b/e2e/scenarios/rail-workspace-switcher/scenario.json @@ -0,0 +1,12 @@ +{ + "id": "rail-workspace-switcher", + "title": "Hover a network rail icon to switch workspaces or servers", + "platforms": ["windows", "macos", "linux"], + "not_applicable": { + "android": "Phone layouts have no hover input; the rail quick switcher is desktop-only.", + "ios": "Phone layouts have no hover input; the rail quick switcher is desktop-only." + }, + "needs": [], + "release": false, + "max_still_seconds": 60 +}