refactor(browser): open scenario sessions without a factory wrapper

This commit is contained in:
morluto
2026-10-10 00:49:14 +08:00
parent 87f0051496
commit d1983a4576
6 changed files with 45 additions and 69 deletions
+3 -3
View File
@@ -1,11 +1,11 @@
import type { BrowserScenarioCapturePort } from "../application/BrowserScenarioCapturePort.js";
import { PlaywrightBrowserScenarioProvider } from "../browser/PlaywrightBrowserScenarioProvider.js";
import { PlaywrightScenarioSessionFactory } from "../browser/PlaywrightScenarioSession.js";
import { PlaywrightScenarioSession } from "../browser/PlaywrightScenarioSession.js";
/** Construct a fresh provider without opening a target or acquiring an engine. */
export const createBrowserScenarioProvider = (
environment: Readonly<Record<string, string | undefined>>,
): BrowserScenarioCapturePort =>
new PlaywrightBrowserScenarioProvider(
new PlaywrightScenarioSessionFactory(environment),
new PlaywrightBrowserScenarioProvider((scenario, options) =>
PlaywrightScenarioSession.open(scenario, environment, options),
);