Files
shell-rs/tests/ui/support/credential.rs
XuzandClaude Opus 5.5 1c855f1508 多语言基础设施:rust-i18n 接入,界面语言默认跟随系统
文案放进 locales/<模块>.yml,经 crate::i18n 的 t! / tn! 取用;启动时先按设置定语言,
改设置时实时切换并发出 UiLocale。守卫测试检查两种语言齐全、占位一致、没有遗漏和死键。
UI 测试夹具固定中文并隔离本线程的语言。共用件(shared/)先转换。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 21:24:06 +08:00

59 lines
2.0 KiB
Rust

//! The credential tests' workspace and steps.
use super::*;
/// A workspace over `store`, its remote terminals recorded by `remote` and
/// its connection test answered by `tester`. Dialogs do not slide, so their
/// fields stay where they were found.
pub fn open_workspace_with_credentials(
cx: &mut TestAppContext,
store: HostStore,
remote: Arc<RecordingRemoteProvider>,
tester: Arc<FakeConnectionTester>,
) -> (WindowHandle<Root>, Entity<Workspace>) {
init_app(cx);
cx.update(|cx| cx.set_reduce_motion(true));
let mut workspace = None;
let handle = cx.open_window(size(px(1280.), px(800.)), |window, cx| {
let store = cx.new(|_| store);
let view = cx.new(|cx| {
Workspace::new_with_services(
store,
cx.new(|_| settings_store()),
remote,
Arc::new(FakeTerminalFactory::default()),
Arc::new(FakeSftpProvider::default()),
Arc::new(FakeLocalDirectory::default()),
tester,
Arc::new(FakeForwardProvider::default()),
window,
cx,
)
});
workspace = Some(view.clone());
Root::new(view, window, cx)
});
cx.run_until_parked();
(handle, workspace.expect("workspace created"))
}
/// Show the credential list and wait for it to be up.
pub async fn show_credentials(cx: &mut TestAppContext, handle: WindowHandle<Root>) {
in_frame(cx, handle, |window, cx| {
window.click("show-credentials", cx)
});
cx.wait_for(handle.into(), Duration::from_secs(2), |window, _| {
window.try_find("credential-search").is_some()
})
.await;
}
/// Wait for the open dialog to close.
pub async fn wait_for_dialog_to_close(cx: &mut TestAppContext, handle: WindowHandle<Root>) {
cx.wait_for(handle.into(), Duration::from_secs(2), |window, _| {
window.try_find("commit").is_none()
})
.await;
cx.run_until_parked();
}