@qcentriq/mcp 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +202 -202
  2. package/README.md +348 -348
  3. package/dist/index.js +32 -4
  4. package/package.json +51 -51
package/dist/index.js CHANGED
@@ -272,7 +272,8 @@ var PYTEST_CONFIG_NAMES = /* @__PURE__ */ new Set(["pytest.ini", "pyproject.toml
272
272
  var HELPER_EXTENSIONS = /* @__PURE__ */ new Set([".py", ".json", ".txt", ".csv", ".yaml", ".yml", ".ini", ".cfg", ".toml"]);
273
273
  var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
274
274
  var MAX_GROUP_HELPERS = 20;
275
- var skippedFolder = (name) => name.startsWith(".") || name === "__pycache__";
275
+ var SKIPPED_FOLDERS = /* @__PURE__ */ new Set(["__pycache__", "__snapshots__", "snapshot_failures"]);
276
+ var skippedFolder = (name) => name.startsWith(".") || SKIPPED_FOLDERS.has(name);
276
277
  function isGroupHelper(relative) {
277
278
  const name = path.basename(relative);
278
279
  const topLevel = !relative.includes("/");
@@ -865,7 +866,10 @@ function registerSaveGroupScriptTool(server, client, config, passingRuns, versio
865
866
  content: z10.string().describe("The Python test script source."),
866
867
  project_id: z10.uuid().optional().describe("Optional project UUID (inferred from the API key if omitted)."),
867
868
  filename: z10.string().optional().describe("Optional script filename; derived from the group title if omitted."),
868
- fixtures: z10.array(z10.object({ file_name: z10.string(), content: z10.string() })).optional().describe("The group's complete helper set (page objects, utilities, test data), each file_name relative to the script's folder, e.g. 'pages/login_page.py'. Replaces every helper stored before. conftest.py is rejected.")
869
+ fixtures: z10.array(z10.object({ file_name: z10.string(), content: z10.string() })).optional().describe("The group's complete helper set (page objects, utilities, test data), each file_name relative to the script's folder, e.g. 'pages/login_page.py'. Replaces every helper stored before. conftest.py is rejected."),
870
+ visual_testing_enabled: z10.boolean().optional().describe("Optional per-group visual testing override (omit to keep existing group setting)."),
871
+ visual_masking_enabled: z10.boolean().optional().describe("Optional per-group dynamic content masking override."),
872
+ visual_diff_threshold: z10.number().min(0).max(1).optional().describe("Optional per-group visual diff threshold percentage from 0.0 (0.0%) to 1.0 (1.0%).")
869
873
  }),
870
874
  annotations: {
871
875
  readOnlyHint: false,
@@ -1015,6 +1019,12 @@ function buildTestEnv(params) {
1015
1019
  if (params.groupId) {
1016
1020
  env.QCENTRIQ_TEST_GROUP_ID = params.groupId;
1017
1021
  }
1022
+ if (params.visualTestingEnabled !== void 0) {
1023
+ env.QCENTRIQ_VISUAL_TESTING_ENABLED = params.visualTestingEnabled ? "true" : "false";
1024
+ }
1025
+ if (params.visualMaskingEnabled !== void 0) {
1026
+ env.QCENTRIQ_VISUAL_MASKING_ENABLED = params.visualMaskingEnabled ? "true" : "false";
1027
+ }
1018
1028
  return env;
1019
1029
  }
1020
1030
  function resolvePytestCommand() {
@@ -1128,6 +1138,8 @@ function registerLocalRunTool(server, client, passingRuns) {
1128
1138
  browser: z13.enum(["chromium", "firefox", "webkit"]).default("chromium").describe("Browser engine to execute against (default 'chromium')."),
1129
1139
  base_url: z13.url().optional().describe("Target application base URL (e.g. from qcentriq_get_environment). Injected as BASE_URL env var."),
1130
1140
  group_id: z13.string().optional().describe("Test group UUID this script belongs to. Injected as QCENTRIQ_TEST_GROUP_ID so the Allure results stay mappable back to the QCentriq group."),
1141
+ visual_testing_enabled: z13.boolean().optional().describe("Whether to enable visual snapshot capture during this local run. Injected as QCENTRIQ_VISUAL_TESTING_ENABLED."),
1142
+ visual_masking_enabled: z13.boolean().optional().describe("Whether to enable dynamic content masking during this local run. Injected as QCENTRIQ_VISUAL_MASKING_ENABLED."),
1131
1143
  env_vars: z13.record(z13.string(), z13.string()).optional().describe("Environment variables to inject into the local test process."),
1132
1144
  extra_args: z13.array(z13.string()).optional().describe("Additional CLI arguments to pass to pytest (e.g. ['-s', '--alluredir=allure-results'])."),
1133
1145
  timeout_seconds: z13.number().int().min(5).max(300).default(60).describe("Timeout in seconds for test execution (default 60)."),
@@ -1137,8 +1149,12 @@ function registerLocalRunTool(server, client, passingRuns) {
1137
1149
  async (args) => {
1138
1150
  try {
1139
1151
  const scriptPath = path6.resolve(args.working_dir ?? process.cwd(), args.file_path.split("::")[0]);
1152
+ const cwd = args.working_dir ? path6.resolve(args.working_dir) : process.cwd();
1140
1153
  const ownDir = qcentriqDirAbove(path6.dirname(scriptPath));
1141
- if (ownDir) await refreshConftest(client, ownDir);
1154
+ if (ownDir) {
1155
+ await refreshConftest(client, ownDir);
1156
+ await clearLocalSnapshots(cwd, ownDir, path6.dirname(scriptPath));
1157
+ }
1142
1158
  const content = await fs5.readFile(scriptPath, "utf-8").catch(() => null);
1143
1159
  const startedAt = Date.now();
1144
1160
  const result = await runLocalPytest({
@@ -1148,12 +1164,17 @@ function registerLocalRunTool(server, client, passingRuns) {
1148
1164
  browser: args.browser,
1149
1165
  baseUrl: args.base_url,
1150
1166
  groupId: args.group_id,
1167
+ visualTestingEnabled: args.visual_testing_enabled,
1168
+ visualMaskingEnabled: args.visual_masking_enabled,
1151
1169
  envVars: args.env_vars,
1152
1170
  extraArgs: args.extra_args,
1153
1171
  timeoutSeconds: args.timeout_seconds,
1154
1172
  workingDir: args.working_dir
1155
1173
  });
1156
- if (ownDir) await fs5.rm(path6.join(ownDir, "qc_state.json"), { force: true });
1174
+ if (ownDir) {
1175
+ await fs5.rm(path6.join(ownDir, "qc_state.json"), { force: true });
1176
+ await clearLocalSnapshots(cwd, ownDir, path6.dirname(scriptPath));
1177
+ }
1157
1178
  const statusText = result.passed ? "PASSED" : "FAILED";
1158
1179
  const summary = [
1159
1180
  `Local Test Run Result: ${statusText} (exit code ${result.exitCode})`,
@@ -1178,6 +1199,13 @@ function registerLocalRunTool(server, client, passingRuns) {
1178
1199
  }
1179
1200
  );
1180
1201
  }
1202
+ async function clearLocalSnapshots(...dirs) {
1203
+ const unique = new Set(dirs.map((d) => path6.resolve(d)));
1204
+ for (const dir of unique) {
1205
+ await fs5.rm(path6.join(dir, "__snapshots__"), { recursive: true, force: true });
1206
+ await fs5.rm(path6.join(dir, "snapshot_failures"), { recursive: true, force: true });
1207
+ }
1208
+ }
1181
1209
  function qcentriqDirAbove(dir) {
1182
1210
  for (let d = dir; ; d = path6.dirname(d)) {
1183
1211
  if (path6.basename(d) === path6.basename(DEFAULT_SCRIPT_DIR)) return d;
package/package.json CHANGED
@@ -1,51 +1,51 @@
1
- {
2
- "name": "@qcentriq/mcp",
3
- "version": "0.5.0",
4
- "description": "Official Model Context Protocol (MCP) server for QCentriq automated test discovery, diagnostics, and execution.",
5
- "type": "module",
6
- "bin": {
7
- "qcentriq-mcp": "dist/index.js"
8
- },
9
- "files": [
10
- "dist"
11
- ],
12
- "engines": {
13
- "node": ">=22.12.0"
14
- },
15
- "publishConfig": {
16
- "access": "public"
17
- },
18
- "scripts": {
19
- "build": "tsup",
20
- "dev": "tsx src/index.ts",
21
- "test": "vitest run",
22
- "typecheck": "tsc --noEmit",
23
- "prepublishOnly": "npm run typecheck && npm test && npm run build"
24
- },
25
- "keywords": [
26
- "mcp",
27
- "model-context-protocol",
28
- "qcentriq",
29
- "playwright",
30
- "testing",
31
- "ai",
32
- "automation",
33
- "claude-desktop",
34
- "cursor"
35
- ],
36
- "author": "QCentriq",
37
- "license": "Apache-2.0",
38
- "dependencies": {
39
- "@modelcontextprotocol/server": "^2.2.0",
40
- "commander": "^15.0.0",
41
- "zod": "^4.5.4"
42
- },
43
- "devDependencies": {
44
- "@modelcontextprotocol/client": "^2.2.0",
45
- "@types/node": "^22.20.4",
46
- "tsup": "^8.4.0",
47
- "tsx": "^4.19.3",
48
- "typescript": "^5.8.2",
49
- "vitest": "^5.0.0"
50
- }
51
- }
1
+ {
2
+ "name": "@qcentriq/mcp",
3
+ "version": "0.5.1",
4
+ "description": "Official Model Context Protocol (MCP) server for QCentriq automated test discovery, diagnostics, and execution.",
5
+ "type": "module",
6
+ "bin": {
7
+ "qcentriq-mcp": "dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "engines": {
13
+ "node": ">=22.12.0"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "scripts": {
19
+ "build": "tsup",
20
+ "dev": "tsx src/index.ts",
21
+ "test": "vitest run",
22
+ "typecheck": "tsc --noEmit",
23
+ "prepublishOnly": "npm run typecheck && npm test && npm run build"
24
+ },
25
+ "keywords": [
26
+ "mcp",
27
+ "model-context-protocol",
28
+ "qcentriq",
29
+ "playwright",
30
+ "testing",
31
+ "ai",
32
+ "automation",
33
+ "claude-desktop",
34
+ "cursor"
35
+ ],
36
+ "author": "QCentriq",
37
+ "license": "Apache-2.0",
38
+ "dependencies": {
39
+ "@modelcontextprotocol/server": "^2.2.0",
40
+ "commander": "^15.0.0",
41
+ "zod": "^4.5.4"
42
+ },
43
+ "devDependencies": {
44
+ "@modelcontextprotocol/client": "^2.2.0",
45
+ "@types/node": "^22.20.4",
46
+ "tsup": "^8.4.0",
47
+ "tsx": "^4.19.3",
48
+ "typescript": "^5.8.2",
49
+ "vitest": "^5.0.0"
50
+ }
51
+ }