This commit is contained in:
Karl Seguin
2025-03-11 10:51:40 +08:00
parent 5182edce6f
commit e3409a27e7
2 changed files with 7 additions and 2 deletions

View File

@@ -274,13 +274,13 @@ test "cdp.page: getFrameTree" {
try ctx.expectSentError(-31998, "BrowserContextNotLoaded", .{ .id = 10 });
}
const bc = try ctx.loadBrowserContext(.{ .id = "BID-9" });
const bc = try ctx.loadBrowserContext(.{ .id = "BID-9", .target_id = "TID-3" });
{
try ctx.processMessage(.{ .id = 11, .method = "Page.getFrameTree" });
try ctx.expectSentResult(.{
.frameTree = .{
.frame = .{
.id = bc.frame_id,
.id = "TID-3",
.loaderId = bc.loader_id,
.url = bc.url,
.domainAndRegistry = "",

View File

@@ -147,6 +147,7 @@ const TestContext = struct {
const BrowserContextOpts = struct {
id: ?[]const u8 = null,
target_id: ?[]const u8 = null,
session_id: ?[]const u8 = null,
};
pub fn loadBrowserContext(self: *TestContext, opts: BrowserContextOpts) !*main.BrowserContext(TestCDP) {
@@ -163,6 +164,10 @@ const TestContext = struct {
bc.id = id;
}
if (opts.target_id) |tid| {
bc.target_id = tid;
}
if (opts.session_id) |sid| {
bc.session_id = sid;
}