Lightpanda: the headless browser designed for AI and automation
dev: speed up some slow tests
Karl Seguine3912ba2084e
diff --git a/src/browser/tests/cdp/isolated_world_redirect.html b/src/browser/tests/cdp/isolated_world_redirect.htmlindex 7f7205a01..65d86af82 100644--- a/src/browser/tests/cdp/isolated_world_redirect.html+++ b/src/browser/tests/cdp/isolated_world_redirect.html@@ -1 +1 @@-<!doctype html><title>Parent jobs</title><iframe src="/redirect-cross-origin/src/browser/tests/cdp/isolated_world_one.html?delay_ms=1000"></iframe>+<!doctype html><title>Parent jobs</title><iframe src="/redirect-cross-origin/src/browser/tests/cdp/isolated_world_one.html?delay_ms=300"></iframe>diff --git a/src/server/Server.zig b/src/server/Server.zigindex a7a768577..6a598f121 100644--- a/src/server/Server.zig+++ b/src/server/Server.zig@@ -2496,9 +2496,16 @@ test "server: HTTP execute script" {// selenium/http/demo.js in ../demo is what actually catches it.const late = try executeRaw(&c, &session_id, "async", "var cb = arguments[0]; setTimeout(function() { window.__late = true; cb('way late'); }, 150);", "[]");try testing.expect(std.mem.indexOf(u8, late, "\"error\":\"script timeout\"") != null);- lp.io.sleep(.fromMilliseconds(400), .awake) catch {};// the assertion only means anything if the stale resolve actually ran- try testing.expectEqual("{\"value\":true}", try executeSync(&c, &session_id, "return window.__late === true;", "[]"));+ var ran = false;+ for (0..200) |_| {+ if (std.mem.eql(u8, "{\"value\":true}", try executeSync(&c, &session_id, "return window.__late === true;", "[]"))) {+ ran = true;+ break;+ }+ lp.io.sleep(.fromMilliseconds(10), .awake) catch {};+ }+ try testing.expect(ran);try testing.expectEqual("{\"value\":\"alive\"}", try executeSync(&c, &session_id, "return 'alive';", "[]"));}@@ -3112,6 +3119,9 @@ fn createTestClient() !TestClient {});try posix.setsockopt(socket, posix.SOL.SOCKET, posix.SO.RCVTIMEO, &timeout);try posix.setsockopt(socket, posix.SOL.SOCKET, posix.SO.SNDTIMEO, &timeout);+ if (@hasDecl(posix.TCP, "NODELAY")) {+ try posix.setsockopt(socket, posix.IPPROTO.TCP, posix.TCP.NODELAY, &std.mem.toBytes(@as(c_int, 1)));+ }return .{.socket = socket,.reader = .{