Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

test(encoding): await child script message delivery

ldm03569ba32761a
diff --git a/moli-core/tests/fetch_behaviors.rs b/moli-core/tests/fetch_behaviors.rs
index 164489f7e..fc21683ec 100644
--- a/moli-core/tests/fetch_behaviors.rs
+++ b/moli-core/tests/fetch_behaviors.rs
@@ -186,9 +186,18 @@ async fn child_classic_script_resource_inherits_child_document_encoding() -> Res
let server = FixtureServer::spawn().await?;
let browser = Browser::new(AppConfig::default())?;
- let page = browser
+ let mut page = browser
.fetch(&server.url("/encoding/child-shift-jis-classic-script-parent"))
.await?;
+ // Load completion does not wait for the child's queued message task.
+ // Observe its delivery before asserting the decoded script contents.
+ browser
+ .wait_for_script_truthy(
+ &mut page,
+ "document.body.hasAttribute('data-child-script-text')",
+ Duration::from_secs(5),
+ )
+ .await?;
let html = page.serialize_html_async().await.unwrap();
assert!(