playwright-ai-reporter 0.0.5 → 0.0.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/reporter.js CHANGED
@@ -94,7 +94,7 @@ class PlaywrightTestReporter {
94
94
  this.suite = suite;
95
95
  const totalTestCount = this._countTests(suite);
96
96
  console.log(`${colors_1.colors.fgCyan}===============================================${colors_1.colors.reset}`);
97
- console.log(`${colors_1.colors.fgMagentaBright}🚀 Starting test run: ${totalTestCount} tests using ${config.workers} workers${colors_1.colors.reset}`);
97
+ console.log(`${colors_1.colors.fgCyan}🚀 Starting test run: ${totalTestCount} tests using ${config.workers} workers${colors_1.colors.reset}`);
98
98
  console.log(`${colors_1.colors.fgCyan}===============================================${colors_1.colors.reset}`);
99
99
  console.log(`${colors_1.colors.fgCyan}Test run started at: ${new Date().toLocaleString()}${colors_1.colors.reset}`);
100
100
  // Get project name(s) from configuration
@@ -171,7 +171,7 @@ class PlaywrightTestReporter {
171
171
  onTestEnd(test, result) {
172
172
  const title = test.title;
173
173
  const timeTakenSec = result.duration / 1000;
174
- console.log(`${colors_1.colors.fgCyan}Finished test: ${colors_1.colors.fgMagentaBright}${test.title}${colors_1.colors.fgCyan}: ${result.status}${colors_1.colors.reset}`);
174
+ console.log(`${colors_1.colors.fgCyan}Finished test: ${colors_1.colors.fgYellow}${test.title}${colors_1.colors.fgCyan}: ${result.status.toUpperCase()}${colors_1.colors.reset}`);
175
175
  // Initialize test record if first attempt
176
176
  if (!this._testRecords.has(title)) {
177
177
  // Create an enhanced test case with required properties
@@ -235,10 +235,10 @@ class PlaywrightTestReporter {
235
235
  */
236
236
  async onTestBegin(test, result) {
237
237
  if (result.retry > 0) {
238
- console.log(`${colors_1.colors.fgYellow}🔄 Retrying test (attempt #${result.retry + 1}): ${colors_1.colors.fgMagentaBright}${test.title}${colors_1.colors.reset}`);
238
+ console.log(`${colors_1.colors.fgYellow}🔄 Retrying test (attempt #${result.retry + 1}): ${colors_1.colors.fgYellow}${test.title}${colors_1.colors.reset}`);
239
239
  }
240
240
  else {
241
- console.log(`${colors_1.colors.fgCyan}Starting test: ${colors_1.colors.fgMagentaBright}${test.title}${colors_1.colors.reset}`);
241
+ console.log(`${colors_1.colors.fgCyan}Starting test: ${colors_1.colors.fgYellow}${test.title}${colors_1.colors.reset}`);
242
242
  }
243
243
  }
244
244
  /**
@@ -277,7 +277,7 @@ class PlaywrightTestReporter {
277
277
  */
278
278
  async onEnd(result) {
279
279
  console.log(`${colors_1.colors.fgCyan}===============================================${colors_1.colors.reset}`);
280
- console.log(`${colors_1.colors.fgMagentaBright}Finished the test run: ${result.status.toUpperCase()}${colors_1.colors.reset}`);
280
+ console.log(`${colors_1.colors.fgCyan}Finished the test run: ${result.status.toUpperCase()}${colors_1.colors.reset}`);
281
281
  console.log(`${colors_1.colors.fgCyan}===============================================${colors_1.colors.reset}`);
282
282
  const endTime = Date.now();
283
283
  const totalTimeSec = (endTime - this._startTime) / 1000;
@@ -438,8 +438,14 @@ class PlaywrightTestReporter {
438
438
  failedTests,
439
439
  };
440
440
  try {
441
+ // Ensure output directory exists
442
+ if (!fs.existsSync(this.outputDir)) {
443
+ fs.mkdirSync(this.outputDir, { recursive: true });
444
+ console.log(`Created output directory: ${path.resolve(this.outputDir)}`);
445
+ }
441
446
  const filePath = path.join(this.outputDir, '.last-run.json');
442
447
  fs.writeFileSync(filePath, JSON.stringify(lastRunData, null, 2));
448
+ console.log(`Last run status written to: ${path.resolve(filePath)}`);
443
449
  }
444
450
  catch (error) {
445
451
  console.error('Failed to write last run status:', error);
@@ -51,12 +51,14 @@ class FileHandler {
51
51
  // Ensure the output directory exists
52
52
  if (!fs.existsSync(outputDir)) {
53
53
  fs.mkdirSync(outputDir, { recursive: true });
54
+ console.log(`Created output directory: ${path.resolve(outputDir)}`);
54
55
  }
55
56
  this.failuresFilePath = path.join(outputDir, 'testFailures.json');
56
57
  this.summaryFilePath = path.join(outputDir, 'testSummary.json');
57
58
  // Initialize failures file with empty array if it doesn't exist
58
59
  if (!fs.existsSync(this.failuresFilePath)) {
59
60
  fs.writeFileSync(this.failuresFilePath, JSON.stringify([], null, 2));
61
+ console.log(`Initialized test failures file: ${path.resolve(this.failuresFilePath)}`);
60
62
  }
61
63
  // Setup periodic flushing of the buffer (every 5 seconds)
62
64
  this.startPeriodicFlush();
@@ -82,6 +84,7 @@ class FileHandler {
82
84
  runEnvironment: summary.buildInfo?.isPipeline ? 'Pipeline' : 'Local',
83
85
  };
84
86
  fs.writeFileSync(this.summaryFilePath, JSON.stringify(summaryWithTests, null, 2));
87
+ console.log(`Test summary written to: ${path.resolve(this.summaryFilePath)}`);
85
88
  // Final flush of failures buffer
86
89
  this.flushFailuresBuffer();
87
90
  // Stop the periodic flush
@@ -124,6 +127,7 @@ class FileHandler {
124
127
  const allFailures = [...existingFailures, ...this.failuresBuffer];
125
128
  // Write back to file
126
129
  fs.writeFileSync(this.failuresFilePath, JSON.stringify(allFailures, null, 2));
130
+ console.log(`Test failures written to: ${path.resolve(this.failuresFilePath)} (${allFailures.length} total failures)`);
127
131
  // Clear buffer
128
132
  this.failuresBuffer = [];
129
133
  this.isBufferDirty = false;
@@ -291,35 +291,35 @@ class Logger {
291
291
  */
292
292
  static logBuildInfo(buildInfo) {
293
293
  if (!buildInfo.isPipeline) {
294
- console.log(`${colors_1.colors.fgMagenta}🖥️ Running locally${colors_1.colors.reset}`);
294
+ console.log(`${colors_1.colors.fgBlue}🖥️ Running locally${colors_1.colors.reset}`);
295
295
  return;
296
296
  }
297
- console.log(`${colors_1.colors.fgMagenta}\nBuild Information:${colors_1.colors.reset}`);
298
- console.log(`${colors_1.colors.fgMagenta}- CI System: ${buildInfo.executionSystem || 'Unknown CI'}${colors_1.colors.reset}`);
297
+ console.log(`${colors_1.colors.fgBlue}\nBuild Information:${colors_1.colors.reset}`);
298
+ console.log(`${colors_1.colors.fgBlue}- CI System: ${buildInfo.executionSystem || 'Unknown CI'}${colors_1.colors.reset}`);
299
299
  if (buildInfo.buildNumber) {
300
- console.log(`${colors_1.colors.fgMagenta}- Build: ${buildInfo.buildNumber}${colors_1.colors.reset}`);
300
+ console.log(`${colors_1.colors.fgBlue}- Build: ${buildInfo.buildNumber}${colors_1.colors.reset}`);
301
301
  }
302
302
  if (buildInfo.buildBranch) {
303
- console.log(`${colors_1.colors.fgMagenta}- Branch: ${buildInfo.buildBranch}${colors_1.colors.reset}`);
303
+ console.log(`${colors_1.colors.fgBlue}- Branch: ${buildInfo.buildBranch}${colors_1.colors.reset}`);
304
304
  }
305
305
  if (buildInfo.commitId) {
306
- console.log(`${colors_1.colors.fgMagenta}- Commit: ${buildInfo.commitId.substring(0, 8)}${colors_1.colors.reset}`);
306
+ console.log(`${colors_1.colors.fgBlue}- Commit: ${buildInfo.commitId.substring(0, 8)}${colors_1.colors.reset}`);
307
307
  }
308
308
  if (buildInfo.commitId) {
309
- console.log(`${colors_1.colors.fgMagenta}- Commit: ${buildInfo.commitId.substring(0, 8)}${colors_1.colors.reset}`);
309
+ console.log(`${colors_1.colors.fgBlue}- Commit: ${buildInfo.commitId.substring(0, 8)}${colors_1.colors.reset}`);
310
310
  }
311
311
  if (buildInfo.buildLink) {
312
- console.log(`${colors_1.colors.fgMagenta}- Build link: ${buildInfo.buildLink}${colors_1.colors.reset}`);
312
+ console.log(`${colors_1.colors.fgBlue}- Build link: ${buildInfo.buildLink}${colors_1.colors.reset}`);
313
313
  }
314
314
  if (buildInfo.artifactsLink) {
315
- console.log(`${colors_1.colors.fgMagenta}- Artifacts: ${buildInfo.artifactsLink}${colors_1.colors.reset}`);
315
+ console.log(`${colors_1.colors.fgBlue}- Artifacts: ${buildInfo.artifactsLink}${colors_1.colors.reset}`);
316
316
  }
317
317
  // Only show test link for Azure Pipelines, as this is specific to that system
318
318
  if (buildInfo.testLink && buildInfo.executionSystem === 'Azure Pipelines') {
319
- console.log(`${colors_1.colors.fgMagenta}- Test Results: ${buildInfo.testLink}${colors_1.colors.reset}`);
319
+ console.log(`${colors_1.colors.fgBlue}- Test Results: ${buildInfo.testLink}${colors_1.colors.reset}`);
320
320
  }
321
321
  if (buildInfo.commitLink && buildInfo.executionSystem === 'GitHub Actions') {
322
- console.log(`${colors_1.colors.fgMagenta}- Commit: ${buildInfo.commitLink}${colors_1.colors.reset}`);
322
+ console.log(`${colors_1.colors.fgBlue}- Commit: ${buildInfo.commitLink}${colors_1.colors.reset}`);
323
323
  }
324
324
  }
325
325
  /**
@@ -329,11 +329,11 @@ class Logger {
329
329
  * @param summary - The test summary containing metrics to log
330
330
  */
331
331
  static logMetrics(summary) {
332
- console.log(`${colors_1.colors.fgMagenta}\nAdditional Metrics:${colors_1.colors.reset}`);
333
- console.log(`${colors_1.colors.fgMagenta}- Average passed test time: ${summary.averageTime.toFixed(2)}s${colors_1.colors.reset}`);
332
+ console.log(`${colors_1.colors.fgBlue}\nAdditional Metrics:${colors_1.colors.reset}`);
333
+ console.log(`${colors_1.colors.fgBlue}- Average passed test time: ${summary.averageTime.toFixed(2)}s${colors_1.colors.reset}`);
334
334
  if (summary.slowestTest > 0) {
335
- console.log(`${colors_1.colors.fgMagenta}- Slowest test took: ${summary.slowestTest.toFixed(2)}s${colors_1.colors.reset}`);
336
- console.log(`${colors_1.colors.fgMagenta}- Top 3 slowest tests:${colors_1.colors.reset}`);
335
+ console.log(`${colors_1.colors.fgBlue}- Slowest test took: ${summary.slowestTest.toFixed(2)}s${colors_1.colors.reset}`);
336
+ console.log(`${colors_1.colors.fgBlue}- Top 3 slowest tests:${colors_1.colors.reset}`);
337
337
  summary.slowestTests.forEach((test, index) => {
338
338
  console.log(` ${index + 1}. ${test.testTitle}: ` +
339
339
  `${colors_1.colors.fgYellow}${test.duration.toFixed(2)}s${colors_1.colors.reset}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-ai-reporter",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Enterprise-grade AI-powered test reporter for Playwright with automatic bug creation, intelligent fix suggestions, auto-healing PRs, and multi-provider support for CI/CD pipelines.",
5
5
  "keywords": [
6
6
  "playwright",
Binary file
Binary file