re-enable CDP node registry

This commit is contained in:
Karl Seguin
2025-12-09 11:50:33 +08:00
parent 49c0e95664
commit 9132bc2375
13 changed files with 653 additions and 624 deletions

View File

@@ -40,6 +40,7 @@ const App = @import("App.zig");
const js = @import("browser/js/js.zig");
const Browser = @import("browser/Browser.zig");
const Session = @import("browser/Session.zig");
const Page = @import("browser/Page.zig");
// Merged std.testing.expectEqual and std.testing.expectString
// can be useful when testing fields of an anytype an you don't know
@@ -415,6 +416,27 @@ fn runWebApiTest(test_file: [:0]const u8) !void {
};
}
// Used by a few CDP tests - wouldn't be sad to see this go.
pub fn pageTest(comptime test_file: []const u8) !*Page {
const page = try test_session.createPage();
errdefer test_session.removePage();
const url = try std.fmt.allocPrintSentinel(
arena_allocator,
"http://127.0.0.1:9582/{s}{s}",
.{ WEB_API_TEST_ROOT, test_file },
0,
);
try page.navigate(url, .{});
test_session.fetchWait(2000);
page._session.browser.runMicrotasks();
page._session.browser.runMessageLoop();
return page;
}
test {
std.testing.refAllDecls(@This());
}