feat: add saveSession flag to create scenario runs
- Add optional `saveSession` boolean parameter to CreateScenarioRunDto
- Add `saveSession` column to ScenarioRunEntity
- When saveSession=true and run completes, preserve the browser context as a named explore session instead of closing it
- Session name follows pattern: run-{runId}
- Automatically extracts token and localStorage for session persistence
- Injected SessionService and SessionContextService into ScenarioSchedulerService
- Updated MCP run_scenario tool to accept saveSession parameter
- Updated UI run dialog with checkbox to enable session preservation
- Client API updated to pass saveSession flag
This commit is contained in:
@@ -359,6 +359,7 @@ export class ScenarioService {
|
||||
async createRun(
|
||||
scenarioId: string,
|
||||
environmentId: string,
|
||||
saveSession = false,
|
||||
): Promise<ScenarioRunEntity> {
|
||||
const scenario = await this.findOne(scenarioId);
|
||||
const environment = await this.environmentRepo.findOneBy({
|
||||
@@ -369,7 +370,7 @@ export class ScenarioService {
|
||||
}
|
||||
|
||||
const run = await this.runRepo.save(
|
||||
this.runRepo.create({ scenarioId, environmentId, status: "pending" }),
|
||||
this.runRepo.create({ scenarioId, environmentId, status: "pending", saveSession }),
|
||||
);
|
||||
|
||||
const stepRuns = scenario.steps.map((step, index) =>
|
||||
|
||||
Reference in New Issue
Block a user