Files
freedak f7a720204a Update: 将子项目从 submodule 转为完整内容
- 移除 GovAI, nomifun-tauri, 算力盒子 的 submodule 引用
- 添加所有子项目的完整源代码
- 保留原始 .git 为 .git.bak 备份
2026-07-04 19:20:46 +08:00

46 lines
1.8 KiB
Rust

//! Task 3: `bring_to_front` engine seam — `#[ignore]` real-Chrome test (headful).
//!
//! Verifies that `CdpBackend::bring_to_front()` successfully sends `Page.bringToFront`
//! + `Target.activateTarget` when the engine is headful. Also verifies that a headless
//! engine returns `BrowserError::Unsupported`.
//!
//! Manual run (requires a display + Chrome):
//! NOMIFUN_CHROME_BINARY="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
//! cargo nextest run -p nomi-browser-engine --run-ignored all -E 'test(bring_)'
mod common;
use nomi_browser_engine::BrowserEngine;
/// Headful engine: `bring_to_front` succeeds (no error).
#[tokio::test]
#[ignore = "requires NOMIFUN_CHROME_BINARY + display (headful)"]
async fn bring_window_to_front_succeeds_headful() {
let backend = common::build_backend_for_fixture_headful("bring-front").await;
// Navigate to a simple page so there's something to foreground.
let _nav = backend
.navigate(&common::fixture_url("act-c1.html"), false)
.await
.expect("navigate");
// bring_to_front should succeed on a headful engine.
backend
.bring_to_front()
.await
.expect("bring_to_front on headful engine must succeed");
}
/// Headless engine: `bring_to_front` returns `Unsupported` gracefully.
#[tokio::test]
#[ignore = "requires NOMIFUN_CHROME_BINARY (headless, no display needed)"]
async fn bring_to_front_headless_returns_unsupported() {
let backend = common::build_backend_for_fixture("bring-front-headless").await;
let result = backend.bring_to_front().await;
assert!(
matches!(
result,
Err(nomi_browser_engine::BrowserError::Unsupported { .. })
),
"headless bring_to_front must return Unsupported, got {result:?}"
);
}