playwright-ai-insights 1.2.6 → 1.2.7
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.
- package/dist/agents/assertionAnalyzer.d.ts +19 -0
- package/dist/agents/assertionAnalyzer.d.ts.map +1 -0
- package/dist/agents/assertionAnalyzer.js +144 -0
- package/dist/agents/assertionAnalyzer.js.map +1 -0
- package/dist/agents/failureAnalyzer.d.ts.map +1 -1
- package/dist/agents/failureAnalyzer.js +50 -22
- package/dist/agents/failureAnalyzer.js.map +1 -1
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +1 -0
- package/dist/agents/index.js.map +1 -1
- package/dist/core/reportGenerator.d.ts.map +1 -1
- package/dist/core/reportGenerator.js +59 -0
- package/dist/core/reportGenerator.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/historyService.d.ts +44 -0
- package/dist/utils/historyService.d.ts.map +1 -0
- package/dist/utils/historyService.js +128 -0
- package/dist/utils/historyService.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assertion Analyzer - Specialized AI analysis for assertion/expectation failures
|
|
3
|
+
*/
|
|
4
|
+
interface AssertionAnalysis {
|
|
5
|
+
suggestion: string;
|
|
6
|
+
confidence: number;
|
|
7
|
+
rootCause: string;
|
|
8
|
+
fixStrategy: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Analyze assertion failure and provide targeted suggestions
|
|
12
|
+
*/
|
|
13
|
+
export declare function analyzeAssertionFailure(errorMessage: string, testName: string, sourceCode?: string): Promise<AssertionAnalysis>;
|
|
14
|
+
/**
|
|
15
|
+
* Check if error is an assertion/expectation failure
|
|
16
|
+
*/
|
|
17
|
+
export declare function isAssertionFailure(errorMessage: string): boolean;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=assertionAnalyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertionAnalyzer.d.ts","sourceRoot":"","sources":["../../src/agents/assertionAnalyzer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,UAAU,iBAAiB;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAwDD;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,iBAAiB,CAAC,CAqF5B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAYhE"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assertion Analyzer - Specialized AI analysis for assertion/expectation failures
|
|
3
|
+
*/
|
|
4
|
+
import { OpenAI } from 'openai';
|
|
5
|
+
const client = new OpenAI({
|
|
6
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
7
|
+
timeout: 30000,
|
|
8
|
+
maxRetries: 0,
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* Extract assertion details from error message
|
|
12
|
+
* Examples:
|
|
13
|
+
* - Expected 'X' but got 'Y'
|
|
14
|
+
* - expected value to be equal
|
|
15
|
+
* - expect(actual).toContain(expected)
|
|
16
|
+
*/
|
|
17
|
+
function parseAssertionError(errorMessage) {
|
|
18
|
+
const result = {};
|
|
19
|
+
// Pattern: "Expected 'something' to contain 'pattern'" or "expected X but got Y"
|
|
20
|
+
let match = errorMessage.match(/Expected\s+['"]([^'"]+)['"]\s+to\s+contain\s+['"]([^'"]+)['"]/i);
|
|
21
|
+
if (match) {
|
|
22
|
+
result.actual = match[1];
|
|
23
|
+
result.expected = match[2];
|
|
24
|
+
result.assertionType = 'toContain';
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
// Pattern: "expected 'X' but got 'Y'" or similar
|
|
28
|
+
match = errorMessage.match(/expected\s+['"]([^'"]*)['"]\s+but\s+got\s+['"]([^'"]*)['"]/i);
|
|
29
|
+
if (match) {
|
|
30
|
+
result.expected = match[1];
|
|
31
|
+
result.actual = match[2];
|
|
32
|
+
result.assertionType = 'equal';
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
// Pattern: "Expected X (string) but received Y (number)"
|
|
36
|
+
match = errorMessage.match(/Expected\s+([^(]+)\s+\(([^)]+)\)\s+but\s+received\s+([^(]+)\s+\(([^)]+)\)/i);
|
|
37
|
+
if (match) {
|
|
38
|
+
result.expected = `${match[1]} (${match[2]})`;
|
|
39
|
+
result.actual = `${match[3]} (${match[4]})`;
|
|
40
|
+
result.assertionType = 'type_mismatch';
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
// Pattern: "expected value to be X"
|
|
44
|
+
match = errorMessage.match(/expected\s+value\s+to\s+be\s+([^,.]+)/i);
|
|
45
|
+
if (match) {
|
|
46
|
+
result.expected = match[1];
|
|
47
|
+
result.assertionType = 'expected_value';
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Analyze assertion failure and provide targeted suggestions
|
|
54
|
+
*/
|
|
55
|
+
export async function analyzeAssertionFailure(errorMessage, testName, sourceCode) {
|
|
56
|
+
try {
|
|
57
|
+
const parsed = parseAssertionError(errorMessage);
|
|
58
|
+
// Build context for AI
|
|
59
|
+
let context = `Test: "${testName}"\nFailure Type: Assertion/Expectation\n\n`;
|
|
60
|
+
if (parsed.expected && parsed.actual) {
|
|
61
|
+
context += `Expected: "${parsed.expected}"\nActual: "${parsed.actual}"\n`;
|
|
62
|
+
context += `Assertion Type: ${parsed.assertionType || 'unknown'}\n\n`;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
context += `Error Details:\n${errorMessage}\n\n`;
|
|
66
|
+
}
|
|
67
|
+
if (sourceCode) {
|
|
68
|
+
context += `Related Code:\n${sourceCode}\n\n`;
|
|
69
|
+
}
|
|
70
|
+
const prompt = `You are a test failure expert. Analyze this assertion failure and provide actionable suggestions:
|
|
71
|
+
|
|
72
|
+
${context}
|
|
73
|
+
|
|
74
|
+
Provide your response in JSON format with:
|
|
75
|
+
{
|
|
76
|
+
"rootCause": "specific reason for the failure (1-2 sentences)",
|
|
77
|
+
"fixStrategy": "how to fix this (1-2 sentences)",
|
|
78
|
+
"suggestions": ["specific suggestion 1", "specific suggestion 2", "specific suggestion 3"]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
Focus on:
|
|
82
|
+
- If values do not match exactly: suggest data validation or wait for correct value
|
|
83
|
+
- If assertion is too strict: suggest using regex or partial matching
|
|
84
|
+
- If timing issue: suggest adding explicit waits before assertion
|
|
85
|
+
- If selector issue: suggest checking element visibility first`;
|
|
86
|
+
const response = await client.chat.completions.create({
|
|
87
|
+
model: 'gpt-4o-mini',
|
|
88
|
+
messages: [{ role: 'user', content: prompt }],
|
|
89
|
+
temperature: 0.3,
|
|
90
|
+
max_tokens: 300,
|
|
91
|
+
});
|
|
92
|
+
const textContent = response.choices[0]?.message?.content || '';
|
|
93
|
+
// Parse JSON response
|
|
94
|
+
let analysisData = {};
|
|
95
|
+
try {
|
|
96
|
+
const jsonMatch = textContent.match(/\{[\s\S]*\}/);
|
|
97
|
+
if (jsonMatch) {
|
|
98
|
+
analysisData = JSON.parse(jsonMatch[0]);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// If JSON parsing fails, extract key phrases
|
|
103
|
+
analysisData = {
|
|
104
|
+
rootCause: textContent.substring(0, 100),
|
|
105
|
+
fixStrategy: 'Review the assertion and verify expected vs actual values match.',
|
|
106
|
+
suggestions: ['Check test data consistency', 'Add explicit wait before assertion'],
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
const suggestion = analysisData.suggestions && analysisData.suggestions.length > 0
|
|
110
|
+
? analysisData.suggestions[0]
|
|
111
|
+
: analysisData.fixStrategy || 'Try validating the test data and assertions';
|
|
112
|
+
return {
|
|
113
|
+
suggestion,
|
|
114
|
+
confidence: 0.75,
|
|
115
|
+
rootCause: analysisData.rootCause || 'Assertion value mismatch',
|
|
116
|
+
fixStrategy: analysisData.fixStrategy || 'Verify expected values in test data',
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
console.warn('Assertion analysis failed:', error);
|
|
121
|
+
return {
|
|
122
|
+
suggestion: 'Review test data and assertion logic',
|
|
123
|
+
confidence: 0.5,
|
|
124
|
+
rootCause: 'Unable to analyze assertion failure',
|
|
125
|
+
fixStrategy: 'Check if test data matches expected values',
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Check if error is an assertion/expectation failure
|
|
131
|
+
*/
|
|
132
|
+
export function isAssertionFailure(errorMessage) {
|
|
133
|
+
if (!errorMessage)
|
|
134
|
+
return false;
|
|
135
|
+
const patterns = [
|
|
136
|
+
/expect\(/i,
|
|
137
|
+
/assertion/i,
|
|
138
|
+
/expected.*but.*got/i,
|
|
139
|
+
/toBe|toEqual|toContain|toMatch|toHaveBeenCalled/i,
|
|
140
|
+
/\bExpected\b.*\bsame as\b/i,
|
|
141
|
+
];
|
|
142
|
+
return patterns.some((pattern) => pattern.test(errorMessage));
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=assertionAnalyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertionAnalyzer.js","sourceRoot":"","sources":["../../src/agents/assertionAnalyzer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CA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AEG;AACH,MAAM,UAAU,kBAAkB,CAAC,YAAoB;IACrD,IAAI,CAAC,YAAY;QAAE,OAAO,KAAK,CAAC;IAEhC,MAAM,QAAQ,GAAG;QACf,WAAW;QACX,YAAY;QACZ,qBAAqB;QACrB,kDAAkD;QAClD,4BAA4B;KAC7B,CAAC;IAEF,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"failureAnalyzer.d.ts","sourceRoot":"","sources":["../../src/agents/failureAnalyzer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"failureAnalyzer.d.ts","sourceRoot":"","sources":["../../src/agents/failureAnalyzer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAiB7E;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAwE3B;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,WAAW,EAAE,EACvB,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAmB7B"}
|
|
@@ -6,6 +6,8 @@ import OpenAI from 'openai';
|
|
|
6
6
|
import { getConfig } from '../utils/config.js';
|
|
7
7
|
import { logger } from '../utils/logger.js';
|
|
8
8
|
import { classifyFailure } from '../analyzers/failureClassifier.js';
|
|
9
|
+
import { analyzeAssertionFailure, isAssertionFailure } from './assertionAnalyzer.js';
|
|
10
|
+
import { suggestLocator, isLocatorTimeoutFailure } from './locatorSuggester.js';
|
|
9
11
|
let cachedClient = null;
|
|
10
12
|
function getOpenAIClient() {
|
|
11
13
|
if (!cachedClient) {
|
|
@@ -25,29 +27,55 @@ export async function analyzeFailure(failure, options = {}) {
|
|
|
25
27
|
if (includeDom && failure.domSnapshot) {
|
|
26
28
|
domContent = failure.domSnapshot.slice(0, maxDomChars);
|
|
27
29
|
}
|
|
28
|
-
const
|
|
30
|
+
const failureType = classifyFailure(failure.error);
|
|
29
31
|
try {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
32
|
+
// Route to specialized analyzer based on failure type
|
|
33
|
+
if (isAssertionFailure(failure.error)) {
|
|
34
|
+
logger.debug('Detected assertion failure, using assertion analyzer');
|
|
35
|
+
const analysis = await analyzeAssertionFailure(failure.error, failure.testName, domContent);
|
|
36
|
+
return {
|
|
37
|
+
testName: failure.testName,
|
|
38
|
+
rootCause: analysis.rootCause,
|
|
39
|
+
suggestions: [analysis.suggestion],
|
|
40
|
+
confidence: analysis.confidence,
|
|
41
|
+
failureType: failureType,
|
|
42
|
+
rawAnalysis: analysis.fixStrategy,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
else if (isLocatorTimeoutFailure(failure.error)) {
|
|
46
|
+
logger.debug('Detected locator/timeout failure, using locator suggester');
|
|
47
|
+
const suggestion = await suggestLocator(failure.testName, failure.error, domContent);
|
|
48
|
+
return {
|
|
49
|
+
testName: failure.testName,
|
|
50
|
+
rootCause: 'Element not found or timeout waiting for element',
|
|
51
|
+
suggestions: [`Try locator: ${suggestion.suggestedLocator} (${suggestion.decision}). ${suggestion.reason}`],
|
|
52
|
+
confidence: suggestion.confidence,
|
|
53
|
+
failureType: failureType,
|
|
54
|
+
rawAnalysis: `Try locator: ${suggestion.suggestedLocator}`,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// Generic analysis for other failures
|
|
59
|
+
logger.debug('Using generic failure analysis');
|
|
60
|
+
const prompt = buildFailureAnalysisPrompt(failure, domContent);
|
|
61
|
+
const client = getOpenAIClient();
|
|
62
|
+
const response = await client.chat.completions.create({
|
|
63
|
+
model: config.model || 'gpt-4o-mini',
|
|
64
|
+
messages: [{ role: 'user', content: prompt }],
|
|
65
|
+
temperature: config.temperature || 0.2,
|
|
66
|
+
});
|
|
67
|
+
const rawAnalysis = response.choices[0].message.content || '';
|
|
68
|
+
const suggestions = extractSuggestions(rawAnalysis);
|
|
69
|
+
const confidence = extractConfidence(rawAnalysis);
|
|
70
|
+
return {
|
|
71
|
+
testName: failure.testName,
|
|
72
|
+
rootCause: rawAnalysis.split('\n')[0],
|
|
73
|
+
suggestions,
|
|
74
|
+
confidence,
|
|
75
|
+
failureType,
|
|
76
|
+
rawAnalysis,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
51
79
|
}
|
|
52
80
|
catch (error) {
|
|
53
81
|
logger.error('Failed to analyze failure with AI', error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"failureAnalyzer.js","sourceRoot":"","sources":["../../src/agents/failureAnalyzer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"failureAnalyzer.js","sourceRoot":"","sources":["../../src/agents/failureAnalyzer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,MAAM,MAAM,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CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,6BAA6B;AAC/D,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAgB;IACzC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACvD,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACtB,MAAM,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,EAAE,CAAC,CAAC,qBAAqB;AAClC,CAAC"}
|
package/dist/agents/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
|
package/dist/agents/index.js
CHANGED
package/dist/agents/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportGenerator.d.ts","sourceRoot":"","sources":["../../src/core/reportGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"reportGenerator.d.ts","sourceRoot":"","sources":["../../src/core/reportGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsCH,cAAM,iBAAiB;IACrB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,UAAU,CAAqC;gBAE3C,WAAW,GAAE,MAAsB;IAI/C;;OAEG;IACG,cAAc,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqC9E;;OAEG;IACH,OAAO,CAAC,eAAe;IA6DvB;;OAEG;IACH,OAAO,CAAC,aAAa;IAWrB;;OAEG;IACH,OAAO,CAAC,cAAc;IAItB;;OAEG;YACW,cAAc;IA+E5B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA0U1B;;OAEG;IACH,OAAO,CAAC,UAAU;CAUnB;AAED,eAAO,MAAM,eAAe,mBAA0B,CAAC;AACvD,eAAe,eAAe,CAAC"}
|
|
@@ -7,6 +7,7 @@ import * as path from 'path';
|
|
|
7
7
|
import { analyzeFailure } from '../agents/failureAnalyzer.js';
|
|
8
8
|
import { suggestLocator, isLocatorTimeoutFailure } from '../agents/locatorSuggester.js';
|
|
9
9
|
import { classifyFailure } from '../analyzers/failureClassifier.js';
|
|
10
|
+
import { recordTestRun, getTestTrend, getRunHistory } from '../utils/historyService.js';
|
|
10
11
|
class AIReportGenerator {
|
|
11
12
|
constructor(projectRoot = process.cwd()) {
|
|
12
13
|
this.resultsFile = 'test-results.json';
|
|
@@ -162,10 +163,22 @@ class AIReportGenerator {
|
|
|
162
163
|
}
|
|
163
164
|
insight.suggestion = suggestion;
|
|
164
165
|
insight.confidence = result.confidence || 0;
|
|
166
|
+
// Record test run in history
|
|
167
|
+
const failureStatus = test.status === 'passed' ? 'passed' :
|
|
168
|
+
test.status === 'timedOut' ? 'timedOut' : 'failed';
|
|
169
|
+
recordTestRun(test.name, failureStatus, failureType, test.error?.message || undefined, suggestion, result.confidence);
|
|
170
|
+
// Get trend and history
|
|
171
|
+
const trendData = getTestTrend(test.name);
|
|
172
|
+
insight.trend = trendData.trend;
|
|
173
|
+
insight.trendIcon = trendData.icon;
|
|
174
|
+
insight.passRate = trendData.passRate;
|
|
175
|
+
insight.runHistory = getRunHistory(test.name);
|
|
165
176
|
}
|
|
166
177
|
catch (error) {
|
|
167
178
|
console.warn(`⚠️ Could not get AI analysis for "${test.name}": ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
168
179
|
insight.suggestion = 'Unable to generate AI insights. Please check the error message above.';
|
|
180
|
+
// Still record failure even if AI analysis fails
|
|
181
|
+
recordTestRun(test.name, test.status, 'unknown', test.error?.message);
|
|
169
182
|
}
|
|
170
183
|
return insight;
|
|
171
184
|
}
|
|
@@ -185,6 +198,14 @@ class AIReportGenerator {
|
|
|
185
198
|
<td class="error-msg">${this.escapeHtml(this.stripAnsiCodes(insight.errorMessage || 'N/A'))}</td>
|
|
186
199
|
<td class="suggestion">${this.escapeHtml(insight.suggestion || 'N/A')}</td>
|
|
187
200
|
<td class="confidence">${insight.confidence ? Math.round(insight.confidence) + '%' : 'N/A'}</td>
|
|
201
|
+
<td class="trend">
|
|
202
|
+
<span class="trend-icon">${insight.trendIcon || '→'}</span>
|
|
203
|
+
<span class="trend-label">${insight.trend || 'N/A'}</span>
|
|
204
|
+
${insight.passRate !== undefined ? `<span class="pass-rate">(${insight.passRate}%)</span>` : ''}
|
|
205
|
+
</td>
|
|
206
|
+
<td class="run-history">
|
|
207
|
+
${insight.runHistory ? insight.runHistory.map(r => `<span class="run-indicator" title="${r.status}">${r.icon}</span>`).join('') : '—'}
|
|
208
|
+
</td>
|
|
188
209
|
<td class="flaky ${insight.isFlaky ? 'yes' : 'no'}">${insight.isFlaky ? '⚠️ Yes' : 'No'}</td>
|
|
189
210
|
</tr>
|
|
190
211
|
`)
|
|
@@ -364,6 +385,42 @@ class AIReportGenerator {
|
|
|
364
385
|
color: #27ae60;
|
|
365
386
|
}
|
|
366
387
|
|
|
388
|
+
.trend {
|
|
389
|
+
text-align: center;
|
|
390
|
+
font-weight: 500;
|
|
391
|
+
white-space: nowrap;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.trend-icon {
|
|
395
|
+
font-size: 1.2em;
|
|
396
|
+
margin-right: 4px;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.trend-label {
|
|
400
|
+
text-transform: capitalize;
|
|
401
|
+
color: #667eea;
|
|
402
|
+
font-size: 0.85em;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.pass-rate {
|
|
406
|
+
display: block;
|
|
407
|
+
font-size: 0.8em;
|
|
408
|
+
color: #999;
|
|
409
|
+
margin-top: 2px;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.run-history {
|
|
413
|
+
text-align: center;
|
|
414
|
+
letter-spacing: 2px;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.run-indicator {
|
|
418
|
+
display: inline-block;
|
|
419
|
+
font-size: 0.9em;
|
|
420
|
+
margin: 0 2px;
|
|
421
|
+
cursor: help;
|
|
422
|
+
}
|
|
423
|
+
|
|
367
424
|
.footer {
|
|
368
425
|
background: #f8f9fa;
|
|
369
426
|
padding: 20px 40px;
|
|
@@ -428,6 +485,8 @@ class AIReportGenerator {
|
|
|
428
485
|
<th>Error Message</th>
|
|
429
486
|
<th>AI Suggestion</th>
|
|
430
487
|
<th>Confidence</th>
|
|
488
|
+
<th>Trend (Last 5)</th>
|
|
489
|
+
<th>Recent Runs</th>
|
|
431
490
|
<th>Flaky?</th>
|
|
432
491
|
</tr>
|
|
433
492
|
</thead>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportGenerator.js","sourceRoot":"","sources":["../../src/core/reportGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"reportGenerator.js","sourceRoot":"","sources":["../../src/core/reportGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AA8BxF,MAAM,iBAAiB;IAKrB,YAAY,cAAsB,OAAO,CAAC,GAAG,EAAE;QAHvC,gBAAW,GAAW,mBAAmB,CAAC;QAC1C,eAAU,GAAW,yBAAyB,CAAC;QAGrD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,WAAoB,EAAE,UAAmB;QAC5D,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,IAAI,CAAC,eAAe,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCA0P0B,YAAY;;;;qCAIZ,UAAU;;;;qCAIV,IAAI,IAAI,EAAE,CAAC,kBAAkB,EAAE;;;;;;;cAOtD,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;0BAgBP,WAAW;;;aAGxB,CAAC,CAAC,CAAC;;;;aAIH;;;;8BAIiB,SAAS;;;;;;KAMlC,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,UAAU,CAAC,IAAY;QAC7B,MAAM,GAAG,GAA8B;YACrC,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,MAAM;YACX,GAAG,EAAE,MAAM;YACX,GAAG,EAAE,QAAQ;YACb,GAAG,EAAE,QAAQ;SACd,CAAC;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACvD,CAAC;CACF;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,iBAAiB,EAAE,CAAC;AACvD,eAAe,eAAe,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './agents/index.js';
|
|
|
8
8
|
export * from './analyzers/index.js';
|
|
9
9
|
export * from './utils/config.js';
|
|
10
10
|
export * from './utils/logger.js';
|
|
11
|
+
export * from './utils/historyService.js';
|
|
11
12
|
import { initialize, analyzeTestFailures, getFailureInsight, checkTestFlakiness } from './core/api.js';
|
|
12
13
|
declare const _default: {
|
|
13
14
|
initialize: typeof initialize;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAG1C,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAEnB,MAAM,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;AAEvB,wBAME"}
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export * from './agents/index.js';
|
|
|
8
8
|
export * from './analyzers/index.js';
|
|
9
9
|
export * from './utils/config.js';
|
|
10
10
|
export * from './utils/logger.js';
|
|
11
|
+
export * from './utils/historyService.js';
|
|
11
12
|
// Default export with common functions
|
|
12
13
|
import { initialize, analyzeTestFailures, getFailureInsight, checkTestFlakiness, utils, } from './core/api.js';
|
|
13
14
|
export default {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAE1C,uCAAuC;AACvC,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,GACN,MAAM,eAAe,CAAC;AAEvB,eAAe;IACb,UAAU;IACV,mBAAmB;IACnB,iBAAiB;IACjB,kBAAkB;IAClB,KAAK;CACN,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test History Service - Tracks test results across runs
|
|
3
|
+
*/
|
|
4
|
+
interface TestRun {
|
|
5
|
+
timestamp: string;
|
|
6
|
+
status: 'passed' | 'failed' | 'timedOut' | 'skipped';
|
|
7
|
+
failureType?: string;
|
|
8
|
+
errorMessage?: string;
|
|
9
|
+
suggestion?: string;
|
|
10
|
+
confidence?: number;
|
|
11
|
+
}
|
|
12
|
+
interface TestHistory {
|
|
13
|
+
testName: string;
|
|
14
|
+
runs: TestRun[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Save test run to history
|
|
18
|
+
*/
|
|
19
|
+
export declare function recordTestRun(testName: string, status: TestRun['status'], failureType?: string, errorMessage?: string, suggestion?: string, confidence?: number): void;
|
|
20
|
+
/**
|
|
21
|
+
* Get last N runs for a test
|
|
22
|
+
*/
|
|
23
|
+
export declare function getTestRunHistory(testName: string, limit?: number): TestRun[];
|
|
24
|
+
/**
|
|
25
|
+
* Get trend for a test (comparing last run to average of 5 runs)
|
|
26
|
+
*/
|
|
27
|
+
export declare function getTestTrend(testName: string): {
|
|
28
|
+
trend: 'improving' | 'degrading' | 'stable' | 'new';
|
|
29
|
+
passRate: number;
|
|
30
|
+
icon: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Save all test runs to consolidated JSON
|
|
34
|
+
*/
|
|
35
|
+
export declare function consolidateHistoryReport(): TestHistory[];
|
|
36
|
+
/**
|
|
37
|
+
* Get run history for report display
|
|
38
|
+
*/
|
|
39
|
+
export declare function getRunHistory(testName: string): Array<{
|
|
40
|
+
status: string;
|
|
41
|
+
icon: string;
|
|
42
|
+
}>;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=historyService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"historyService.d.ts","sourceRoot":"","sources":["../../src/utils/historyService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,UAAU,OAAO;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,WAAW;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB;AAcD;;GAEG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,EACzB,WAAW,CAAC,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,MAAM,EACrB,UAAU,CAAC,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,IAAI,CA2BN;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,OAAO,EAAE,CAehF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,GACf;IAAE,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,QAAQ,GAAG,KAAK,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CA2BzF;AASD;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,WAAW,EAAE,CAkBxD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAavF"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test History Service - Tracks test results across runs
|
|
3
|
+
*/
|
|
4
|
+
import * as fs from 'fs';
|
|
5
|
+
import * as path from 'path';
|
|
6
|
+
const HISTORY_DIR = 'reports/test-history';
|
|
7
|
+
const HISTORY_FILE = 'reports/test-history.json';
|
|
8
|
+
/**
|
|
9
|
+
* Ensure history directory exists
|
|
10
|
+
*/
|
|
11
|
+
function ensureHistoryDir() {
|
|
12
|
+
if (!fs.existsSync(HISTORY_DIR)) {
|
|
13
|
+
fs.mkdirSync(HISTORY_DIR, { recursive: true });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Save test run to history
|
|
18
|
+
*/
|
|
19
|
+
export function recordTestRun(testName, status, failureType, errorMessage, suggestion, confidence) {
|
|
20
|
+
try {
|
|
21
|
+
ensureHistoryDir();
|
|
22
|
+
const testFile = path.join(HISTORY_DIR, `${sanitizeName(testName)}.json`);
|
|
23
|
+
let history = { testName, runs: [] };
|
|
24
|
+
if (fs.existsSync(testFile)) {
|
|
25
|
+
history = JSON.parse(fs.readFileSync(testFile, 'utf8'));
|
|
26
|
+
}
|
|
27
|
+
history.runs.push({
|
|
28
|
+
timestamp: new Date().toISOString(),
|
|
29
|
+
status,
|
|
30
|
+
failureType,
|
|
31
|
+
errorMessage,
|
|
32
|
+
suggestion,
|
|
33
|
+
confidence,
|
|
34
|
+
});
|
|
35
|
+
// Keep only last 10 runs
|
|
36
|
+
history.runs = history.runs.slice(-10);
|
|
37
|
+
fs.writeFileSync(testFile, JSON.stringify(history, null, 2));
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.warn('Failed to record test run:', error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get last N runs for a test
|
|
45
|
+
*/
|
|
46
|
+
export function getTestRunHistory(testName, limit = 5) {
|
|
47
|
+
try {
|
|
48
|
+
ensureHistoryDir();
|
|
49
|
+
const testFile = path.join(HISTORY_DIR, `${sanitizeName(testName)}.json`);
|
|
50
|
+
if (!fs.existsSync(testFile)) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
const history = JSON.parse(fs.readFileSync(testFile, 'utf8'));
|
|
54
|
+
return history.runs.slice(-limit);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
console.warn('Failed to get test run history:', error);
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get trend for a test (comparing last run to average of 5 runs)
|
|
63
|
+
*/
|
|
64
|
+
export function getTestTrend(testName) {
|
|
65
|
+
const runs = getTestRunHistory(testName, 5);
|
|
66
|
+
if (runs.length === 0) {
|
|
67
|
+
return { trend: 'new', passRate: 0, icon: '✨' };
|
|
68
|
+
}
|
|
69
|
+
const passCount = runs.filter((r) => r.status === 'passed').length;
|
|
70
|
+
const passRate = Math.round((passCount / runs.length) * 100);
|
|
71
|
+
if (runs.length < 2) {
|
|
72
|
+
return { trend: 'stable', passRate, icon: '→' };
|
|
73
|
+
}
|
|
74
|
+
const lastRun = runs[runs.length - 1];
|
|
75
|
+
const previousRuns = runs.slice(0, -1);
|
|
76
|
+
const previousPassRate = Math.round((previousRuns.filter((r) => r.status === 'passed').length / previousRuns.length) * 100);
|
|
77
|
+
if (lastRun.status === 'passed' && previousPassRate < 100) {
|
|
78
|
+
return { trend: 'improving', passRate, icon: '📈' };
|
|
79
|
+
}
|
|
80
|
+
else if (lastRun.status === 'failed' && previousPassRate === 100) {
|
|
81
|
+
return { trend: 'degrading', passRate, icon: '📉' };
|
|
82
|
+
}
|
|
83
|
+
return { trend: 'stable', passRate, icon: '→' };
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Sanitize test name for filename
|
|
87
|
+
*/
|
|
88
|
+
function sanitizeName(name) {
|
|
89
|
+
return name.replace(/[^a-z0-9]/gi, '_').toLowerCase();
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Save all test runs to consolidated JSON
|
|
93
|
+
*/
|
|
94
|
+
export function consolidateHistoryReport() {
|
|
95
|
+
try {
|
|
96
|
+
ensureHistoryDir();
|
|
97
|
+
const files = fs.readdirSync(HISTORY_DIR).filter((f) => f.endsWith('.json'));
|
|
98
|
+
const allHistory = files
|
|
99
|
+
.map((file) => {
|
|
100
|
+
const filePath = path.join(HISTORY_DIR, file);
|
|
101
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
102
|
+
})
|
|
103
|
+
.sort((a, b) => a.testName.localeCompare(b.testName));
|
|
104
|
+
fs.writeFileSync(HISTORY_FILE, JSON.stringify(allHistory, null, 2));
|
|
105
|
+
return allHistory;
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
console.warn('Failed to consolidate history:', error);
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get run history for report display
|
|
114
|
+
*/
|
|
115
|
+
export function getRunHistory(testName) {
|
|
116
|
+
const runs = getTestRunHistory(testName, 5);
|
|
117
|
+
return runs.map((run) => ({
|
|
118
|
+
status: run.status,
|
|
119
|
+
icon: run.status === 'passed'
|
|
120
|
+
? '✅'
|
|
121
|
+
: run.status === 'failed'
|
|
122
|
+
? '❌'
|
|
123
|
+
: run.status === 'timedOut'
|
|
124
|
+
? '⏱️'
|
|
125
|
+
: '⊘',
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=historyService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"historyService.js","sourceRoot":"","sources":["../../src/utils/historyService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAgB7B,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAC3C,MAAM,YAAY,GAAG,2BAA2B,CAAC;AAEjD;;GAEG;AACH,SAAS,gBAAgB;IACvB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAChC,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,QAAgB,EAChB,MAAyB,EACzB,WAAoB,EACpB,YAAqB,EACrB,UAAmB,EACnB,UAAmB;IAEnB,IAAI,CAAC;QACH,gBAAgB,EAAE,CAAC;QAEnB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC1E,IAAI,OAAO,GAAgB,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAElD,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAA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