diff --git a/.agents/skills/verify-dms-api/playground/node_modules b/.agents/skills/verify-dms-api/playground/node_modules deleted file mode 120000 index 8b01a6d..0000000 --- a/.agents/skills/verify-dms-api/playground/node_modules +++ /dev/null @@ -1 +0,0 @@ -../../../../playground/node_modules \ No newline at end of file diff --git a/.agents/skills/verify-dms-api/verify.config.ts b/.agents/skills/verify-dms-api/verify.config.ts index 52c8bfc..ebeafd5 100644 --- a/.agents/skills/verify-dms-api/verify.config.ts +++ b/.agents/skills/verify-dms-api/verify.config.ts @@ -49,16 +49,14 @@ export interface VerifyConfig { formal: FormalCheck[]; } -const SKILL = ".agents/skills/verify-dms-api"; - const config: VerifyConfig = { - playground: `${SKILL}/playground`, + playground: "e2e/playground", prepare: [ ["pnpm", "install", "--frozen-lockfile", "--prefer-offline", "--ignore-scripts"], ["pnpm", "run", "build"], ["pnpm", "--dir", "playground", "install", "--ignore-workspace", "--frozen-lockfile", "--prefer-offline", "--ignore-scripts"], - ["ln", "-sfn", "../../../../playground/node_modules", `${SKILL}/playground/node_modules`], - ["node_modules/.bin/tsc", "-p", `${SKILL}/playground/tsconfig.build.json`], + ["ln", "-sfn", "../../playground/node_modules", "e2e/playground/node_modules"], + ["node_modules/.bin/tsc", "-p", "e2e/playground/tsconfig.build.json"], ], userFacing: ["src/**", "frontend-vue/**", "skills/**", "package.json"], notUserFacing: ["frontend-vue/tests/**", "frontend-vue/.*", "frontend-vue/eslint.config.mjs", "frontend-vue/vitest.config.ts", "frontend-vue/pnpm-lock.yaml"], diff --git a/.gitignore b/.gitignore index edf6930..578e29f 100644 --- a/.gitignore +++ b/.gitignore @@ -382,6 +382,6 @@ e2e/blob-report e2e/blob-reports # What a backend of the verification playground writes when it starts -.agents/skills/verify-dms-api/playground/antelope-lock -.agents/skills/verify-dms-api/playground/.codex -.agents/skills/verify-dms-api/playground/.mcp.json +e2e/playground/antelope-lock +e2e/playground/.codex +e2e/playground/.mcp.json diff --git a/e2e/journeys.config.ts b/e2e/journeys.config.ts new file mode 100644 index 0000000..3af74de --- /dev/null +++ b/e2e/journeys.config.ts @@ -0,0 +1,16 @@ +import type { JourneysConfig } from "@antelopejs/dms/e2e"; + +export default { + playground: "e2e/playground", + prepare: [ + [ + "pnpm", + "install", + "--frozen-lockfile", + "--prefer-offline", + "--ignore-scripts", + ], + ["pnpm", "run", "e2e:build"], + ], + smoke: "smoke", +} satisfies JourneysConfig; diff --git a/.agents/skills/verify-dms-api/playground/antelope.config.ts b/e2e/playground/antelope.config.ts similarity index 97% rename from .agents/skills/verify-dms-api/playground/antelope.config.ts rename to e2e/playground/antelope.config.ts index 631a00a..678bcb9 100644 --- a/.agents/skills/verify-dms-api/playground/antelope.config.ts +++ b/e2e/playground/antelope.config.ts @@ -32,11 +32,11 @@ function apiConfig(): z.infer { * and the module's `@/` import alias applies to files under the folder the * source names, so the source names the files' real folder. */ -const moduleRoot = dirname(realpathSync(resolve(__dirname, "../../../../package.json"))); +const moduleRoot = dirname(realpathSync(resolve(__dirname, "../../package.json"))); /** * The repository's playground with the ports, origins, secrets and mail - * `dms-control` sets for a run, a fixture module (`app`) and the module under + * the e2e kit sets for a run, a fixture module (`app`) and the module under * verification built from the checkout. */ export default defineConfig({ diff --git a/e2e/playground/node_modules b/e2e/playground/node_modules new file mode 120000 index 0000000..3a0c5b3 --- /dev/null +++ b/e2e/playground/node_modules @@ -0,0 +1 @@ +../../playground/node_modules \ No newline at end of file diff --git a/.agents/skills/verify-dms-api/playground/package.json b/e2e/playground/package.json similarity index 100% rename from .agents/skills/verify-dms-api/playground/package.json rename to e2e/playground/package.json diff --git a/.agents/skills/verify-dms-api/playground/src/automation-stub/implementation.ts b/e2e/playground/src/automation-stub/implementation.ts similarity index 100% rename from .agents/skills/verify-dms-api/playground/src/automation-stub/implementation.ts rename to e2e/playground/src/automation-stub/implementation.ts diff --git a/.agents/skills/verify-dms-api/playground/src/automation-stub/registry.ts b/e2e/playground/src/automation-stub/registry.ts similarity index 100% rename from .agents/skills/verify-dms-api/playground/src/automation-stub/registry.ts rename to e2e/playground/src/automation-stub/registry.ts diff --git a/.agents/skills/verify-dms-api/playground/src/automation-stub/routes.ts b/e2e/playground/src/automation-stub/routes.ts similarity index 100% rename from .agents/skills/verify-dms-api/playground/src/automation-stub/routes.ts rename to e2e/playground/src/automation-stub/routes.ts diff --git a/.agents/skills/verify-dms-api/playground/src/fixture-members.ts b/e2e/playground/src/fixture-members.ts similarity index 100% rename from .agents/skills/verify-dms-api/playground/src/fixture-members.ts rename to e2e/playground/src/fixture-members.ts diff --git a/.agents/skills/verify-dms-api/playground/src/fixture-routes.ts b/e2e/playground/src/fixture-routes.ts similarity index 100% rename from .agents/skills/verify-dms-api/playground/src/fixture-routes.ts rename to e2e/playground/src/fixture-routes.ts diff --git a/.agents/skills/verify-dms-api/playground/src/fixture.ts b/e2e/playground/src/fixture.ts similarity index 100% rename from .agents/skills/verify-dms-api/playground/src/fixture.ts rename to e2e/playground/src/fixture.ts diff --git a/.agents/skills/verify-dms-api/playground/src/index.ts b/e2e/playground/src/index.ts similarity index 100% rename from .agents/skills/verify-dms-api/playground/src/index.ts rename to e2e/playground/src/index.ts diff --git a/.agents/skills/verify-dms-api/playground/tsconfig.build.json b/e2e/playground/tsconfig.build.json similarity index 100% rename from .agents/skills/verify-dms-api/playground/tsconfig.build.json rename to e2e/playground/tsconfig.build.json diff --git a/e2e/playground/tsconfig.json b/e2e/playground/tsconfig.json new file mode 100644 index 0000000..30bd5bc --- /dev/null +++ b/e2e/playground/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "rootDir": ".", + "noEmit": true + }, + "include": ["./src/**/*.ts", "./antelope.config.ts"] +} diff --git a/oxfmt.config.ts b/oxfmt.config.ts index 059010c..208b884 100644 --- a/oxfmt.config.ts +++ b/oxfmt.config.ts @@ -1,12 +1,13 @@ import { antelopeFmtPreset } from "@antelopejs/tooling-configs/oxc/fmt"; -/** Prettier formats the Vue layer; Markdown was never machine-formatted here; the journeys and their helpers keep the layout they had in the verify skill. */ +/** Prettier formats the Vue layer; Markdown was never machine-formatted here; the journeys, their helpers and their playground are hand-formatted. */ export default antelopeFmtPreset({ ignorePatterns: [ "frontend-vue/**", "**/*.md", "**/*.vue", "e2e/journeys/**", + "e2e/playground/**", "e2e/*.mjs", "e2e/*.cjs", ], diff --git a/package.json b/package.json index c23636f..8ede06c 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "build": "rimraf dist && tsc", "dev": "ajs project dev -w -p playground", "e2e": "playwright test -c e2e", - "e2e:build": "pnpm run build && pnpm --dir playground install --ignore-workspace --frozen-lockfile --prefer-offline --ignore-scripts && ln -sfn ../../../../playground/node_modules .agents/skills/verify-dms-api/playground/node_modules && tsc -p .agents/skills/verify-dms-api/playground/tsconfig.build.json", + "e2e:build": "pnpm run build && pnpm --dir playground install --ignore-workspace --frozen-lockfile --prefer-offline --ignore-scripts && ln -sfn ../../playground/node_modules e2e/playground/node_modules && tsc -p e2e/playground/tsconfig.build.json", "lint:fix": "oxlint --fix --max-warnings=1000000 && oxfmt . && pnpm --dir frontend-vue lint:fix", "lint": "oxlint && pnpm --dir frontend-vue lint", "typecheck": "tsc -p tests", @@ -67,7 +67,7 @@ }, "devDependencies": { "@antelopejs/core": "~1.24.5", - "@antelopejs/dms": "0.21.4-next.939.g641c7fa", + "@antelopejs/dms": "0.21.4-next.944.g3da5606", "@antelopejs/dms-frontend": ">=0.11.8 <0.12.0", "@antelopejs/interface-data-api": ">=0.8.0 <0.9.0", "@antelopejs/tooling-configs": ">=0.8.9 <0.9.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4e4d241..2b978d4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -37,8 +37,8 @@ importers: specifier: ~1.24.5 version: 1.24.5 '@antelopejs/dms': - specifier: 0.21.4-next.939.g641c7fa - version: 0.21.4-next.939.g641c7fa(@antelopejs/core@1.24.5)(@playwright/test@1.65.1)(typescript@6.0.3) + specifier: 0.21.4-next.944.g3da5606 + version: 0.21.4-next.944.g3da5606(@antelopejs/core@1.24.5)(@playwright/test@1.65.1)(typescript@6.0.3) '@antelopejs/dms-frontend': specifier: '>=0.11.8 <0.12.0' version: 0.11.8(@antelopejs/core@1.24.5) @@ -118,8 +118,8 @@ packages: peerDependencies: '@antelopejs/core': ~1.24.0 - '@antelopejs/dms@0.21.4-next.939.g641c7fa': - resolution: {integrity: sha512-wAF+SPGjEl4X8JM23HFXBLtTRjBQqx5OoWg3Cxm2Pm260UDdeLukgbZw0dw5ifNZoMv7wjV/uyTiqZ+WSeK7Rw==} + '@antelopejs/dms@0.21.4-next.944.g3da5606': + resolution: {integrity: sha512-Os2WiWC8f5cm4JBtLea0ZQxnx09Iwp4t9vb1pWBcrcR8HJI3EshGE2jqjmspY4BovEgI0yYGzmH73QFPC9/IUg==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true peerDependencies: @@ -3589,7 +3589,7 @@ snapshots: '@oxc-parser/binding-linux-x64-gnu': 0.95.0 '@oxc-parser/binding-win32-x64-msvc': 0.95.0 - '@antelopejs/dms@0.21.4-next.939.g641c7fa(@antelopejs/core@1.24.5)(@playwright/test@1.65.1)(typescript@6.0.3)': + '@antelopejs/dms@0.21.4-next.944.g3da5606(@antelopejs/core@1.24.5)(@playwright/test@1.65.1)(typescript@6.0.3)': dependencies: 2fa: 0.1.2 '@antelopejs/interface-api': 0.3.3(@antelopejs/interface-core@0.5.1) diff --git a/tests/helpers/backend.ts b/tests/helpers/backend.ts index d004b09..dda220a 100644 --- a/tests/helpers/backend.ts +++ b/tests/helpers/backend.ts @@ -14,10 +14,7 @@ import { join, resolve } from "node:path"; import { z } from "zod"; /** The verification playground: the fixture app, dms-api from this checkout, the DMS, MongoDB and auth modules. */ -export const PLAYGROUND = resolve( - __dirname, - "../../.agents/skills/verify-dms-api/playground", -); +export const PLAYGROUND = resolve(__dirname, "../../e2e/playground"); const READY_TIMEOUT_MS = 90_000; const POLL_MS = 250; diff --git a/tests/helpers/dms.ts b/tests/helpers/dms.ts index a713821..391191c 100644 --- a/tests/helpers/dms.ts +++ b/tests/helpers/dms.ts @@ -263,7 +263,8 @@ export class Dms { /** * Sends one call to the project's routes and reads back the request log - * it made, found by its `x-request-id` or by its method and path. + * it made, found by its `x-request-id` or by its method and path among + * the logs written after the call. */ async sendAndRead(request: { method?: string; @@ -271,6 +272,11 @@ export class Dms { headers?: HeadersInit; body?: string; }): Promise<{ status: number; log: Json }> { + const earlier = new Set( + resultsOf((await this.mon("/logs?limit=50")).body, loggedSchema).map( + (entry) => entry._id, + ), + ); const sent = await this.raw(request); const path = request.path.split("?")[0]; const method = request.method ?? "GET"; @@ -280,8 +286,9 @@ export class Dms { const listed = await this.mon("/logs?limit=50"); const row = resultsOf(listed.body, loggedSchema).find( (entry) => - (requestId !== null && entry.requestId === requestId) || - (entry.path === path && entry.method === method), + !earlier.has(entry._id) && + ((requestId !== null && entry.requestId === requestId) || + (entry.path === path && entry.method === method)), ); if (row) return { diff --git a/tests/helpers/journeys-setup.ts b/tests/helpers/journeys-setup.ts index b69f1c7..7db2072 100644 --- a/tests/helpers/journeys-setup.ts +++ b/tests/helpers/journeys-setup.ts @@ -14,7 +14,7 @@ export default async function setup(project: { provide: (key: "mongoUrl", value: string) => void; }): Promise<() => Promise> { for (const built of [ - join(PLAYGROUND, "../../../../dist/index.js"), + join(PLAYGROUND, "../../dist/index.js"), join(PLAYGROUND, "dist/index.js"), ]) { if (!existsSync(built)) diff --git a/tests/helpers/package.ts b/tests/helpers/package.ts index cbf21f8..6046cd8 100644 --- a/tests/helpers/package.ts +++ b/tests/helpers/package.ts @@ -1,7 +1,8 @@ import { execFileSync } from "node:child_process"; -import { existsSync, readFileSync } from "node:fs"; +import { existsSync, readdirSync, readFileSync } from "node:fs"; import { createRequire } from "node:module"; -import { join } from "node:path"; +import { basename, join } from "node:path"; +import { pathToFileURL } from "node:url"; import { z } from "zod"; const ROOT = join(__dirname, "..", ".."); @@ -109,3 +110,23 @@ export function localeKeys(file: string): string[] { JSON.parse(readText(`frontend-vue/i18n/locales/${file}`)), ); } + +const journeysModuleSchema = z.object({ + journeys: z.array(z.object({ id: z.string() })), +}); + +/** Each feature of `e2e/journeys/`, named after its file, mapped to the ids of the journeys it exports. */ +export async function journeyFeatures(): Promise> { + const folder = join(ROOT, "e2e", "journeys"); + const files = readdirSync(folder).filter((file) => file.endsWith(".mjs")); + const features = await Promise.all( + files.map(async (file) => { + const module: unknown = await import( + pathToFileURL(join(folder, file)).href + ); + const { journeys } = journeysModuleSchema.parse(module); + return [basename(file, ".mjs"), journeys.map(({ id }) => id)] as const; + }), + ); + return new Map(features); +} diff --git a/tests/package.test.ts b/tests/package.test.ts index a6c0a02..f42fa80 100644 --- a/tests/package.test.ts +++ b/tests/package.test.ts @@ -1,14 +1,15 @@ import { satisfies } from "semver"; import { beforeAll, describe, expect, it } from "vitest"; +import journeysConfig from "../e2e/journeys.config"; import { exists, installedVersion, + journeyFeatures, localeKeys, manifest, packedFiles, readText, rendererRange, - run, skillCases, } from "./helpers/package"; @@ -143,8 +144,10 @@ describe("the docs and the locales", () => { }); }); -describe("the verify feature map", () => { - it("covers every user-facing file, and every feature has its journeys", () => { - expect(() => run("pnpm", ["exec", "dms-control", "map"])).not.toThrow(); +describe("the e2e journeys", () => { + it("export a journeys list per feature, and journeys for the smoke feature", async () => { + const features = await journeyFeatures(); + + expect(features.get(journeysConfig.smoke)?.length).toBeGreaterThan(0); }); });