Files
pi2d/scripts/e2e/host-init.lua
T
yuez b02f4e9070 test(e2e): add the full web-console end-to-end gate
- API/WS driver A0–A12: auth/pairing, workspaces, instances, session create,
  real model streaming, abort, model/thinking, history paging, resync,
  multi-workspace isolation, subagents and a deterministic attention/diff
  trigger (attention-ext.ts).
- Playwright driver B1–B14 + C1–C4: guard/pairing, workspaces, chat streaming,
  abort, panels, attention, status/devices, reconnect, deep links, i18n/theme,
  responsive overflow and console errors.
- lib.sh isolates every run (runtime/data/state/agent dirs, ephemeral port,
  fresh workspaces) and reaps by /proc env; run-all.sh builds both sides.
  Document the plan and the 31/31 acceptance run.
2026-10-21 20:42:34 +08:00

31 lines
1.2 KiB
Lua

-- Init used by the pi2d end-to-end harness.
-- Minimal, hermetic: only the plugin under test on the runtimepath, with the
-- web console enabled and diagnostics enabled. Setting up the plugin here also
-- makes `pi.host` skip its own `setup()` call.
--
-- `cli.args` reaches every `pi --mode rpc` process the plugin spawns, so the
-- test-only attention extension (`scripts/e2e/attention-ext.ts`) is present in
-- the session the daemon drives (docs/e2e.md A11 — pre-execution diff review
-- needs something that emits `extension_ui_request`).
local function here()
local source = debug.getinfo(1, "S").source
if source:sub(1, 1) == "@" then
source = source:sub(2)
end
return vim.fn.fnamemodify(source, ":p:h")
end
local plugin = vim.env.PI2_E2E_PLUGIN or "/home/yuez/Workspace/Neovim/pi2.nvim-web"
local attention_ext = here() .. "/attention-ext.ts"
assert(vim.fn.filereadable(attention_ext) == 1, "e2e attention extension missing: " .. attention_ext)
vim.opt.runtimepath:prepend(plugin)
vim.opt.swapfile = false
vim.opt.shadafile = "NONE"
vim.g.mapleader = " "
require("pi").setup({
web = { enabled = true, log = true, auto_start = false },
cli = { args = { "--extension", attention_ext } },
})