@testrelic/playwright-analytics 2.3.6 → 2.3.8
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/api-fixture.cjs.map +1 -1
- package/dist/api-fixture.js.map +1 -1
- package/dist/fixture.cjs.map +1 -1
- package/dist/fixture.js.map +1 -1
- package/dist/index.cjs +5 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1073,10 +1073,10 @@ body{
|
|
|
1073
1073
|
return body;
|
|
1074
1074
|
}
|
|
1075
1075
|
|
|
1076
|
-
function renderNdtHeaders(headers,label){
|
|
1077
|
-
if(!headers)return '<div class="ndt-body-empty">No '+label+' headers captured</div>';
|
|
1076
|
+
function renderNdtHeaders(headers,label,emptyMsg){
|
|
1077
|
+
if(!headers)return '<div class="ndt-body-empty">'+(emptyMsg||('No '+label+' headers captured'))+'</div>';
|
|
1078
1078
|
var keys=[];for(var k in headers){if(headers.hasOwnProperty(k))keys.push(k);}
|
|
1079
|
-
if(keys.length===0)return '<div class="ndt-body-empty">No '+label+' headers captured</div>';
|
|
1079
|
+
if(keys.length===0)return '<div class="ndt-body-empty">'+(emptyMsg||('No '+label+' headers captured'))+'</div>';
|
|
1080
1080
|
keys.sort();
|
|
1081
1081
|
var h='<table class="ndt-headers-tbl"><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody>';
|
|
1082
1082
|
for(var i=0;i<keys.length;i++){h+='<tr><td>'+esc(keys[i])+'</td><td>'+esc(headers[keys[i]])+'</td></tr>';}
|
|
@@ -1489,7 +1489,7 @@ body{
|
|
|
1489
1489
|
if(ac.timestamp)h+='<span class="ndt-general-k">Timestamp</span><span class="ndt-general-v">'+fmtDate(ac.timestamp)+'</span>';
|
|
1490
1490
|
h+='</div></div>';
|
|
1491
1491
|
|
|
1492
|
-
h+='<div class="ndt-detail-pane" data-ndt-pane="req-headers">'+renderNdtHeaders(reqHeaders,'request')+'</div>';
|
|
1492
|
+
h+='<div class="ndt-detail-pane" data-ndt-pane="req-headers">'+renderNdtHeaders(reqHeaders,'request','Request headers not available — only explicitly passed headers are captured for API tests')+'</div>';
|
|
1493
1493
|
h+='<div class="ndt-detail-pane" data-ndt-pane="req-body">'+renderNdtBody(reqBodyStr,false,false,ct,'No request body')+'</div>';
|
|
1494
1494
|
h+='<div class="ndt-detail-pane" data-ndt-pane="res-headers">'+renderNdtHeaders(resHeaders,'response')+'</div>';
|
|
1495
1495
|
h+='<div class="ndt-detail-pane" data-ndt-pane="res-body">'+renderNdtBody(resBodyStr,false,false,ct,'No response body captured')+'</div>';
|
|
@@ -2524,6 +2524,7 @@ ${s}
|
|
|
2524
2524
|
`),await zt();let i=null;if(this.config.includeArtifacts&&this.runTimestamp)try{let l=dirname(this.config.outputPath);i=Jt(l,this.runTimestamp);let d=join(l,"artifact-manifest.json"),c=JSON.stringify(i),p=d+".tmp";writeFileSync(p,c,"utf-8"),renameSync(p,d);}catch{}if(this.activeReportMode==="streaming"&&this.streamingWriter)await this.finalizeStreamingReport(r,a,e,i);else {let l=this.buildTimeline(),d=new Map;for(let u of this.collectedTests){let g=d.get(u.testId);(!g||u.retry>g.retry)&&d.set(u.testId,u);}let c=Array.from(d.values()),p=er(c,l.length),f={schemaVersion:X,testRunId:this.testRunId,startedAt:this.startedAt,completedAt:r,totalDuration:a,summary:p,ci:D(),metadata:this.config.metadata,timeline:l,shardRunIds:null};this.writeReport(f),await Pe(f,this.config,i),He(p,this.config.outputPath,this.config.htmlReportPath,this.config.quiet),this.cloudClient&&await Qe(this.cloudClient,this.config.cloud,this.config.cloud?.uploadStrategy,this.testRunId,this.cloudRunId,f,r,a,p);}}catch{}}async finalizeStreamingReport(e,r,n,s){if(!this.streamingWriter)return;let{totalApiCalls:a,totalAssertions:o,totalNavigations:i,totalNetworkRequests:l,totalConsoleLogs:d,totalActionSteps:c}=this.summaryCounters;this.summaryCounters={total:0,passed:0,failed:0,flaky:0,skipped:0,timedOut:0,interrupted:0,totalApiCalls:a,totalAssertions:o,totalNavigations:i,totalNetworkRequests:l,totalConsoleLogs:d,totalActionSteps:c};let p=new Map,f=new Map;for(let y of this.testIndex){let T=`${y.filePath}::${y.titlePath.join(" > ")}`,v=p.get(T);(v===void 0||y.retryIndex>v)&&p.set(T,y.retryIndex);}let u=0;for(let y of this.testIndex){let T=`${y.filePath}::${y.titlePath.join(" > ")}`,v=p.get(T);if(y.isRetry=y.retryIndex<v,y.isRetry)continue;switch(u++,this.summaryCounters.total++,y.status){case "passed":this.summaryCounters.passed++;break;case "failed":this.summaryCounters.failed++;break;case "flaky":this.summaryCounters.flaky++;break;case "skipped":this.summaryCounters.skipped++;break;case "timedout":this.summaryCounters.timedOut++;break;default:this.summaryCounters.interrupted++;break}let k=f.get(y.filePath);switch(k||(k={filePath:y.filePath,total:0,passed:0,failed:0,flaky:0,skipped:0,timedOut:0},f.set(y.filePath,k)),k.total++,y.status){case "passed":k.passed++;break;case "failed":k.failed++;break;case "flaky":k.flaky++;break;case "skipped":k.skipped++;break;case "timedout":k.timedOut++;break}}let g=Array.from(f.values());this.streamingWriter.writeIndex(this.testIndex),this.streamingWriter.writeCompactIndex(this.testIndex);let h={reporterTotal:this.summaryCounters.total,indexTotal:u,playwrightStatus:n.status,isValid:this.summaryCounters.total===u};h.isValid||process.stderr.write(`[testrelic] WARNING: Summary count mismatch \u2014 reporter: ${h.reporterTotal}, index: ${h.indexTotal}
|
|
2525
2525
|
`);let m={total:this.summaryCounters.total,passed:this.summaryCounters.passed,failed:this.summaryCounters.failed,flaky:this.summaryCounters.flaky,skipped:this.summaryCounters.skipped,timedout:this.summaryCounters.timedOut,totalApiCalls:this.summaryCounters.totalApiCalls,uniqueApiUrls:0,apiCallsByMethod:{},apiCallsByStatusRange:{"2xx":0,"3xx":0,"4xx":0,"5xx":0,error:0},apiResponseTime:null,totalAssertions:this.summaryCounters.totalAssertions,passedAssertions:0,failedAssertions:0,totalNavigations:this.summaryCounters.totalNavigations,uniqueNavigationUrls:0,totalTimelineSteps:this.testIndex.length,totalActionSteps:this.summaryCounters.totalActionSteps,actionStepsByCategory:{}},b={testRunId:this.testRunId,startedAt:this.startedAt,completedAt:e,totalDuration:r,...this.summaryCounters,metadata:this.config.metadata,reportMode:"streaming",files:g,enrichedSummary:m,validation:h,writeErrors:this.streamingWriter.getWriteErrors()};this.streamingWriter.writeSummary(b);let C={schemaVersion:"2.0",generatedAt:new Date().toISOString(),reportMode:"streaming",summaryFile:"summary.json",indexFile:"index.json",testsDir:"tests",artifactsDir:"artifacts",testCount:this.testIndex.length,totalSizeBytes:this.streamingWriter.computeTotalSize()};this.streamingWriter.writeManifest(C),await Pe(this.buildStreamingReport(b,m,e,r),this.config,s),He(m,this.config.outputPath,this.config.htmlReportPath,this.config.quiet);let w=this.streamingWriter.getReportDir();if(process.stderr.write(`[testrelic] Streaming report written to ${w}
|
|
2526
2526
|
[testrelic] ${this.testIndex.length} test detail files on disk
|
|
2527
|
+
[testrelic] View report: npx testrelic serve ${w}
|
|
2527
2528
|
`),this.streamingWriter.getWriteErrors().length>0&&process.stderr.write(`[testrelic] WARNING: ${this.streamingWriter.getWriteErrors().length} write error(s) during streaming
|
|
2528
2529
|
`),this.streamingWriter.dispose(),this.cloudClient){let y=this.buildStreamingReport(b,m,e,r);await Qe(this.cloudClient,this.config.cloud,this.config.cloud?.uploadStrategy,this.testRunId,this.cloudRunId,y,e,r,m);}this.testIndex.length=0,this.collectedTests.length=0,this.streamingWriter=null,this.cloudClient=null;}buildStreamingReport(e,r,n,s){return {schemaVersion:X,testRunId:this.testRunId,startedAt:this.startedAt,completedAt:n,totalDuration:s,summary:r,ci:D(),metadata:this.config.metadata,timeline:[],shardRunIds:null}}printsToStdio(){return false}checkMemoryPressure(){try{let e=process.memoryUsage(),r=e.heapUsed/1024/1024;if(r<200)return;let n=e.heapUsed/e.heapTotal;n>.9&&this.activeReportMode==="embedded"?(process.stderr.write(`[testrelic] WARNING: High memory (${Math.round(r)} MB). Auto-switching to streaming mode.
|
|
2529
2530
|
`),this.switchToStreamingMode()):n>.8&&process.stderr.write(`[testrelic] WARNING: Memory pressure detected (${Math.round(r)} MB used).
|