mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
Twenty-five specs called the Playwright APIs with default or hardcoded timeouts. Routed over Tor those budgets are too small, so a spec fails on transport latency rather than on the behaviour it asserts. Route the waits through resolveTimeout and reach pages via gotoOnion, the helpers the tor branch introduced for exactly this. The remaining changes in the diff are import wrapping around those calls. The repository lint enforces this: a raw numeric timeout in a role spec is rejected with a pointer to resolveTimeout, which is how a hardcoded 500ms wait added during this session was caught. Merge work rather than authored here; not deployed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
const { test, expect } = require("@playwright/test");
|
|
|
|
const { gotoOnion } = require("./personas");
|
|
|
|
exports.register = function (shared) {
|
|
test("guest: Home Assistant onboarding or login surface is reachable", async ({ page }) => {
|
|
const response = await gotoOnion(page, `${shared.env.baseUrl}/`);
|
|
expect(response, "Expected a Home Assistant response").toBeTruthy();
|
|
expect(response.status(), "Expected Home Assistant status to be < 400").toBeLessThan(400);
|
|
expect(
|
|
response.url().includes(shared.env.canonicalDomain),
|
|
`Expected canonical domain "${shared.env.canonicalDomain}" to back the Home Assistant URL`,
|
|
).toBe(true);
|
|
});
|
|
|
|
test("guest: the MCP endpoint rejects unauthenticated access", async ({ page }) => {
|
|
test.skip(!shared.env.mcpEnabled, "MCP server integration is disabled in this variant");
|
|
|
|
const response = await page.request.get(`${shared.env.baseUrl}/api/mcp`, {
|
|
failOnStatusCode: false,
|
|
});
|
|
expect(
|
|
response.status(),
|
|
"an unauthenticated MCP probe must not be served a 2xx; the endpoint is token-guarded",
|
|
).toBeGreaterThanOrEqual(400);
|
|
});
|
|
};
|