mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 06:23:45 +00:00
fix wpt and legacy_test runners
This commit is contained in:
@@ -85,15 +85,18 @@ pub fn run(allocator: Allocator, file: []const u8, session: *lp.Session) !void {
|
|||||||
const page = try session.createPage();
|
const page = try session.createPage();
|
||||||
defer session.removePage();
|
defer session.removePage();
|
||||||
|
|
||||||
const js_context = page.js;
|
var ls: lp.js.Local.Scope = undefined;
|
||||||
|
page.js.localScope(&ls);
|
||||||
|
defer ls.deinit();
|
||||||
|
|
||||||
var try_catch: lp.js.TryCatch = undefined;
|
var try_catch: lp.js.TryCatch = undefined;
|
||||||
try_catch.init(js_context);
|
try_catch.init(&ls.local);
|
||||||
defer try_catch.deinit();
|
defer try_catch.deinit();
|
||||||
|
|
||||||
try page.navigate(url, .{});
|
try page.navigate(url, .{});
|
||||||
_ = session.wait(2000);
|
_ = session.wait(2000);
|
||||||
|
|
||||||
js_context.eval("testing.assertOk()", "testing.assertOk()") catch |err| {
|
ls.local.eval("testing.assertOk()", "testing.assertOk()") catch |err| {
|
||||||
const caught = try_catch.caughtOrError(allocator, err);
|
const caught = try_catch.caughtOrError(allocator, err);
|
||||||
std.debug.print("{s}: test failure\nError: {f}\n", .{ file, caught });
|
std.debug.print("{s}: test failure\nError: {f}\n", .{ file, caught });
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
@@ -118,20 +118,23 @@ fn run(
|
|||||||
|
|
||||||
_ = page.wait(2000);
|
_ = page.wait(2000);
|
||||||
|
|
||||||
const js_context = page.js;
|
var ls: lp.js.Local.Scope = undefined;
|
||||||
|
page.js.localScope(&ls);
|
||||||
|
defer ls.deinit();
|
||||||
|
|
||||||
var try_catch: lp.js.TryCatch = undefined;
|
var try_catch: lp.js.TryCatch = undefined;
|
||||||
try_catch.init(js_context);
|
try_catch.init(&ls.local);
|
||||||
defer try_catch.deinit();
|
defer try_catch.deinit();
|
||||||
|
|
||||||
// Check the final test status.
|
// Check the final test status.
|
||||||
js_context.eval("report.status", "teststatus") catch |err| {
|
ls.local.eval("report.status", "teststatus") catch |err| {
|
||||||
const caught = try_catch.caughtOrError(arena, err);
|
const caught = try_catch.caughtOrError(arena, err);
|
||||||
err_out.* = caught.exception;
|
err_out.* = caught.exception;
|
||||||
return err;
|
return err;
|
||||||
};
|
};
|
||||||
|
|
||||||
// return the detailed result.
|
// return the detailed result.
|
||||||
const value = js_context.exec("report.log", "report") catch |err| {
|
const value = ls.local.exec("report.log", "report") catch |err| {
|
||||||
const caught = try_catch.caughtOrError(arena, err);
|
const caught = try_catch.caughtOrError(arena, err);
|
||||||
err_out.* = caught.exception;
|
err_out.* = caught.exception;
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
Reference in New Issue
Block a user