feat(import): add central yaml import for all exportable kinds

- add POST /import, an import page and the import_yaml mcp tool; items
  are validated up front and imported in dependency order
- switch list page import buttons to the central import
- write scenario exports as separate --- yaml documents per entity
- give each test app its own files dir to avoid cross-suite races
- use node: prefix for node built-in imports
- bump version to 1.18.0
This commit is contained in:
ars9 committed 2026-09-30 19:25:03 +03:00
1 parent cf56840df9
commit 8935783371
39 files changed
+848 -130

No files matched your search

+8 -8
View File
@@ -148,7 +148,7 @@ export class E2eExportService {
const timeoutMs = (scenarioTimeoutSeconds ?? DEFAULT_SCENARIO_TIMEOUT_SEC) * 1000;
return `import { defineConfig } from "@playwright/test";
import * as dotenv from "dotenv";
import * as path from "path";
import * as path from "node:path";
dotenv.config({ path: path.resolve(__dirname, ".env") });
@@ -235,13 +235,13 @@ the scenario are bundled under \`files/\` and served locally by
return `import { test, expect } from "@playwright/test";
import type { BrowserContext, Page } from "@playwright/test";
import * as fs from "fs";
import * as path from "path";
import * as crypto from "crypto";
import * as http from "http";
import * as https from "https";
import { URL } from "url";
import { randomUUID } from "crypto";
import * as fs from "node:fs";
import * as path from "node:path";
import * as crypto from "node:crypto";
import * as http from "node:http";
import * as https from "node:https";
import { URL } from "node:url";
import { randomUUID } from "node:crypto";
// Credential data resolved from this scenario's aliases at export time.
// Stored in credentials.json (gitignored) - contains sensitive values.
@@ -2,10 +2,10 @@ import { Injectable, OnModuleInit } from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import { Interval } from "@nestjs/schedule";
import { InjectRepository } from "@nestjs/typeorm";
import * as crypto from "crypto";
import * as fs from "fs/promises";
import * as os from "os";
import * as path from "path";
import * as crypto from "node:crypto";
import * as fs from "node:fs/promises";
import * as os from "node:os";
import * as path from "node:path";
import { Effect } from "effect";
import type { Browser, BrowserContext, Page } from "playwright";
import { chromium } from "playwright";
+9 -9
View File
@@ -150,20 +150,20 @@ export class ScenarioController {
version,
});
res.setHeader("Content-Type", "application/yaml; charset=utf-8");
// Serialize as YAML stream: each entity separated by a comment header
// Serialize as a YAML stream: one `---` document per entity, each with a
// comment naming it. POST /import reads this format back.
const kindLabels: Record<string, string> = {
environment: "Environment",
credential: "Credential",
scenario: "Scenario",
};
const parts = (entities as ExportEntity[]).map((entity) => {
const label = kindLabels[entity.kind ?? ""] ?? entity.kind ?? "Entity";
const comment = `# --- ${label}: ${
entity.name ?? entity.id ?? ""
} ---`;
return `${comment}\n${yamlStringify(entity)}`;
});
return parts.join("\n");
return (entities as ExportEntity[])
.map((entity) => {
const label = kindLabels[entity.kind ?? ""] ?? entity.kind ?? "Entity";
const comment = `# ${label}: ${entity.name ?? entity.id ?? ""}`;
return `---\n${comment}\n${yamlStringify(entity)}`;
})
.join("");
}
@Get(":id/export-e2e")
+2 -2
View File
@@ -7,8 +7,8 @@ import {
} from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import { InjectRepository } from "@nestjs/typeorm";
import * as fs from "fs/promises";
import * as path from "path";
import * as fs from "node:fs/promises";
import * as path from "node:path";
import { Like, Repository } from "typeorm";
import {
PaginatedResult,