Lightpanda: the headless browser designed for AI and automation
add modes to the tests
Muki Kiboigo1fe8456cbde1
diff --git a/src/network/HttpClient.zig b/src/network/HttpClient.zigindex 24b07e335..701ee075f 100644--- a/src/network/HttpClient.zig+++ b/src/network/HttpClient.zig@@ -4228,7 +4228,8 @@ fn testTransfer(arena: *lp.Arena) Transfer {.req = .{.method = .GET,.url = "http://example.com/",- .origin = "",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .document,.shutdown_callback = noopShutdown,},@@ -4457,7 +4458,8 @@ test "HttpClient: fulfillIntercepted survives a done_callback that tears down th.req = .{.method = .GET,.url = "http://example.com/",- .origin = "",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .document,.shutdown_callback = noopShutdown,.ctx = &ctx,@@ -4538,6 +4540,8 @@ test "HttpClient: kill during done_callback does not also fire shutdown_callback.req = .{.method = .GET,.url = "http://example.com/",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .xhr,.shutdown_callback = Ctx.shutdownCallback,.ctx = &ctx,@@ -4619,6 +4623,8 @@ test "HttpClient: kill during a non-terminal callback defers shutdown_callback".req = .{.method = .GET,.url = "http://example.com/",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .xhr,.shutdown_callback = Ctx.shutdownCallback,.ctx = &ctx,@@ -4675,7 +4681,8 @@ test "HttpClient: aborting a robots-parked transfer unlinks it from the gate" {.req = .{.method = .GET,.url = "http://example.com/",- .origin = "",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .document,.shutdown_callback = noopShutdown,},@@ -4739,7 +4746,8 @@ test "HttpClient: fulfillIntercepted follows a 3xx redirect" {.method = .POST,.url = "http://example.com/start",.body = "payload",- .origin = "",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .document,.shutdown_callback = noopShutdown,.ctx = undefined,@@ -4779,7 +4787,8 @@ test "HttpClient: fulfillIntercepted follows a 3xx redirect" {.method = .POST,.url = "http://example.com/start",.body = "payload",- .origin = "",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .document,.shutdown_callback = noopShutdown,.ctx = undefined,@@ -4843,7 +4852,8 @@ test "HttpClient: fulfillIntercepted delivers a 3xx without a Location as the re.req = .{.method = .GET,.url = "http://example.com/",- .origin = "",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .document,.shutdown_callback = noopShutdown,.ctx = &ctx,@@ -4908,6 +4918,8 @@ test "HttpClient: abortParked survives an error_callback that tears down the own.method = .GET,.url = "http://example.com/",.origin = "",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .document,.shutdown_callback = noopShutdown,.ctx = &ctx,@@ -4981,7 +4993,8 @@ test "HttpClient: abort survives an error_callback that tears down the owner" {.req = .{.method = .GET,.url = "http://example.com/",- .origin = "",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .xhr,.shutdown_callback = noopShutdown,.ctx = &ctx,@@ -5014,7 +5027,8 @@ test "HttpClient: abort survives an error_callback that tears down the owner" {.req = .{.method = .GET,.url = "http://example.com/",- .origin = "",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .xhr,.shutdown_callback = noopShutdown,.ctx = &ctx,@@ -5074,6 +5088,8 @@ test "HttpClient: throttled navigations wait for their per-host slot" {.req = .{.method = .GET,.url = url,+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .document,.shutdown_callback = noopShutdown,.ctx = undefined,diff --git a/src/network/SingleFlight.zig b/src/network/SingleFlight.zigindex 76deabb30..d6befa9ec 100644--- a/src/network/SingleFlight.zig+++ b/src/network/SingleFlight.zig@@ -106,6 +106,8 @@ fn makeTestTransfer(arena: *lp.Arena, client: *HttpClient, id: u32) !*Transfer {.req = .{.method = .GET,.url = "http://example.com/",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .document,.shutdown_callback = HttpClient.noopShutdown,},diff --git a/src/network/WebBotAuth.zig b/src/network/WebBotAuth.zigindex 9fc80cc89..8114efdb3 100644--- a/src/network/WebBotAuth.zig+++ b/src/network/WebBotAuth.zig@@ -244,6 +244,8 @@ test "signRequest: adds headers with correct names" {.req = .{.method = .GET,.url = "https://example.com/",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .document,.shutdown_callback = @import("HttpClient.zig").noopShutdown,},diff --git a/src/server/cdp/CDP.zig b/src/server/cdp/CDP.zigindex e9c431b65..03759c378 100644--- a/src/server/cdp/CDP.zig+++ b/src/server/cdp/CDP.zig@@ -1516,6 +1516,8 @@ test "cdp: syncRequest short-circuits after disconnect" {const transfer = try client.newRequest(.{.method = .GET,.url = "http://127.0.0.1:9582/",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .fetch,.shutdown_callback = HttpClient.noopShutdown,}, null);diff --git a/src/server/cdp/domains/network.zig b/src/server/cdp/domains/network.zigindex 12a43bc3d..c98782e76 100644--- a/src/server/cdp/domains/network.zig+++ b/src/server/cdp/domains/network.zig@@ -1177,6 +1177,8 @@ test "cdp.Network: setBlockedURLs blocks requests with inspector reason" {.loader_id = 1,.method = .GET,.url = "https://blocked.test/script.js",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .script,.notification = bc.session.notification,.ctx = &error_context,@@ -1201,6 +1203,8 @@ test "cdp.Network: setBlockedURLs blocks requests with inspector reason" {.loader_id = 1,.method = .GET,.url = "http://127.0.0.1:9582/redirect-no-fragment",+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .script,.notification = bc.session.notification,.ctx = &error_context,@@ -1240,6 +1244,8 @@ test "cdp.Network: POST body exposed as postData" {.method = .POST,.url = "http://127.0.0.1:9582/echo_body",.body = body,+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .fetch,.notification = bc.session.notification,.shutdown_callback = HttpClient.noopShutdown,@@ -1501,6 +1507,8 @@ test "cdp.Network: redirect hop precedes Fetch pause and carries redirectRespons.loader_id = 7,.method = .GET,.url = start_url,+ .credentials_mode = .omit,+ .request_mode = .no_cors,.resource_type = .script,.notification = bc.session.notification,.ctx = &callback_context,