- 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
55 lines
1.0 KiB
TypeScript
55 lines
1.0 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
|
import { Type } from "class-transformer";
|
|
import {
|
|
IsArray,
|
|
IsIn,
|
|
IsInt,
|
|
IsNotEmpty,
|
|
IsOptional,
|
|
IsString,
|
|
Min,
|
|
ValidateNested,
|
|
} from "class-validator";
|
|
import { StepType } from "../scenario-step.entity";
|
|
|
|
export class ScenarioStepExportDto {
|
|
@ApiProperty()
|
|
@IsInt()
|
|
@Min(0)
|
|
order: number;
|
|
|
|
@ApiProperty({ enum: ["login", "exec", "sign"] })
|
|
@IsIn(["login", "exec", "sign"])
|
|
type: StepType;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
sessionName: string | null;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
execCode: string | null;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
validateCode: string | null;
|
|
}
|
|
|
|
export class ScenarioExportDto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
name: string;
|
|
|
|
@ApiProperty({ type: [ScenarioStepExportDto] })
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => ScenarioStepExportDto)
|
|
steps: ScenarioStepExportDto[];
|
|
}
|