"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const test_1 = require("@playwright/test");
const v3_js_1 = require("../../lib/v3/v3.js");
const v3_dynamic_config_js_1 = require("./v3.dynamic.config.js");
const zod_1 = require("zod");
const testUtils_js_1 = require("./testUtils.js");
test_1.test.describe("V3 hard timeouts", () => {
    let v3;
    test_1.test.beforeEach(async () => {
        v3 = new v3_js_1.V3(v3_dynamic_config_js_1.v3DynamicTestConfig);
        await v3.init();
    });
    test_1.test.afterEach(async () => {
        await (0, testUtils_js_1.closeV3)(v3);
    });
    (0, test_1.test)("observe() enforces timeoutMs", async () => {
        // Tiny timeout to force the race to hit the timeout branch
        await (0, test_1.expect)(v3.observe("find something", { timeout: 5 })).rejects.toThrow(/timed out/i);
    });
    (0, test_1.test)("extract() enforces timeoutMs", async () => {
        const schema = zod_1.z.object({ title: zod_1.z.string().optional() });
        await (0, test_1.expect)(v3.extract("Extract title", schema, { timeout: 5 })).rejects.toThrow(/timed out/i);
    });
    (0, test_1.test)("act() enforces timeoutMs", async () => {
        await (0, test_1.expect)(v3.act("do nothing", { timeout: 5 })).rejects.toThrow(/timed out/i);
    });
});
//# sourceMappingURL=timeouts.spec.js.map