Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1f466e988 | ||
|
|
2d99a79e69 | ||
|
|
ca778e2382 | ||
|
|
414353a5bd | ||
|
|
3080dc6100 | ||
|
|
1bb9f8d07c | ||
|
|
a539baec37 | ||
|
|
7dff6e1852 | ||
|
|
fc7fa85850 | ||
|
|
7e5a2cf051 | ||
|
|
c4e08a9676 | ||
|
|
2c0b76c9e6 | ||
|
|
4d1f51c607 | ||
|
|
2215239ecb | ||
|
|
43eeb080be | ||
|
|
03a19d4284 | ||
|
|
3aeee3fcfc | ||
|
|
471003a8c5 | ||
|
|
c109773d2a | ||
|
|
ed6b67faed | ||
|
|
ff7bfcaf1d | ||
|
|
91330a82d0 | ||
|
|
ce75c58a34 | ||
|
|
03b9070b9b | ||
|
|
f6f610516c | ||
|
|
cf49a91b66 | ||
|
|
e0a97e32f7 | ||
|
|
dd0eeeae29 | ||
|
|
4bb22df1fb | ||
|
|
aee087597a | ||
|
|
993a321dd0 | ||
|
|
381e66aca5 | ||
|
|
d7a05eea21 | ||
|
|
c61ddbff3d | ||
|
|
0c20d72cbf | ||
|
|
021f334c0c | ||
|
|
c61264cdf9 | ||
|
|
e4d6f50a0b | ||
|
|
0435e0330e | ||
|
|
13b5f9e575 | ||
|
|
dde4b28abd | ||
|
|
3817724637 | ||
|
|
26b5856ce0 | ||
|
|
6aeb733f20 | ||
|
|
29fcec6ab8 | ||
|
|
5d6c76cdda | ||
|
|
844c2f3145 |
No files matched your search
@@ -102,24 +102,44 @@ jobs:
|
||||
name: Rust (${{ matrix.os }})
|
||||
needs: changes
|
||||
if: needs.changes.outputs.rust == 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-22.04, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
# Self-hosted runners (scripts/selfhost-runner) only for trusted events, and only while the
|
||||
# SELFHOSTED_RUNNERS repository variable is 'true': runs-on cannot fall back when none is online.
|
||||
runs-on: ${{ matrix.os == 'ubuntu-22.04' && vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: pnpm/action-setup@v5
|
||||
with: { version: 11 }
|
||||
- uses: actions/setup-node@v5
|
||||
with: { node-version: 22, cache: pnpm }
|
||||
with:
|
||||
node-version: 22
|
||||
cache: ${{ runner.environment != 'self-hosted' && 'pnpm' || '' }}
|
||||
package-manager-cache: ${{ runner.environment != 'self-hosted' }}
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with: { components: "clippy, rustfmt" }
|
||||
# Only main saves the cache (saving takes minutes on Windows); PRs restore main's.
|
||||
# Self-hosted runners keep persistent local Cargo caches; GitHub-hosted runners use Actions cache
|
||||
# (only main saves it because saving takes minutes on Windows; PRs restore main's).
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
if: runner.environment != 'self-hosted'
|
||||
with:
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
# The persistent target dir makes incremental builds pay off; cap its size so it can't fill the disk.
|
||||
- name: Persistent Cargo target dir
|
||||
if: runner.environment == 'self-hosted'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "CARGO_INCREMENTAL=1" >> "$GITHUB_ENV"
|
||||
size=$(du -sm "$CARGO_TARGET_DIR" 2>/dev/null | cut -f1 || true)
|
||||
if [ "${size:-0}" -gt 40000 ]; then
|
||||
echo "$CARGO_TARGET_DIR is ${size} MB; clearing it"
|
||||
rm -rf "$CARGO_TARGET_DIR"
|
||||
fi
|
||||
- uses: taiki-e/install-action@nextest
|
||||
- name: Linux deps
|
||||
if: runner.os == 'Linux'
|
||||
|
||||
@@ -44,3 +44,4 @@ CLAUDE.local.md
|
||||
|
||||
# Local reference screenshots
|
||||
pycharm-screenshots/
|
||||
dist-phone
|
||||
@@ -7,6 +7,7 @@
|
||||
"sortPackageJson": false,
|
||||
"ignorePatterns": [
|
||||
"dist",
|
||||
"mobile/gen",
|
||||
"target",
|
||||
"src/bindings.ts",
|
||||
"docs/snippets/plugin-catalog.jsx",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[workspace]
|
||||
resolver = "3"
|
||||
members = ["crates/*", "src-tauri"]
|
||||
members = ["crates/*", "src-tauri", "mobile"]
|
||||
# Plugins and the guest SDK build for wasm32-wasip2 in their own workspaces.
|
||||
exclude = ["sdk", "plugins"]
|
||||
|
||||
@@ -21,6 +21,7 @@ ide-index = { path = "crates/ide-index" }
|
||||
ide-syntax = { path = "crates/ide-syntax" }
|
||||
ide-search = { path = "crates/ide-search" }
|
||||
ide-jsonrpc = { path = "crates/ide-jsonrpc" }
|
||||
ide-pair = { path = "crates/ide-pair" }
|
||||
ide-lsp = { path = "crates/ide-lsp" }
|
||||
ide-dap = { path = "crates/ide-dap" }
|
||||
ide-vcs = { path = "crates/ide-vcs" }
|
||||
|
||||
@@ -38,6 +38,8 @@ pub enum IdeEvent {
|
||||
WindowGroupsChanged,
|
||||
/// A project was loaded or unloaded for the MCP server without a window of its own.
|
||||
McpBackgroundProjectsChanged,
|
||||
/// A phone paired with this desktop, connected, disconnected or was removed.
|
||||
MobileDevicesChanged,
|
||||
/// A window entered or left full screen, itself or as a member of a full-screen window group.
|
||||
WindowFullscreenChanged,
|
||||
/// This remote window's connection to its host ended on its own (network loss, the host or
|
||||
|
||||
@@ -78,6 +78,7 @@ zip.workspace = true
|
||||
quick-xml = "0.42"
|
||||
|
||||
[dev-dependencies]
|
||||
ide-pair = { workspace = true, features = ["testing"] }
|
||||
ide-ssh = { workspace = true, features = ["testing"] }
|
||||
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "io-util", "test-util"] }
|
||||
criterion = { version = "0.5", default-features = false }
|
||||
|
||||
@@ -255,6 +255,11 @@ impl Host {
|
||||
}
|
||||
|
||||
/// The project of `window` (or of the window owning it).
|
||||
/// The windows that have a project open.
|
||||
pub fn windows(&self) -> Vec<String> {
|
||||
self.projects.read().keys().cloned().collect()
|
||||
}
|
||||
|
||||
pub fn project(&self, window: &str) -> IdeResult<Arc<Project>> {
|
||||
self.projects
|
||||
.read()
|
||||
|
||||
@@ -129,6 +129,23 @@ impl Dispatcher {
|
||||
self
|
||||
}
|
||||
|
||||
/// Also runs `then` (with the host and the call's window) after each successful call of
|
||||
/// `name`, when it is registered.
|
||||
pub fn after(&mut self, name: &str, then: impl Fn(&Arc<Host>, &str) + Send + Sync + 'static) -> &mut Self {
|
||||
let Some((_, slot)) = self.handlers.get_mut(name) else { return self };
|
||||
let (inner, then) = (slot.clone(), Arc::new(then));
|
||||
*slot = Arc::new(move |call: Call| {
|
||||
let (host, window) = (call.host.clone(), call.window.clone());
|
||||
let (fut, then) = (inner(call), then.clone());
|
||||
Box::pin(async move {
|
||||
let value = fut.await?;
|
||||
then(&host, &window);
|
||||
Ok(value)
|
||||
})
|
||||
});
|
||||
self
|
||||
}
|
||||
|
||||
pub fn commands(&self) -> Vec<&'static str> {
|
||||
let mut out: Vec<_> = self.handlers.keys().copied().collect();
|
||||
out.sort_unstable();
|
||||
@@ -155,13 +172,32 @@ where
|
||||
R: tokio::io::AsyncRead + Unpin + Send + 'static,
|
||||
W: tokio::io::AsyncWrite + Unpin + Send + 'static,
|
||||
{
|
||||
let handler = Arc::new(ServerHandler { host: host.clone(), dispatcher, peer: peer.clone() });
|
||||
serve_scoped(host, dispatcher, peer, reader, writer, None).await;
|
||||
}
|
||||
|
||||
/// Like [`serve`], for a client that shares `host` with others (a phone paired with the
|
||||
/// desktop): it may only name windows starting with `scope`, and on disconnect only
|
||||
/// those windows' reports are forgotten. Without a scope the client owns the host.
|
||||
pub async fn serve_scoped<R, W>(
|
||||
host: Arc<Host>,
|
||||
dispatcher: Dispatcher,
|
||||
peer: Arc<OnceLock<Peer>>,
|
||||
reader: R,
|
||||
writer: W,
|
||||
scope: Option<String>,
|
||||
) where
|
||||
R: tokio::io::AsyncRead + Unpin + Send + 'static,
|
||||
W: tokio::io::AsyncWrite + Unpin + Send + 'static,
|
||||
{
|
||||
let handler = Arc::new(ServerHandler { host: host.clone(), dispatcher, peer: peer.clone(), scope: scope.clone() });
|
||||
let p = Peer::connect(reader, writer, handler);
|
||||
let _ = peer.set(p.clone());
|
||||
p.closed().await;
|
||||
// Reports belong to the disconnected desktop, even while the host shuts down.
|
||||
// Reports belong to the disconnected client, even while the host shuts down.
|
||||
for window in host.projects.read().keys() {
|
||||
host.mcp_reports.forget_window(window);
|
||||
if scope.as_deref().is_none_or(|s| window.starts_with(s)) {
|
||||
host.mcp_reports.forget_window(window);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,6 +214,7 @@ pub fn client_accepts(event: &IdeEvent, trusted: bool) -> bool {
|
||||
match event {
|
||||
IdeEvent::WindowGroupsChanged
|
||||
| IdeEvent::McpBackgroundProjectsChanged
|
||||
| IdeEvent::MobileDevicesChanged
|
||||
| IdeEvent::WindowFullscreenChanged
|
||||
| IdeEvent::RemoteConnectionLost { .. }
|
||||
| IdeEvent::UpdateStatusChanged { .. }
|
||||
@@ -233,6 +270,8 @@ struct ServerHandler {
|
||||
host: Arc<Host>,
|
||||
dispatcher: Dispatcher,
|
||||
peer: Arc<OnceLock<Peer>>,
|
||||
/// The prefix of the windows this client may name (see [`serve_scoped`]).
|
||||
scope: Option<String>,
|
||||
}
|
||||
|
||||
pub fn server_info() -> ServerInfo {
|
||||
@@ -256,6 +295,12 @@ impl Handler for ServerHandler {
|
||||
"invoke" => {
|
||||
let call: Invoke =
|
||||
serde_json::from_value(params).map_err(|e| (codes::INVALID_PARAMS, e.to_string()))?;
|
||||
if self.scope.as_deref().is_some_and(|s| !call.window.starts_with(s)) {
|
||||
return Err(error_reply(IdeError::new(
|
||||
ide_core::error::ErrorKind::PermissionDenied,
|
||||
format!("window {} belongs to another client", call.window),
|
||||
)));
|
||||
}
|
||||
let Some((trust, handler)) = self.dispatcher.handlers.get(call.cmd.as_str()).cloned() else {
|
||||
return Err((codes::METHOD_NOT_FOUND, format!("command {} is not available remotely", call.cmd)));
|
||||
};
|
||||
@@ -326,6 +371,7 @@ mod tests {
|
||||
IdeEvent::WindowGroupsChanged,
|
||||
IdeEvent::WindowFullscreenChanged,
|
||||
IdeEvent::McpBackgroundProjectsChanged,
|
||||
IdeEvent::MobileDevicesChanged,
|
||||
] {
|
||||
assert!(!client_accepts(&event, true), "{event:?}");
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ async fn external_maven_link_persists_reloads_and_unlink_keeps_files() {
|
||||
assert_eq!(b.pom, canonical);
|
||||
assert_eq!(dunce::canonicalize(root.join(&b.dir)).unwrap(), sibling);
|
||||
assert_eq!(host.project("main").unwrap().content_roots(), vec![sibling.clone()]);
|
||||
assert_eq!(host.project("main").unwrap().lsp.jdtls_import_roots(), vec![sibling.clone()]);
|
||||
assert_eq!(import_roots(&host, |roots| !roots.is_empty()).await, vec![sibling.clone()]);
|
||||
|
||||
let reloaded = ops::build::build_model(&host, "main").await.unwrap();
|
||||
assert_eq!(
|
||||
@@ -63,13 +63,26 @@ async fn external_maven_link_persists_reloads_and_unlink_keeps_files() {
|
||||
let gone = ops::build::build_model(&host, "main").await.unwrap();
|
||||
assert!(gone.maven.unwrap().projects.iter().all(|p| p.artifact_id != "b"));
|
||||
assert!(host.project("main").unwrap().content_roots().is_empty());
|
||||
assert!(host.project("main").unwrap().lsp.jdtls_import_roots().is_empty());
|
||||
assert!(import_roots(&host, |roots| roots.is_empty()).await.is_empty());
|
||||
assert_eq!(saved(), Vec::<String>::new());
|
||||
assert_eq!(std::fs::read_to_string(root.join("pom.xml")).unwrap(), a_pom);
|
||||
assert_eq!(std::fs::read_to_string(sibling.join("pom.xml")).unwrap(), b_pom);
|
||||
host.shutdown().await;
|
||||
}
|
||||
|
||||
/// The language server's Maven import roots once `ready` holds: a settings change refreshes them in
|
||||
/// the background.
|
||||
async fn import_roots(host: &Host, ready: impl Fn(&[std::path::PathBuf]) -> bool) -> Vec<std::path::PathBuf> {
|
||||
for _ in 0..200 {
|
||||
let roots = host.project("main").unwrap().lsp.jdtls_import_roots();
|
||||
if ready(&roots) {
|
||||
return roots;
|
||||
}
|
||||
tokio::time::sleep(std::time::Duration::from_millis(25)).await;
|
||||
}
|
||||
host.project("main").unwrap().lsp.jdtls_import_roots()
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn reactor_module_beside_a_trusted_project_is_a_content_root_until_removed() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
//! A phone paired over iroh drives the desktop's backend: it pairs with a ticket's code,
|
||||
//! opens a project in a window of its own and gets that window's events back, the way
|
||||
//! `src-tauri/src/mobile.rs` wires `ide_pair` to `rpc::serve_scoped`.
|
||||
|
||||
use ide_host::rpc::{self, Dispatcher, EventMessage, Invoke};
|
||||
use ide_host::{Host, HostConfig};
|
||||
use ide_jsonrpc::{Handler, Peer};
|
||||
use ide_pair::{DeviceStore, Listener, SessionHandler};
|
||||
use parking_lot::Mutex;
|
||||
use serde_json::{Value, json};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, OnceLock};
|
||||
use std::time::Duration;
|
||||
|
||||
#[derive(Default)]
|
||||
struct Phone {
|
||||
events: Mutex<Vec<EventMessage>>,
|
||||
}
|
||||
|
||||
impl Handler for Phone {
|
||||
fn on_notification(&self, method: &str, params: Value) {
|
||||
if method == "event" {
|
||||
self.events.lock().push(serde_json::from_value(params).unwrap());
|
||||
}
|
||||
}
|
||||
fn on_request(&self, method: &str, _: Value) -> Result<Value, (i64, String)> {
|
||||
Err((ide_jsonrpc::codes::METHOD_NOT_FOUND, method.to_owned()))
|
||||
}
|
||||
}
|
||||
|
||||
type Peers = Arc<Mutex<HashMap<String, Arc<OnceLock<Peer>>>>>;
|
||||
|
||||
fn scope_for(id: &str) -> String {
|
||||
format!("mobile-{}-", &id[..12])
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
|
||||
async fn a_paired_phone_opens_a_project_on_the_desktop_and_gets_its_events() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let project = tmp.path().join("demo");
|
||||
std::fs::create_dir_all(&project).unwrap();
|
||||
let base = tmp.path().join("desktop");
|
||||
|
||||
// The desktop: one host, its phones' windows routed to their connections.
|
||||
let peers: Peers = Peers::default();
|
||||
let sink_peers = peers.clone();
|
||||
let host = Arc::new(Host::new(HostConfig {
|
||||
config_dir: base.join("config"),
|
||||
data_dir: base.join("data"),
|
||||
local_data_dir: base.join("data"),
|
||||
languages: Arc::new(ide_language::LanguageRegistry::load(None).unwrap()),
|
||||
syntax: Arc::default(),
|
||||
sink_for: Box::new(move |w| {
|
||||
let scope = w.splitn(3, '-').take(2).collect::<Vec<_>>().join("-") + "-";
|
||||
let peer = sink_peers.lock().entry(scope).or_default().clone();
|
||||
rpc::event_sink(peer, Some(w.to_owned()))
|
||||
}),
|
||||
owner: |w| w,
|
||||
runtime: tokio::runtime::Handle::current(),
|
||||
project_environment: false,
|
||||
}));
|
||||
let serving_host = host.clone();
|
||||
let serving_peers = peers.clone();
|
||||
let handler: SessionHandler = Arc::new(move |session| {
|
||||
let host = serving_host.clone();
|
||||
let peers = serving_peers.clone();
|
||||
Box::pin(async move {
|
||||
let scope = scope_for(&session.device.id);
|
||||
let peer = Arc::new(OnceLock::new());
|
||||
peers.lock().insert(scope.clone(), peer.clone());
|
||||
rpc::serve_scoped(host, Dispatcher::standard(), peer, session.recv, session.send, Some(scope)).await;
|
||||
})
|
||||
});
|
||||
let listener = Listener::start(
|
||||
ide_pair::bind_local(true).await,
|
||||
DeviceStore::load(base.join("config").join("mobile-devices.json")),
|
||||
"Workstation".into(),
|
||||
handler,
|
||||
Arc::new(|| {}),
|
||||
);
|
||||
let ticket = listener.ticket(Duration::from_secs(60)).await.0;
|
||||
|
||||
// The phone scans the ticket.
|
||||
let scanned = ide_pair::Ticket::decode(&ticket.encode()).unwrap();
|
||||
let phone = ide_pair::bind_local(false).await;
|
||||
let (_conn, welcome, send, recv) =
|
||||
ide_pair::connect(&phone, scanned.addr, "Pixel", Some(&scanned.code)).await.unwrap();
|
||||
assert_eq!(welcome.desktop, "Workstation");
|
||||
let client = Arc::new(Phone::default());
|
||||
let peer = Peer::connect(recv, send, client.clone());
|
||||
let window = format!("{}1", scope_for(&phone.id().to_string()));
|
||||
let invoke = |cmd: &str, args: Value| Invoke { window: window.clone(), cmd: cmd.into(), args };
|
||||
|
||||
let opened: Value = peer.request("invoke", invoke("open_project", json!({ "path": project })), None).await.unwrap();
|
||||
assert_eq!(opened["name"], "demo");
|
||||
|
||||
let file = project.join("notes.txt");
|
||||
std::fs::write(&file, "old").unwrap();
|
||||
let edit = json!({ "files": [{ "kind": "edit", "path": file, "edits": [{
|
||||
"range": { "start": { "line": 0, "col": 0 }, "end": { "line": 0, "col": 3 } },
|
||||
"new_text": "new"
|
||||
}] }] });
|
||||
let prepared: Value =
|
||||
peer.request("invoke", invoke("prepare_workspace_edit", json!({ "edit": edit })), None).await.unwrap();
|
||||
let _: Value =
|
||||
peer.request("invoke", invoke("apply_workspace_edit", json!({ "edit": prepared })), None).await.unwrap();
|
||||
assert_eq!(std::fs::read_to_string(&file).unwrap(), "new");
|
||||
for _ in 0..500 {
|
||||
let got = client.events.lock().iter().any(|e| {
|
||||
e.window.as_deref() == Some(window.as_str())
|
||||
&& matches!(e.event, ide_core::IdeEvent::WorkspaceEditApplied { .. })
|
||||
});
|
||||
if got {
|
||||
return;
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(10)).await;
|
||||
}
|
||||
panic!("the phone got no event for its window");
|
||||
}
|
||||
@@ -687,3 +687,42 @@ async fn serves_builtin_mcp_over_remote_dispatch_and_routes_ui_requests() {
|
||||
invoke(&peer, "close_project", json!({})).await.unwrap();
|
||||
peer.kill();
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn a_scoped_client_only_reaches_its_own_windows() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let project = tmp.path().join("demo");
|
||||
std::fs::create_dir_all(&project).unwrap();
|
||||
let base = tmp.path().join("host");
|
||||
let peer_slot = Arc::new(OnceLock::new());
|
||||
let sink_peer = peer_slot.clone();
|
||||
let host = Arc::new(Host::new(HostConfig {
|
||||
config_dir: base.join("config"),
|
||||
data_dir: base.join("data"),
|
||||
local_data_dir: base.join("data"),
|
||||
languages: Arc::new(ide_language::LanguageRegistry::load(None).unwrap()),
|
||||
syntax: Arc::default(),
|
||||
sink_for: Box::new(move |w| rpc::event_sink(sink_peer.clone(), Some(w.to_owned()))),
|
||||
owner: |w| w,
|
||||
runtime: tokio::runtime::Handle::current(),
|
||||
project_environment: false,
|
||||
}));
|
||||
// A window of the desktop itself.
|
||||
host.open_project("main", &project).unwrap();
|
||||
let (client_io, server_io) = tokio::io::duplex(1 << 16);
|
||||
let (sr, sw) = tokio::io::split(server_io);
|
||||
let scope = Some("mobile-abc-".to_owned());
|
||||
tokio::spawn(rpc::serve_scoped(host.clone(), Dispatcher::standard(), peer_slot, sr, sw, scope));
|
||||
let (cr, cw) = tokio::io::split(client_io);
|
||||
let peer = Peer::connect(cr, cw, Arc::new(Client::default()));
|
||||
|
||||
let call = |window: &str, cmd: &str, args: Value| Invoke { window: window.into(), cmd: cmd.into(), args };
|
||||
let denied = peer.request::<_, Value>("invoke", call("main", "index_status", json!({})), None).await;
|
||||
let denied = rpc::error_from_reply(denied.unwrap_err());
|
||||
assert_eq!(denied.kind, ide_core::error::ErrorKind::PermissionDenied, "{denied:?}");
|
||||
|
||||
let own = call("mobile-abc-1", "open_project", json!({ "path": project }));
|
||||
let opened: Value = peer.request("invoke", own, None).await.unwrap();
|
||||
assert_eq!(opened["name"], "demo");
|
||||
assert!(host.project("main").is_ok(), "the desktop's window is untouched");
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
[package]
|
||||
name = "ide-pair"
|
||||
description = "Pairing phones with the desktop over iroh: the endpoint, pairing tickets, paired devices and the connection handshake"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
iroh = "1.3"
|
||||
base64.workspace = true
|
||||
getrandom = "0.3"
|
||||
parking_lot.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
thiserror.workspace = true
|
||||
tokio.workspace = true
|
||||
tracing.workspace = true
|
||||
|
||||
[features]
|
||||
# `bind_local`: endpoints on the loopback interface without relays, for tests.
|
||||
testing = []
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile.workspace = true
|
||||
tokio = { workspace = true, features = ["signal"] }
|
||||
@@ -0,0 +1,38 @@
|
||||
//! A stand-in phone for trying pairing without the mobile app:
|
||||
//! `cargo run -p ide-pair --example phone -- '<pairing code>'` pairs with the desktop that
|
||||
//! showed the code and stays connected; run it again without the code to reconnect.
|
||||
//! The phone's key is kept in the system temporary directory.
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let key_file = std::env::temp_dir().join("openidea-example-phone.key");
|
||||
let addr_file = std::env::temp_dir().join("openidea-example-phone.desktop");
|
||||
let key = ide_pair::load_or_create_key(&key_file).expect("phone key");
|
||||
let (addr, code) = match std::env::args().nth(1) {
|
||||
Some(text) => {
|
||||
let ticket = ide_pair::Ticket::decode(&text).expect("an openidea-pair: code");
|
||||
std::fs::write(&addr_file, serde_json::to_vec(&ticket.addr).unwrap()).unwrap();
|
||||
(ticket.addr, Some(ticket.code))
|
||||
}
|
||||
None => {
|
||||
let saved = std::fs::read(&addr_file).expect("pair first: pass the pairing code");
|
||||
(serde_json::from_slice(&saved).unwrap(), None)
|
||||
}
|
||||
};
|
||||
let endpoint = iroh::Endpoint::builder(iroh::endpoint::presets::N0).secret_key(key).bind().await.expect("endpoint");
|
||||
println!("phone {}", endpoint.id());
|
||||
match ide_pair::connect(&endpoint, addr, "Example Phone", code.as_deref()).await {
|
||||
Ok((connection, welcome, _send, _recv)) => {
|
||||
println!("connected to {} — press Ctrl+C to disconnect", welcome.desktop);
|
||||
tokio::select! {
|
||||
_ = connection.closed() => println!("the desktop closed the connection"),
|
||||
_ = tokio::signal::ctrl_c() => {}
|
||||
}
|
||||
}
|
||||
Err(e) => eprintln!("{e}"),
|
||||
}
|
||||
endpoint.close().await;
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
}
|
||||
@@ -0,0 +1,467 @@
|
||||
//! Pairing phones with the desktop over iroh.
|
||||
//!
|
||||
//! The desktop runs an iroh [`Endpoint`] under a persistent key, so its endpoint id
|
||||
//! stays the same across restarts. Pairing shows a [`Ticket`] (a QR code): the
|
||||
//! endpoint's address plus a one-time code that expires. A phone that connects
|
||||
//! with a valid code is remembered by its own endpoint id ([`DeviceStore`]) and
|
||||
//! reconnects later without one. iroh authenticates both ends by their keys and
|
||||
//! encrypts the connection, through a relay when no direct path exists.
|
||||
//!
|
||||
//! A connection opens one bidirectional stream. The phone sends a [`Hello`] line
|
||||
//! (JSON, newline-terminated), the desktop answers a [`Welcome`] line, and then
|
||||
//! the stream carries the remote development protocol (`ide_host::rpc`) like an
|
||||
//! SSH channel to `openidea-server` does. [`Listener`] hands accepted streams to
|
||||
//! the desktop as [`Session`]s; [`connect`] is the phone's side.
|
||||
|
||||
use base64::Engine as _;
|
||||
use base64::engine::general_purpose::URL_SAFE_NO_PAD;
|
||||
use iroh::endpoint::{Connection, RecvStream, SendStream};
|
||||
use iroh::{Endpoint, EndpointAddr, SecretKey};
|
||||
use parking_lot::Mutex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
use std::future::Future;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
|
||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||
|
||||
/// The protocol both ends announce in the QUIC handshake.
|
||||
pub const ALPN: &[u8] = b"openidea/mobile/1";
|
||||
/// What a pairing QR code holds before the encoded ticket.
|
||||
pub const TICKET_PREFIX: &str = "openidea-pair:";
|
||||
const PROTOCOL: u32 = 1;
|
||||
/// Longest handshake line either side accepts.
|
||||
const LINE_MAX: usize = 4096;
|
||||
/// How long a phone has to send its hello after connecting.
|
||||
const HELLO_TIMEOUT: Duration = Duration::from_secs(10);
|
||||
/// How long a ticket waits for the relay before giving direct addresses only.
|
||||
const ONLINE_TIMEOUT: Duration = Duration::from_secs(5);
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum PairError {
|
||||
#[error("not an OpenIDEA pairing code")]
|
||||
Ticket,
|
||||
#[error("cannot reach the desktop: {0}")]
|
||||
Connect(String),
|
||||
#[error("the desktop refused the connection: {0}")]
|
||||
Refused(String),
|
||||
#[error("{0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
}
|
||||
|
||||
/// What a pairing QR code carries: where the desktop is and a one-time code.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct Ticket {
|
||||
pub v: u32,
|
||||
/// The desktop's name, shown on the phone while it connects.
|
||||
pub desktop: String,
|
||||
pub addr: EndpointAddr,
|
||||
pub code: String,
|
||||
}
|
||||
|
||||
impl Ticket {
|
||||
pub fn encode(&self) -> String {
|
||||
let json = serde_json::to_vec(self).expect("a ticket serializes");
|
||||
format!("{TICKET_PREFIX}{}", URL_SAFE_NO_PAD.encode(json))
|
||||
}
|
||||
|
||||
pub fn decode(text: &str) -> Result<Self, PairError> {
|
||||
let body = text.trim().strip_prefix(TICKET_PREFIX).ok_or(PairError::Ticket)?;
|
||||
let json = URL_SAFE_NO_PAD.decode(body).map_err(|_| PairError::Ticket)?;
|
||||
let ticket: Self = serde_json::from_slice(&json).map_err(|_| PairError::Ticket)?;
|
||||
if ticket.v != PROTOCOL {
|
||||
return Err(PairError::Ticket);
|
||||
}
|
||||
Ok(ticket)
|
||||
}
|
||||
}
|
||||
|
||||
/// A paired phone, known by its endpoint id.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Device {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
/// Seconds since the Unix epoch.
|
||||
pub paired_at: u64,
|
||||
}
|
||||
|
||||
/// The paired phones, kept in a JSON file.
|
||||
pub struct DeviceStore {
|
||||
file: PathBuf,
|
||||
devices: Mutex<Vec<Device>>,
|
||||
}
|
||||
|
||||
impl DeviceStore {
|
||||
/// Reads `file`; a missing or unreadable one is an empty list.
|
||||
pub fn load(file: impl Into<PathBuf>) -> Self {
|
||||
let file = file.into();
|
||||
let devices = std::fs::read(&file).ok().and_then(|b| serde_json::from_slice(&b).ok()).unwrap_or_default();
|
||||
Self { file, devices: Mutex::new(devices) }
|
||||
}
|
||||
|
||||
pub fn list(&self) -> Vec<Device> {
|
||||
self.devices.lock().clone()
|
||||
}
|
||||
|
||||
pub fn get(&self, id: &str) -> Option<Device> {
|
||||
self.devices.lock().iter().find(|d| d.id == id).cloned()
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.devices.lock().is_empty()
|
||||
}
|
||||
|
||||
/// Adds `device`, replacing one with the same id.
|
||||
pub fn add(&self, device: Device) -> std::io::Result<()> {
|
||||
let mut devices = self.devices.lock();
|
||||
devices.retain(|d| d.id != device.id);
|
||||
devices.push(device);
|
||||
self.save(&devices)
|
||||
}
|
||||
|
||||
pub fn remove(&self, id: &str) -> std::io::Result<bool> {
|
||||
let mut devices = self.devices.lock();
|
||||
let before = devices.len();
|
||||
devices.retain(|d| d.id != id);
|
||||
if devices.len() == before {
|
||||
return Ok(false);
|
||||
}
|
||||
self.save(&devices)?;
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
fn save(&self, devices: &[Device]) -> std::io::Result<()> {
|
||||
if let Some(dir) = self.file.parent() {
|
||||
std::fs::create_dir_all(dir)?;
|
||||
}
|
||||
let tmp = self.file.with_extension("json.tmp");
|
||||
std::fs::write(&tmp, serde_json::to_vec_pretty(devices).map_err(std::io::Error::other)?)?;
|
||||
std::fs::rename(&tmp, &self.file)
|
||||
}
|
||||
}
|
||||
|
||||
/// The endpoint key in `file`, created there (readable by the user only) the first time.
|
||||
pub fn load_or_create_key(file: &Path) -> std::io::Result<SecretKey> {
|
||||
if let Ok(bytes) = std::fs::read(file)
|
||||
&& let Ok(bytes) = <[u8; 32]>::try_from(bytes.as_slice())
|
||||
{
|
||||
return Ok(SecretKey::from_bytes(&bytes));
|
||||
}
|
||||
let key = SecretKey::generate();
|
||||
if let Some(dir) = file.parent() {
|
||||
std::fs::create_dir_all(dir)?;
|
||||
}
|
||||
write_private(file, &key.to_bytes())?;
|
||||
Ok(key)
|
||||
}
|
||||
|
||||
/// The desktop's endpoint: its key from `key_file`, n0's relays and address lookup, accepting phones.
|
||||
pub async fn bind_desktop(key_file: &Path) -> Result<Endpoint, PairError> {
|
||||
let key = load_or_create_key(key_file)?;
|
||||
Endpoint::builder(iroh::endpoint::presets::N0)
|
||||
.secret_key(key)
|
||||
.alpns(vec![ALPN.to_vec()])
|
||||
.bind()
|
||||
.await
|
||||
.map_err(|e| PairError::Connect(e.to_string()))
|
||||
}
|
||||
|
||||
/// An endpoint on the loopback interface without relays or address lookup; `accept` makes it
|
||||
/// accept phones. For tests on one machine.
|
||||
#[cfg(any(test, feature = "testing"))]
|
||||
pub async fn bind_local(accept: bool) -> Endpoint {
|
||||
Endpoint::builder(iroh::endpoint::presets::Minimal)
|
||||
.relay_mode(iroh::RelayMode::Disabled)
|
||||
.alpns(if accept { vec![ALPN.to_vec()] } else { vec![] })
|
||||
.bind_addr("127.0.0.1:0")
|
||||
.expect("a loopback address")
|
||||
.bind()
|
||||
.await
|
||||
.expect("a loopback endpoint")
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
fn write_private(file: &Path, bytes: &[u8]) -> std::io::Result<()> {
|
||||
use std::io::Write as _;
|
||||
use std::os::unix::fs::OpenOptionsExt as _;
|
||||
let mut f = std::fs::OpenOptions::new().write(true).create(true).truncate(true).mode(0o600).open(file)?;
|
||||
f.write_all(bytes)
|
||||
}
|
||||
|
||||
#[cfg(not(unix))]
|
||||
fn write_private(file: &Path, bytes: &[u8]) -> std::io::Result<()> {
|
||||
std::fs::write(file, bytes)
|
||||
}
|
||||
|
||||
/// The phone's first line.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Hello {
|
||||
pub v: u32,
|
||||
/// The phone's name, shown in the desktop's device list.
|
||||
pub name: String,
|
||||
/// The ticket's code, when pairing.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub code: Option<String>,
|
||||
}
|
||||
|
||||
/// The desktop's answer to a [`Hello`].
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Welcome {
|
||||
pub ok: bool,
|
||||
pub desktop: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub error: Option<String>,
|
||||
}
|
||||
|
||||
async fn read_line(recv: &mut RecvStream) -> std::io::Result<Vec<u8>> {
|
||||
let mut line = Vec::new();
|
||||
loop {
|
||||
let byte = recv.read_u8().await?;
|
||||
if byte == b'\n' {
|
||||
return Ok(line);
|
||||
}
|
||||
if line.len() == LINE_MAX {
|
||||
return Err(std::io::Error::new(std::io::ErrorKind::InvalidData, "handshake line too long"));
|
||||
}
|
||||
line.push(byte);
|
||||
}
|
||||
}
|
||||
|
||||
async fn write_line<T: Serialize>(send: &mut SendStream, value: &T) -> std::io::Result<()> {
|
||||
let mut line = serde_json::to_vec(value).map_err(std::io::Error::other)?;
|
||||
line.push(b'\n');
|
||||
send.write_all(&line).await?;
|
||||
send.flush().await
|
||||
}
|
||||
|
||||
/// A phone's accepted connection, its stream ready for the remote development protocol.
|
||||
pub struct Session {
|
||||
pub device: Device,
|
||||
pub connection: Connection,
|
||||
pub send: SendStream,
|
||||
pub recv: RecvStream,
|
||||
}
|
||||
|
||||
pub type SessionHandler = Arc<dyn Fn(Session) -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>;
|
||||
|
||||
struct Pending {
|
||||
code: [u8; 16],
|
||||
expires: Instant,
|
||||
}
|
||||
|
||||
struct Shared {
|
||||
store: DeviceStore,
|
||||
desktop: String,
|
||||
pending: Mutex<Option<Pending>>,
|
||||
/// Connected phones by device id.
|
||||
online: Mutex<HashMap<String, Connection>>,
|
||||
handler: SessionHandler,
|
||||
on_change: Arc<dyn Fn() + Send + Sync>,
|
||||
}
|
||||
|
||||
impl Shared {
|
||||
/// Uses up the pairing code when `code` matches it in time.
|
||||
fn redeem(&self, code: &str) -> bool {
|
||||
let Ok(given) = URL_SAFE_NO_PAD.decode(code) else { return false };
|
||||
let mut pending = self.pending.lock();
|
||||
let valid = pending.as_ref().is_some_and(|p| p.expires > Instant::now() && constant_time_eq(&p.code, &given));
|
||||
if valid {
|
||||
*pending = None;
|
||||
}
|
||||
valid
|
||||
}
|
||||
}
|
||||
|
||||
fn constant_time_eq(a: &[u8], b: &[u8]) -> bool {
|
||||
a.len() == b.len() && a.iter().zip(b).fold(0u8, |acc, (x, y)| acc | (x ^ y)) == 0
|
||||
}
|
||||
|
||||
fn now_secs() -> u64 {
|
||||
SystemTime::now().duration_since(UNIX_EPOCH).map_or(0, |d| d.as_secs())
|
||||
}
|
||||
|
||||
/// Accepts phones on `endpoint`: paired ones, and new ones holding the current ticket's code.
|
||||
pub struct Listener {
|
||||
endpoint: Endpoint,
|
||||
shared: Arc<Shared>,
|
||||
}
|
||||
|
||||
impl Listener {
|
||||
/// Starts accepting on the current tokio runtime. `endpoint` must accept [`ALPN`].
|
||||
/// `handler` serves each session; `on_change` runs when a device pairs, connects,
|
||||
/// disconnects or is removed.
|
||||
pub fn start(
|
||||
endpoint: Endpoint,
|
||||
store: DeviceStore,
|
||||
desktop: String,
|
||||
handler: SessionHandler,
|
||||
on_change: Arc<dyn Fn() + Send + Sync>,
|
||||
) -> Self {
|
||||
let shared = Arc::new(Shared {
|
||||
store,
|
||||
desktop,
|
||||
pending: Mutex::new(None),
|
||||
online: Mutex::new(HashMap::new()),
|
||||
handler,
|
||||
on_change,
|
||||
});
|
||||
let accepting = endpoint.clone();
|
||||
let accept_shared = shared.clone();
|
||||
tokio::spawn(async move {
|
||||
while let Some(incoming) = accepting.accept().await {
|
||||
let shared = accept_shared.clone();
|
||||
tokio::spawn(async move {
|
||||
match incoming.await {
|
||||
Ok(connection) => accept(shared, connection).await,
|
||||
Err(e) => tracing::debug!("mobile connection failed: {e}"),
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Self { endpoint, shared }
|
||||
}
|
||||
|
||||
/// A new ticket valid for `ttl`; any earlier one stops working.
|
||||
pub async fn ticket(&self, ttl: Duration) -> (Ticket, Duration) {
|
||||
// Without the relay (offline, or a firewall) the address still has the direct ones.
|
||||
let _ = tokio::time::timeout(ONLINE_TIMEOUT, self.endpoint.online()).await;
|
||||
let (code, expires) = {
|
||||
let mut pending = self.shared.pending.lock();
|
||||
match pending.as_ref() {
|
||||
// Asked again while the shown code still works (a second dialog, a re-render): the same code.
|
||||
Some(p) if p.expires > Instant::now() => (p.code, p.expires),
|
||||
_ => {
|
||||
let mut code = [0u8; 16];
|
||||
getrandom::fill(&mut code).expect("system randomness");
|
||||
let expires = Instant::now() + ttl;
|
||||
*pending = Some(Pending { code, expires });
|
||||
(code, expires)
|
||||
}
|
||||
}
|
||||
};
|
||||
let ticket = Ticket {
|
||||
v: PROTOCOL,
|
||||
desktop: self.shared.desktop.clone(),
|
||||
addr: self.endpoint.addr(),
|
||||
code: URL_SAFE_NO_PAD.encode(code),
|
||||
};
|
||||
(ticket, expires.saturating_duration_since(Instant::now()))
|
||||
}
|
||||
|
||||
/// Stops the current ticket from pairing anything.
|
||||
pub fn cancel_pairing(&self) {
|
||||
*self.shared.pending.lock() = None;
|
||||
}
|
||||
|
||||
/// The paired devices, each with whether it is connected now.
|
||||
pub fn devices(&self) -> Vec<(Device, bool)> {
|
||||
let online = self.shared.online.lock();
|
||||
self.shared
|
||||
.store
|
||||
.list()
|
||||
.into_iter()
|
||||
.map(|d| {
|
||||
let connected = online.contains_key(&d.id);
|
||||
(d, connected)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Forgets a device and drops its connection.
|
||||
pub fn remove(&self, id: &str) -> std::io::Result<bool> {
|
||||
let removed = self.shared.store.remove(id)?;
|
||||
if let Some(connection) = self.shared.online.lock().remove(id) {
|
||||
connection.close(0u32.into(), b"unpaired");
|
||||
}
|
||||
if removed {
|
||||
(self.shared.on_change)();
|
||||
}
|
||||
Ok(removed)
|
||||
}
|
||||
|
||||
pub fn has_devices(&self) -> bool {
|
||||
!self.shared.store.is_empty()
|
||||
}
|
||||
|
||||
pub fn endpoint(&self) -> &Endpoint {
|
||||
&self.endpoint
|
||||
}
|
||||
|
||||
pub async fn close(&self) {
|
||||
self.endpoint.close().await;
|
||||
}
|
||||
}
|
||||
|
||||
async fn accept(shared: Arc<Shared>, connection: Connection) {
|
||||
let id = connection.remote_id().to_string();
|
||||
let Ok((mut send, mut recv)) = connection.accept_bi().await else { return };
|
||||
let hello = match tokio::time::timeout(HELLO_TIMEOUT, read_line(&mut recv)).await {
|
||||
Ok(Ok(line)) => serde_json::from_slice::<Hello>(&line).ok(),
|
||||
_ => None,
|
||||
};
|
||||
let refuse = |error: &str| Welcome { ok: false, desktop: shared.desktop.clone(), error: Some(error.into()) };
|
||||
let Some(hello) = hello.filter(|h| h.v == PROTOCOL) else {
|
||||
let _ = write_line(&mut send, &refuse("unsupported client")).await;
|
||||
let _ = send.finish();
|
||||
return;
|
||||
};
|
||||
let device = if let Some(known) = shared.store.get(&id) {
|
||||
known
|
||||
} else if hello.code.as_deref().is_some_and(|code| shared.redeem(code)) {
|
||||
let device = Device { id: id.clone(), name: hello.name.clone(), paired_at: now_secs() };
|
||||
if let Err(e) = shared.store.add(device.clone()) {
|
||||
tracing::warn!("cannot save the paired device: {e}");
|
||||
}
|
||||
device
|
||||
} else {
|
||||
let reason =
|
||||
if hello.code.is_some() { "the pairing code is invalid or expired" } else { "this device is not paired" };
|
||||
let _ = write_line(&mut send, &refuse(reason)).await;
|
||||
let _ = send.finish();
|
||||
connection.closed().await;
|
||||
return;
|
||||
};
|
||||
let welcome = Welcome { ok: true, desktop: shared.desktop.clone(), error: None };
|
||||
if write_line(&mut send, &welcome).await.is_err() {
|
||||
return;
|
||||
}
|
||||
// One connection per device: a reconnect replaces the one it left behind.
|
||||
if let Some(old) = shared.online.lock().insert(id.clone(), connection.clone()) {
|
||||
old.close(0u32.into(), b"replaced");
|
||||
}
|
||||
(shared.on_change)();
|
||||
(shared.handler)(Session { device, connection: connection.clone(), send, recv }).await;
|
||||
{
|
||||
let mut online = shared.online.lock();
|
||||
if online.get(&id).is_some_and(|c| c.stable_id() == connection.stable_id()) {
|
||||
online.remove(&id);
|
||||
}
|
||||
}
|
||||
(shared.on_change)();
|
||||
}
|
||||
|
||||
/// The phone's side: connects to `addr`, pairing with `code` or as a paired device.
|
||||
pub async fn connect(
|
||||
endpoint: &Endpoint,
|
||||
addr: EndpointAddr,
|
||||
name: &str,
|
||||
code: Option<&str>,
|
||||
) -> Result<(Connection, Welcome, SendStream, RecvStream), PairError> {
|
||||
let connection = endpoint.connect(addr, ALPN).await.map_err(|e| PairError::Connect(e.to_string()))?;
|
||||
let (mut send, mut recv) = connection.open_bi().await.map_err(|e| PairError::Connect(e.to_string()))?;
|
||||
let hello = Hello { v: PROTOCOL, name: name.into(), code: code.map(str::to_owned) };
|
||||
write_line(&mut send, &hello).await?;
|
||||
let line = read_line(&mut recv).await?;
|
||||
let welcome: Welcome =
|
||||
serde_json::from_slice(&line).map_err(|e| std::io::Error::new(std::io::ErrorKind::InvalidData, e))?;
|
||||
if !welcome.ok {
|
||||
return Err(PairError::Refused(welcome.error.unwrap_or_default()));
|
||||
}
|
||||
Ok((connection, welcome, send, recv))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
@@ -0,0 +1,138 @@
|
||||
use super::*;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
async fn endpoint(alpns: Vec<Vec<u8>>) -> Endpoint {
|
||||
bind_local(!alpns.is_empty()).await
|
||||
}
|
||||
|
||||
struct Desktop {
|
||||
listener: Listener,
|
||||
changes: Arc<AtomicUsize>,
|
||||
_dir: tempfile::TempDir,
|
||||
}
|
||||
|
||||
/// A desktop whose sessions echo what the phone sends.
|
||||
async fn desktop() -> Desktop {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let changes = Arc::new(AtomicUsize::new(0));
|
||||
let counted = changes.clone();
|
||||
let handler: SessionHandler = Arc::new(|mut s: Session| {
|
||||
Box::pin(async move {
|
||||
let _ = tokio::io::copy(&mut s.recv, &mut s.send).await;
|
||||
let _ = s.send.finish();
|
||||
s.connection.closed().await;
|
||||
})
|
||||
});
|
||||
let listener = Listener::start(
|
||||
endpoint(vec![ALPN.to_vec()]).await,
|
||||
DeviceStore::load(dir.path().join("devices.json")),
|
||||
"Workstation".into(),
|
||||
handler,
|
||||
Arc::new(move || {
|
||||
counted.fetch_add(1, Ordering::SeqCst);
|
||||
}),
|
||||
);
|
||||
Desktop { listener, changes, _dir: dir }
|
||||
}
|
||||
|
||||
async fn echo(send: &mut SendStream, recv: &mut RecvStream) -> Vec<u8> {
|
||||
send.write_all(b"ping").await.unwrap();
|
||||
let mut buf = [0u8; 4];
|
||||
recv.read_exact(&mut buf).await.unwrap();
|
||||
buf.to_vec()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_ticket_round_trips_through_its_text() {
|
||||
let key = SecretKey::generate();
|
||||
let ticket =
|
||||
Ticket { v: 1, desktop: "Workstation".into(), addr: EndpointAddr::new(key.public()), code: "abc".into() };
|
||||
let text = ticket.encode();
|
||||
assert!(text.starts_with(TICKET_PREFIX));
|
||||
assert_eq!(Ticket::decode(&text).unwrap(), ticket);
|
||||
assert!(matches!(Ticket::decode("https://example.com"), Err(PairError::Ticket)));
|
||||
assert!(matches!(Ticket::decode("openidea-pair:!!"), Err(PairError::Ticket)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_endpoint_key_survives_a_restart() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let file = dir.path().join("mobile").join("endpoint.key");
|
||||
let first = load_or_create_key(&file).unwrap();
|
||||
assert_eq!(load_or_create_key(&file).unwrap().public(), first.public());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn a_phone_pairs_with_the_code_once_and_then_reconnects_without_it() {
|
||||
let desktop = desktop().await;
|
||||
let ticket = desktop.listener.ticket(Duration::from_secs(60)).await.0;
|
||||
|
||||
let phone = endpoint(vec![]).await;
|
||||
let (conn, welcome, mut send, mut recv) =
|
||||
connect(&phone, ticket.addr.clone(), "Pixel", Some(&ticket.code)).await.unwrap();
|
||||
assert_eq!(welcome.desktop, "Workstation");
|
||||
assert_eq!(echo(&mut send, &mut recv).await, b"ping");
|
||||
let devices = desktop.listener.devices();
|
||||
assert_eq!(devices.len(), 1);
|
||||
assert_eq!(devices[0].0.name, "Pixel");
|
||||
assert_eq!(devices[0].0.id, phone.id().to_string());
|
||||
assert!(devices[0].1, "shown as connected");
|
||||
conn.close(0u32.into(), b"bye");
|
||||
|
||||
// The code is used up: another phone can't pair with it.
|
||||
let stranger = endpoint(vec![]).await;
|
||||
let refused = connect(&stranger, ticket.addr.clone(), "Stranger", Some(&ticket.code)).await;
|
||||
assert!(matches!(refused, Err(PairError::Refused(_))), "{refused:?}");
|
||||
|
||||
// The paired phone needs no code.
|
||||
let (_conn, _, mut send, mut recv) = connect(&phone, ticket.addr.clone(), "Pixel", None).await.unwrap();
|
||||
assert_eq!(echo(&mut send, &mut recv).await, b"ping");
|
||||
assert!(desktop.changes.load(Ordering::SeqCst) >= 2);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn an_unpaired_phone_without_a_code_is_refused() {
|
||||
let desktop = desktop().await;
|
||||
let ticket = desktop.listener.ticket(Duration::from_secs(60)).await.0;
|
||||
let phone = endpoint(vec![]).await;
|
||||
let refused = connect(&phone, ticket.addr, "Pixel", None).await;
|
||||
assert!(matches!(&refused, Err(PairError::Refused(e)) if e.contains("not paired")), "{refused:?}");
|
||||
assert!(desktop.listener.devices().is_empty());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn an_expired_or_cancelled_code_does_not_pair() {
|
||||
let desktop = desktop().await;
|
||||
let expired = desktop.listener.ticket(Duration::ZERO).await.0;
|
||||
let phone = endpoint(vec![]).await;
|
||||
assert!(connect(&phone, expired.addr.clone(), "Pixel", Some(&expired.code)).await.is_err());
|
||||
|
||||
let cancelled = desktop.listener.ticket(Duration::from_secs(60)).await.0;
|
||||
desktop.listener.cancel_pairing();
|
||||
assert!(connect(&phone, cancelled.addr, "Pixel", Some(&cancelled.code)).await.is_err());
|
||||
assert!(desktop.listener.devices().is_empty());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn removing_a_device_drops_its_connection_and_its_pairing() {
|
||||
let desktop = desktop().await;
|
||||
let ticket = desktop.listener.ticket(Duration::from_secs(60)).await.0;
|
||||
let phone = endpoint(vec![]).await;
|
||||
let (conn, ..) = connect(&phone, ticket.addr.clone(), "Pixel", Some(&ticket.code)).await.unwrap();
|
||||
|
||||
assert!(desktop.listener.remove(&phone.id().to_string()).unwrap());
|
||||
tokio::time::timeout(Duration::from_secs(5), conn.closed()).await.expect("connection closed");
|
||||
assert!(desktop.listener.devices().is_empty());
|
||||
assert!(connect(&phone, ticket.addr, "Pixel", None).await.is_err());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn asking_again_while_the_code_works_gives_the_same_code() {
|
||||
let desktop = desktop().await;
|
||||
let (first, _) = desktop.listener.ticket(Duration::from_secs(60)).await;
|
||||
let (second, left) = desktop.listener.ticket(Duration::from_secs(60)).await;
|
||||
assert_eq!(first.code, second.code);
|
||||
assert!(left <= Duration::from_secs(60));
|
||||
desktop.listener.cancel_pairing();
|
||||
assert_ne!(desktop.listener.ticket(Duration::from_secs(60)).await.0.code, first.code);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
async function show(page: Page, action: string) {
|
||||
await page.evaluate(async (action) => {
|
||||
const actions = "/src/platform/actions.ts";
|
||||
if (!(await (await import(/* @vite-ignore */ actions)).executeAction(action))) throw Error(action);
|
||||
}, action);
|
||||
}
|
||||
|
||||
test("analysis scope fields align with their radio choices and retain their values", async ({ workbench: page }) => {
|
||||
await page.evaluate(async () => {
|
||||
const search = "/src/platform/search.ts";
|
||||
(await import(/* @vite-ignore */ search)).saveCustomScopes([
|
||||
{ name: "Frontend", pattern: "file:src//*" },
|
||||
{ name: "Tests", pattern: "file:tests//*" },
|
||||
]);
|
||||
});
|
||||
await show(page, "analyze.inspectCode");
|
||||
const dialog = page.getByRole("dialog", { name: "Specify Inspection Scope" });
|
||||
const scope = dialog.getByRole("group", { name: "Scope" });
|
||||
const directory = scope.getByRole("textbox", { name: "Directory" });
|
||||
const custom = scope.getByRole("button", { name: "Custom scope", exact: true });
|
||||
const radio = scope.getByRole("radio", { name: "Module or directory" });
|
||||
const label = scope.getByText("Module or directory", { exact: true });
|
||||
|
||||
await radio.check();
|
||||
const path = (await directory.boundingBox())!;
|
||||
const choice = (await label.boundingBox())!;
|
||||
expect(path.y + path.height / 2).toBeCloseTo(choice.y + choice.height / 2, 0);
|
||||
await directory.fill("/dev/acme-api/src");
|
||||
await expect(custom).toBeDisabled();
|
||||
await scope.getByRole("radio", { name: "Custom scope", exact: true }).check();
|
||||
await expect(directory).toBeDisabled();
|
||||
expect((await custom.boundingBox())!.x).toBeCloseTo(path.x, 0);
|
||||
await custom.click();
|
||||
await page.getByRole("option", { name: /^Tests/ }).click();
|
||||
await expect(custom).toContainText("Tests");
|
||||
|
||||
await radio.check();
|
||||
await expect(directory).toHaveValue("/dev/acme-api/src");
|
||||
await scope.getByRole("radio", { name: "Custom scope", exact: true }).check();
|
||||
await expect(custom).toContainText("Tests");
|
||||
await page.setViewportSize({ width: 400, height: 640 });
|
||||
const stacked = (await directory.boundingBox())!;
|
||||
const customBox = (await custom.boundingBox())!;
|
||||
const radioBox = (await label.boundingBox())!;
|
||||
const next = (await scope.getByText("Current file", { exact: true }).boundingBox())!;
|
||||
expect(stacked.y).toBeGreaterThan(radioBox.y + radioBox.height);
|
||||
expect(stacked.y + stacked.height).toBeLessThan(next.y);
|
||||
expect(stacked.x).toBeCloseTo(customBox.x, 0);
|
||||
expect(await scope.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
|
||||
});
|
||||
|
||||
for (const [action, title] of [
|
||||
["code.cleanup", "Run Code Cleanup"],
|
||||
["analyze.locateDuplicates", "Locate Duplicates"],
|
||||
["find.structural", "Structural Search"],
|
||||
["find.replaceStructural", "Structural Replace"],
|
||||
] as const) {
|
||||
test(`${title} keeps directory options with their scope choice`, async ({ workbench: page }) => {
|
||||
await show(page, action);
|
||||
const dialog = page.getByRole("dialog", { name: title });
|
||||
const scope = dialog.getByRole("group", { name: "Scope" });
|
||||
const directory = scope.getByRole("textbox", { name: "Directory" });
|
||||
await expect(directory).toBeDisabled();
|
||||
await scope.getByRole("radio", { name: "Module or directory" }).check();
|
||||
await expect(directory).toBeEnabled();
|
||||
await expect(scope.getByRole("button", { name: "Browse…" })).toBeEnabled();
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import type { EditorView } from "@codemirror/view";
|
||||
import { expect, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("gutter breakpoint keeps its location and buttons visible while editing in a short window", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 410, height: 340 });
|
||||
await stubDesktop(page);
|
||||
const name = "RecalculateInternationalPaymentsAcrossMultipleRegionalSettlementCyclesAndVerifyReceiptTotals.ts";
|
||||
const path = `/dev/acme-api/${name}`;
|
||||
await page.evaluate(async (path) => {
|
||||
const contributionsModule = "/src/workbench/contributions.ts";
|
||||
const { editorService } = await import(/* @vite-ignore */ contributionsModule);
|
||||
await editorService().openFile(path);
|
||||
}, path);
|
||||
await page.locator(".cm-content").evaluate(async (editor, path) => {
|
||||
const view = (editor as HTMLElement & { cmTile: { view: EditorView } }).cmTile.view;
|
||||
const insert = Array.from({ length: 14 }, (_, i) => `const amount${i + 1} = ${i * 10};`).join("\n");
|
||||
view.dispatch({ changes: { from: 0, to: view.state.doc.length, insert } });
|
||||
const breakpointsModule = "/src/features/debugger/breakpoints/store.ts";
|
||||
const { addBreakpoint } = await import(/* @vite-ignore */ breakpointsModule);
|
||||
window.__ipc.handlers.debug_set_breakpoints = () => [];
|
||||
addBreakpoint(path, 7, { condition: "amount8 > 50", hitCondition: ">= 3", logMessage: "amount: {amount8}" });
|
||||
}, path);
|
||||
const marker = page.locator(".cm-lineNumbers .cm-gutterElement").filter({ hasText: /^8$/ });
|
||||
const open = () => marker.click({ button: "right" });
|
||||
await open();
|
||||
|
||||
const popup = page.getByRole("dialog", { name: "Breakpoint properties" });
|
||||
const done = popup.getByRole("button", { name: "Done", exact: true });
|
||||
const condition = popup.getByLabel("Condition", { exact: true });
|
||||
await expect(condition).toBeFocused();
|
||||
await expect(done).toBeInViewport({ ratio: 1 });
|
||||
const location = popup.getByTitle(`${path}:8`, { exact: true });
|
||||
await expect(location.getByText(":8", { exact: true })).toBeInViewport({ ratio: 1 });
|
||||
await expect(popup.getByText("Condition", { exact: true })).toHaveCSS("font-size", "13px");
|
||||
|
||||
await condition.fill("amount8 > 60");
|
||||
const log = popup.getByRole("textbox", { name: "Evaluate and log", exact: true });
|
||||
await log.fill("paid: {amount8}");
|
||||
await expect(location).toBeInViewport({ ratio: 1 });
|
||||
await expect(done).toBeInViewport({ ratio: 1 });
|
||||
await done.click();
|
||||
await expect(popup).toBeHidden();
|
||||
|
||||
await open();
|
||||
await expect(condition).toHaveValue("amount8 > 60");
|
||||
await expect(log).toHaveValue("paid: {amount8}");
|
||||
await popup.getByRole("button", { name: /^More/ }).click();
|
||||
const dialog = page.getByRole("dialog", { name: "Breakpoints", exact: true });
|
||||
await expect(dialog.getByLabel("Condition", { exact: true })).toHaveValue("amount8 > 60");
|
||||
});
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
async function showBuild(page: Page) {
|
||||
await page.evaluate(async () => {
|
||||
async function showBuild(page: Page, diagnosticPath: string | null = null) {
|
||||
await page.evaluate(async (path) => {
|
||||
const storePath = "/src/features/build/store.ts";
|
||||
const layoutPath = "/src/workbench/toolwindows/store.ts";
|
||||
const { useBuildRun } = await import(/* @vite-ignore */ storePath);
|
||||
@@ -17,10 +17,10 @@ async function showBuild(page: Page) {
|
||||
{ kind: "out", text: "Compiling TypeScript" },
|
||||
{ kind: "err", text: "Expected a number" },
|
||||
],
|
||||
messages: [{ severity: "error", text: "Expected a number", path: null, range: null, code: null }],
|
||||
messages: [{ severity: "error", text: "Expected a number", path, range: null, code: null }],
|
||||
});
|
||||
showToolWindow("build", true);
|
||||
});
|
||||
}, diagnosticPath);
|
||||
const build = page.getByRole("region", { name: "Build", exact: true });
|
||||
await expect(build.getByRole("log", { name: "Build output" })).toBeVisible();
|
||||
return build;
|
||||
@@ -35,6 +35,28 @@ test("Build gives about two thirds of the initial split to output", async ({ wor
|
||||
expect(treeWidth / (treeWidth + consoleWidth)).toBeCloseTo(0.33, 2);
|
||||
});
|
||||
|
||||
test("Build reserves room for duration and file counts beside long directory paths", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 760, height: 680 });
|
||||
const path = "/dev/acme-api/src/services/regional-catalogs/generated/api/development/builders/catalog.ts";
|
||||
const build = await showBuild(page, path);
|
||||
const root = build.getByRole("treeitem", { name: /^Build Project/ });
|
||||
const filename = build.getByTitle(path, { exact: true }).getByText("catalog.ts", { exact: true });
|
||||
const counts = build.getByTitle(path, { exact: true }).getByText("1 error", { exact: true });
|
||||
const errorSummary = root.getByText("1 error", { exact: true });
|
||||
const elapsed = root.getByText("1 s 200 ms", { exact: true });
|
||||
await expect(elapsed).toHaveCSS("font-size", "12px");
|
||||
await expect(counts).toBeInViewport({ ratio: 1 });
|
||||
const textFits = (el: Element) => {
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(el);
|
||||
return range.getBoundingClientRect().width <= el.getBoundingClientRect().width;
|
||||
};
|
||||
expect(await filename.evaluate(textFits)).toBe(true);
|
||||
expect(await errorSummary.evaluate(textFits)).toBe(true);
|
||||
const [duration, row] = await Promise.all([elapsed.boundingBox(), root.boundingBox()]);
|
||||
expect(row!.x + row!.width - duration!.x - duration!.width).toBeLessThan(12);
|
||||
});
|
||||
|
||||
test("Build output and diagnostics respond to a console font change", async ({ workbench: page }) => {
|
||||
const build = await showBuild(page);
|
||||
const log = build.getByRole("log", { name: "Build output" });
|
||||
|
||||
@@ -111,6 +111,7 @@ test("completion lists the server's items and inserts the chosen one", async ({
|
||||
});
|
||||
await expect(editor.locator(".cm-content")).toHaveCSS("font-size", zoomedSize);
|
||||
await expect(method.locator(".cm-completionLabel")).toHaveCSS("font-size", zoomedSize);
|
||||
|
||||
await page.keyboard.type("toD");
|
||||
await expect(popup.getByText("total", { exact: true })).toBeHidden();
|
||||
// Refreshing the results rebuilds the list; the hint bar must stay below it, not jump to the top.
|
||||
@@ -124,6 +125,37 @@ test("completion lists the server's items and inserts the chosen one", async ({
|
||||
await expect(popup).toBeHidden();
|
||||
await expect(editor.locator(".cm-activeLine")).toHaveText(/^\s*order\.toDto\(\)$/);
|
||||
expect((await ipcCalls(page, "lsp_completion")).length).toBeGreaterThan(0);
|
||||
|
||||
await page.evaluate(async () => {
|
||||
const path = "/src/platform/actions.ts";
|
||||
await (await import(/* @vite-ignore */ path)).executeAction("editor.splitRight");
|
||||
});
|
||||
const panes = page.locator("[data-pane-id]");
|
||||
await expect(panes).toHaveCount(2);
|
||||
await page.setViewportSize({ width: 480, height: 760 });
|
||||
await panes.last().locator(".cm-content").focus();
|
||||
await page.keyboard.press("End");
|
||||
await page.keyboard.press("Enter");
|
||||
await page.keyboard.type("order.");
|
||||
await page.keyboard.press("Control+Space");
|
||||
const footer = popup.locator(".cm-lsp-completion-footer");
|
||||
await expect
|
||||
.poll(() =>
|
||||
footer.evaluate((el) => {
|
||||
const tip = el.querySelector("span")!;
|
||||
const sort = el.querySelector("button")!;
|
||||
const a = tip.getBoundingClientRect();
|
||||
const b = sort.getBoundingClientRect();
|
||||
return {
|
||||
oneRow: Math.abs(a.y + a.height / 2 - b.y - b.height / 2) <= 1,
|
||||
hintClipped: tip.scrollWidth > tip.clientWidth,
|
||||
sortFits: sort.scrollWidth <= sort.clientWidth + 1 && b.right <= el.getBoundingClientRect().right,
|
||||
};
|
||||
}),
|
||||
)
|
||||
.toEqual({ oneRow: true, hintClipped: true, sortFits: true });
|
||||
await expect(footer.getByTitle("Press ↵ to insert, ⇥ to replace")).toHaveCSS("font-size", "12px");
|
||||
await expect(footer.getByRole("button", { name: "Sort by name" })).toBeInViewport({ ratio: 1 });
|
||||
});
|
||||
|
||||
test("long completion signatures fit the editor when the workbench is narrowed", async ({ workbench: page }) => {
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test("the editor color picker fits recent colors and keeps its actions visible", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 980, height: 720 });
|
||||
await page.evaluate(async () => {
|
||||
const recent = Array.from({ length: 20 }, (_, i) => `#${((i + 1) * 314241).toString(16).padStart(6, "0")}ff`);
|
||||
localStorage.setItem("openidea.colorPicker.recent.v1", JSON.stringify(recent));
|
||||
const contributions = "/src/workbench/contributions.ts";
|
||||
const { editorService } = await import(/* @vite-ignore */ contributions);
|
||||
await editorService().openFile("/dev/acme-api/theme.css");
|
||||
});
|
||||
const editor = page.locator(".cm-editor").first();
|
||||
const contents = editor.locator(".cm-content");
|
||||
await contents.click();
|
||||
await page.keyboard.press("Meta+a");
|
||||
await page.keyboard.insertText(".notice { color: #5a8fbd; }");
|
||||
|
||||
const swatch = editor.locator(".cm-openidea-gutter-colors").getByTitle("#5a8fbd", { exact: true });
|
||||
const picker = page.getByRole("dialog", { name: "Color picker", exact: true });
|
||||
const palette = picker.locator(".react-colorful__saturation");
|
||||
const hex = picker.getByRole("textbox", { name: "Hexadecimal", exact: true });
|
||||
const apply = picker.getByRole("button", { name: "Apply", exact: true });
|
||||
const cancel = picker.getByRole("button", { name: "Cancel", exact: true });
|
||||
const recent = picker.getByRole("group", { name: "Recent colors", exact: true }).getByRole("button");
|
||||
await swatch.click();
|
||||
await expect(hex).toHaveValue("5A8FBDFF");
|
||||
expect((await picker.boundingBox())!.width).toBeLessThanOrEqual(308);
|
||||
await expect(palette).toHaveCSS("height", "152px");
|
||||
expect(await picker.evaluate((el) => el.scrollWidth - el.clientWidth)).toBe(0);
|
||||
await hex.fill("#ff0000");
|
||||
expect(await picker.evaluate((el) => el.scrollWidth - el.clientWidth)).toBe(0);
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(picker).toBeHidden();
|
||||
|
||||
await page.setViewportSize({ width: 280, height: 315 });
|
||||
await swatch.click();
|
||||
await expect(recent).toHaveCount(20);
|
||||
const swatchRows = await recent.evaluateAll((elements) => {
|
||||
const rows: number[] = [];
|
||||
for (const element of elements) {
|
||||
const box = element.getBoundingClientRect();
|
||||
if (!rows.includes(box.top)) rows.push(box.top);
|
||||
const previous = element.previousElementSibling?.getBoundingClientRect();
|
||||
if (previous?.top === box.top && previous.right > box.left) throw new Error("Color swatches overlap");
|
||||
}
|
||||
return rows.length;
|
||||
});
|
||||
expect(swatchRows).toBeGreaterThan(2);
|
||||
expect(await picker.evaluate((el) => el.scrollWidth - el.clientWidth)).toBe(0);
|
||||
await expect(apply).toBeInViewport({ ratio: 1 });
|
||||
await expect(cancel).toBeInViewport({ ratio: 1 });
|
||||
await hex.fill("#d27c54");
|
||||
await cancel.click();
|
||||
await expect(picker).toBeHidden();
|
||||
await expect(contents).toContainText("#5a8fbd");
|
||||
|
||||
await swatch.click();
|
||||
await hex.fill("#d27c54");
|
||||
await apply.click();
|
||||
await expect(picker).toBeHidden();
|
||||
await expect(contents).toContainText("#d27c54");
|
||||
});
|
||||
@@ -780,6 +780,81 @@ test("Commit Options applies a named TODO filter independently of the TODO windo
|
||||
expect(await ipcCalls(page, "vcs_commit")).toEqual([]);
|
||||
});
|
||||
|
||||
test("commit check text scrolls independently of its status icon and retry action", async ({ workbench: page }) => {
|
||||
await stubRepository(page);
|
||||
await page.setViewportSize({ width: 850, height: 650 });
|
||||
await page.evaluate(async () => {
|
||||
const registryPath = "/src/features/vcs/commitCheckRegistry.ts";
|
||||
const layoutPath = "/src/workbench/toolwindows/store.ts";
|
||||
const { registerCommitCheck } = await import(/* @vite-ignore */ registryPath);
|
||||
const layout = await import(/* @vite-ignore */ layoutPath);
|
||||
layout.moveToolWindow("commit", "left");
|
||||
layout.setToolWindowSize("left", 238);
|
||||
for (let index = 0; index < 6; index++) {
|
||||
registerCommitCheck({
|
||||
id: `test.commitLayout.${index}`,
|
||||
order: index - 1000,
|
||||
title: `Ledger check ${index + 1}`,
|
||||
run: () => {
|
||||
if (index === 0) document.body.dataset.checkRuns = String(Number(document.body.dataset.checkRuns ?? 0) + 1);
|
||||
return {
|
||||
severity: "error",
|
||||
text: "The regional settlement totals differ from the monthly inventory audit and need a second review.",
|
||||
fix:
|
||||
index === 5
|
||||
? {
|
||||
label: "Review final check",
|
||||
run: () => {
|
||||
document.body.dataset.commitCheckReviewed = "yes";
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
await page.keyboard.press("Meta+k");
|
||||
const commit = page.getByRole("region", { name: "Commit", exact: true });
|
||||
await commit.getByRole("textbox", { name: "Commit message" }).fill("Review the settlement totals");
|
||||
await commit.getByRole("button", { name: "Commit Options", exact: true }).click();
|
||||
const options = page.getByRole("dialog", { name: "Commit Options", exact: true });
|
||||
await options.getByRole("button", { name: "Run Commit Checks", exact: true }).click();
|
||||
|
||||
const feedback = commit.getByRole("alert").filter({ hasText: "Ledger check 1" });
|
||||
const first = feedback.getByText("Ledger check 1", { exact: true });
|
||||
const second = feedback.getByText("Ledger check 2", { exact: true });
|
||||
const results = first.locator("../..");
|
||||
const icon = feedback.locator("svg").first();
|
||||
const retry = commit.getByRole("button", { name: "Rerun Commit Checks", exact: true });
|
||||
const commitAnyway = commit.getByRole("button", { name: "Commit Anyway", exact: true });
|
||||
await expect(commitAnyway).toBeInViewport({ ratio: 1 });
|
||||
await expect(first).toHaveCSS("font-size", "13px");
|
||||
const firstRow = (await first.locator("..").boundingBox())!;
|
||||
const secondRow = (await second.locator("..").boundingBox())!;
|
||||
expect(secondRow.y - (firstRow.y + firstRow.height)).toBeCloseTo(4, 0);
|
||||
expect(await results.evaluate((node) => node.scrollHeight > node.clientHeight)).toBe(true);
|
||||
const statusTop = (await icon.boundingBox())!.y;
|
||||
const retryTop = (await retry.boundingBox())!.y;
|
||||
await results.evaluate((node) => {
|
||||
node.scrollTop = node.scrollHeight;
|
||||
});
|
||||
expect(await results.evaluate((node) => node.scrollTop)).toBeGreaterThan(0);
|
||||
expect((await icon.boundingBox())!.y).toBeCloseTo(statusTop, 0);
|
||||
expect((await retry.boundingBox())!.y).toBeCloseTo(retryTop, 0);
|
||||
const details = feedback.getByRole("button", { name: "Review final check", exact: true });
|
||||
await expect(details).toBeInViewport({ ratio: 1 });
|
||||
await expect(icon).toBeInViewport({ ratio: 1 });
|
||||
await expect(retry).toBeInViewport({ ratio: 1 });
|
||||
await expect(commitAnyway).toBeInViewport({ ratio: 1 });
|
||||
await details.click();
|
||||
await expect(page.locator("body")).toHaveAttribute("data-commit-check-reviewed", "yes");
|
||||
await retry.click();
|
||||
await expect(page.locator("body")).toHaveAttribute("data-check-runs", "2");
|
||||
await expect(first).toBeVisible();
|
||||
expect(await ipcCalls(page, "vcs_commit")).toEqual([]);
|
||||
});
|
||||
|
||||
test("the TODO check reports unreadable files and can retry after they become available", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
@@ -1084,27 +1159,51 @@ test("the Commit tool window restores the draft and author options for the inclu
|
||||
await expect(message).toHaveValue("Default draft");
|
||||
});
|
||||
|
||||
test("commit message history opens above the message without an empty icon column", async ({ workbench: page }) => {
|
||||
test("commit message history shows compact message previews above the editor", async ({ workbench: page }) => {
|
||||
await page.emulateMedia({ reducedMotion: "reduce" });
|
||||
await stubRepository(page);
|
||||
await page.keyboard.press("Meta+k");
|
||||
const message = page.getByRole("textbox", { name: "Commit message" });
|
||||
await expect(message).toBeVisible();
|
||||
await page.evaluate((root) => {
|
||||
localStorage.setItem(`openidea.vcs.commitMessages:${root}`, JSON.stringify(["Previous commit message"]));
|
||||
localStorage.setItem(
|
||||
`openidea.vcs.commitMessages:${root}`,
|
||||
JSON.stringify([
|
||||
"Update inventory\n\nReview settlement totals",
|
||||
"Update inventory\n\nReconcile export records",
|
||||
...Array.from({ length: 7 }, (_, index) => `Earlier message ${index + 1}`),
|
||||
]),
|
||||
);
|
||||
}, ROOT);
|
||||
await message.fill("Draft");
|
||||
await page.getByRole("button", { name: "Commit Message History" }).click();
|
||||
const history = page.getByRole("button", { name: "Commit Message History" });
|
||||
await history.click();
|
||||
|
||||
const menu = page.getByRole("menu", { name: "Recent commit messages" });
|
||||
const row = menu.getByRole("menuitem", { name: "Previous commit message" });
|
||||
const row = menu.getByRole("menuitem", { name: /Update inventory.*Review settlement totals/ });
|
||||
await expect(row).toBeVisible();
|
||||
const messageBox = await message.boundingBox();
|
||||
const menuBox = await menu.locator("..").boundingBox();
|
||||
expect(messageBox).not.toBeNull();
|
||||
expect(menuBox).not.toBeNull();
|
||||
expect(menuBox!.y + menuBox!.height).toBeLessThan(messageBox!.y);
|
||||
expect(Math.abs(menuBox!.x - messageBox!.x)).toBeLessThan(2);
|
||||
const messageBox = (await message.boundingBox())!;
|
||||
const menuBox = (await menu.locator("..").boundingBox())!;
|
||||
const rowBox = (await row.boundingBox())!;
|
||||
expect(messageBox.y - menuBox.y - menuBox.height).toBeCloseTo(3, 0);
|
||||
expect(Math.abs(menuBox.x - messageBox.x)).toBeLessThan(2);
|
||||
expect(menuBox.height).toBeLessThan(rowBox.height * 8);
|
||||
await expect(row).toHaveCSS("font-family", await message.evaluate((el) => getComputedStyle(el).fontFamily));
|
||||
await expect(row).toHaveCSS("font-size", await message.evaluate((el) => getComputedStyle(el).fontSize));
|
||||
await expect(row.locator("span")).toHaveCount(1);
|
||||
|
||||
await row.press("Escape");
|
||||
await expect(menu).toBeHidden();
|
||||
await expect(message).toHaveValue("Draft");
|
||||
await history.click();
|
||||
await row.press("Home");
|
||||
await expect(row).toBeFocused();
|
||||
await page.keyboard.press("ArrowDown");
|
||||
const second = menu.getByRole("menuitem", { name: /Update inventory.*Reconcile export records/ });
|
||||
await expect(second).toBeFocused();
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(message).toHaveValue("Update inventory\n\nReconcile export records");
|
||||
await expect(message).toBeFocused();
|
||||
});
|
||||
|
||||
test("Amend shows the original author and warns when the committer differs", async ({ workbench: page }) => {
|
||||
@@ -1215,6 +1314,60 @@ async function stubEarlierAmend(page: Page) {
|
||||
});
|
||||
}
|
||||
|
||||
test("Amend sizes the chooser for long subjects while keeping the last commit action distinct", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await stubEarlierAmend(page);
|
||||
const tip = "Record regional settlement adjustments across the quarterly audit and reconciliation reports";
|
||||
const earlier = "Expand the warehouse reconciliation report with monthly ledger and inventory audit totals";
|
||||
await page.evaluate(
|
||||
({ tip, earlier }) => {
|
||||
const handlers = window.__ipc.handlers;
|
||||
const log = handlers.vcs_log!;
|
||||
handlers.vcs_log = (args) =>
|
||||
(log(args) as { id: string; summary: string; message: string }[]).map((commit) => {
|
||||
const subject = commit.id === "1111111" ? tip : commit.id === "aaaaaaa" ? earlier : commit.summary;
|
||||
return { ...commit, summary: subject, message: subject };
|
||||
});
|
||||
},
|
||||
{ tip, earlier },
|
||||
);
|
||||
await page.setViewportSize({ width: 1040, height: 700 });
|
||||
await page.keyboard.press("Meta+k");
|
||||
const panel = page.getByRole("region", { name: "Commit", exact: true });
|
||||
const choose = panel.getByRole("button", { name: "Choose Commit to Amend", exact: true });
|
||||
await choose.click();
|
||||
const list = page.getByRole("listbox", { name: "Choose Commit to Amend", exact: true });
|
||||
const popup = list.locator("xpath=ancestor::*[@data-popup]");
|
||||
const search = popup.getByRole("textbox", { name: "Search commits", exact: true });
|
||||
const last = list.getByRole("option", { name: /^Amend Last Commit/ });
|
||||
const previous = list.getByRole("option", { name: earlier, exact: true });
|
||||
|
||||
await expect(previous).toBeVisible();
|
||||
const wide = (await popup.boundingBox())!;
|
||||
expect(wide.width).toBeGreaterThan(360);
|
||||
expect(wide.width).toBeLessThanOrEqual(522);
|
||||
await expect(last.getByText("Amend Last Commit", { exact: true })).toHaveCSS("font-weight", "600");
|
||||
await expect(last.getByText(tip, { exact: true })).toHaveAttribute("title", tip);
|
||||
await expect(previous.getByText(earlier, { exact: true })).toHaveAttribute("title", earlier);
|
||||
|
||||
await page.setViewportSize({ width: 440, height: 520 });
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const box = (await popup.boundingBox())!;
|
||||
return box.x >= 0 && box.x + box.width <= 440 && box.width < wide.width;
|
||||
})
|
||||
.toBe(true);
|
||||
await expect(search).toBeFocused();
|
||||
await search.fill("inventory audit");
|
||||
await expect(previous).toBeVisible();
|
||||
await search.press("Enter");
|
||||
await expect(list).toBeHidden();
|
||||
await page.setViewportSize({ width: 1040, height: 700 });
|
||||
await page.keyboard.press("Meta+k");
|
||||
await expect(panel.getByRole("textbox", { name: "Commit message" })).toHaveValue(earlier);
|
||||
});
|
||||
|
||||
test("Amend can select an earlier commit before protected history", async ({ workbench: page }) => {
|
||||
await stubEarlierAmend(page);
|
||||
await page.keyboard.press("Meta+k");
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* with its frames and variables, and stepping and resuming go back to the adapter. The adapter is
|
||||
* stubbed at the IPC layer; `crates/ide-dap/tests` drives real ones.
|
||||
*/
|
||||
import type { JvmMemoryResult } from "../src/platform/ipc";
|
||||
import { expect, ipcCalls, openFromTree, stubDesktop, test } from "./fixtures";
|
||||
|
||||
const ROOT = "/dev/acme-api";
|
||||
@@ -114,6 +115,83 @@ test("stops at a breakpoint, shows frames and variables, steps and resumes", asy
|
||||
await expect(debug.getByText("CreateOrderRequest(sku='A-1', qty=2)")).toBeHidden();
|
||||
});
|
||||
|
||||
test("Memory gives class filtering the available toolbar width and exposes changed-only filtering", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
const rows = [
|
||||
{ name: "OrderCache", instances: 64, deltaInstances: 12 },
|
||||
{ name: "OrderRepository", instances: 16, deltaInstances: 0 },
|
||||
].map((row) => ({ ...row, bytes: row.instances * 16, deltaBytes: null, module: null, ambiguous: false }));
|
||||
const result: JvmMemoryResult = {
|
||||
status: "ready",
|
||||
snapshot: {
|
||||
rows,
|
||||
totalInstances: 80,
|
||||
totalBytes: 1280,
|
||||
javaVersion: "21",
|
||||
takenWhileSuspended: true,
|
||||
hasBaseline: true,
|
||||
elapsedMs: 5,
|
||||
source: "debugger",
|
||||
},
|
||||
};
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(
|
||||
async ({ result, id }) => {
|
||||
const caps = { jvmMemory: true, jvmHeap: true };
|
||||
window.__ipc.handlers.debug_capabilities = () => caps;
|
||||
window.__ipc.handlers.debug_jvm_memory_classes = () => result;
|
||||
const debugPath = "/src/features/debugger/state.ts";
|
||||
const { adoptSession } = await import(/* @vite-ignore */ debugPath);
|
||||
adoptSession(id, { adapter: "java-debug", name: "Billing Service", status: "paused", caps });
|
||||
const dockPath = "/src/workbench/toolwindows/store.ts";
|
||||
const layout = await import(/* @vite-ignore */ dockPath);
|
||||
layout.moveToolWindow("debug", "bottom");
|
||||
layout.setToolWindowSize("bottom", 300);
|
||||
layout.showToolWindow("debug", true);
|
||||
},
|
||||
{ result, id: SESSION },
|
||||
);
|
||||
|
||||
const debug = page.getByRole("region", { name: "Debug", exact: true });
|
||||
await debug.getByRole("tab", { name: "Memory" }).click();
|
||||
const toolbar = debug.getByRole("toolbar", { name: "Memory", exact: true });
|
||||
const filter = toolbar.getByRole("textbox", { name: "Filter classes" });
|
||||
const options = toolbar.getByRole("button", { name: "View Options" });
|
||||
const grid = debug.getByRole("grid", { name: "Memory", exact: true });
|
||||
await expect(grid.getByText("OrderRepository", { exact: true })).toBeVisible();
|
||||
expect((await filter.boundingBox())!.width).toBeGreaterThan((await toolbar.boundingBox())!.width / 2);
|
||||
|
||||
await page.evaluate(async () => {
|
||||
const dockPath = "/src/workbench/toolwindows/store.ts";
|
||||
const layout = await import(/* @vite-ignore */ dockPath);
|
||||
layout.moveToolWindow("debug", "right");
|
||||
layout.setToolWindowSize("right", 330);
|
||||
});
|
||||
await expect.poll(async () => (await toolbar.boundingBox())!.width).toBeCloseTo(330, 0);
|
||||
const bar = (await toolbar.boundingBox())!;
|
||||
const gear = (await options.boundingBox())!;
|
||||
const input = (await filter.boundingBox())!;
|
||||
expect(input.width).toBeGreaterThan(bar.width / 2);
|
||||
expect(input.x + input.width).toBeLessThan(gear.x);
|
||||
expect(gear.x + gear.width).toBeLessThanOrEqual(bar.x + bar.width);
|
||||
|
||||
await filter.fill("cache");
|
||||
await expect(grid.getByText("OrderRepository", { exact: true })).toBeHidden();
|
||||
await toolbar.getByRole("button", { name: "Clear", exact: true }).click();
|
||||
await expect(grid.getByText("OrderRepository", { exact: true })).toBeVisible();
|
||||
|
||||
await options.press("Enter");
|
||||
const changed = page.getByRole("menuitemcheckbox", { name: "Changed only" });
|
||||
await expect(changed).not.toBeChecked();
|
||||
await changed.press("Enter");
|
||||
await expect(grid.getByText("OrderRepository", { exact: true })).toBeHidden();
|
||||
await expect(options).toHaveAttribute("aria-pressed", "true");
|
||||
await expect(options).toBeFocused();
|
||||
await options.press("Enter");
|
||||
await expect(changed).toBeChecked();
|
||||
});
|
||||
|
||||
test("Evaluate keeps a multiline expression and its result visible in a short dialog", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 580, height: 420 });
|
||||
await stubDesktop(page);
|
||||
|
||||
@@ -88,3 +88,40 @@ test("a close button on the left keeps a narrow slot before the icon", async ({
|
||||
const slot = await box(closeOf(selected));
|
||||
expect(slot.x + slot.width).toBeLessThanOrEqual(label.x + 0.5);
|
||||
});
|
||||
|
||||
test("a pinned editor tab uses the close slot and can be unpinned from it", async ({ workbench: page }) => {
|
||||
await openFromTree(page, "README.md");
|
||||
await openFromTree(page, "build.gradle.kts");
|
||||
const strip = page.getByRole("tablist", { name: "Editor tabs" });
|
||||
const unpinned = strip.getByRole("tab", { name: "build.gradle.kts", exact: true });
|
||||
const pinned = strip.getByRole("tab", { name: "build.gradle.kts Pinned", exact: true });
|
||||
const menu = page.getByRole("menu", { name: "Context menu" });
|
||||
const pin = async () => {
|
||||
await unpinned.click({ button: "right" });
|
||||
await menu.getByRole("menuitem", { name: "Pin Tab", exact: true }).click();
|
||||
};
|
||||
await pin();
|
||||
const unpin = pinned.locator("..").getByRole("button", { name: "Unpin Tab", exact: true });
|
||||
|
||||
for (const closeButtonPosition of ["right", "left"]) {
|
||||
await setTabs(page, { closeButtonPosition });
|
||||
await expect(closeOf(pinned)).toHaveCount(0);
|
||||
const tab = await box(pinned.locator(".."));
|
||||
const action = await box(unpin);
|
||||
const label = await box(pinned.locator(":scope > span"));
|
||||
const inset = closeButtonPosition === "left" ? action.x - tab.x : tab.x + tab.width - action.x - action.width;
|
||||
expect(inset).toBeCloseTo(2, 0);
|
||||
expect(action.width).toBeCloseTo(16, 0);
|
||||
if (closeButtonPosition === "left") expect(action.x + action.width).toBeLessThanOrEqual(label.x);
|
||||
else expect(action.x).toBeGreaterThanOrEqual(label.x + label.width);
|
||||
}
|
||||
|
||||
await setTabs(page, { showCloseButton: false });
|
||||
await unpin.click();
|
||||
await expect(unpinned).toHaveAttribute("aria-selected", "true");
|
||||
await expect(closeOf(unpinned)).toHaveCount(0);
|
||||
|
||||
await pin();
|
||||
await pinned.click({ button: "middle" });
|
||||
await expect(pinned).toHaveCount(0);
|
||||
});
|
||||
@@ -0,0 +1,81 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
async function openEditorTabsSettings(page: Page) {
|
||||
await page.evaluate(async () => {
|
||||
const actionsModule = "/src/platform/actions.ts";
|
||||
const { executeAction } = await import(/* @vite-ignore */ actionsModule);
|
||||
await executeAction("file.settings", "editor.general.editorTabs");
|
||||
});
|
||||
const dialog = page.getByRole("dialog", { name: "Settings", exact: true });
|
||||
await expect(dialog.getByRole("region", { name: "Closing Policy", exact: true })).toBeVisible();
|
||||
return dialog;
|
||||
}
|
||||
|
||||
test("Editor Tabs aligns appearance fields and stacks closing choices at both widths", async ({ workbench: page }) => {
|
||||
const settings = await openEditorTabsSettings(page);
|
||||
const appearance = settings.getByRole("region", { name: "Appearance", exact: true });
|
||||
const placement = appearance.getByRole("button", { name: "Tab placement", exact: true });
|
||||
const closePosition = appearance.getByRole("button", { name: "Close button position", exact: true });
|
||||
const closing = settings.getByRole("region", { name: "Closing Policy", exact: true });
|
||||
const limit = closing.getByRole("textbox", { name: "Tab limit", exact: true });
|
||||
const footer = settings.getByRole("button", { name: "OK", exact: true });
|
||||
|
||||
for (const width of [1100, 580]) {
|
||||
await page.setViewportSize({ width, height: 760 });
|
||||
const placementBox = (await placement.boundingBox())!;
|
||||
const closeBox = (await closePosition.boundingBox())!;
|
||||
expect(Math.abs(placementBox.x - closeBox.x)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(placementBox.width - closeBox.width)).toBeLessThanOrEqual(1);
|
||||
await expect(placement).toBeInViewport();
|
||||
await expect(limit).toHaveValue("30");
|
||||
|
||||
for (const name of ["When the tab limit is reached", "When the current tab is closed, activate"]) {
|
||||
const choices = closing.getByRole("radiogroup", { name, exact: true }).getByRole("radio");
|
||||
const first = (await choices.first().boundingBox())!;
|
||||
const last = (await choices.last().boundingBox())!;
|
||||
expect(Math.abs(first.x - last.x)).toBeLessThanOrEqual(1);
|
||||
expect(last.y).toBeGreaterThan(first.y + first.height);
|
||||
expect(last.x + last.width).toBeLessThanOrEqual(width);
|
||||
}
|
||||
await expect(footer).toBeInViewport();
|
||||
}
|
||||
});
|
||||
|
||||
test("Editor Tabs keeps row and overflow choices independently selected and keyboard operable", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
const settings = await openEditorTabsSettings(page);
|
||||
const group = settings.getByRole("radiogroup", { name: "Show tabs in", exact: true });
|
||||
const one = group.getByRole("radio", { name: /^One row/ });
|
||||
const multiple = group.getByRole("radio", { name: "Multiple rows", exact: true });
|
||||
const scroll = group.getByRole("radio", { name: "Scroll the tabs panel", exact: true });
|
||||
const squeeze = group.getByRole("radio", { name: "Squeeze tabs", exact: true });
|
||||
await expect(one).toBeChecked();
|
||||
await expect(scroll).toBeChecked();
|
||||
const oneBox = (await one.boundingBox())!;
|
||||
const scrollBox = (await scroll.boundingBox())!;
|
||||
const multipleBox = (await multiple.boundingBox())!;
|
||||
expect(scrollBox.x).toBeGreaterThan(oneBox.x + 8);
|
||||
expect(scrollBox.y).toBeGreaterThan(oneBox.y);
|
||||
expect(Math.abs(multipleBox.x - oneBox.x)).toBeLessThanOrEqual(1);
|
||||
expect(multipleBox.y).toBeGreaterThan(scrollBox.y);
|
||||
|
||||
await scroll.press("ArrowDown");
|
||||
await expect(squeeze).toBeFocused();
|
||||
await expect(squeeze).toBeChecked();
|
||||
await expect(one).toBeChecked();
|
||||
await one.press("ArrowDown");
|
||||
await expect(multiple).toBeFocused();
|
||||
await expect(multiple).toBeChecked();
|
||||
await expect(squeeze).toBeDisabled();
|
||||
await expect(squeeze).toBeChecked();
|
||||
await multiple.press("ArrowUp");
|
||||
await expect(one).toBeChecked();
|
||||
await expect(squeeze).toBeEnabled();
|
||||
await settings.getByRole("button", { name: "OK", exact: true }).click();
|
||||
|
||||
const reopened = await openEditorTabsSettings(page);
|
||||
await expect(reopened.getByRole("radio", { name: /^One row/ })).toBeChecked();
|
||||
await expect(reopened.getByRole("radio", { name: "Squeeze tabs", exact: true })).toBeChecked();
|
||||
});
|
||||
@@ -0,0 +1,80 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
const root = "/dev/acme-api";
|
||||
const stem = "InternationalSettlementRegionalReconciliationAndAuditWarehouseAllocationConfiguration";
|
||||
const original = stem + ".txt";
|
||||
const renamed = "WarehouseAllocation.txt";
|
||||
|
||||
test("file rename groups the name and reflows the options without losing validation", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1000, height: 700 });
|
||||
await page.evaluate(
|
||||
async ({ root, original }) => {
|
||||
const fsModule = "/src/features/project-tree/fs.ts";
|
||||
const storeModule = "/src/features/project-tree/store.ts";
|
||||
const { projectFs } = await import(/* @vite-ignore */ fsModule);
|
||||
const { loadDir } = await import(/* @vite-ignore */ storeModule);
|
||||
await projectFs(root).createFile(root + "/" + original);
|
||||
await loadDir(root, true);
|
||||
},
|
||||
{ root, original },
|
||||
);
|
||||
const source = page.getByRole("treeitem", { name: original, exact: true });
|
||||
await source.click();
|
||||
await page.keyboard.press("Shift+F6");
|
||||
|
||||
const dialog = page.getByRole("dialog", { name: "Rename", exact: true });
|
||||
const prompt = dialog.getByText("Rename file '" + original + "' and its usages to:", { exact: true });
|
||||
const field = dialog.getByRole("textbox", { name: "New name" });
|
||||
const references = dialog.getByRole("checkbox", { name: "Search for references" });
|
||||
const comments = dialog.getByRole("checkbox", { name: "Search in comments and strings" });
|
||||
const submit = dialog.getByRole("button", { name: "Refactor", exact: true });
|
||||
const referencesRow = references.locator("xpath=ancestor::label");
|
||||
const commentsRow = comments.locator("xpath=ancestor::label");
|
||||
|
||||
await expect(field).toBeFocused();
|
||||
const selected = await field.evaluate((el: HTMLInputElement) => el.value.slice(el.selectionStart!, el.selectionEnd!));
|
||||
expect(selected).toBe(stem);
|
||||
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const a = (await prompt.boundingBox())!;
|
||||
const b = (await field.boundingBox())!;
|
||||
return b.y - a.y - a.height;
|
||||
})
|
||||
.toBeCloseTo(4, 0);
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const a = (await referencesRow.boundingBox())!;
|
||||
const b = (await commentsRow.boundingBox())!;
|
||||
return Math.abs(a.y - b.y) < 1 && b.x >= a.x + a.width;
|
||||
})
|
||||
.toBe(true);
|
||||
|
||||
await field.fill("README.md");
|
||||
await expect(dialog.getByRole("alert")).toBeVisible();
|
||||
await expect(submit).toBeDisabled();
|
||||
await page.setViewportSize({ width: 400, height: 520 });
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const a = (await referencesRow.boundingBox())!;
|
||||
const b = (await commentsRow.boundingBox())!;
|
||||
return b.y >= a.y + a.height;
|
||||
})
|
||||
.toBe(true);
|
||||
await expect(field).toHaveValue("README.md");
|
||||
await expect(prompt).toBeInViewport({ ratio: 1 });
|
||||
await expect(submit).toBeInViewport({ ratio: 1 });
|
||||
expect(
|
||||
await dialog.locator("[data-dialog-body]").evaluate((node) => node.scrollWidth - node.clientWidth),
|
||||
).toBeLessThanOrEqual(1);
|
||||
|
||||
await field.fill(renamed);
|
||||
await expect(dialog.getByRole("alert")).toBeHidden();
|
||||
await references.uncheck();
|
||||
await comments.uncheck();
|
||||
await submit.click();
|
||||
await expect(dialog).toBeHidden();
|
||||
await page.setViewportSize({ width: 1000, height: 700 });
|
||||
await expect(page.getByRole("treeitem", { name: renamed, exact: true })).toBeVisible();
|
||||
await expect(source).toHaveCount(0);
|
||||
});
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { Locator, Page } from "@playwright/test";
|
||||
import { expect, openFromTree, test } from "./fixtures";
|
||||
|
||||
const latest = "regional-order-reconciliation-endpoints-for-sandbox-environments/".repeat(3) + "checkout\nText to find";
|
||||
|
||||
async function seedHistory(page: Page, kind: "find" | "replace") {
|
||||
await page.evaluate(
|
||||
async ({ kind, latest }) => {
|
||||
const searchModule = "/src/platform/search.ts";
|
||||
const { rememberSearch } = await import(/* @vite-ignore */ searchModule);
|
||||
for (let i = 0; i < 19; i++) rememberSearch(kind, `Order rule ${i}`);
|
||||
rememberSearch(kind, latest);
|
||||
},
|
||||
{ kind, latest },
|
||||
);
|
||||
}
|
||||
|
||||
async function openHistory(field: Locator, menu: Locator) {
|
||||
await field.focus();
|
||||
await field.press("Alt+ArrowDown");
|
||||
await expect(menu).toBeVisible();
|
||||
}
|
||||
|
||||
test("editor find history grows with the field and restores the original query", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1040, height: 700 });
|
||||
await openFromTree(page, "build.gradle.kts");
|
||||
await page.keyboard.press("Meta+f");
|
||||
await seedHistory(page, "find");
|
||||
|
||||
const field = page.getByRole("textbox", { name: "Find", exact: true });
|
||||
const menu = page.getByRole("menu", { name: "Recent Searches", exact: true });
|
||||
await openHistory(field, menu);
|
||||
|
||||
const newest = menu.getByRole("menuitem").first();
|
||||
await expect(newest).toHaveText(latest.replace("\n", " ⏎ "));
|
||||
await expect(newest).toHaveAttribute("title", latest);
|
||||
await expect.poll(async () => (await menu.boundingBox())!.width).toBeGreaterThan(420);
|
||||
await newest.press("Enter");
|
||||
await expect(menu).toBeHidden();
|
||||
await expect(field).toHaveValue(latest);
|
||||
await expect(field).toBeFocused();
|
||||
});
|
||||
|
||||
test("project replacement history stays inside a narrow window and keeps its heading visible", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 440, height: 520 });
|
||||
await page.keyboard.press("Meta+Shift+r");
|
||||
await seedHistory(page, "replace");
|
||||
|
||||
const field = page.getByRole("textbox", { name: "Replace with" });
|
||||
const menu = page.getByRole("menu", { name: "Recent Replacements" });
|
||||
await openHistory(field, menu);
|
||||
|
||||
const popup = menu.locator("..");
|
||||
const heading = popup.getByText("Recent Replacements", { exact: true });
|
||||
const newest = menu.getByRole("menuitem").first();
|
||||
await expect(newest).toHaveText(latest.replace("\n", " ⏎ "));
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const { x, width } = (await popup.boundingBox())!;
|
||||
return x >= 0 && x + width <= 440;
|
||||
})
|
||||
.toBe(true);
|
||||
|
||||
await newest.press("End");
|
||||
const oldest = menu.getByRole("menuitem").last();
|
||||
await expect(oldest).toBeFocused();
|
||||
await expect.poll(async () => popup.evaluate((node) => node.scrollTop)).toBeGreaterThan(0);
|
||||
await expect(heading).toBeInViewport();
|
||||
|
||||
await oldest.press("Home");
|
||||
await expect(newest).toBeFocused();
|
||||
await newest.press("Enter");
|
||||
await expect(menu).toBeHidden();
|
||||
await expect(field).toHaveValue(latest);
|
||||
await expect(field).toBeFocused();
|
||||
});
|
||||
@@ -1,6 +1,66 @@
|
||||
import type { Locator } from "@playwright/test";
|
||||
import { expect, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("Find Usages places read and write filters with the other actions", async ({ workbench: page }) => {
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
const modulePath = "/src/features/code-insight/usages.ts";
|
||||
const { useUsagesPopup } = await import(modulePath);
|
||||
const path = "/dev/acme-api/src/SettlementService.ts";
|
||||
const lines = ["const current = settlement;", "settlement = next;"];
|
||||
window.__ipc.handlers.fs_read_text = () => lines.join("\n");
|
||||
useUsagesPopup.setState({
|
||||
open: true,
|
||||
anchor: { x: 100, y: 150 },
|
||||
symbol: "settlement",
|
||||
loading: false,
|
||||
scope: "project",
|
||||
groups: [
|
||||
{
|
||||
path,
|
||||
usages: lines.map((text, line) => ({
|
||||
path,
|
||||
line,
|
||||
col: text.indexOf("settlement"),
|
||||
endCol: text.indexOf("settlement") + "settlement".length,
|
||||
text,
|
||||
access: line === 0 ? "read" : "write",
|
||||
})),
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
const popup = page.getByRole("dialog", { name: "Usages", exact: true });
|
||||
const read = { name: "Show read accesses", exact: true };
|
||||
const write = { name: "Show write accesses", exact: true };
|
||||
const actions = popup.getByRole("button", { name: "Show Preview", exact: true }).locator("..");
|
||||
await expect(popup.getByRole("option")).toHaveCount(2);
|
||||
for (const width of [1120, 540]) {
|
||||
await page.setViewportSize({ width, height: 640 });
|
||||
expect(await actions.getByRole("toolbar", { name: "Usage access filters", exact: true }).count()).toBe(1);
|
||||
await expect(actions.getByRole("button", read)).toBeInViewport({ ratio: 1 });
|
||||
await expect(actions.getByRole("button", write)).toBeInViewport({ ratio: 1 });
|
||||
}
|
||||
await actions.getByRole("button", write).click();
|
||||
await expect(popup.getByRole("option")).toHaveCount(1);
|
||||
await popup.getByRole("button", { name: /Open in Find Window/ }).click();
|
||||
|
||||
const view = page.getByRole("region", { name: "Find Usages", exact: true });
|
||||
const toolbar = view.getByRole("toolbar", { name: "Usages actions", exact: true });
|
||||
const readButton = toolbar.getByRole("button", read);
|
||||
const writeButton = toolbar.getByRole("button", write);
|
||||
await expect(readButton).toHaveAttribute("aria-pressed", "true");
|
||||
await expect(writeButton).toHaveAttribute("aria-pressed", "false");
|
||||
const a = (await readButton.boundingBox())!;
|
||||
const b = (await writeButton.boundingBox())!;
|
||||
expect(a.x).toBeCloseTo(b.x, 0);
|
||||
expect(b.y).toBeGreaterThanOrEqual(a.y + a.height);
|
||||
await expect(view.locator("mark")).toHaveCount(1);
|
||||
await writeButton.click();
|
||||
await expect(view.locator("mark")).toHaveCount(2);
|
||||
});
|
||||
|
||||
async function checkSize(icon: Locator, size = 16) {
|
||||
const dimensions = await icon.evaluate((node) => {
|
||||
const style = getComputedStyle(node);
|
||||
|
||||
@@ -3,11 +3,12 @@ import { expect, openFromTree, stubDesktop, test } from "./fixtures";
|
||||
test("Git annotations align dates and full author names at UI text size", async ({ workbench: page }) => {
|
||||
const editor = await openFromTree(page, "build.gradle.kts");
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
const longEmail = `reconciliation+${"regional-settlement-".repeat(5)}[email protected]`;
|
||||
await page.evaluate(async (email) => {
|
||||
const root = "/dev/acme-api";
|
||||
const file = `${root}/build.gradle.kts`;
|
||||
const handlers = window.__ipc.handlers;
|
||||
handlers.vcs_blame = () => [
|
||||
const lines = [
|
||||
{
|
||||
commit: "a1234567".padEnd(40, "a"),
|
||||
author: "Lena Park",
|
||||
@@ -21,6 +22,23 @@ test("Git annotations align dates and full author names at UI text size", async
|
||||
summary: "Review totals",
|
||||
},
|
||||
];
|
||||
handlers.vcs_blame = () => lines;
|
||||
handlers.vcs_log = ({ query }) => {
|
||||
const { branch } = query as { branch?: string };
|
||||
const line = lines.find(({ commit }) => commit === branch);
|
||||
if (!line) return [];
|
||||
return [
|
||||
{
|
||||
...line,
|
||||
id: line.commit,
|
||||
shortId: line.commit.slice(0, 8),
|
||||
refs: [],
|
||||
parents: [],
|
||||
email: line === lines[0] ? "[email protected]" : email,
|
||||
message: line.summary,
|
||||
},
|
||||
];
|
||||
};
|
||||
const projectModule = "/src/platform/project.ts";
|
||||
const { useProject } = await import(/* @vite-ignore */ projectModule);
|
||||
const { settings } = useProject.getState();
|
||||
@@ -39,7 +57,7 @@ test("Git annotations align dates and full author names at UI text size", async
|
||||
const actionsModule = "/src/platform/actions.ts";
|
||||
const { executeAction } = await import(/* @vite-ignore */ actionsModule);
|
||||
await executeAction("vcs.annotate", file);
|
||||
});
|
||||
}, longEmail);
|
||||
|
||||
const gutter = editor.locator(".cm-vcs-blame");
|
||||
const first = gutter.locator("[data-commit]").filter({ hasText: "3 May 2026" });
|
||||
@@ -51,6 +69,21 @@ test("Git annotations align dates and full author names at UI text size", async
|
||||
await expect
|
||||
.poll(async () => Math.abs((await firstAuthor.boundingBox())!.x - (await secondAuthor.boundingBox())!.x))
|
||||
.toBeLessThan(1);
|
||||
|
||||
await first.hover();
|
||||
const details = page.getByRole("dialog").filter({ has: page.getByTitle("Show Commit in Git Log") });
|
||||
await expect(details).toContainText("[email protected]");
|
||||
await expect.poll(async () => (await details.boundingBox())!.width).toBeLessThan(400);
|
||||
await expect(details.getByTitle("Show Commit in Git Log")).toHaveCSS(
|
||||
"font-family",
|
||||
await details.evaluate((el) => getComputedStyle(el).fontFamily),
|
||||
);
|
||||
|
||||
await page.setViewportSize({ width: 430, height: 640 });
|
||||
await second.hover();
|
||||
await expect(details).toContainText(longEmail);
|
||||
await expect(details).toBeInViewport({ ratio: 1 });
|
||||
await expect.poll(() => details.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
|
||||
const uiSize = await editor.evaluate((el) => getComputedStyle(el).getPropertyValue("--fs-ui").trim());
|
||||
await expect(firstAuthor).toHaveCSS("font-size", uiSize);
|
||||
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
import { expect, stubDesktop, test } from "./fixtures";
|
||||
|
||||
const rootSubject = "Start warehouse reporting";
|
||||
const mergeSubject = "Merge reporting changes";
|
||||
const firstSubject = "Align regional settlement totals with the warehouse ledger before monthly reconciliation closes";
|
||||
const secondSubject = "Keep archived settlement adjustments in the regional audit trail after the ledger is rebuilt";
|
||||
|
||||
test("Git Log commit choices fit their rows and navigate by keyboard after filtering", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1040, height: 700 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(
|
||||
async ({ mergeSubject, firstSubject, secondSubject, rootSubject }) => {
|
||||
const root = "/dev/acme-api";
|
||||
const changes = [
|
||||
[mergeSubject, "Merge Author", [1, 2]],
|
||||
[firstSubject, "Priya Kapoor", [3]],
|
||||
[secondSubject, "Morgan Olsen", [3]],
|
||||
[rootSubject, "Initial Author", []],
|
||||
] as const;
|
||||
const id = (i: number) => String(i + 1).repeat(40);
|
||||
const commits = changes.map(([summary, author, parents], i) => ({
|
||||
id: id(i),
|
||||
shortId: id(i).slice(0, 8),
|
||||
parents: parents.map(id),
|
||||
refs: i === 0 ? ["HEAD", "main"] : [],
|
||||
author,
|
||||
email: "[email protected]",
|
||||
timeMs: Date.UTC(2026, 10, 15 - i, 10 + i, 30),
|
||||
summary,
|
||||
message: summary,
|
||||
}));
|
||||
const handlers = window.__ipc.handlers;
|
||||
handlers.vcs_log = ({ query }) => {
|
||||
const { skip, limit, range } = query as { skip: number; limit: number; range?: string };
|
||||
return range ? [] : commits.slice(skip, limit ? skip + limit : undefined);
|
||||
};
|
||||
handlers.vcs_log_refs = () => ({});
|
||||
handlers.vcs_log_users = () => [];
|
||||
handlers.vcs_branches = () => [];
|
||||
handlers.vcs_branch_info = () => ({ head: "main", headCommit: id(0), ahead: 0, behind: 0 });
|
||||
handlers.vcs_config_get = () => null;
|
||||
handlers.vcs_commit_files = () => [];
|
||||
handlers.vcs_log_details_batch = ({ revisions }) =>
|
||||
(revisions as string[]).map(() => ({ message: "", containingBranches: [], signature: "N" }));
|
||||
const vcsModule = "/src/features/vcs/store.ts";
|
||||
const contextModule = "/src/platform/context.ts";
|
||||
const actionsModule = "/src/platform/actions.ts";
|
||||
const { useVcs } = await import(/* @vite-ignore */ vcsModule);
|
||||
const { setContext } = await import(/* @vite-ignore */ contextModule);
|
||||
const { executeAction } = await import(/* @vite-ignore */ actionsModule);
|
||||
useVcs.setState({ available: true, root, repo: root, roots: [root], branchesLoaded: true });
|
||||
setContext("vcsAvailable", true);
|
||||
await executeAction("vcs.showLog");
|
||||
},
|
||||
{ mergeSubject, firstSubject, secondSubject, rootSubject },
|
||||
);
|
||||
|
||||
const log = page.getByRole("listbox", { name: "Commits", exact: true });
|
||||
const merge = log.getByRole("option", { name: new RegExp(mergeSubject) });
|
||||
await merge.click();
|
||||
await log.press("ArrowRight");
|
||||
const chooser = page.getByRole("dialog", { name: "Select Parent Commit", exact: true });
|
||||
const options = chooser.getByRole("option");
|
||||
const filter = chooser.getByRole("combobox", { name: "Search commits" });
|
||||
await expect(filter).toBeFocused();
|
||||
await expect(options).toHaveCount(2);
|
||||
const before = (await chooser.boundingBox())!;
|
||||
expect(before.height).toBeLessThan(200);
|
||||
const first = options.filter({ hasText: firstSubject });
|
||||
const subject = first.getByText(firstSubject, { exact: true });
|
||||
const author = first.getByText("Priya Kapoor", { exact: true });
|
||||
const hash = first.getByText("22222222", { exact: true });
|
||||
await expect(subject).toHaveCSS("font-size", "13px");
|
||||
await expect(author).toHaveCSS("font-size", "12px");
|
||||
expect((await subject.boundingBox())!.y).toBeLessThan((await hash.boundingBox())!.y);
|
||||
await expect(subject.locator("..")).toHaveAttribute("title", /Priya Kapoor/);
|
||||
|
||||
await page.setViewportSize({ width: 440, height: 520 });
|
||||
const narrow = (await chooser.boundingBox())!;
|
||||
expect(narrow.x + narrow.width).toBeLessThanOrEqual(440);
|
||||
expect(await chooser.evaluate((node) => node.scrollWidth - node.clientWidth)).toBeLessThanOrEqual(1);
|
||||
await filter.fill("No such change");
|
||||
await expect(chooser.getByText("No commits", { exact: true })).toBeVisible();
|
||||
await filter.press("Enter");
|
||||
await expect(chooser).toBeVisible();
|
||||
await filter.fill("Morgan Olsen");
|
||||
await expect(options).toHaveCount(1);
|
||||
await expect(options.first()).toContainText(secondSubject);
|
||||
await filter.fill("");
|
||||
await expect(options).toHaveCount(2);
|
||||
await filter.press("ArrowDown");
|
||||
await expect(options.filter({ hasText: secondSubject })).toHaveAttribute("aria-selected", "true");
|
||||
await filter.press("Enter");
|
||||
await expect(chooser).toBeHidden();
|
||||
await expect(log.getByRole("option", { name: new RegExp(secondSubject) })).toHaveAttribute("aria-selected", "true");
|
||||
|
||||
await log.getByRole("option", { name: new RegExp(rootSubject) }).click();
|
||||
await log.press("ArrowLeft");
|
||||
const children = page.getByRole("dialog", { name: "Select Child Commit", exact: true });
|
||||
await expect(children.getByRole("option")).toHaveCount(2);
|
||||
await children.getByRole("option", { name: new RegExp(firstSubject) }).click();
|
||||
await expect(children).toBeHidden();
|
||||
await expect(log.getByRole("option", { name: new RegExp(firstSubject) })).toHaveAttribute("aria-selected", "true");
|
||||
});
|
||||
@@ -12,6 +12,30 @@ const names = [
|
||||
"InvoicePublisher.ts",
|
||||
];
|
||||
|
||||
test("a pinned editor tab can be unpinned from the hidden tabs list", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 700, height: 650 });
|
||||
await page.evaluate(async (first) => {
|
||||
const module = "/src/workbench/contributions.ts";
|
||||
const { editorService } = await import(/* @vite-ignore */ module);
|
||||
await editorService().openFile(`/dev/acme-api/${first}`);
|
||||
}, names[0]!);
|
||||
const strip = page.getByRole("tablist", { name: "Editor tabs" });
|
||||
const tab = strip.getByRole("tab", { name: names[0], exact: true });
|
||||
await tab.click({ button: "right" });
|
||||
await page.getByRole("menuitem", { name: "Pin Tab", exact: true }).click();
|
||||
await page.evaluate(async (files) => {
|
||||
const module = "/src/workbench/contributions.ts";
|
||||
const { editorService } = await import(/* @vite-ignore */ module);
|
||||
for (const name of files) await editorService().openFile(`/dev/acme-api/${name}`);
|
||||
}, names.slice(1));
|
||||
await strip.evaluate((element) => (element.scrollLeft = element.scrollWidth));
|
||||
await page.getByRole("button", { name: "Show Hidden Tabs" }).click();
|
||||
const row = page.getByRole("grid", { name: "Hidden Editor Tabs" }).getByRole("row").filter({ hasText: names[0]! });
|
||||
await expect(row.getByRole("button", { name: "Close Tab", exact: true })).toHaveCount(0);
|
||||
await row.getByRole("button", { name: "Unpin Tab", exact: true }).click();
|
||||
await expect(tab).toHaveCount(1);
|
||||
});
|
||||
|
||||
test("the editor overflow lists clipped tabs and can close or open one without touching visible tabs", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import { expect, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("image controls and metadata stay readable in a narrow editor", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1080, height: 700 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
const path = "/dev/acme-api/status.svg";
|
||||
const image =
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="128" height="96"><rect width="128" height="96"/></svg>';
|
||||
window.__ipc.handlers.fs_read_image = () => "data:image/svg+xml," + encodeURIComponent(image);
|
||||
window.__ipc.handlers.fs_probe = () => ({ size: 4096, binary: false, tooLarge: false });
|
||||
const contributions = "/src/workbench/contributions.ts";
|
||||
const { editorService } = await import(/* @vite-ignore */ contributions);
|
||||
await editorService().openFile(path);
|
||||
});
|
||||
const toolbars = page.getByRole("toolbar", { name: "Image viewer", exact: true });
|
||||
const toolbar = toolbars.last();
|
||||
const zoomIn = toolbar.getByRole("button", { name: "Zoom In", exact: true });
|
||||
const actualSize = toolbar.getByRole("button", { name: "Actual Size", exact: true });
|
||||
const chessboard = toolbar.getByRole("button", { name: "Show Chessboard", exact: true });
|
||||
const showText = toolbar.getByRole("button", { name: "Open as Text", exact: true });
|
||||
const dimensions = toolbar.getByText(/128\s*×\s*96/);
|
||||
await expect(page.getByRole("img", { name: "status.svg", exact: true })).toBeVisible();
|
||||
await expect(dimensions).toBeVisible();
|
||||
const wideHeight = (await toolbar.boundingBox())!.height;
|
||||
|
||||
await page.getByRole("button", { name: "Split Right", exact: true }).click();
|
||||
await expect(toolbars).toHaveCount(2);
|
||||
await page.setViewportSize({ width: 640, height: 570 });
|
||||
expect(await dimensions.evaluate((el) => el.scrollWidth - el.clientWidth)).toBe(0);
|
||||
expect((await toolbar.boundingBox())!.height).toBeGreaterThan(wideHeight);
|
||||
expect((await dimensions.boundingBox())!.y).toBeGreaterThan((await zoomIn.boundingBox())!.y);
|
||||
await expect(dimensions).toHaveCSS("font-size", "13px");
|
||||
await expect(showText).toHaveCSS("white-space", "nowrap");
|
||||
for (const item of [zoomIn, actualSize, chessboard, showText, dimensions]) {
|
||||
await expect(item).toBeInViewport({ ratio: 1 });
|
||||
}
|
||||
await expect(toolbar.getByText("4.0 KB", { exact: true })).toBeVisible();
|
||||
|
||||
await zoomIn.click();
|
||||
await expect(toolbar.getByText("125%", { exact: true })).toBeVisible();
|
||||
await actualSize.click();
|
||||
await expect(toolbar.getByText("100%", { exact: true })).toBeVisible();
|
||||
await chessboard.click();
|
||||
await expect(chessboard).toHaveAttribute("aria-pressed", "false");
|
||||
await showText.click();
|
||||
await expect(page.locator(".cm-content")).toBeVisible();
|
||||
});
|
||||
@@ -83,6 +83,10 @@ test("links independent Gradle roots, runs identical task paths in their own bui
|
||||
});
|
||||
const tasks = tree.getByRole("treeitem", { name: /^assemble\b/ });
|
||||
await expect(tasks).toHaveCount(2);
|
||||
expect(await tasks.allTextContents()).toEqual(["assemble", "assemble"]);
|
||||
for (const task of await tasks.all()) {
|
||||
await expect(task).toHaveAccessibleDescription("Assembles this project");
|
||||
}
|
||||
await page.screenshot({ path: info.outputPath("gradle-two-roots.png"), animations: "disabled" });
|
||||
|
||||
await tasks.nth(0).dblclick();
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
async function editMacros(page: Page) {
|
||||
await page.evaluate(async () => {
|
||||
const actions = "/src/platform/actions.ts";
|
||||
if (!(await (await import(/* @vite-ignore */ actions)).executeAction("macro.edit"))) throw Error("Edit Macros");
|
||||
});
|
||||
}
|
||||
|
||||
test("Edit Macros keeps a balanced, resizable split for names and recorded steps", async ({ workbench: page }) => {
|
||||
await page.evaluate(async () => {
|
||||
const model = "/src/features/macros/model.ts";
|
||||
const { saveMacro } = await import(/* @vite-ignore */ model);
|
||||
saveMacro("Insert comment", [{ kind: "text", text: "Review this block" }]);
|
||||
saveMacro("Wrap selection", [
|
||||
{ kind: "key", key: "Home" },
|
||||
{ kind: "text", text: "beginProcessingCurrentSelectionImmediately();".repeat(6) },
|
||||
{ kind: "key", key: "End" },
|
||||
]);
|
||||
});
|
||||
await editMacros(page);
|
||||
|
||||
const editor = page.getByRole("dialog", { name: "Edit Macros", exact: true });
|
||||
const macros = editor.getByRole("listbox", { name: "Macros" });
|
||||
const steps = editor.getByRole("list", { name: "Recorded steps" });
|
||||
const options = editor.getByRole("toolbar", { name: "Macros" });
|
||||
const divider = editor.getByRole("separator", { name: "Macros" });
|
||||
const [initial, stepsWidth] = await editor.evaluate((dialog) => [
|
||||
dialog.querySelector('[role="listbox"]')!.getBoundingClientRect().width,
|
||||
dialog.querySelector("ol")!.getBoundingClientRect().width,
|
||||
]);
|
||||
expect(Math.abs(initial - stepsWidth)).toBeLessThanOrEqual(1);
|
||||
await expect(macros).toBeFocused();
|
||||
expect((await steps.boundingBox())!.height).toBeGreaterThan(260);
|
||||
expect((await options.boundingBox())!.y).toBeLessThan((await macros.boundingBox())!.y);
|
||||
|
||||
await macros.getByRole("option", { name: "Wrap selection" }).click();
|
||||
await expect(steps.getByText("Press Home")).toBeVisible();
|
||||
await divider.press("ArrowRight");
|
||||
await expect.poll(async () => (await macros.boundingBox())!.width).toBeGreaterThan(initial + 5);
|
||||
const resized = (await macros.boundingBox())!.width;
|
||||
await editor.locator("[data-dialog-footer]").getByRole("button", { name: "Close" }).click();
|
||||
await editMacros(page);
|
||||
await expect.poll(async () => (await macros.boundingBox())!.width).toBeCloseTo(resized, 0);
|
||||
|
||||
await page.setViewportSize({ width: 400, height: 620 });
|
||||
await macros.getByRole("option", { name: "Wrap selection" }).click();
|
||||
expect(await steps.evaluate((list) => list.scrollWidth - list.clientWidth)).toBeLessThanOrEqual(1);
|
||||
await options.getByRole("button", { name: "Rename Macro" }).click();
|
||||
const rename = page.getByRole("dialog", { name: "Rename Macro", exact: true });
|
||||
await rename.getByRole("textbox").fill("Wrap text");
|
||||
await rename.getByRole("button", { name: "Rename", exact: true }).click();
|
||||
await expect(macros.getByRole("option", { name: "Wrap text" })).toBeVisible();
|
||||
await expect(steps.getByText("Press Home")).toBeVisible();
|
||||
});
|
||||
@@ -0,0 +1,74 @@
|
||||
import type { MavenModel } from "../src/platform/ipc";
|
||||
import { expect, stubDesktop, test } from "./fixtures";
|
||||
|
||||
const maven: MavenModel = {
|
||||
projects: [
|
||||
{
|
||||
pom: "pom.xml",
|
||||
dir: "",
|
||||
groupId: "dev.acme",
|
||||
artifactId: "billing",
|
||||
version: "1.0.0",
|
||||
packaging: "jar",
|
||||
displayName: "Billing",
|
||||
parent: null,
|
||||
modules: [],
|
||||
aggregated: false,
|
||||
plugins: [
|
||||
{
|
||||
groupId: "org.apache.maven.plugins",
|
||||
artifactId: "maven-surefire-plugin",
|
||||
version: "3.2.5",
|
||||
prefix: "surefire",
|
||||
goals: ["test"],
|
||||
},
|
||||
],
|
||||
dependencies: [],
|
||||
profiles: [],
|
||||
javaVersion: 21,
|
||||
command: "mvn",
|
||||
options: [],
|
||||
env: {},
|
||||
},
|
||||
],
|
||||
profiles: [],
|
||||
syncedAt: 1,
|
||||
stale: false,
|
||||
syncError: null,
|
||||
};
|
||||
|
||||
test("Maven plugin rows give the name priority over coordinates in narrow docks", async ({ workbench: page }) => {
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async (maven) => {
|
||||
window.__ipc.handlers.build_model = () => ({ maven, gradle: [] });
|
||||
const buildModule = "/src/features/build-tools/store.ts";
|
||||
const { loadModel, setExpanded } = await import(/* @vite-ignore */ buildModule);
|
||||
await loadModel();
|
||||
setExpanded("maven", new Set(["mvn:pom.xml", "mvn:pom.xml:plugins"]));
|
||||
const dockModule = "/src/workbench/toolwindows/store.ts";
|
||||
const { showToolWindow, setToolWindowSize } = await import(/* @vite-ignore */ dockModule);
|
||||
showToolWindow("maven", true);
|
||||
setToolWindowSize("right", 190);
|
||||
}, maven);
|
||||
|
||||
const tree = page.getByRole("tree", { name: "Maven projects" });
|
||||
const coordinates = "(org.apache.maven.plugins:maven-surefire-plugin:3.2.5)";
|
||||
const plugin = tree.getByRole("treeitem", { name: `surefire ${coordinates}`, exact: true });
|
||||
const name = plugin.getByText("surefire", { exact: true });
|
||||
const metadata = plugin.getByText(coordinates, { exact: true });
|
||||
await expect(name).toBeVisible();
|
||||
await expect(metadata).toHaveAttribute("title", coordinates);
|
||||
const fit = (el: Element) => {
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(el);
|
||||
return range.getBoundingClientRect().width <= el.getBoundingClientRect().width;
|
||||
};
|
||||
expect(await name.evaluate(fit)).toBe(true);
|
||||
expect(await metadata.evaluate(fit)).toBe(false);
|
||||
expect(await metadata.evaluate((el) => getComputedStyle(el).color)).not.toBe(
|
||||
await name.evaluate((el) => getComputedStyle(el).color),
|
||||
);
|
||||
|
||||
await plugin.locator("[data-tree-toggle]").click();
|
||||
await expect(tree.getByRole("treeitem", { name: "surefire:test", exact: true })).toBeVisible();
|
||||
});
|
||||
@@ -11,7 +11,7 @@ async function openNewBranchDialog(
|
||||
page: Page,
|
||||
from?: string,
|
||||
mergeBase = "1111111",
|
||||
blocked = false,
|
||||
blocked: boolean | string = false,
|
||||
withPrefix = false,
|
||||
) {
|
||||
await stubDesktop(page);
|
||||
@@ -43,7 +43,10 @@ async function openNewBranchDialog(
|
||||
];
|
||||
h.vcs_create_branch = ({ options }) =>
|
||||
blocked && (options as { mode?: string } | null)?.mode === "normal"
|
||||
? { checkout: { kind: "localChanges", files: ["dirty.txt"] }, created: null }
|
||||
? {
|
||||
checkout: { kind: "localChanges", files: [typeof blocked === "string" ? blocked : "dirty.txt"] },
|
||||
created: null,
|
||||
}
|
||||
: { checkout: { kind: "done" }, created: { tip: "2222222", previousTip: null } };
|
||||
h.vcs_merge_base = () => mergeBase;
|
||||
const vcsModule = "/src/features/vcs/store.ts";
|
||||
@@ -151,6 +154,36 @@ for (const [button, mode] of [
|
||||
});
|
||||
}
|
||||
|
||||
test("local changes review keeps file names and checkout choices visible", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1040, height: 740 });
|
||||
const folder = "services/international-payments/regional-settlement/weekly-close/adjustments";
|
||||
const path = `${folder}/ReceiptPolicy.ts`;
|
||||
const { dialog, input } = await openNewBranchDialog(page, "2".repeat(40), "1111111", path);
|
||||
await input.fill("topic");
|
||||
await dialog.getByRole("button", { name: "Create", exact: true }).click();
|
||||
const review = page.getByRole("dialog", { name: "Git Checkout Problem" });
|
||||
const force = review.getByRole("button", { name: "Force Checkout", exact: true });
|
||||
const smart = review.getByRole("button", { name: "Smart Checkout", exact: true });
|
||||
const cancel = review.getByRole("button", { name: "Don't Checkout", exact: true });
|
||||
await expect(force).toBeVisible();
|
||||
expect((await force.boundingBox())!.x - (await review.boundingBox())!.x).toBeLessThan(24);
|
||||
|
||||
await page.setViewportSize({ width: 420, height: 480 });
|
||||
const tree = review.getByRole("tree", { name: "Changed files" });
|
||||
const row = tree.getByRole("treeitem", { name: `ReceiptPolicy.ts ${folder}`, exact: true });
|
||||
await expect(row.getByTitle(path, { exact: true })).toBeVisible();
|
||||
const file = row.getByText("ReceiptPolicy.ts", { exact: true });
|
||||
await expect(file).toBeInViewport({ ratio: 1 });
|
||||
expect(await file.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
|
||||
await expect(row.getByText(folder, { exact: true })).toHaveCSS("font-size", "12px");
|
||||
const restoreHint = review.getByText(/Smart Checkout .* your changes and restores them/);
|
||||
expect((await restoreHint.boundingBox())!.y).toBeLessThan((await tree.boundingBox())!.y);
|
||||
for (const button of [force, smart, cancel]) await expect(button).toBeInViewport({ ratio: 1 });
|
||||
await cancel.click();
|
||||
await expect(review).toBeHidden();
|
||||
expect(await ipcCalls(page, "vcs_create_branch")).toHaveLength(1);
|
||||
});
|
||||
|
||||
test("pasted text has its spaces replaced", async ({ workbench: page }) => {
|
||||
const { dialog, input } = await openNewBranchDialog(page);
|
||||
await input.fill("");
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test("fits notification body and actions below the dismiss button in a narrow window", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 420, height: 540 });
|
||||
const title = "Validation failed for the catalog service";
|
||||
const body = "The build stopped while checking the catalog response type.";
|
||||
const action = "recheckCatalogServiceResponsePayloadAfterRegeneratingTypesForDevelopment";
|
||||
await page.evaluate(
|
||||
async ({ title, body, action }) => {
|
||||
const servicePath = "/src/workbench/contributions.ts";
|
||||
const { notifications } = await import(/* @vite-ignore */ servicePath);
|
||||
notifications().notify({
|
||||
level: "error",
|
||||
title,
|
||||
body,
|
||||
actions: [{ label: action, run: () => document.body.setAttribute("data-validation-retried", "true") }],
|
||||
});
|
||||
},
|
||||
{ title, body, action },
|
||||
);
|
||||
|
||||
const balloon = page.getByRole("alert").filter({ hasText: title });
|
||||
const message = balloon.getByText(body, { exact: true });
|
||||
const dismiss = balloon.getByRole("button", { name: "Dismiss", exact: true });
|
||||
const retry = balloon.getByRole("button", { name: action, exact: true });
|
||||
await expect(balloon).toBeInViewport({ ratio: 1 });
|
||||
const [messageBox, dismissBox] = await Promise.all([message.boundingBox(), dismiss.boundingBox()]);
|
||||
expect(messageBox!.y).toBeGreaterThanOrEqual(dismissBox!.y + dismissBox!.height);
|
||||
expect(messageBox!.x + messageBox!.width).toBeGreaterThanOrEqual(dismissBox!.x + dismissBox!.width - 1);
|
||||
expect(await retry.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
|
||||
await retry.click();
|
||||
await expect(page.locator("body")).toHaveAttribute("data-validation-retried", "true");
|
||||
await expect(balloon).toBeHidden();
|
||||
});
|
||||
@@ -1,9 +1,7 @@
|
||||
import type { EditorView } from "@codemirror/view";
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("Quick Evaluate opens an object tree that fits the editor and returns focus on Escape", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
test("Quick Evaluate and hover keep value previews usable in a narrow editor", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 445, height: 500 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
@@ -19,7 +17,9 @@ test("Quick Evaluate opens an object tree that fits the editor and returns focus
|
||||
h.fs_probe = () => ({ size: 48, binary: false, tooLarge: false });
|
||||
h.fs_read_text = () => "summary = {}\nsubtotal = 42\n";
|
||||
h.debug_evaluate_in = ({ expression }) =>
|
||||
expression === "summary" ? value("summary", "{...}", "dict", 101) : value("subtotal", "42", "int");
|
||||
expression === "summary"
|
||||
? value("summary", `{'audit': '${"Regional settlement totals ".repeat(8)}'}`, "dict", 101)
|
||||
: value("subtotal", "42", "int");
|
||||
h.debug_variables = ({ reference }) =>
|
||||
reference === 101
|
||||
? [value("audit", "{...}", "dict", 102), value("total", "47.74", "float")]
|
||||
@@ -81,8 +81,59 @@ test("Quick Evaluate opens an object tree that fits the editor and returns focus
|
||||
await evaluate(2);
|
||||
await expect(hint.getByRole("tree")).toHaveCount(0);
|
||||
await expect(hint).toHaveText(/subtotal\s*=\s*42/);
|
||||
expect(await ipcCalls(page, "debug_evaluate_in")).toEqual([
|
||||
const scalar = hint.locator("[class*='_valueTooltip_']");
|
||||
const uiFont = await page.locator("body").evaluate((el) => getComputedStyle(el).fontFamily);
|
||||
await expect(scalar).toHaveCSS("font-family", uiFont);
|
||||
await expect(scalar).toHaveCSS("font-size", "13px");
|
||||
await expect(scalar).toHaveCSS("font-weight", "700");
|
||||
await expect(scalar.locator(".cm-openidea-icon")).toHaveCount(1);
|
||||
await content.press("Escape");
|
||||
await expect(hint).toBeHidden();
|
||||
|
||||
await page.setViewportSize({ width: 620, height: 480 });
|
||||
await page.evaluate(async () => {
|
||||
const layoutModule = "/src/workbench/toolwindows/store.ts";
|
||||
const servicesModule = "/src/workbench/contributions.ts";
|
||||
const { moveToolWindow, setToolWindowSize } = await import(/* @vite-ignore */ layoutModule);
|
||||
const { toolWindowService } = await import(/* @vite-ignore */ servicesModule);
|
||||
moveToolWindow("project", "left");
|
||||
setToolWindowSize("left", 220);
|
||||
toolWindowService().show("project", false);
|
||||
});
|
||||
await expect.poll(async () => (await editor.boundingBox())!.x).toBeGreaterThan(160);
|
||||
const position = await content.evaluate((el) => {
|
||||
const { view } = (el as HTMLElement & { cmTile: { view: EditorView } }).cmTile;
|
||||
return view.coordsAtPos(view.state.doc.line(1).from + 2);
|
||||
});
|
||||
await page.mouse.move(position!.left, (position!.top + position!.bottom) / 2);
|
||||
const hover = page.locator(".cm-tooltip-hover").locator("[class*='_valueTooltip_']");
|
||||
const expand = hover.getByRole("button", { name: "Expand value" });
|
||||
await expect(hover).toContainText("Regional settlement totals");
|
||||
await expect(hover).toHaveCSS("font-family", uiFont);
|
||||
const summary = hover.locator("[class*='_valueText_']");
|
||||
const textBox = (await summary.boundingBox())!;
|
||||
const controlBox = (await expand.boundingBox())!;
|
||||
const iconBox = (await hover.locator(".cm-openidea-icon").boundingBox())!;
|
||||
expect(textBox.height).toBeGreaterThan(20);
|
||||
expect(Math.abs(controlBox.y - iconBox.y)).toBeLessThan(1);
|
||||
expect(textBox.x).toBeGreaterThanOrEqual(iconBox.x + iconBox.width);
|
||||
const fitsEditor = async () => {
|
||||
const tooltip = await hover.boundingBox();
|
||||
const pane = (await editor.boundingBox())!;
|
||||
return !!tooltip && tooltip.x >= pane.x - 1 && tooltip.x + tooltip.width <= pane.x + pane.width + 1;
|
||||
};
|
||||
await expect.poll(fitsEditor).toBe(true);
|
||||
await page.setViewportSize({ width: 555, height: 480 });
|
||||
await expect.poll(fitsEditor).toBe(true);
|
||||
await expand.click();
|
||||
const pinned = hint.getByRole("tree", { name: "summary" });
|
||||
await expect(pinned).toBeFocused();
|
||||
await pinned.press("Escape");
|
||||
await expect(content).toBeFocused();
|
||||
const calls = await ipcCalls(page, "debug_evaluate_in");
|
||||
expect(calls.filter((call) => call.context === "watch")).toEqual([
|
||||
{ session: 91, frameId: 11, expression: "summary", context: "watch" },
|
||||
{ session: 91, frameId: 11, expression: "subtotal", context: "watch" },
|
||||
]);
|
||||
expect(calls).toContainEqual({ session: 91, frameId: 11, expression: "summary", context: "hover" });
|
||||
});
|
||||
@@ -0,0 +1,75 @@
|
||||
import type { SearchQuery } from "../src/bindings";
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("Replace All keeps both values readable and the actions visible", async ({ workbench: page }) => {
|
||||
const pattern = `LEGACY_${"MONTH_END_RECONCILIATION_INPUT_".repeat(15)}END`;
|
||||
const replacement = `ACTIVE_${"MONTH_END_RECONCILIATION_OUTPUT_".repeat(18)}END`;
|
||||
await page.emulateMedia({ reducedMotion: "reduce" });
|
||||
await page.setViewportSize({ width: 1040, height: 700 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate((pattern) => {
|
||||
window.__ipc.handlers.search_validate = () => null;
|
||||
window.__ipc.handlers.search_start = ({ query, onEvent }) => {
|
||||
if ((query as SearchQuery).pattern !== pattern) return null;
|
||||
setTimeout(() => {
|
||||
for (const relPath of ["invoice.txt", "receipt.txt"]) {
|
||||
window.__ipc.send(onEvent, {
|
||||
type: "file",
|
||||
file: {
|
||||
path: `/dev/acme-api/${relPath}`,
|
||||
relPath,
|
||||
matches: [{ line: 0, text: pattern, ranges: [[0, pattern.length]], textOffset: 0 }],
|
||||
},
|
||||
});
|
||||
}
|
||||
window.__ipc.send(onEvent, {
|
||||
type: "done",
|
||||
summary: { files: 2, matches: 2, limitHit: false, cancelled: false, elapsedMs: 1 },
|
||||
});
|
||||
}, 20);
|
||||
return null;
|
||||
};
|
||||
}, pattern);
|
||||
await page.keyboard.press("Meta+Shift+r");
|
||||
const popup = page.getByRole("dialog", { name: "Replace in Files", exact: true });
|
||||
await popup.getByRole("textbox", { name: "Text to find", exact: true }).fill(pattern);
|
||||
const replacementInput = popup.getByRole("textbox", { name: "Replace with", exact: true });
|
||||
await replacementInput.fill(replacement);
|
||||
await expect(popup.getByRole("listbox", { name: "Matches" }).getByRole("option")).toHaveCount(2);
|
||||
await page.setViewportSize({ width: 440, height: 520 });
|
||||
await popup.getByRole("button", { name: "Replace All", exact: true }).click();
|
||||
|
||||
const dialog = page.getByRole("dialog", { name: "Replace All", exact: true });
|
||||
const findText = dialog.getByRole("region", { name: "Text to find", exact: true });
|
||||
const replaceText = dialog.getByRole("region", { name: "Replace with", exact: true });
|
||||
const replace = dialog.getByRole("button", { name: "Replace", exact: true });
|
||||
const cancel = dialog.getByRole("button", { name: "Cancel", exact: true });
|
||||
await expect(findText).toHaveText(pattern);
|
||||
await expect(replaceText).toHaveText(replacement);
|
||||
await expect(dialog.getByText("Replace 2 occurrences in 2 files?", { exact: true })).toBeVisible();
|
||||
const bottom = (await replace.boundingBox())!.y;
|
||||
for (const item of [findText, replaceText]) {
|
||||
await expect(item).toHaveCSS("font-size", "13px");
|
||||
expect(await item.evaluate((el) => el.scrollHeight > el.clientHeight && el.scrollWidth === el.clientWidth)).toBe(
|
||||
true,
|
||||
);
|
||||
await item.focus();
|
||||
await page.keyboard.press("End");
|
||||
await expect.poll(() => item.evaluate((el) => el.scrollTop)).toBeGreaterThan(0);
|
||||
}
|
||||
expect((await replace.boundingBox())!.y).toBeCloseTo(bottom, 0);
|
||||
await expect(replace).toBeInViewport({ ratio: 1 });
|
||||
await expect(cancel).toBeInViewport({ ratio: 1 });
|
||||
await cancel.click();
|
||||
await expect(dialog).toBeHidden();
|
||||
|
||||
await page.setViewportSize({ width: 1040, height: 700 });
|
||||
await replacementInput.fill("");
|
||||
await popup.getByRole("button", { name: "Open in Find Window", exact: true }).click();
|
||||
const findWindow = page.getByRole("region", { name: "Find", exact: true });
|
||||
await findWindow.getByRole("button", { name: "Replace All", exact: true }).click();
|
||||
await expect(findText).toHaveText(pattern);
|
||||
await expect(replaceText).toHaveText("Empty text");
|
||||
await cancel.click();
|
||||
expect(await ipcCalls(page, "replace_in_files")).toHaveLength(0);
|
||||
});
|
||||
@@ -581,3 +581,54 @@ test("CMake builds the selected target in Build before starting only the applica
|
||||
await expect(run.getByRole("tab", { name: "hello [Release, release]" })).toBeVisible();
|
||||
await expect(run.getByText("COMPILER_OUTPUT", { exact: true })).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("test report export separates the format and destination in a narrow window", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 410, height: 500 });
|
||||
await stubRun(
|
||||
page,
|
||||
[
|
||||
{
|
||||
kind: "stdout",
|
||||
text: '{"Package":"example.com/checkout","Action":"pass","Test":"TestReceipt","Elapsed":0.1}\n',
|
||||
},
|
||||
],
|
||||
0,
|
||||
{ id: "go:report-tests", name: "Checkout tests", kind: "go", command: "go", args: ["test", "-json"], isTest: true },
|
||||
);
|
||||
await page.evaluate(() => {
|
||||
window.__ipc.handlers.fs_entry_kind = () => {
|
||||
throw { kind: "NotFound", message: "Not found" };
|
||||
};
|
||||
window.__ipc.handlers.fs_create_file_bytes = () => null;
|
||||
});
|
||||
|
||||
await page.keyboard.press("Control+r");
|
||||
const results = page.getByRole("toolbar", { name: "Test results" });
|
||||
await results.getByRole("button", { name: "More Actions" }).click();
|
||||
const exportItem = page.getByRole("menuitem", { name: "Export Test Results…" });
|
||||
await expect(exportItem).toBeEnabled();
|
||||
await exportItem.click();
|
||||
|
||||
const dialog = page.getByRole("dialog", { name: "Export Test Results" });
|
||||
const html = dialog.getByRole("radio", { name: "HTML", exact: true });
|
||||
const xml = dialog.getByRole("radio", { name: "XML", exact: true });
|
||||
await expect(html).toBeVisible();
|
||||
expect((await xml.boundingBox())!.y).toBeGreaterThan((await html.boundingBox())!.y);
|
||||
const file = dialog.getByLabel("File name", { exact: true });
|
||||
const folder = dialog.getByLabel("Folder", { exact: true });
|
||||
const browse = dialog.getByRole("button", { name: "Browse…" });
|
||||
await expect(file).toBeFocused();
|
||||
await expect(file).toHaveValue("Test Results - Checkout tests.html");
|
||||
await expect(folder).toHaveValue("/dev/acme-api");
|
||||
await expect(browse).toBeInViewport({ ratio: 1 });
|
||||
expect((await folder.boundingBox())!.width).toBeGreaterThan(180);
|
||||
await file.fill("receipts.html");
|
||||
await folder.fill("reports");
|
||||
await xml.check();
|
||||
await expect(file).toHaveValue("receipts.xml");
|
||||
await expect(dialog.getByRole("checkbox", { name: "Open exported file in browser" })).toBeDisabled();
|
||||
await dialog.getByRole("button", { name: "OK", exact: true }).click();
|
||||
await expect(dialog).toBeHidden();
|
||||
const [write] = await ipcCalls(page, "fs_create_file_bytes");
|
||||
expect(write).toMatchObject({ path: "/dev/acme-api/reports/receipts.xml" });
|
||||
});
|
||||
@@ -1,39 +1,145 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import type { BeforeLaunchTask } from "../src/bindings";
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
async function openConfigurations(page: Page, target?: string) {
|
||||
await page.evaluate(async (target) => {
|
||||
test("expands VM options beside the field and returns edited text to the configuration", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
const original = "-Xmx512m\n-Ddemo.endpoint=https://example.test/" + "long-segment/".repeat(12);
|
||||
await page.evaluate(async (vmOptions) => {
|
||||
const path = "/src/features/run/store.ts";
|
||||
const { useRun } = await import(/* @vite-ignore */ path);
|
||||
const base = {
|
||||
kind: "shell",
|
||||
command: "/Users/developer/projects/acme/services/payments/scripts/start-development-server",
|
||||
args: ["--watch"],
|
||||
cwd: "/Users/developer/projects/acme/services/payments",
|
||||
env: { NODE_ENV: "development" },
|
||||
detected: false,
|
||||
isTest: false,
|
||||
debugAdapter: null,
|
||||
};
|
||||
useRun.setState({
|
||||
configs: [
|
||||
{
|
||||
...base,
|
||||
id: "layout:app",
|
||||
name: "Payments development server",
|
||||
target,
|
||||
beforeLaunch: [{ kind: "run", target: "layout:prepare" }],
|
||||
id: "layout:jvm",
|
||||
name: "Catalog service",
|
||||
kind: "application",
|
||||
command: "java",
|
||||
args: ["example.Catalog"],
|
||||
params: { mainClass: "example.Catalog", vmOptions },
|
||||
env: {},
|
||||
cwd: null,
|
||||
detected: false,
|
||||
isTest: false,
|
||||
debugAdapter: "java-debug",
|
||||
},
|
||||
{ ...base, id: "layout:prepare", name: "Prepare generated sources for the payments development server" },
|
||||
],
|
||||
selectedId: "layout:app",
|
||||
editTarget: "layout:jvm",
|
||||
loaded: true,
|
||||
editorOpen: true,
|
||||
});
|
||||
}, target);
|
||||
}, original);
|
||||
|
||||
const config = page.getByRole("dialog", { name: "Run/Debug Configurations", exact: true });
|
||||
const field = config.getByRole("textbox", { name: "VM options", exact: true });
|
||||
const expanded = page.getByRole("dialog", { name: "VM options", exact: true });
|
||||
const editor = expanded.getByRole("textbox", { name: "VM options", exact: true });
|
||||
for (const width of [1100, 560]) {
|
||||
await page.setViewportSize({ width, height: 760 });
|
||||
await field.scrollIntoViewIfNeeded();
|
||||
await field.press("Shift+Enter");
|
||||
await expect(editor).toBeFocused();
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const source = (await field.boundingBox())!;
|
||||
const popup = (await expanded.boundingBox())!;
|
||||
const gap = Math.min(Math.abs(popup.y - source.y - source.height), Math.abs(source.y - popup.y - popup.height));
|
||||
return popup.x >= 0 && popup.x + popup.width <= width && gap <= 6;
|
||||
})
|
||||
.toBe(true);
|
||||
await expect.poll(() => editor.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeGreaterThan(0);
|
||||
await editor.fill("-Xmx1g");
|
||||
await editor.press("Escape");
|
||||
await expect(expanded).toBeHidden();
|
||||
await expect(field).toBeFocused();
|
||||
await expect(field).toHaveValue(original);
|
||||
}
|
||||
|
||||
const expand = config.getByRole("button", { name: "Expand (⇧⏎)", exact: true });
|
||||
await expand.click();
|
||||
await expect(editor).toBeFocused();
|
||||
await editor.fill(original + "\n-Ddemo.mode=local");
|
||||
await editor.press("Control+Enter");
|
||||
await expect(expanded).toBeHidden();
|
||||
await expect(field).toHaveValue(original + "\n-Ddemo.mode=local");
|
||||
});
|
||||
|
||||
async function openConfigurations(page: Page, target?: string, beforeLaunch?: BeforeLaunchTask[]) {
|
||||
await page.evaluate(
|
||||
async ({ target, beforeLaunch }) => {
|
||||
const path = "/src/features/run/store.ts";
|
||||
const { useRun } = await import(/* @vite-ignore */ path);
|
||||
const base = {
|
||||
kind: "shell",
|
||||
command: "/Users/developer/projects/acme/services/payments/scripts/start-development-server",
|
||||
args: ["--watch"],
|
||||
cwd: "/Users/developer/projects/acme/services/payments",
|
||||
env: { NODE_ENV: "development" },
|
||||
detected: false,
|
||||
isTest: false,
|
||||
debugAdapter: null,
|
||||
};
|
||||
useRun.setState({
|
||||
configs: [
|
||||
{
|
||||
...base,
|
||||
id: "layout:app",
|
||||
name: "Payments development server",
|
||||
target,
|
||||
beforeLaunch: beforeLaunch ?? [{ kind: "run", target: "layout:prepare" }],
|
||||
},
|
||||
{ ...base, id: "layout:prepare", name: "Prepare generated sources for the payments development server" },
|
||||
],
|
||||
selectedId: "layout:app",
|
||||
loaded: true,
|
||||
editorOpen: true,
|
||||
});
|
||||
},
|
||||
{ target, beforeLaunch },
|
||||
);
|
||||
await expect(page.getByRole("dialog", { name: "Run/Debug Configurations", exact: true })).toBeVisible();
|
||||
}
|
||||
|
||||
test("before-launch tasks wrap as ordered tags and keep their edit controls", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1150, height: 820 });
|
||||
await openConfigurations(page, undefined, [
|
||||
{ kind: "build" },
|
||||
{ kind: "buildArtifacts" },
|
||||
{ kind: "command", target: "make generate" },
|
||||
]);
|
||||
const dialog = page.getByRole("dialog", { name: "Run/Debug Configurations", exact: true });
|
||||
const tasks = dialog.getByRole("list", { name: "Before launch tasks", exact: true });
|
||||
const build = tasks.getByRole("button", { name: "1. Build Project", exact: true });
|
||||
const artifacts = tasks.getByRole("button", { name: "2. Build Artifacts", exact: true });
|
||||
await tasks.scrollIntoViewIfNeeded();
|
||||
await expect(build).toBeVisible();
|
||||
expect((await build.boundingBox())!.y).toBeCloseTo((await artifacts.boundingBox())!.y, 0);
|
||||
await expect(build).toHaveCSS("font-size", "13px");
|
||||
|
||||
await page.setViewportSize({ width: 520, height: 820 });
|
||||
await expect.poll(() => tasks.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
|
||||
const command = tasks.getByRole("textbox", { name: "Before launch command 3" });
|
||||
expect((await command.boundingBox())!.y).toBeGreaterThan((await build.boundingBox())!.y + 20);
|
||||
await command.fill("make report");
|
||||
|
||||
await build.press("Enter");
|
||||
const actions = page.getByRole("menu", { name: "Task Actions", exact: true });
|
||||
const moveDown = actions.getByRole("menuitem", { name: "Move Down", exact: true });
|
||||
await expect(moveDown).toBeVisible();
|
||||
await moveDown.click();
|
||||
await expect(tasks.getByRole("button", { name: "1. Build Artifacts", exact: true })).toBeVisible();
|
||||
const moved = tasks.getByRole("listitem").filter({
|
||||
has: page.getByRole("button", { name: "2. Build Project", exact: true }),
|
||||
});
|
||||
await moved.getByRole("button", { name: "Remove Task" }).click();
|
||||
await expect(tasks.getByRole("textbox", { name: "Before launch command 2" })).toHaveValue("make report");
|
||||
|
||||
await tasks.getByRole("button", { name: "Add task", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "Build Project", exact: true }).click();
|
||||
await expect(tasks.getByRole("button", { name: "3. Build Project", exact: true })).toBeVisible();
|
||||
});
|
||||
|
||||
test("long run target names leave room for configuration names in the sidebar", async ({ workbench: page }) => {
|
||||
const target = "payments-development-shared-staging-runner-west";
|
||||
await openConfigurations(page, target);
|
||||
@@ -55,6 +161,32 @@ test("long run target names leave room for configuration names in the sidebar",
|
||||
await expect(dialog.getByRole("textbox", { name: "Name", exact: true })).toHaveValue("Payments development server");
|
||||
});
|
||||
|
||||
test("the configuration type list scrolls below its search field in a short window", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 780, height: 370 });
|
||||
await openConfigurations(page);
|
||||
const dialog = page.getByRole("dialog", { name: "Run/Debug Configurations", exact: true });
|
||||
await dialog.getByRole("button", { name: "Add New Configuration", exact: true }).click();
|
||||
const chooser = page.getByRole("dialog", { name: "Add New Configuration", exact: true });
|
||||
const search = chooser.getByRole("textbox", { name: "Search configuration types" });
|
||||
const list = chooser.getByRole("listbox", { name: "Configuration types" });
|
||||
await expect(search).toBeFocused();
|
||||
expect(await chooser.evaluate((el) => el.scrollHeight - el.clientHeight)).toBeLessThanOrEqual(1);
|
||||
expect(await list.evaluate((el) => el.scrollHeight - el.clientHeight)).toBeGreaterThan(0);
|
||||
|
||||
await search.press("End");
|
||||
const active = list.getByRole("option", { selected: true });
|
||||
await expect(active).toBeInViewport({ ratio: 0.98 });
|
||||
expect(await list.evaluate((el) => el.scrollTop)).toBeGreaterThan(0);
|
||||
await expect(active.locator("svg")).toHaveAttribute("width", "16");
|
||||
await expect(search).toBeInViewport({ ratio: 1 });
|
||||
|
||||
await search.fill("Tomcat");
|
||||
await expect(list.getByRole("option", { name: "Tomcat Server", selected: true })).toBeVisible();
|
||||
await search.press("Enter");
|
||||
await expect(chooser).toBeHidden();
|
||||
await expect(dialog.getByRole("tab", { name: "Server", exact: true })).toBeVisible();
|
||||
});
|
||||
|
||||
test("run configuration sidebar resizes with mouse and keyboard and remembers the layout", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
const prefix = "reconcile-regional-inventory-and-rebuild-order-settlement-cache-for-warehouse-";
|
||||
const east = prefix + "east-stage";
|
||||
const west = prefix + "west-stage";
|
||||
const content = JSON.stringify(
|
||||
{ name: "warehouse-tools", scripts: { [east]: "node east.js", [west]: "node west.js", build: "node build.js" } },
|
||||
null,
|
||||
2,
|
||||
);
|
||||
|
||||
test("the npm gutter keeps distinct ends of long names and runs the selected script", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 440, height: 520 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async (text) => {
|
||||
const backendPath = "/src/editor/core/backend.ts";
|
||||
const servicePath = "/src/workbench/contributions.ts";
|
||||
const { docBackend } = await import(/* @vite-ignore */ backendPath);
|
||||
const { editorService } = await import(/* @vite-ignore */ servicePath);
|
||||
const path = "/dev/acme-api/package.json";
|
||||
docBackend().files.set(path, text);
|
||||
const handlers = window.__ipc.handlers;
|
||||
handlers.fs_probe = () => ({ size: text.length, binary: false, tooLarge: false });
|
||||
handlers.fs_read_text = ({ path }) => docBackend().files.get(String(path)) ?? "";
|
||||
handlers.fs_read_dir = () => [];
|
||||
handlers.run_configs = () => [];
|
||||
handlers.run_start = ({ config }) => ({
|
||||
id: 7,
|
||||
configId: (config as { id: string }).id,
|
||||
name: (config as { name: string }).name,
|
||||
pid: 4242,
|
||||
running: true,
|
||||
pty: false,
|
||||
});
|
||||
await editorService().openFile(path);
|
||||
}, content);
|
||||
const editor = page.locator(".cm-editor");
|
||||
const menu = page.getByRole("menu", { name: "Context menu" });
|
||||
for (const name of [east, west]) {
|
||||
await editor.getByTitle("Run '" + name + "'", { exact: true }).click();
|
||||
const label = "Run 'npm run " + name + "'";
|
||||
const run = menu.getByRole("menuitem", { name: label, exact: true });
|
||||
const end = run.getByText(label.slice(-12), { exact: true });
|
||||
await expect(end).toBeVisible();
|
||||
await expect(end.locator("..")).toHaveAttribute("title", label);
|
||||
expect(await end.evaluate((node) => node.clientWidth >= node.scrollWidth)).toBe(true);
|
||||
const start = end.locator("..").locator(":scope > span").first();
|
||||
expect(await start.evaluate((node) => node.clientWidth < node.scrollWidth)).toBe(true);
|
||||
await expect(start).toHaveCSS("text-overflow", "ellipsis");
|
||||
const titleUnderPointer = await start.evaluate((node) => {
|
||||
const { x, y, width, height } = node.getBoundingClientRect();
|
||||
return document.elementFromPoint(x + width / 2, y + height / 2)?.getAttribute("title");
|
||||
});
|
||||
expect(titleUnderPointer).toBe(label);
|
||||
await expect(run).toBeFocused();
|
||||
if (name === east) await run.press("Escape");
|
||||
else await run.press("Enter");
|
||||
await expect(menu).toBeHidden();
|
||||
}
|
||||
await expect
|
||||
.poll(async () => ipcCalls(page, "run_start"))
|
||||
.toMatchObject([{ config: { args: ["run", west], kind: "npm" } }]);
|
||||
});
|
||||
@@ -1,4 +1,64 @@
|
||||
import { doubleShift, expect, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("Search Everywhere keeps line numbers visible beside long Text result filenames", async ({ workbench: page }) => {
|
||||
const relPath = "config/InternationalSettlementReconciliationEndpointsForStagingEnvironments.ts";
|
||||
const query = "settlementEndpoint";
|
||||
const text = `const ${query} = "/staging/settlement";`;
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(
|
||||
({ relPath, text, query }) => {
|
||||
window.__ipc.handlers.search_start = (args) => {
|
||||
setTimeout(() => {
|
||||
const matches = [12344, 12345].map((line) => ({
|
||||
line,
|
||||
text,
|
||||
ranges: [[6, 6 + query.length]],
|
||||
textOffset: 0,
|
||||
}));
|
||||
window.__ipc.send(args.onEvent, {
|
||||
type: "file",
|
||||
file: { path: `/dev/acme-api/${relPath}`, relPath, matches },
|
||||
});
|
||||
window.__ipc.send(args.onEvent, {
|
||||
type: "done",
|
||||
summary: { files: 1, matches: 2, limitHit: false, cancelled: false, elapsedMs: 4 },
|
||||
});
|
||||
}, 20);
|
||||
return null;
|
||||
};
|
||||
},
|
||||
{ relPath, text, query },
|
||||
);
|
||||
|
||||
await doubleShift(page);
|
||||
const dialog = page.getByRole("dialog", { name: "Search Everywhere" });
|
||||
await dialog.getByRole("tab", { name: "Text", exact: true }).click();
|
||||
const search = dialog.getByRole("combobox", { name: "Search query" });
|
||||
await search.fill(query);
|
||||
const rows = dialog.getByRole("option");
|
||||
await expect(rows).toHaveCount(2);
|
||||
for (const width of [920, 440]) {
|
||||
await page.setViewportSize({ width, height: 640 });
|
||||
for (const line of [12345, 12346]) {
|
||||
const row = rows.filter({ hasText: String(line) });
|
||||
await expect(row.locator("mark")).toHaveText(query);
|
||||
expect(
|
||||
await row.evaluate((el) => {
|
||||
const location = el.lastElementChild!;
|
||||
const lineText = location.lastChild!;
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(lineText);
|
||||
const bounds = range.getBoundingClientRect();
|
||||
const clip = location.getBoundingClientRect();
|
||||
return bounds.width > 0 && bounds.left >= clip.left && bounds.right <= clip.right + 1;
|
||||
}),
|
||||
).toBe(true);
|
||||
await expect(row.getByText(relPath.split("/").at(-1)!, { exact: true })).toHaveAttribute("title", relPath);
|
||||
}
|
||||
}
|
||||
await search.press("ArrowDown");
|
||||
await expect(rows.nth(1)).toHaveAttribute("aria-selected", "true");
|
||||
});
|
||||
import type { Page } from "@playwright/test";
|
||||
|
||||
test("action names stay readable beside shortcuts and categories", async ({ workbench: page }) => {
|
||||
|
||||
@@ -15,7 +15,7 @@ async function run(page: Page, id: string) {
|
||||
}, id);
|
||||
}
|
||||
|
||||
async function stubFindMatches(page: Page) {
|
||||
async function stubFindMatches(page: Page, firstPath = LONG_RESULT_PATH) {
|
||||
await stubDesktop(page);
|
||||
await page.evaluate((longPath) => {
|
||||
window.__ipc.handlers.search_validate = () => null;
|
||||
@@ -39,7 +39,7 @@ async function stubFindMatches(page: Page) {
|
||||
}, 20);
|
||||
return null;
|
||||
};
|
||||
}, LONG_RESULT_PATH);
|
||||
}, firstPath);
|
||||
}
|
||||
|
||||
async function expectControlsFit(page: Page) {
|
||||
@@ -205,3 +205,29 @@ test("Find in Files prioritizes the preview and remembers an adjusted split", as
|
||||
await expect(handle).toBeAttached();
|
||||
await expect.poll(resultsShare).toBeCloseTo(adjusted, 2);
|
||||
});
|
||||
|
||||
test("Find in Files keeps the file and its parent folder visible in the preview caption", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 400, height: 570 });
|
||||
const prefix = "config/generated/regional-integrations/sandbox/development/notifications";
|
||||
const name = "RegionalLedgerSettings.txt";
|
||||
const path = `${prefix}/runtime/${name}`;
|
||||
await stubFindMatches(page, path);
|
||||
await run(page, "find.inPath");
|
||||
const dialog = page.getByRole("dialog", { name: "Find in Files" });
|
||||
const search = dialog.getByPlaceholder("Search");
|
||||
await search.fill("http://localhost:8080");
|
||||
const preview = dialog.locator("[data-panel][id=preview]");
|
||||
const caption = preview.getByTitle(path, { exact: true });
|
||||
const folder = caption.getByText("/runtime", { exact: true });
|
||||
const beginning = caption.getByText(prefix, { exact: true });
|
||||
await expect(caption.getByText(name, { exact: true })).toBeInViewport({ ratio: 1 });
|
||||
await expect(folder).toBeInViewport({ ratio: 1 });
|
||||
await expect(folder).toHaveCSS("font-size", "13px");
|
||||
expect(await beginning.evaluate((el) => el.scrollWidth > el.clientWidth)).toBe(true);
|
||||
expect(await folder.evaluate((el) => el.scrollWidth <= el.clientWidth)).toBe(true);
|
||||
await search.press("ArrowDown");
|
||||
await search.press("ArrowDown");
|
||||
await expect(preview.getByTitle("config/endpoint-1.txt", { exact: true })).toContainText("endpoint-1.txt");
|
||||
});
|
||||
@@ -0,0 +1,59 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test("Find in Files keeps the scope list and pattern editor usable in a narrow window", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1040, height: 700 });
|
||||
const longName = "Regional settlement reconciliation sources for month-end audit and publication";
|
||||
await page.evaluate(async (longName) => {
|
||||
const search = "/src/platform/search.ts";
|
||||
const { saveCustomScopes } = await import(/* @vite-ignore */ search);
|
||||
saveCustomScopes(
|
||||
Array.from({ length: 26 }, (_, i) => ({
|
||||
name: i ? `Reconciliation scope ${i + 1}` : longName,
|
||||
pattern: i ? `file:src/scope-${i + 1}//*` : "file:src/reconciliation//*",
|
||||
})),
|
||||
);
|
||||
}, longName);
|
||||
await page.keyboard.press("Meta+Shift+F");
|
||||
const find = page.getByRole("dialog", { name: "Find in Files", exact: true });
|
||||
await find.getByRole("tab", { name: "Scope", exact: true }).click();
|
||||
const openScopes = find.getByRole("button", { name: "Edit Scopes…", exact: true });
|
||||
await openScopes.click();
|
||||
|
||||
const dialog = page.getByRole("dialog", { name: "Scopes", exact: true });
|
||||
const list = dialog.getByRole("list", { name: "Scopes", exact: true });
|
||||
const name = dialog.getByRole("textbox", { name: "Name:", exact: true });
|
||||
const pattern = dialog.getByRole("textbox", { name: "Pattern:", exact: true });
|
||||
await expect(pattern).toHaveValue("file:src/reconciliation//*");
|
||||
expect(await list.evaluate((el) => el.scrollHeight - el.clientHeight)).toBeGreaterThan(100);
|
||||
await expect(list.getByRole("button", { name: longName })).toHaveAttribute("title", longName);
|
||||
expect((await list.boundingBox())!.x).toBeLessThan((await name.boundingBox())!.x);
|
||||
|
||||
await page.setViewportSize({ width: 460, height: 530 });
|
||||
const fields = (await pattern.boundingBox())!;
|
||||
expect(fields.y).toBeGreaterThanOrEqual((await list.boundingBox())!.y + (await list.boundingBox())!.height);
|
||||
expect(fields.width).toBeGreaterThan(250);
|
||||
await list.evaluate((el) => (el.scrollTop = el.scrollHeight));
|
||||
expect((await pattern.boundingBox())!.y).toBeCloseTo(fields.y, 0);
|
||||
const toolbar = dialog.getByRole("toolbar", { name: "Scopes actions" });
|
||||
const add = toolbar.getByRole("button", { name: "Add Scope", exact: true });
|
||||
const ok = dialog.getByRole("button", { name: "OK", exact: true });
|
||||
await expect(add).toBeInViewport({ ratio: 1 });
|
||||
await expect(ok).toBeInViewport({ ratio: 1 });
|
||||
|
||||
await name.fill("Unsaved selection");
|
||||
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
|
||||
await openScopes.click();
|
||||
await expect(name).toHaveValue(longName);
|
||||
await add.click();
|
||||
const draft = list.getByRole("button", { name: "Unnamed", exact: true });
|
||||
await expect(draft).toHaveAttribute("aria-current", "true");
|
||||
await expect(draft).toBeInViewport({ ratio: 1 });
|
||||
await expect(ok).toBeDisabled();
|
||||
await name.fill("Release inputs");
|
||||
await pattern.fill("file:src/release//*");
|
||||
await ok.click();
|
||||
await expect(dialog).toBeHidden();
|
||||
await openScopes.click();
|
||||
await list.getByRole("button", { name: "Release inputs", exact: true }).click();
|
||||
await expect(pattern).toHaveValue("file:src/release//*");
|
||||
});
|
||||
@@ -75,7 +75,7 @@ for (const locale of ["en", "zh"]) {
|
||||
const path = "/src/platform/i18n.ts";
|
||||
await (await import(/* @vite-ignore */ path)).setLocale(locale);
|
||||
}, locale);
|
||||
for (const id of ["appearance", "editor.font", "general", "general.httpProxy"]) {
|
||||
for (const id of ["appearance", "editor.font", "general", "general.httpProxy", "vcs.log"]) {
|
||||
await selectPage(page, id);
|
||||
const body = page.locator("[class*='pageBody']");
|
||||
for (const width of [1000, 784, 640, 520]) {
|
||||
@@ -108,6 +108,31 @@ test("keeps Open project in options within narrow System Settings", async ({ wor
|
||||
expect(overflow).toBeLessThanOrEqual(1);
|
||||
});
|
||||
|
||||
test("Git Log settings group display and column options with aligned checkboxes", async ({ workbench: page }) => {
|
||||
await page.keyboard.press("Meta+,");
|
||||
const dialog = page.getByRole("dialog", { name: "Settings", exact: true });
|
||||
await selectPage(page, "vcs.log");
|
||||
const view = dialog.getByRole("region", { name: "View Options" });
|
||||
const columns = dialog.getByRole("region", { name: "Visible columns" });
|
||||
const tagNames = view.getByRole("checkbox", { name: "Show tag names" });
|
||||
const hash = columns.getByRole("checkbox", { name: "Hash" });
|
||||
await expect(view.getByRole("checkbox")).toHaveCount(5);
|
||||
await expect(columns.getByRole("checkbox")).toHaveCount(4);
|
||||
|
||||
for (const width of [1000, 520]) {
|
||||
await page.setViewportSize({ width, height: 760 });
|
||||
// Read both rows together once the dialog has finished opening and relaid out.
|
||||
await expect
|
||||
.poll(async () => Math.abs((await tagNames.boundingBox())!.x - (await hash.boundingBox())!.x))
|
||||
.toBeLessThan(0.5);
|
||||
}
|
||||
|
||||
await expect(hash).not.toBeChecked();
|
||||
await hash.focus();
|
||||
await page.keyboard.press("Space");
|
||||
await expect(hash).toBeChecked();
|
||||
});
|
||||
|
||||
test("settings sidebar resizes with mouse and keyboard and remembers its width", async ({ workbench: page }) => {
|
||||
await page.keyboard.press("Meta+,");
|
||||
const dialog = page.getByRole("dialog", { name: "Settings", exact: true });
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test("Settings aligns search results with their parent pages and honors smaller tree indents", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.keyboard.press("Meta+,");
|
||||
const dialog = page.getByRole("dialog", { name: "Settings", exact: true });
|
||||
const search = dialog.getByRole("textbox", { name: "Search settings" });
|
||||
const tree = dialog.getByRole("tree", { name: "Settings pages" });
|
||||
await search.fill("Language Defaults");
|
||||
|
||||
const editor = tree.getByRole("treeitem", { name: "Editor", exact: true });
|
||||
const scheme = tree.getByRole("treeitem", { name: "Color Scheme", exact: true });
|
||||
const defaults = tree.getByRole("treeitem", { name: "Language Defaults", exact: true });
|
||||
await expect(defaults).toHaveAttribute("aria-selected", "true");
|
||||
await expect(defaults.locator("mark")).toHaveText(["Language", "Defaults"]);
|
||||
|
||||
const insets = () =>
|
||||
Promise.all(
|
||||
[editor, scheme, defaults].map((row) =>
|
||||
row.locator(":scope > span:last-child").evaluate((label) => {
|
||||
const left = label.closest('[role="tree"]')!.getBoundingClientRect().left;
|
||||
return Math.round(label.getBoundingClientRect().left - left);
|
||||
}),
|
||||
),
|
||||
);
|
||||
await expect.poll(insets).toEqual([28, 44, 60]);
|
||||
await page.setViewportSize({ width: 580, height: 720 });
|
||||
await expect.poll(insets).toEqual([28, 44, 60]);
|
||||
await page.evaluate(() => document.documentElement.style.setProperty("--tree-indent", "12px"));
|
||||
await expect.poll(insets).toEqual([28, 40, 52]);
|
||||
|
||||
await search.press("ArrowUp");
|
||||
await expect(scheme).toHaveAttribute("aria-selected", "true");
|
||||
await search.press("ArrowUp");
|
||||
await expect(editor).toHaveAttribute("aria-selected", "true");
|
||||
await expect(search).toBeFocused();
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test("shortcut assignment fits the first stroke and conflict names in a narrow window", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 336, height: 540 });
|
||||
await page.keyboard.press("Meta+,");
|
||||
const settings = page.getByRole("dialog", { name: "Settings", exact: true });
|
||||
await settings.getByRole("treeitem", { name: "Keymap", exact: true }).click();
|
||||
await settings.getByRole("textbox", { name: "Search actions" }).fill("Find Action");
|
||||
const action = settings.getByRole("treeitem", { name: /Find Action/ });
|
||||
await action.click();
|
||||
await settings.getByRole("button", { name: "Add Keyboard Shortcut", exact: true }).click();
|
||||
|
||||
const dialog = page.getByRole("dialog", { name: "Keyboard Shortcut: Find Action…", exact: true });
|
||||
const first = dialog.getByRole("textbox", { name: "First stroke" });
|
||||
const body = dialog.locator("[data-dialog-body]");
|
||||
const titleBar = dialog.locator("[data-dialog-titlebar]");
|
||||
await expect(first).toBeFocused();
|
||||
await expect(titleBar).toHaveText("Keyboard Shortcut");
|
||||
await expect(body.getByText("Find Action…", { exact: true })).toBeVisible();
|
||||
const firstBounds = (await first.boundingBox())!;
|
||||
const bodyBounds = (await body.boundingBox())!;
|
||||
expect(firstBounds.width).toBeGreaterThan(bodyBounds.width - 32);
|
||||
const conflicts = dialog.getByRole("list", { name: "Conflicts:" });
|
||||
await expect(conflicts).toHaveCount(0);
|
||||
|
||||
await first.press("Meta+Alt+L");
|
||||
await expect(conflicts).toBeVisible();
|
||||
await expect(conflicts.getByRole("listitem").filter({ hasText: "Reformat Code" }).first()).toBeVisible();
|
||||
expect(await conflicts.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
|
||||
expect(
|
||||
await conflicts
|
||||
.getByRole("listitem")
|
||||
.evaluateAll((rows) => rows.every((row) => row.scrollHeight <= row.clientHeight)),
|
||||
).toBe(true);
|
||||
expect(await body.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
|
||||
|
||||
const ok = dialog.getByRole("button", { name: "OK", exact: true });
|
||||
await ok.click();
|
||||
const confirmation = page.getByRole("dialog", { name: "Warning", exact: true });
|
||||
await expect(confirmation.getByRole("list").getByText("Reformat Code", { exact: true })).toHaveCount(2);
|
||||
await confirmation.getByRole("button", { name: "Leave", exact: true }).click();
|
||||
await expect(dialog).toBeHidden();
|
||||
await expect(action.locator("kbd").filter({ hasText: "⌥⌘L" })).toHaveCount(1);
|
||||
});
|
||||
@@ -102,6 +102,9 @@ test("edits the staged version and keeps an unsaved draft when the index changes
|
||||
await expect(headPane).toContainText("val committed = 0");
|
||||
await expect(indexPane).toContainText("val external = 3");
|
||||
await expect(localPane).not.toBeEmpty();
|
||||
const indexHeading = page.getByTitle(`Staged (index) ${path}`, { exact: true });
|
||||
await expect(indexHeading.getByText("build.gradle.kts", { exact: true })).toBeVisible();
|
||||
await expect(indexHeading.getByText("Staged (index)", { exact: true })).toBeVisible();
|
||||
const working = await localPane.textContent();
|
||||
|
||||
await page.getByRole("button", { name: "Unstage Change", exact: true }).click();
|
||||
|
||||
@@ -1,5 +1,41 @@
|
||||
import { expect, openFromTree, test } from "./fixtures";
|
||||
|
||||
test("the line separator menu has a heading and keeps the current choice visible", async ({ workbench: page }) => {
|
||||
await openFromTree(page, "build.gradle.kts");
|
||||
const status = page.locator('[data-status-item="editor.lineEnding"]').getByRole("button");
|
||||
const menu = page.getByRole("menu", { name: /^Line Separator$/i });
|
||||
const windows = "Windows (\\r\\n)";
|
||||
const unix = "Unix and macOS (\\n)";
|
||||
const classic = "Classic Mac OS (\\r)";
|
||||
await expect(status).toHaveText("LF");
|
||||
await status.click();
|
||||
const heading = menu.locator("..").getByText("Line Separator", { exact: true });
|
||||
expect(await heading.count()).toBe(1);
|
||||
await expect(heading).toHaveCSS("font-size", "13px");
|
||||
await expect(menu.locator('[role^="menuitem"]')).toHaveText([windows, unix, classic]);
|
||||
|
||||
await page.setViewportSize({ width: 540, height: 540 });
|
||||
await expect(heading).toBeInViewport({ ratio: 1 });
|
||||
await expect(menu.getByRole("menuitemcheckbox", { name: unix, checked: true })).toBeInViewport({ ratio: 1 });
|
||||
await expect(menu.getByRole("menuitem", { name: windows })).toBeFocused();
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(status).toHaveText("CRLF");
|
||||
|
||||
await status.click();
|
||||
await expect(menu.getByRole("menuitemcheckbox", { name: windows, checked: true })).toBeFocused();
|
||||
await page.keyboard.press("ArrowDown");
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(status).toHaveText("LF");
|
||||
|
||||
await page.evaluate(async () => {
|
||||
const path = "/src/platform/i18n.ts";
|
||||
await (await import(/* @vite-ignore */ path)).setLocale("zh");
|
||||
});
|
||||
await status.click();
|
||||
const translated = page.getByRole("menu", { name: "行分隔符", exact: true });
|
||||
await expect(translated.getByRole("menuitem", { name: "Windows 换行 (\\r\\n)", exact: true })).toBeVisible();
|
||||
});
|
||||
|
||||
test("status bar uses its row height and widget insets in both densities", async ({ workbench: page }) => {
|
||||
const editor = await openFromTree(page, "build.gradle.kts");
|
||||
const bar = page.locator('footer[aria-label="Status bar"]');
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
async function openDialog(page: Page, id: "find.structural" | "find.replaceStructural") {
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async (id) => {
|
||||
window.__ipc.handlers.structural_languages = () => [
|
||||
{ id: "java", name: "Java" },
|
||||
{ id: "typescript", name: "TypeScript" },
|
||||
];
|
||||
window.__ipc.handlers.structural_validate = () => null;
|
||||
const actionsModule = "/src/platform/actions.ts";
|
||||
const { executeAction } = await import(/* @vite-ignore */ actionsModule);
|
||||
await executeAction(id);
|
||||
}, id);
|
||||
}
|
||||
|
||||
test("Structural Search puts language selection beside the taller template editor", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1080, height: 720 });
|
||||
await openDialog(page, "find.structural");
|
||||
const dialog = page.getByRole("dialog", { name: "Structural Search" });
|
||||
const editor = dialog.getByRole("textbox", { name: "Search template" });
|
||||
const label = dialog.locator("label").filter({ hasText: /^Search template$/ });
|
||||
const language = dialog.getByRole("button", { name: "Language", exact: true });
|
||||
await expect(editor).toBeFocused();
|
||||
await expect(language).toHaveText("Java");
|
||||
|
||||
const { x, y, width, height } = (await editor.boundingBox())!;
|
||||
const caption = (await label.boundingBox())!;
|
||||
const picker = (await language.boundingBox())!;
|
||||
expect(Math.abs(caption.y + caption.height / 2 - (picker.y + picker.height / 2))).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(caption.x - x)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(picker.x + picker.width - (x + width))).toBeLessThanOrEqual(1);
|
||||
expect(y - (picker.y + picker.height)).toBeLessThanOrEqual(6);
|
||||
expect(Math.abs(height - 150)).toBeLessThanOrEqual(1);
|
||||
|
||||
await language.click();
|
||||
await page.getByRole("option", { name: "TypeScript" }).click();
|
||||
await editor.fill("console.log($value$)");
|
||||
await expect
|
||||
.poll(() => ipcCalls(page, "structural_validate"))
|
||||
.toContainEqual({
|
||||
query: { language: "typescript", pattern: "console.log($value$)", replacement: null, maxMatches: 0 },
|
||||
});
|
||||
await expect(dialog.getByRole("button", { name: "Find", exact: true })).toBeEnabled();
|
||||
});
|
||||
|
||||
test("Structural Replace uses editor typography and fits the template controls in a narrow window", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 400, height: 620 });
|
||||
await openDialog(page, "find.replaceStructural");
|
||||
const dialog = page.getByRole("dialog", { name: "Structural Replace" });
|
||||
const search = dialog.getByRole("textbox", { name: "Search template" });
|
||||
const replacement = dialog.getByRole("textbox", { name: "Replace template" });
|
||||
await expect(search).toBeFocused();
|
||||
await page.evaluate(async () => {
|
||||
const projectModule = "/src/platform/project.ts";
|
||||
const { useProject } = await import(/* @vite-ignore */ projectModule);
|
||||
const { settings, project } = useProject.getState();
|
||||
const current = settings ?? project?.settings;
|
||||
if (!current) throw new Error("Expected project settings");
|
||||
useProject.setState({
|
||||
settings: { ...current, editor: { ...current.editor, fontFamily: "Consolas", fontSize: 17, lineHeight: 26 } },
|
||||
});
|
||||
});
|
||||
|
||||
for (const template of [search, replacement]) {
|
||||
await expect(template).toHaveCSS("font-family", /^Consolas,/);
|
||||
await expect(template).toHaveCSS("font-size", "17px");
|
||||
await expect(template).toHaveCSS("line-height", "26px");
|
||||
const box = (await template.boundingBox())!;
|
||||
expect(box.x).toBeGreaterThanOrEqual(0);
|
||||
expect(box.x + box.width).toBeLessThanOrEqual(400);
|
||||
expect(Math.abs(box.height - 105)).toBeLessThanOrEqual(1);
|
||||
}
|
||||
await expect(dialog.getByRole("radio", { name: "Whole project" })).toBeInViewport();
|
||||
await replacement.fill("Objects.equals($a$, $b$)");
|
||||
await expect(replacement).toHaveValue("Objects.equals($a$, $b$)");
|
||||
await expect(dialog.getByRole("button", { name: "Cancel" })).toBeInViewport();
|
||||
});
|
||||
@@ -71,7 +71,15 @@ for (const { width, split } of [{ width: 220 }, { width: 280 }, { width: 520 },
|
||||
const search = terminal.getByRole("search", { name: "Find in terminal" });
|
||||
const input = search.getByRole("textbox", { name: "Find in terminal" });
|
||||
await input.fill("alpha");
|
||||
await expect(search.locator("[aria-live=polite]")).toHaveText(/\d+\/3/);
|
||||
const count = search.locator("[aria-live=polite]");
|
||||
await expect(count).toHaveText(/\d+\/3/);
|
||||
await expect(count).toHaveCSS("font-size", "13px");
|
||||
const match = await count.textContent();
|
||||
// The incremental search can report after the first Enter; retry until Enter moves on.
|
||||
await expect(async () => {
|
||||
await input.press("Enter");
|
||||
await expect(count).not.toHaveText(match!, { timeout: 1000 });
|
||||
}).toPass();
|
||||
if (process.env.OPENIDEA_TERMINAL_SHOTS)
|
||||
await terminal.screenshot({
|
||||
path: `${process.env.OPENIDEA_TERMINAL_SHOTS}/terminal-${width}${split ? "-split" : ""}.png`,
|
||||
@@ -83,9 +91,19 @@ for (const { width, split } of [{ width: 220 }, { width: 280 }, { width: 520 },
|
||||
expect(rect.x).toBeGreaterThanOrEqual(bounds.x);
|
||||
expect(rect.x + rect.width).toBeLessThanOrEqual(bounds.x + bounds.width + 1);
|
||||
}
|
||||
expect((await input.boundingBox())!.width).toBeGreaterThan(40);
|
||||
|
||||
const matchCase = search.getByRole("button", { name: "Match Case", exact: true });
|
||||
const inputBox = (await input.boundingBox())!;
|
||||
if (width <= 280 || split) {
|
||||
expect(inputBox.width).toBeGreaterThan(bounds.width * 0.62);
|
||||
expect((await matchCase.boundingBox())!.y).toBeGreaterThan(inputBox.y + inputBox.height);
|
||||
} else {
|
||||
expect(inputBox.width).toBeGreaterThan(80);
|
||||
}
|
||||
const countBox = (await count.boundingBox())!;
|
||||
const previousBox = (await search.getByRole("button", { name: "Previous Occurrence", exact: true }).boundingBox())!;
|
||||
expect(previousBox.x - countBox.x - countBox.width).toBeLessThanOrEqual(4);
|
||||
expect(countBox.y + countBox.height / 2).toBeCloseTo(previousBox.y + previousBox.height / 2, 0);
|
||||
|
||||
await matchCase.focus();
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(matchCase).toHaveAttribute("aria-pressed", "true");
|
||||
@@ -130,7 +148,7 @@ test("wide terminal search leaves the grid in place and avoids covering the acti
|
||||
const top = (await search.boundingBox())!;
|
||||
expect(top.y).toBeCloseTo(before.y, 0);
|
||||
expect(top.x + top.width).toBeCloseTo(before.x + before.width, 0);
|
||||
expect(top.width).toBeLessThan(before.width);
|
||||
expect(top.width).toBeLessThan(420);
|
||||
|
||||
await input.fill("right-edge");
|
||||
await expect(search.locator("[aria-live=polite]")).toHaveText("1/1");
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test.use({ hasTouch: true, isMobile: true, viewport: { width: 1180, height: 820 } });
|
||||
|
||||
test("a touch screen gets finger-sized rows and a long press opens the context menu", async ({ workbench: page }) => {
|
||||
await expect(page.locator("html")).toHaveAttribute("data-form-factor", "tablet");
|
||||
await expect(page.locator("html")).toHaveAttribute("data-touch", "");
|
||||
|
||||
const row = page.getByRole("treeitem", { name: /acme-api/ });
|
||||
expect((await row.boundingBox())?.height).toBe(36);
|
||||
|
||||
const box = (await row.boundingBox())!;
|
||||
const point = { x: Math.round(box.x + 40), y: Math.round(box.y + box.height / 2) };
|
||||
const cdp = await page.context().newCDPSession(page);
|
||||
await cdp.send("Input.dispatchTouchEvent", { type: "touchStart", touchPoints: [point] });
|
||||
await page.waitForTimeout(700);
|
||||
await cdp.send("Input.dispatchTouchEvent", { type: "touchEnd", touchPoints: [] });
|
||||
|
||||
// One menu, still open after the finger lifts.
|
||||
await expect(page.getByRole("menu")).toHaveCount(1);
|
||||
await expect(page.getByRole("menuitem", { name: "Copy Path/Reference…" })).toBeVisible();
|
||||
await page.screenshot({ path: test.info().outputPath("touch-long-press.png"), animations: "disabled" });
|
||||
});
|
||||
|
||||
test.describe("phone", () => {
|
||||
test.use({ viewport: { width: 390, height: 844 } });
|
||||
|
||||
test("shows one page at a time above a bottom bar of tool windows", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
const bar = page.getByRole("navigation", { name: "Tool Windows" });
|
||||
await expect(bar.getByRole("button")).toHaveText(["Agents", "Editor", "Git", "Database", "More"]);
|
||||
await expect(page.getByRole("tree", { name: "Project" })).toHaveCount(0);
|
||||
|
||||
await bar.getByRole("button", { name: "Git" }).tap();
|
||||
await expect(page.getByRole("region", { name: "Commit", exact: true })).toBeVisible();
|
||||
await page.getByRole("tab", { name: "Log" }).tap();
|
||||
await expect(page.getByRole("region", { name: "Git", exact: true })).toBeVisible();
|
||||
|
||||
await bar.getByRole("button", { name: "More" }).tap();
|
||||
await page.getByRole("button", { name: "Project", exact: true }).tap();
|
||||
const project = page.getByRole("region", { name: "Project", exact: true });
|
||||
await expect(project.getByRole("tree", { name: "Project" })).toBeVisible();
|
||||
await expect(project.getByRole("button", { name: "Hide" })).toHaveCount(0);
|
||||
await expect(bar.getByRole("button", { name: "More" })).toHaveAttribute("aria-current", "page");
|
||||
await page.screenshot({ path: test.info().outputPath("phone-project.png"), animations: "disabled" });
|
||||
|
||||
await page.getByRole("button", { name: "Back" }).tap();
|
||||
await expect(page.getByRole("heading", { name: "Tool Windows" })).toBeVisible();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,26 @@
|
||||
[package]
|
||||
name = "openidea-mobile"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
publish = false
|
||||
description = "OpenIDEA for phones: a client of a paired desktop's backend."
|
||||
|
||||
[lib]
|
||||
name = "openidea_mobile_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2", features = [] }
|
||||
ide-jsonrpc.workspace = true
|
||||
ide-pair.workspace = true
|
||||
iroh = "1.3"
|
||||
parking_lot.workspace = true
|
||||
rustls.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
tokio = { workspace = true, features = ["rt-multi-thread", "sync", "time"] }
|
||||
tracing.workspace = true
|
||||
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../gen/schemas/mobile-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "The phone app's window",
|
||||
"windows": ["main"],
|
||||
"permissions": ["core:default"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
xcuserdata/
|
||||
build/
|
||||
Externals/
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 118 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,116 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "83.5x83.5",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "ios-marketing",
|
||||
"filename" : "[email protected]",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>method</key>
|
||||
<string>debugging</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17150" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Y6W-OH-hqX">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17122"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="s0d-6b-0kx">
|
||||
<objects>
|
||||
<viewController id="Y6W-OH-hqX" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="5EZ-qb-Rvc">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
@@ -0,0 +1,21 @@
|
||||
# Uncomment the next line to define a global platform for your project
|
||||
|
||||
target 'openidea-mobile_iOS' do
|
||||
platform :ios, '15.0'
|
||||
# Pods for openidea-mobile_iOS
|
||||
end
|
||||
|
||||
target 'openidea-mobile_macOS' do
|
||||
platform :osx, '11.0'
|
||||
# Pods for openidea-mobile_macOS
|
||||
end
|
||||
|
||||
# Delete the deployment target for iOS and macOS, causing it to be inherited from the Podfile
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
target.build_configurations.each do |config|
|
||||
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
|
||||
config.build_settings.delete 'MACOSX_DEPLOYMENT_TARGET'
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
namespace ffi {
|
||||
extern "C" {
|
||||
void start_app();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "bindings/bindings.h"
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
ffi::start_app();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,482 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 77;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
2744EE2804F53E6D881BBF63 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = CB2F9850B5B2E58F8850F60C /* main.mm */; };
|
||||
439CE87E75F5AD3D7C2BB846 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7C4C118DEB9045B80D2E2F33 /* Metal.framework */; };
|
||||
50A2CEA4BFAE82C5417AF211 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0335D6DAA4A236FA00ABDDE /* UIKit.framework */; };
|
||||
558FF4DEC743B4C4A4E1394A /* MetalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F6A2CA6A9929991FAE262E92 /* MetalKit.framework */; };
|
||||
67FF332B4F390BA7238EC4AD /* libapp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 51CF154506119E3532192BDB /* libapp.a */; };
|
||||
7427A0592E7B97C8138D6D77 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B0916BE90883D96E76F981E4 /* SystemConfiguration.framework */; };
|
||||
761D09B9E2A025076C7B5BB7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 61DCE72B6C0408FC68D678A9 /* Assets.xcassets */; };
|
||||
8A3D17B05D91E14C58E16E7C /* libresolv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = EBA16B20F8C1BD770CE41317 /* libresolv.tbd */; };
|
||||
9B750D464D1F6CC949D0A296 /* assets in Resources */ = {isa = PBXBuildFile; fileRef = 757B8928C4FFC96B8E547556 /* assets */; };
|
||||
A0D84801569B5C8D81344B35 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9C4E9850A60BC849577163F /* CoreGraphics.framework */; };
|
||||
A64C2C85D1B23CCAD0ECEF4A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2E4ABD78F29F9B6F20AD5F99 /* Security.framework */; };
|
||||
B3A80B9591727EFEA3A4FF5A /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 023842344E3E19138412F2BB /* WebKit.framework */; };
|
||||
EB560C0C028CA3980BAAAB14 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FEBCCAD47D16E3FE348AA8D9 /* LaunchScreen.storyboard */; };
|
||||
F10CE1D0D0B023C65E70039C /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BB417B443C7D99CBCA63EC83 /* QuartzCore.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
023842344E3E19138412F2BB /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
|
||||
031ADDAE46B9939F945B3608 /* main.rs */ = {isa = PBXFileReference; path = main.rs; sourceTree = "<group>"; };
|
||||
17D55C8B634D7F3CA145C29D /* openidea-mobile_iOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "openidea-mobile_iOS.entitlements"; sourceTree = "<group>"; };
|
||||
2E4ABD78F29F9B6F20AD5F99 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
|
||||
51CF154506119E3532192BDB /* libapp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libapp.a; sourceTree = "<group>"; };
|
||||
61DCE72B6C0408FC68D678A9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
70A325B1D770533BD52889F7 /* lib.rs */ = {isa = PBXFileReference; path = lib.rs; sourceTree = "<group>"; };
|
||||
735E9C39344322F0BAB0586A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||
757B8928C4FFC96B8E547556 /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; path = assets; sourceTree = SOURCE_ROOT; };
|
||||
7C4C118DEB9045B80D2E2F33 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; };
|
||||
847192858CD7077DE5B78EAC /* openidea-mobile_iOS.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = "openidea-mobile_iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
896863188D37FC615176FB77 /* bindings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bindings.h; sourceTree = "<group>"; };
|
||||
A9C4E9850A60BC849577163F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
|
||||
B0916BE90883D96E76F981E4 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
|
||||
BB417B443C7D99CBCA63EC83 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
|
||||
CB2F9850B5B2E58F8850F60C /* main.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; };
|
||||
EBA16B20F8C1BD770CE41317 /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; };
|
||||
F0335D6DAA4A236FA00ABDDE /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
||||
F6A2CA6A9929991FAE262E92 /* MetalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalKit.framework; path = System/Library/Frameworks/MetalKit.framework; sourceTree = SDKROOT; };
|
||||
FEBCCAD47D16E3FE348AA8D9 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
4C0BD3FEE4255BFF3BA6569E /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
67FF332B4F390BA7238EC4AD /* libapp.a in Frameworks */,
|
||||
A0D84801569B5C8D81344B35 /* CoreGraphics.framework in Frameworks */,
|
||||
439CE87E75F5AD3D7C2BB846 /* Metal.framework in Frameworks */,
|
||||
558FF4DEC743B4C4A4E1394A /* MetalKit.framework in Frameworks */,
|
||||
F10CE1D0D0B023C65E70039C /* QuartzCore.framework in Frameworks */,
|
||||
A64C2C85D1B23CCAD0ECEF4A /* Security.framework in Frameworks */,
|
||||
7427A0592E7B97C8138D6D77 /* SystemConfiguration.framework in Frameworks */,
|
||||
8A3D17B05D91E14C58E16E7C /* libresolv.tbd in Frameworks */,
|
||||
50A2CEA4BFAE82C5417AF211 /* UIKit.framework in Frameworks */,
|
||||
B3A80B9591727EFEA3A4FF5A /* WebKit.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
172B4D6F3AD687EF6BC4AC13 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
757B8928C4FFC96B8E547556 /* assets */,
|
||||
61DCE72B6C0408FC68D678A9 /* Assets.xcassets */,
|
||||
FEBCCAD47D16E3FE348AA8D9 /* LaunchScreen.storyboard */,
|
||||
B26E6A55FCF5686AD3906FFF /* Externals */,
|
||||
F551C95FA1868AE5DA51D100 /* openidea-mobile_iOS */,
|
||||
55CB6D093DCFABB98F780B17 /* Sources */,
|
||||
CA107C281B8B1F5BB49E41D7 /* src */,
|
||||
638EE276B309A4ED7C13784B /* Frameworks */,
|
||||
D8049152DD2DE1ECECBD14CF /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
55CB6D093DCFABB98F780B17 /* Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DCC0C46EC2E539EF574DFA67 /* openidea-mobile */,
|
||||
);
|
||||
path = Sources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
638EE276B309A4ED7C13784B /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A9C4E9850A60BC849577163F /* CoreGraphics.framework */,
|
||||
51CF154506119E3532192BDB /* libapp.a */,
|
||||
EBA16B20F8C1BD770CE41317 /* libresolv.tbd */,
|
||||
7C4C118DEB9045B80D2E2F33 /* Metal.framework */,
|
||||
F6A2CA6A9929991FAE262E92 /* MetalKit.framework */,
|
||||
BB417B443C7D99CBCA63EC83 /* QuartzCore.framework */,
|
||||
2E4ABD78F29F9B6F20AD5F99 /* Security.framework */,
|
||||
B0916BE90883D96E76F981E4 /* SystemConfiguration.framework */,
|
||||
F0335D6DAA4A236FA00ABDDE /* UIKit.framework */,
|
||||
023842344E3E19138412F2BB /* WebKit.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B26E6A55FCF5686AD3906FFF /* Externals */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = Externals;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C621872E9E0D2C765CE79B42 /* bindings */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
896863188D37FC615176FB77 /* bindings.h */,
|
||||
);
|
||||
path = bindings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CA107C281B8B1F5BB49E41D7 /* src */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
70A325B1D770533BD52889F7 /* lib.rs */,
|
||||
031ADDAE46B9939F945B3608 /* main.rs */,
|
||||
);
|
||||
name = src;
|
||||
path = ../../src;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D8049152DD2DE1ECECBD14CF /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
847192858CD7077DE5B78EAC /* openidea-mobile_iOS.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
DCC0C46EC2E539EF574DFA67 /* openidea-mobile */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CB2F9850B5B2E58F8850F60C /* main.mm */,
|
||||
C621872E9E0D2C765CE79B42 /* bindings */,
|
||||
);
|
||||
path = "openidea-mobile";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F551C95FA1868AE5DA51D100 /* openidea-mobile_iOS */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
735E9C39344322F0BAB0586A /* Info.plist */,
|
||||
17D55C8B634D7F3CA145C29D /* openidea-mobile_iOS.entitlements */,
|
||||
);
|
||||
path = "openidea-mobile_iOS";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
"TEMP_6FE66B9E-FD05-477E-9B43-E0D023270A34" /* arm64 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = arm64;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
"TEMP_D69FF00B-4A56-4E76-B751-168968D4AF6A" /* x86_64 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = x86_64;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
8CFF48BAA56B4120D8BA712B /* openidea-mobile_iOS */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1F9E7E2EDE92674BB8D0C67A /* Build configuration list for PBXNativeTarget "openidea-mobile_iOS" */;
|
||||
buildPhases = (
|
||||
3DEE39C0B2E9A26D8DFE0116 /* Build Rust Code */,
|
||||
BA18F72BCCD0E4F1DF3F6687 /* Sources */,
|
||||
4B64842C21CCD4FD9313BC6B /* Resources */,
|
||||
4C0BD3FEE4255BFF3BA6569E /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "openidea-mobile_iOS";
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = "openidea-mobile_iOS";
|
||||
productReference = 847192858CD7077DE5B78EAC /* openidea-mobile_iOS.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
E186C563A0B9A8C675E62D27 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = YES;
|
||||
LastUpgradeCheck = 1430;
|
||||
TargetAttributes = {
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 3A54F638E765215F8035A58F /* Build configuration list for PBXProject "openidea-mobile" */;
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
Base,
|
||||
en,
|
||||
);
|
||||
mainGroup = 172B4D6F3AD687EF6BC4AC13;
|
||||
minimizedProjectReferenceProxies = 1;
|
||||
preferredProjectObjectVersion = 77;
|
||||
productRefGroup = D8049152DD2DE1ECECBD14CF /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
8CFF48BAA56B4120D8BA712B /* openidea-mobile_iOS */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
4B64842C21CCD4FD9313BC6B /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
761D09B9E2A025076C7B5BB7 /* Assets.xcassets in Resources */,
|
||||
EB560C0C028CA3980BAAAB14 /* LaunchScreen.storyboard in Resources */,
|
||||
9B750D464D1F6CC949D0A296 /* assets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
3DEE39C0B2E9A26D8DFE0116 /* Build Rust Code */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Build Rust Code";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(SRCROOT)/Externals/x86_64/${CONFIGURATION}/libapp.a",
|
||||
"$(SRCROOT)/Externals/arm64/${CONFIGURATION}/libapp.a",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "pnpm tauri ios xcode-script -v --platform \"${PLATFORM_DISPLAY_NAME:?}\" --sdk-root \"${SDKROOT:?}\" --framework-search-paths \"${FRAMEWORK_SEARCH_PATHS:?}\" --header-search-paths \"${HEADER_SEARCH_PATHS:?}\" --gcc-preprocessor-definitions \"${GCC_PREPROCESSOR_DEFINITIONS:-}\" --configuration \"${CONFIGURATION:?}\" ${FORCE_COLOR} ${ARCHS:?}\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
BA18F72BCCD0E4F1DF3F6687 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2744EE2804F53E6D881BBF63 /* main.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
38DDA77512FF41759C083562 /* debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ARCHS = (
|
||||
arm64,
|
||||
);
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = "openidea-mobile_iOS/openidea-mobile_iOS.entitlements";
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
ENABLE_BITCODE = NO;
|
||||
"EXCLUDED_ARCHS[sdk=iphoneos*]" = x86_64;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\".\"",
|
||||
);
|
||||
INFOPLIST_FILE = "openidea-mobile_iOS/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
"LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(PLATFORM_NAME) $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/$(PLATFORM_NAME)";
|
||||
"LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(PLATFORM_NAME) $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/$(PLATFORM_NAME)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ai.l0ng.openidea.mobile;
|
||||
PRODUCT_NAME = "OpenIDEA Mobile";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALID_ARCHS = arm64;
|
||||
};
|
||||
name = debug;
|
||||
};
|
||||
900382D9B8AEDB1E9722F8D6 /* release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = release;
|
||||
};
|
||||
E2545040F8CCC1D43776F5BA /* release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ARCHS = (
|
||||
arm64,
|
||||
);
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = "openidea-mobile_iOS/openidea-mobile_iOS.entitlements";
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
ENABLE_BITCODE = NO;
|
||||
"EXCLUDED_ARCHS[sdk=iphoneos*]" = x86_64;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\".\"",
|
||||
);
|
||||
INFOPLIST_FILE = "openidea-mobile_iOS/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
"LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(PLATFORM_NAME) $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/$(PLATFORM_NAME)";
|
||||
"LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(PLATFORM_NAME) $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/$(PLATFORM_NAME)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ai.l0ng.openidea.mobile;
|
||||
PRODUCT_NAME = "OpenIDEA Mobile";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALID_ARCHS = arm64;
|
||||
};
|
||||
name = release;
|
||||
};
|
||||
ED212AB5CA50F2EC04BBD81B /* debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
"DEBUG=1",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = debug;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
1F9E7E2EDE92674BB8D0C67A /* Build configuration list for PBXNativeTarget "openidea-mobile_iOS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
38DDA77512FF41759C083562 /* debug */,
|
||||
E2545040F8CCC1D43776F5BA /* release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = debug;
|
||||
};
|
||||
3A54F638E765215F8035A58F /* Build configuration list for PBXProject "openidea-mobile" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
ED212AB5CA50F2EC04BBD81B /* debug */,
|
||||
900382D9B8AEDB1E9722F8D6 /* release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = debug;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = E186C563A0B9A8C675E62D27 /* Project object */;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildSystemType</key>
|
||||
<string>Original</string>
|
||||
<key>DisableBuildSystemDeprecationDiagnostic</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1430"
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES"
|
||||
runPostActionsOnFailure = "NO">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "8CFF48BAA56B4120D8BA712B"
|
||||
BuildableName = "openidea-mobile_iOS.app"
|
||||
BlueprintName = "openidea-mobile_iOS"
|
||||
ReferencedContainer = "container:openidea-mobile.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "NO"
|
||||
onlyGenerateCoverageForSpecifiedTargets = "NO">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "8CFF48BAA56B4120D8BA712B"
|
||||
BuildableName = "openidea-mobile_iOS.app"
|
||||
BlueprintName = "openidea-mobile_iOS"
|
||||
ReferencedContainer = "container:openidea-mobile.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<Testables>
|
||||
</Testables>
|
||||
<CommandLineArguments>
|
||||
</CommandLineArguments>
|
||||
<EnvironmentVariables>
|
||||
<EnvironmentVariable
|
||||
key = "RUST_BACKTRACE"
|
||||
value = "full"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
<EnvironmentVariable
|
||||
key = "RUST_LOG"
|
||||
value = "info"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
</EnvironmentVariables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "8CFF48BAA56B4120D8BA712B"
|
||||
BuildableName = "openidea-mobile_iOS.app"
|
||||
BlueprintName = "openidea-mobile_iOS"
|
||||
ReferencedContainer = "container:openidea-mobile.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<CommandLineArguments>
|
||||
</CommandLineArguments>
|
||||
<EnvironmentVariables>
|
||||
<EnvironmentVariable
|
||||
key = "RUST_BACKTRACE"
|
||||
value = "full"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
<EnvironmentVariable
|
||||
key = "RUST_LOG"
|
||||
value = "info"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
</EnvironmentVariables>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "release"
|
||||
shouldUseLaunchSchemeArgsEnv = "NO"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "8CFF48BAA56B4120D8BA712B"
|
||||
BuildableName = "openidea-mobile_iOS.app"
|
||||
BlueprintName = "openidea-mobile_iOS"
|
||||
ReferencedContainer = "container:openidea-mobile.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<CommandLineArguments>
|
||||
</CommandLineArguments>
|
||||
<EnvironmentVariables>
|
||||
<EnvironmentVariable
|
||||
key = "RUST_BACKTRACE"
|
||||
value = "full"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
<EnvironmentVariable
|
||||
key = "RUST_LOG"
|
||||
value = "info"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
</EnvironmentVariables>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
<string>metal</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict/>
|
||||
</plist>
|
||||
@@ -0,0 +1,97 @@
|
||||
name: openidea-mobile
|
||||
options:
|
||||
bundleIdPrefix: ai.l0ng.openidea.mobile
|
||||
deploymentTarget:
|
||||
iOS: 15.0
|
||||
fileGroups: [../../src]
|
||||
configs:
|
||||
debug: debug
|
||||
release: release
|
||||
settingGroups:
|
||||
app:
|
||||
base:
|
||||
PRODUCT_NAME: OpenIDEA Mobile
|
||||
PRODUCT_BUNDLE_IDENTIFIER: ai.l0ng.openidea.mobile
|
||||
targetTemplates:
|
||||
app:
|
||||
type: application
|
||||
sources:
|
||||
- path: Sources
|
||||
scheme:
|
||||
environmentVariables:
|
||||
RUST_BACKTRACE: full
|
||||
RUST_LOG: info
|
||||
settings:
|
||||
groups: [app]
|
||||
targets:
|
||||
openidea-mobile_iOS:
|
||||
type: application
|
||||
platform: iOS
|
||||
sources:
|
||||
- path: Sources
|
||||
- path: Assets.xcassets
|
||||
# Exclude built static libs: regenerating with xcodegen after a build
|
||||
# otherwise turns the per-configuration libapp.a copies into colliding
|
||||
# resources ("Multiple commands produce …/libapp.a"). They are linked
|
||||
# via LIBRARY_SEARCH_PATHS, never bundled as resources.
|
||||
- path: Externals
|
||||
excludes: ["**/*.a"]
|
||||
- path: openidea-mobile_iOS
|
||||
- path: assets
|
||||
buildPhase: resources
|
||||
type: folder
|
||||
- path: LaunchScreen.storyboard
|
||||
info:
|
||||
path: openidea-mobile_iOS/Info.plist
|
||||
properties:
|
||||
LSRequiresIPhoneOS: true
|
||||
UILaunchStoryboardName: LaunchScreen
|
||||
UIRequiredDeviceCapabilities: [arm64, metal]
|
||||
UISupportedInterfaceOrientations:
|
||||
- UIInterfaceOrientationPortrait
|
||||
- UIInterfaceOrientationLandscapeLeft
|
||||
- UIInterfaceOrientationLandscapeRight
|
||||
UISupportedInterfaceOrientations~ipad:
|
||||
- UIInterfaceOrientationPortrait
|
||||
- UIInterfaceOrientationPortraitUpsideDown
|
||||
- UIInterfaceOrientationLandscapeLeft
|
||||
- UIInterfaceOrientationLandscapeRight
|
||||
CFBundleShortVersionString: 1.0.0
|
||||
CFBundleVersion: "1.0.0"
|
||||
entitlements:
|
||||
path: openidea-mobile_iOS/openidea-mobile_iOS.entitlements
|
||||
scheme:
|
||||
environmentVariables:
|
||||
RUST_BACKTRACE: full
|
||||
RUST_LOG: info
|
||||
settings:
|
||||
base:
|
||||
ENABLE_BITCODE: false
|
||||
ARCHS: [arm64]
|
||||
VALID_ARCHS: arm64
|
||||
LIBRARY_SEARCH_PATHS[arch=x86_64]: $(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(PLATFORM_NAME) $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/$(PLATFORM_NAME)
|
||||
LIBRARY_SEARCH_PATHS[arch=arm64]: $(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(PLATFORM_NAME) $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/$(PLATFORM_NAME)
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES: true
|
||||
EXCLUDED_ARCHS[sdk=iphoneos*]: x86_64
|
||||
groups: [app]
|
||||
dependencies:
|
||||
- framework: libapp.a
|
||||
embed: false
|
||||
- sdk: CoreGraphics.framework
|
||||
- sdk: Metal.framework
|
||||
- sdk: MetalKit.framework
|
||||
- sdk: QuartzCore.framework
|
||||
- sdk: Security.framework
|
||||
# iroh: network interfaces and DNS servers.
|
||||
- sdk: SystemConfiguration.framework
|
||||
- sdk: libresolv.tbd
|
||||
- sdk: UIKit.framework
|
||||
- sdk: WebKit.framework
|
||||
preBuildScripts:
|
||||
- script: |
|
||||
pnpm tauri ios xcode-script -v --platform "${PLATFORM_DISPLAY_NAME:?}" --sdk-root "${SDKROOT:?}" --framework-search-paths "${FRAMEWORK_SEARCH_PATHS:?}" --header-search-paths "${HEADER_SEARCH_PATHS:?}" --gcc-preprocessor-definitions "${GCC_PREPROCESSOR_DEFINITIONS:-}" --configuration "${CONFIGURATION:?}" ${FORCE_COLOR} ${ARCHS:?}
|
||||
name: Build Rust Code
|
||||
basedOnDependencyAnalysis: false
|
||||
outputFiles:
|
||||
- $(SRCROOT)/Externals/x86_64/${CONFIGURATION}/libapp.a
|
||||
- $(SRCROOT)/Externals/arm64/${CONFIGURATION}/libapp.a
|
||||
@@ -0,0 +1 @@
|
||||
{"core":{"default_permission":{"identifier":"default","description":"Default core plugins set.","permissions":["core:path:default","core:event:default","core:window:default","core:webview:default","core:app:default","core:image:default","core:resources:default","core:menu:default","core:tray:default"]},"permissions":{},"permission_sets":{},"global_scope_schema":null},"core:app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version","allow-identifier","allow-bundle-type","allow-register-listener","allow-remove-listener","allow-supports-multiple-windows"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-bundle-type":{"identifier":"allow-bundle-type","description":"Enables the bundle_type command without any pre-configured scope.","commands":{"allow":["bundle_type"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-exit":{"identifier":"allow-exit","description":"Enables the exit command without any pre-configured scope.","commands":{"allow":["exit"],"deny":[]}},"allow-fetch-data-store-identifiers":{"identifier":"allow-fetch-data-store-identifiers","description":"Enables the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":["fetch_data_store_identifiers"],"deny":[]}},"allow-identifier":{"identifier":"allow-identifier","description":"Enables the identifier command without any pre-configured scope.","commands":{"allow":["identifier"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","commands":{"allow":["name"],"deny":[]}},"allow-register-listener":{"identifier":"allow-register-listener","description":"Enables the register_listener command without any pre-configured scope.","commands":{"allow":["register_listener"],"deny":[]}},"allow-remove-data-store":{"identifier":"allow-remove-data-store","description":"Enables the remove_data_store command without any pre-configured scope.","commands":{"allow":["remove_data_store"],"deny":[]}},"allow-remove-listener":{"identifier":"allow-remove-listener","description":"Enables the remove_listener command without any pre-configured scope.","commands":{"allow":["remove_listener"],"deny":[]}},"allow-set-app-theme":{"identifier":"allow-set-app-theme","description":"Enables the set_app_theme command without any pre-configured scope.","commands":{"allow":["set_app_theme"],"deny":[]}},"allow-set-dock-visibility":{"identifier":"allow-set-dock-visibility","description":"Enables the set_dock_visibility command without any pre-configured scope.","commands":{"allow":["set_dock_visibility"],"deny":[]}},"allow-supports-multiple-windows":{"identifier":"allow-supports-multiple-windows","description":"Enables the supports_multiple_windows command without any pre-configured scope.","commands":{"allow":["supports_multiple_windows"],"deny":[]}},"allow-tauri-version":{"identifier":"allow-tauri-version","description":"Enables the tauri_version command without any pre-configured scope.","commands":{"allow":["tauri_version"],"deny":[]}},"allow-version":{"identifier":"allow-version","description":"Enables the version command without any pre-configured scope.","commands":{"allow":["version"],"deny":[]}},"deny-app-hide":{"identifier":"deny-app-hide","description":"Denies the app_hide command without any pre-configured scope.","commands":{"allow":[],"deny":["app_hide"]}},"deny-app-show":{"identifier":"deny-app-show","description":"Denies the app_show command without any pre-configured scope.","commands":{"allow":[],"deny":["app_show"]}},"deny-bundle-type":{"identifier":"deny-bundle-type","description":"Denies the bundle_type command without any pre-configured scope.","commands":{"allow":[],"deny":["bundle_type"]}},"deny-default-window-icon":{"identifier":"deny-default-window-icon","description":"Denies the default_window_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["default_window_icon"]}},"deny-exit":{"identifier":"deny-exit","description":"Denies the exit command without any pre-configured scope.","commands":{"allow":[],"deny":["exit"]}},"deny-fetch-data-store-identifiers":{"identifier":"deny-fetch-data-store-identifiers","description":"Denies the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":[],"deny":["fetch_data_store_identifiers"]}},"deny-identifier":{"identifier":"deny-identifier","description":"DenLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
{"default":{"identifier":"default","description":"The phone app's window","local":true,"windows":["main"],"permissions":["core:default"]}}
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 718 B |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 3.5 KiB |