vibe coded maxx
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"_comment": "Action Catalog for generating Playwright + MCP tests from editor data.",
|
||||
"_version": "0.1.0",
|
||||
"_targetGroup": "core-documentation",
|
||||
|
||||
"actions": {
|
||||
"open_admin_portal": {
|
||||
"template": "await page.goto(process.env.BASE_URL ?? 'https://pbx.local:4443');"
|
||||
},
|
||||
|
||||
"navigate_to_downloads_portal": {
|
||||
"template": "await page.goto(REPO_URL);"
|
||||
},
|
||||
|
||||
"search_for_document": {
|
||||
"template": "const link = page.locator('a, li, td').filter({ hasText: /{{pattern}}/i });\nawait expect(link.first()).toBeVisible();",
|
||||
"params": ["pattern"]
|
||||
},
|
||||
|
||||
"assert_document_visible": {
|
||||
"template": "const el = page.locator('a, li, td').filter({ hasText: /{{pattern}}/i });\nawait expect(el.first()).toBeVisible();",
|
||||
"params": ["pattern"]
|
||||
},
|
||||
|
||||
"extract_text_content": {
|
||||
"template": "const content = await page.locator('body').innerText();\n// TODO: Parse and save the relevant section (Release Notes, Changelog, etc.)"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const CATALOG_PATH = path.join(__dirname, 'catalog.json');
|
||||
|
||||
let cachedCatalog = null;
|
||||
|
||||
function loadActionCatalog(forceReload = false) {
|
||||
if (cachedCatalog && !forceReload) {
|
||||
return cachedCatalog;
|
||||
}
|
||||
|
||||
const raw = fs.readFileSync(CATALOG_PATH, 'utf-8');
|
||||
cachedCatalog = JSON.parse(raw);
|
||||
return cachedCatalog;
|
||||
}
|
||||
|
||||
function getAction(actionKey) {
|
||||
const catalog = loadActionCatalog();
|
||||
return catalog.actions ? catalog.actions[actionKey] : undefined;
|
||||
}
|
||||
|
||||
module.exports = { loadActionCatalog, getAction };
|
||||
@@ -0,0 +1,33 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
export interface ActionDefinition {
|
||||
template: string;
|
||||
params?: string[];
|
||||
}
|
||||
|
||||
export interface ActionCatalog {
|
||||
_comment?: string;
|
||||
_version?: string;
|
||||
_targetGroup?: string;
|
||||
actions: Record<string, ActionDefinition>;
|
||||
}
|
||||
|
||||
const CATALOG_PATH = path.join(__dirname, 'catalog.json');
|
||||
|
||||
let cachedCatalog: ActionCatalog | null = null;
|
||||
|
||||
export function loadActionCatalog(forceReload = false): ActionCatalog {
|
||||
if (cachedCatalog && !forceReload) {
|
||||
return cachedCatalog;
|
||||
}
|
||||
|
||||
const raw = fs.readFileSync(CATALOG_PATH, 'utf-8');
|
||||
cachedCatalog = JSON.parse(raw);
|
||||
return cachedCatalog!;
|
||||
}
|
||||
|
||||
export function getAction(actionKey: string): ActionDefinition | undefined {
|
||||
const catalog = loadActionCatalog();
|
||||
return catalog.actions[actionKey];
|
||||
}
|
||||
Reference in New Issue
Block a user