- add Snippet entity with name, description, code; full CRUD backend - add snippets pages (list, create, edit, detail) and nav entry - add runSnippet helper in code-executor using new Function with args array - add result param to execute() so validateCode can access exec output - remove sessionName from steps; each run now spawns its own fresh browser - fix waitForURL race by polling localStorage for token instead
51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
|
import {
|
|
IsIn,
|
|
IsInt,
|
|
IsNotEmpty,
|
|
IsOptional,
|
|
IsString,
|
|
Min,
|
|
} from "class-validator";
|
|
import { StepType } from "../scenario-step.entity";
|
|
|
|
export class CreateScenarioStepDto {
|
|
@ApiPropertyOptional({ example: "Check login page title" })
|
|
@IsOptional()
|
|
@IsString()
|
|
title?: string;
|
|
|
|
@ApiProperty({ example: 0, description: "Execution order (ascending)" })
|
|
@IsInt()
|
|
@Min(0)
|
|
order: number;
|
|
|
|
@ApiProperty({ enum: ["login", "exec", "sign"], example: "exec" })
|
|
@IsIn(["login", "exec", "sign"])
|
|
type: StepType;
|
|
|
|
@ApiPropertyOptional({
|
|
description: "Session name (deprecated — browser is created automatically per run).",
|
|
example: "my-session",
|
|
})
|
|
@IsOptional()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
sessionName?: string;
|
|
|
|
@ApiPropertyOptional({ example: "return await page.title();" })
|
|
@IsOptional()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
execCode?: string;
|
|
|
|
@ApiPropertyOptional({
|
|
example:
|
|
'return { success: result !== null, description: "title present" };',
|
|
})
|
|
@IsOptional()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
validateCode?: string;
|
|
}
|