fix(browser): capture popup network and report early event gaps (#614)

* fix(browser): capture selected events in popup pages

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>

* fix(browser): capture popup network and report early event gaps

* fix(browser): deduplicate owned popup discovery

* test(browser): group popup selection coverage with the scenario event suite

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>

* test(browser): verify popup evidence through CLI and MCP

* fix(browser): expose shared-context event coverage limits

---------

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
Co-authored-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
N0zoM1z0
2026-10-06 01:58:54 +08:00
committed by GitHub
co-authored by Rudy Celekli morluto
parent 5f3ba3e688
commit f557207887
8 changed files with 366 additions and 10 deletions
@@ -99,6 +99,7 @@ class FakeSession implements BrowserScenarioSessionPort {
performCalls = 0;
captureCalls = 0;
onPerform: (() => void) | undefined;
eventGaps: readonly string[] = [];
private step = 0;
constructor(
@@ -138,6 +139,10 @@ class FakeSession implements BrowserScenarioSessionPort {
return { retained: 0, dropped: 0, items: [] };
}
eventLimitations(): readonly string[] {
return this.eventGaps;
}
async perform(_action: BrowserScenarioAction, signal?: AbortSignal) {
this.performCalls += 1;
this.onPerform?.();
@@ -184,6 +189,24 @@ class FakeSession implements BrowserScenarioSessionPort {
}
describe("PlaywrightBrowserScenarioProvider", () => {
it("makes reported event gaps ineligible for equality even in launch mode", async () => {
const session = new FakeSession("launch");
session.eventGaps = ["Popup frames before discovery are unavailable"];
const provider = new PlaywrightBrowserScenarioProvider({
open: () => Promise.resolve(session),
});
const result = await provider.captureScenario(
scenario({ events: ["frames"] }),
);
expect(result.ok).toBe(true);
if (!result.ok) throw result.error;
expect(result.value.completeness).toMatchObject({
status: "incomplete",
equality_eligible: false,
missing_sections: ["events"],
});
expect(result.value.limitations).toContain(session.eventGaps[0]);
});
it("returns an initial state and every step beyond the former action ceiling", async () => {
const session = new FakeSession("launch");
const provider = new PlaywrightBrowserScenarioProvider({