Skip to content

armgit / moli

Public Imported from GitHub
0

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

test(fetch): wait for child document decoding message

ldm088639900ac64
diff --git a/moli-core/tests/fetch_behaviors.rs b/moli-core/tests/fetch_behaviors.rs
index 27f28a3dd..164489f7e 100644
--- a/moli-core/tests/fetch_behaviors.rs
+++ b/moli-core/tests/fetch_behaviors.rs
@@ -206,9 +206,17 @@ async fn child_document_html_decodes_from_raw_response_bytes() -> Result<()> {
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-document-parent"))
.await?;
+ // The decoded result arrives through a queued child message task.
+ browser
+ .wait_for_script_truthy(
+ &mut page,
+ "document.body.hasAttribute('data-child-document-text')",
+ Duration::from_secs(5),
+ )
+ .await?;
let html = page.serialize_html_async().await.unwrap();
assert!(