Files
claw/tests/scene_generator_html_test.rs
木炎 d00086a70b feat: add sg_scene_generator.html with dual-panel UI and settings modal
Add self-contained HTML page for the Scene Skill Generator frontend:
- Dual-column glass-morphism layout matching service-console style
- Left sidebar: status card, sourceDir input with analyze button,
  sceneId/sceneName inputs, settings button, generate button
- Right panel: streaming log display with SSE event rendering
- Settings modal: outputRoot, lessons, llmBaseUrl, llmModel fields
- JavaScript: connects to http://127.0.0.1:3210, implements analyze()
  via fetch POST /analyze, generate() via fetch POST /generate with
  SSE stream reading, settings modal open/close
- Rust test verifying HTML file exists and contains required elements

🤖 Generated with [Qoder][https://qoder.com]
2026-04-16 22:23:33 +08:00

31 lines
1.1 KiB
Rust

use std::fs;
use std::path::PathBuf;
#[test]
fn scene_generator_html_exists_and_has_required_elements() {
let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let html_path = manifest_dir
.join("frontend")
.join("scene-generator")
.join("sg_scene_generator.html");
let source = fs::read_to_string(&html_path)
.unwrap_or_else(|err| panic!("HTML file not found at {:?}: {}", html_path, err));
assert!(source.contains("场景 Skill 生成器"), "missing title");
assert!(source.contains("sourceDir"), "missing sourceDir input");
assert!(source.contains("sceneId"), "missing sceneId input");
assert!(source.contains("sceneName"), "missing sceneName input");
assert!(source.contains("/analyze"), "missing /analyze endpoint");
assert!(source.contains("/generate"), "missing /generate endpoint");
assert!(
source.contains("fetch("),
"missing fetch for API calls"
);
assert!(
source.contains("127.0.0.1") || source.contains("localhost"),
"should reference localhost server"
);
}