@yasserkhanorg/e2e-agents 0.5.13 → 0.5.15

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ai_mapping.d.ts","sourceRoot":"","sources":["../../src/agent/ai_mapping.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AA4BvD,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB;AAyWD,wBAAsB,iBAAiB,CACnC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,qBAAqB,EAC7B,KAAK,EAAE,UAAU,EAAE,EACnB,KAAK,EAAE,QAAQ,EAAE,GAClB,OAAO,CAAC,eAAe,CAAC,CA4O1B"}
1
+ {"version":3,"file":"ai_mapping.d.ts","sourceRoot":"","sources":["../../src/agent/ai_mapping.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AA4BvD,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB;AA4WD,wBAAsB,iBAAiB,CACnC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,qBAAqB,EAC7B,KAAK,EAAE,UAAU,EAAE,EACnB,KAAK,EAAE,QAAQ,EAAE,GAClB,OAAO,CAAC,eAAe,CAAC,CA+O1B"}
@@ -249,8 +249,11 @@ function selectCandidateTests(flows, tests, maxCandidateTests) {
249
249
  continue;
250
250
  }
251
251
  const matched = fallbackKws.filter((k) => haystack.includes(k));
252
- if (matched.length < fallbackKws.length) {
253
- continue; // all tokens must appear in at least one test title
252
+ // For 3+ tokens, n-1 must match (allows one absent word like "view");
253
+ // for 1-2 tokens all must match.
254
+ const required = fallbackKws.length >= 3 ? fallbackKws.length - 1 : fallbackKws.length;
255
+ if (matched.length < required) {
256
+ continue;
254
257
  }
255
258
  fallbackCandidates.push({ path: testPath, score: matched.length, matchedKeywords: matched });
256
259
  }
@@ -418,12 +421,15 @@ async function mapAITestsToFlows(appRoot, testsRoot, config, flows, tests) {
418
421
  'Rules:',
419
422
  '- Keep at most 5 tests per flow.',
420
423
  '- Use exact flowId values from FLOWS.',
421
- '- Map a test when you have clear evidence it covers the flow — from the file path OR from test titles in the content. Behavioral coverage via test titles is sufficient even when the filename does not exactly match the flow (e.g. search_user_post_spec.js covers search_messages if its titles assert searching for messages). Generic subsystem similarity without behavioral evidence is not enough.',
422
424
  '- A flow may only map to tests listed under FLOW_CANDIDATE_SIGNALS for that flow.',
423
- '- Treat single-keyword or broad subsystem overlap as insufficient evidence.',
424
- '- If the candidate path overlap is weak or ambiguous, return tests: [].',
425
- '- If unsure for a flow, return tests: [].',
426
- '- For EVERY flow (whether or not tests were found), return missingScenarios with 3-5 key user-facing test scenarios that must be covered. Write each as a short imperative statement starting with a verb (e.g. "Search for a message by keyword and verify results appear"). For mapped flows, focus on what the existing tests do NOT cover; for unmapped flows, describe the core scenarios a new test should include.',
425
+ '- Map a test when its file path OR test content titles demonstrate behavioral overlap with the flow scenario. A file named search_user_post_spec.js with titles about searching messages covers search_messages. Generic subsystem similarity alone is not enough.',
426
+ '- When FLOW_CANDIDATE_SIGNALS shows 3 or more candidates for a flow, map ALL that have any behavioral connection to the flow domain collectively they represent comprehensive coverage. For example, 4+ Cypress search specs collectively cover search_messages even if each only covers one search scenario.',
427
+ '- Only return tests: [] when no candidate has ANY behavioral connection to the flow.',
428
+ '- missingScenarios decision tree based on tests.length AFTER you have determined your test mappings:',
429
+ ' * tests.length >= 4: return missingScenarios: [] — comprehensive coverage, no gap to report.',
430
+ ' * tests.length 1-3: list only scenarios that are genuinely absent from ALL mapped tests combined.',
431
+ ' * tests.length 0: list 3-5 core user-facing scenarios that must be covered.',
432
+ ' Write each scenario as a short imperative starting with a verb.',
427
433
  '',
428
434
  `FLOWS (${prioritizedFlows.length}):`,
429
435
  JSON.stringify(prioritizedFlows.map((flow) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/agent/runner.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AA+S7C,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,OAAO,CAAC;CAClB;AAYD,wBAAsB,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAwTzF;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAqUtF"}
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/agent/runner.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAqT7C,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,OAAO,CAAC;CAClB;AAYD,wBAAsB,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAwTzF;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAqUtF"}
@@ -45,7 +45,13 @@ function computeGaps(flows, coverageMap, coverage) {
45
45
  if (coveredBy.length === 0) {
46
46
  return true; // no tests at all
47
47
  }
48
- // Also flag as a gap if tests exist but the AI identified missing scenarios.
48
+ // Flows with 4+ mapped tests are considered comprehensively covered the AI
49
+ // maps 4 tests only when multiple spec files collectively demonstrate coverage.
50
+ // missingScenarios from the AI are informational for such flows, not blocking.
51
+ if (coveredBy.length >= 4) {
52
+ return false;
53
+ }
54
+ // For flows with 1-3 tests, flag as a gap if AI identified missing scenarios.
49
55
  const flowCoverage = coverageByFlowId.get(flow.id);
50
56
  return (flowCoverage?.missingScenarios || []).length > 0;
51
57
  })
@@ -246,8 +246,11 @@ function selectCandidateTests(flows, tests, maxCandidateTests) {
246
246
  continue;
247
247
  }
248
248
  const matched = fallbackKws.filter((k) => haystack.includes(k));
249
- if (matched.length < fallbackKws.length) {
250
- continue; // all tokens must appear in at least one test title
249
+ // For 3+ tokens, n-1 must match (allows one absent word like "view");
250
+ // for 1-2 tokens all must match.
251
+ const required = fallbackKws.length >= 3 ? fallbackKws.length - 1 : fallbackKws.length;
252
+ if (matched.length < required) {
253
+ continue;
251
254
  }
252
255
  fallbackCandidates.push({ path: testPath, score: matched.length, matchedKeywords: matched });
253
256
  }
@@ -415,12 +418,15 @@ export async function mapAITestsToFlows(appRoot, testsRoot, config, flows, tests
415
418
  'Rules:',
416
419
  '- Keep at most 5 tests per flow.',
417
420
  '- Use exact flowId values from FLOWS.',
418
- '- Map a test when you have clear evidence it covers the flow — from the file path OR from test titles in the content. Behavioral coverage via test titles is sufficient even when the filename does not exactly match the flow (e.g. search_user_post_spec.js covers search_messages if its titles assert searching for messages). Generic subsystem similarity without behavioral evidence is not enough.',
419
421
  '- A flow may only map to tests listed under FLOW_CANDIDATE_SIGNALS for that flow.',
420
- '- Treat single-keyword or broad subsystem overlap as insufficient evidence.',
421
- '- If the candidate path overlap is weak or ambiguous, return tests: [].',
422
- '- If unsure for a flow, return tests: [].',
423
- '- For EVERY flow (whether or not tests were found), return missingScenarios with 3-5 key user-facing test scenarios that must be covered. Write each as a short imperative statement starting with a verb (e.g. "Search for a message by keyword and verify results appear"). For mapped flows, focus on what the existing tests do NOT cover; for unmapped flows, describe the core scenarios a new test should include.',
422
+ '- Map a test when its file path OR test content titles demonstrate behavioral overlap with the flow scenario. A file named search_user_post_spec.js with titles about searching messages covers search_messages. Generic subsystem similarity alone is not enough.',
423
+ '- When FLOW_CANDIDATE_SIGNALS shows 3 or more candidates for a flow, map ALL that have any behavioral connection to the flow domain collectively they represent comprehensive coverage. For example, 4+ Cypress search specs collectively cover search_messages even if each only covers one search scenario.',
424
+ '- Only return tests: [] when no candidate has ANY behavioral connection to the flow.',
425
+ '- missingScenarios decision tree based on tests.length AFTER you have determined your test mappings:',
426
+ ' * tests.length >= 4: return missingScenarios: [] — comprehensive coverage, no gap to report.',
427
+ ' * tests.length 1-3: list only scenarios that are genuinely absent from ALL mapped tests combined.',
428
+ ' * tests.length 0: list 3-5 core user-facing scenarios that must be covered.',
429
+ ' Write each scenario as a short imperative starting with a verb.',
424
430
  '',
425
431
  `FLOWS (${prioritizedFlows.length}):`,
426
432
  JSON.stringify(prioritizedFlows.map((flow) => ({
@@ -41,7 +41,13 @@ function computeGaps(flows, coverageMap, coverage) {
41
41
  if (coveredBy.length === 0) {
42
42
  return true; // no tests at all
43
43
  }
44
- // Also flag as a gap if tests exist but the AI identified missing scenarios.
44
+ // Flows with 4+ mapped tests are considered comprehensively covered the AI
45
+ // maps 4 tests only when multiple spec files collectively demonstrate coverage.
46
+ // missingScenarios from the AI are informational for such flows, not blocking.
47
+ if (coveredBy.length >= 4) {
48
+ return false;
49
+ }
50
+ // For flows with 1-3 tests, flag as a gap if AI identified missing scenarios.
45
51
  const flowCoverage = coverageByFlowId.get(flow.id);
46
52
  return (flowCoverage?.missingScenarios || []).length > 0;
47
53
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yasserkhanorg/e2e-agents",
3
- "version": "0.5.13",
3
+ "version": "0.5.15",
4
4
  "description": "Pluggable LLM provider library for AI-powered test automation. Use Claude, Ollama, or your own LLM. Integrate with Playwright, Jest, or any test framework. MCP server for test agents, cost tracking, and hybrid provider mode.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",