@testrelic/playwright-analytics 2.3.2 → 2.3.3
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 +2 -1
- package/dist/api-fixture.cjs.map +1 -1
- package/dist/api-fixture.js +2 -1
- package/dist/api-fixture.js.map +1 -1
- package/dist/cli.cjs +134 -42
- package/dist/fixture.cjs +2 -1
- package/dist/fixture.cjs.map +1 -1
- package/dist/fixture.js +2 -1
- package/dist/fixture.js.map +1 -1
- package/dist/index.cjs +149 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +149 -79
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var crypto=require('crypto'),fs=require('fs'),path=require('path'),core=require('@testrelic/core'),child_process=require('child_process'),http=require('http'),promises=require('fs/promises'),zlib=require('zlib'),test=require('@playwright/test'),perf_hooks=require('perf_hooks');var
|
|
2
|
-
`),false}}
|
|
3
|
-
`);
|
|
4
|
-
`)
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var crypto=require('crypto'),fs$1=require('fs'),path=require('path'),core=require('@testrelic/core'),child_process=require('child_process'),http=require('http'),os$1=require('os'),readline=require('readline'),promises=require('fs/promises'),zlib=require('zlib'),test=require('@playwright/test'),perf_hooks=require('perf_hooks');var Nr=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Pr=".testrelic-report";function ve(t,e,r,n){let s=`${t}|${e.join("|")}|${r}|${n}`;return crypto.createHash("sha256").update(s).digest("hex").substring(0,12)}var W=class{constructor(e){this.writeErrors=[];this.totalBytesWritten=0;this.reportDir=path.join(e,Pr),this.testsDir=path.join(this.reportDir,"tests"),fs$1.mkdirSync(this.testsDir,{recursive:true});}getReportDir(){return this.reportDir}getWriteErrors(){return this.writeErrors}writeTestDetail(e,r,n){try{let s=path.join(this.testsDir,e);fs$1.mkdirSync(s,{recursive:!0});let a=path.join(s,"meta.json"),o=a+".tmp",i=JSON.stringify(r);return fs$1.writeFileSync(o,i,"utf-8"),fs$1.renameSync(o,a),this.totalBytesWritten+=Buffer.byteLength(i,"utf-8"),n?.networkRequestsFile&&this.moveFile(n.networkRequestsFile,path.join(s,"network.jsonl")),n?.consoleLogsFile&&this.moveFile(n.consoleLogsFile,path.join(s,"console.jsonl")),n?.apiCallsFile&&this.moveFile(n.apiCallsFile,path.join(s,"api-calls.jsonl")),!0}catch(s){let a=s instanceof Error?s.message:String(s);return this.writeErrors.push({testId:e,error:a,timestamp:new Date().toISOString()}),process.stderr.write(`[testrelic] Failed to write test detail for ${e}: ${a}
|
|
2
|
+
`),false}}moveFile(e,r){try{fs$1.renameSync(e,r);}catch{try{let{copyFileSync:n}=Nr("fs");n(e,r);try{fs$1.unlinkSync(e);}catch{}}catch(n){process.stderr.write(`[testrelic] Failed to move file ${e} \u2192 ${r}: ${n instanceof Error?n.message:String(n)}
|
|
3
|
+
`);}}}writeIndex(e){let r=path.join(this.reportDir,"index.json"),n=r+".tmp",s=JSON.stringify(e);fs$1.writeFileSync(n,s,"utf-8"),fs$1.renameSync(n,r),this.totalBytesWritten+=Buffer.byteLength(s,"utf-8");}writeCompactIndex(e){let r=path.join(this.reportDir,"index-compact.json"),n=r+".tmp",s=e.map(({titlePath:o,project:i,...l})=>l),a=JSON.stringify(s);fs$1.writeFileSync(n,a,"utf-8"),fs$1.renameSync(n,r),this.totalBytesWritten+=Buffer.byteLength(a,"utf-8");}writeSummary(e){let r=path.join(this.reportDir,"summary.json"),n=r+".tmp",s=JSON.stringify(e);fs$1.writeFileSync(n,s,"utf-8"),fs$1.renameSync(n,r),this.totalBytesWritten+=Buffer.byteLength(s,"utf-8");}writeManifest(e){let r=path.join(this.reportDir,"manifest.json"),n=r+".tmp",s=JSON.stringify(e);fs$1.writeFileSync(n,s,"utf-8"),fs$1.renameSync(n,r),this.totalBytesWritten+=Buffer.byteLength(s,"utf-8");}computeTotalSize(){return this.totalBytesWritten}dispose(){}};var $r=".testrelic",jr=5,zr=new Set(["__proto__","constructor","prototype"]),at=Object.freeze({apiKey:null,endpoint:"https://api.testrelic.com/api/v1",uploadStrategy:"batch",timeout:3e4,projectName:null,queueMaxAge:6048e5,queueDirectory:".testrelic/queue"}),Vr={s:1e3,m:60*1e3,h:3600*1e3,d:1440*60*1e3};function ot(t){let e=path.resolve(t);for(let r=0;r<=jr;r++){let n=path.join(e,$r);if(fs$1.existsSync(n))return n;let s=path.dirname(e);if(s===e)break;e=s;}return null}function lt(t){try{let e=fs$1.readFileSync(t,"utf-8"),r=JSON.parse(e);return typeof r!="object"||r===null||Array.isArray(r)||!dt(r)?null:r}catch{return null}}function dt(t){for(let e of Object.keys(t)){if(zr.has(e))return false;let r=t[e];if(typeof r=="object"&&r!==null&&!Array.isArray(r)&&!dt(r))return false}return true}function ct(t){let e=/^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/.exec(t);if(e)return process.env[e[1]]??null;let r=/^\$([A-Za-z_][A-Za-z0-9_]*)$/.exec(t);return r?process.env[r[1]]??null:t}function ye(t){let e=Object.create(null);for(let r of Object.keys(t)){let n=t[r];typeof n=="string"&&n.startsWith("$")?e[r]=ct(n):typeof n=="object"&&n!==null&&!Array.isArray(n)?e[r]=ye(n):e[r]=n;}return e}function it(t){let e=/^(\d+)\s*([smhd])$/.exec(t.trim());if(!e)return null;let r=parseInt(e[1],10),n=e[2],s=Vr[n];return !s||r<=0?null:r*s}function ut(t,e){let r=Object.create(null);if(Object.assign(r,at),t){let l=t.cloud;l&&typeof l=="object"&&(typeof l.endpoint=="string"&&(r.endpoint=l.endpoint),typeof l.upload=="string"&&(r.uploadStrategy=l.upload),typeof l.timeout=="number"&&(r.timeout=l.timeout),typeof l.apiKey=="string"&&l.apiKey.length>0&&(r.apiKey=l.apiKey));let c=t.project;c&&typeof c=="object"&&typeof c.name=="string"&&(r.projectName=c.name);let d=t.queue;if(d&&typeof d=="object"){if(typeof d.maxAge=="string"){let p=it(d.maxAge);p!==null&&(r.queueMaxAge=p);}typeof d.directory=="string"&&(r.queueDirectory=d.directory);}}if(e){if(typeof e.apiKey=="string"&&e.apiKey.length>0){let l=e.apiKey.startsWith("$")?ct(e.apiKey):e.apiKey;l&&(r.apiKey=l);}if(typeof e.endpoint=="string"&&(r.endpoint=e.endpoint),typeof e.upload=="string"&&(r.uploadStrategy=e.upload),typeof e.timeout=="number"&&(r.timeout=e.timeout),typeof e.projectName=="string"&&(r.projectName=e.projectName),typeof e.queueMaxAge=="string"){let l=it(e.queueMaxAge);l!==null&&(r.queueMaxAge=l);}typeof e.queueDirectory=="string"&&(r.queueDirectory=e.queueDirectory);}let n=process.env.TESTRELIC_API_KEY;n&&n.length>0&&(r.apiKey=n);let s=process.env.TESTRELIC_CLOUD_ENDPOINT;s&&core.isValidEndpointUrl(s)&&(r.endpoint=s);let a=process.env.TESTRELIC_UPLOAD_STRATEGY;a&&["batch","realtime","both"].includes(a)&&(r.uploadStrategy=a);let o=process.env.TESTRELIC_CLOUD_TIMEOUT;if(o){let l=parseInt(o,10);!isNaN(l)&&l>=1e3&&l<=12e4&&(r.timeout=l);}let i=Object.freeze(r);return core.isValidCloudConfig(i)?i:at}var Kr=[/AKIA[A-Z0-9]{16}/g,/Bearer\s+[A-Za-z0-9\-._~+/]+=*/g,/-----BEGIN\s+(RSA\s+)?PRIVATE\sKEY-----[\s\S]*?-----END/g,/\/\/[^:]+:[^@]+@/g],Yr=["authorization","cookie","set-cookie","x-api-key"],Zr=["password","secret","token","apiKey","api_key"];function pt(t){let e=Object.create(null);return e.trackApiCalls=t?.trackApiCalls??true,e.captureRequestHeaders=t?.captureRequestHeaders??true,e.captureResponseHeaders=t?.captureResponseHeaders??true,e.captureRequestBody=t?.captureRequestBody??true,e.captureResponseBody=t?.captureResponseBody??true,e.captureAssertions=t?.captureAssertions??true,e.redactHeaders=t?.redactHeaders??[...Yr],e.redactBodyFields=t?.redactBodyFields??[...Zr],e.apiIncludeUrls=t?.apiIncludeUrls??[],e.apiExcludeUrls=t?.apiExcludeUrls??[],Object.freeze(e)}function ft(t){if(t!==void 0&&!core.isValidConfig(t))throw core.createError(core.ErrorCode.CONFIG_INVALID,"Invalid reporter configuration");let e=Object.create(null);e.outputPath=t?.outputPath??"./test-results/analytics-timeline.json",e.includeStackTrace=t?.includeStackTrace??false,e.includeCodeSnippets=t?.includeCodeSnippets??true,e.codeContextLines=t?.codeContextLines??3,e.includeNetworkStats=t?.includeNetworkStats??true,e.navigationTypes=t?.navigationTypes??null,e.redactPatterns=[...Kr,...t?.redactPatterns??[]],e.testRunId=t?.testRunId??null,e.metadata=t?.metadata??null;let r=e.outputPath;e.openReport=t?.openReport??true,e.htmlReportPath=t?.htmlReportPath??r.replace(/\.json$/,".html"),e.includeArtifacts=t?.includeArtifacts??true,e.trackApiCalls=t?.trackApiCalls??true,e.quiet=t?.quiet??false,e.includeActionSteps=t?.includeActionSteps??true,e.captureConsoleLogs=t?.captureConsoleLogs??true;let n=ot(process.cwd()),s=n?lt(n):null,a=s?ye(s):null,o=ut(a,t?.cloud);return e.cloud=o.apiKey?o:null,e.reportMode=t?.reportMode??"streaming",e.streamingThreshold=t?.streamingThreshold??0,Object.freeze(e)}var X="1.3.0";function gt(t,e,r){try{let s=fs$1.readFileSync(t,"utf-8").split(`
|
|
4
|
+
`);if(e<1||e>s.length)return null;let a=Math.max(1,e-r),o=Math.min(s.length,e+r),i=[];for(let l=a;l<=o;l++){let c=l===e?">":" ",d=String(l).padStart(String(o).length," ");i.push(`${c} ${d} | ${s[l-1]}`);}return i.join(`
|
|
5
|
+
`)}catch{return null}}function ht(t){return e=>{let r=e;for(let n of t)if(typeof n=="string"){let s=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");r=r.replace(new RegExp(s,"g"),"[REDACTED]");}else {let s=n.flags.includes("g")?n.flags:n.flags+"g",a=new RegExp(n.source,s);r=r.replace(a,"[REDACTED]");}return r}}function Xr(t){return t.GITHUB_ACTIONS!=="true"?null:{provider:"github-actions",buildId:t.GITHUB_RUN_ID??null,commitSha:t.GITHUB_SHA??null,branch:t.GITHUB_REF_NAME??null,runUrl:t.GITHUB_SERVER_URL&&t.GITHUB_REPOSITORY&&t.GITHUB_RUN_ID?`${t.GITHUB_SERVER_URL}/${t.GITHUB_REPOSITORY}/actions/runs/${t.GITHUB_RUN_ID}`:null}}function en(t){return t.GITLAB_CI!=="true"?null:{provider:"gitlab-ci",buildId:t.CI_PIPELINE_ID??null,commitSha:t.CI_COMMIT_SHA??null,branch:t.CI_COMMIT_BRANCH??t.CI_COMMIT_REF_NAME??null,runUrl:t.CI_PIPELINE_URL??null}}function tn(t){if(!t.JENKINS_URL)return null;let e=t.GIT_BRANCH??null;return e?.startsWith("origin/")&&(e=e.slice(7)),{provider:"jenkins",buildId:t.BUILD_ID??null,commitSha:t.GIT_COMMIT??null,branch:e,runUrl:t.BUILD_URL??null}}function rn(t){return t.CIRCLECI!=="true"?null:{provider:"circleci",buildId:t.CIRCLE_BUILD_NUM??null,commitSha:t.CIRCLE_SHA1??null,branch:t.CIRCLE_BRANCH??null,runUrl:t.CIRCLE_BUILD_URL??null}}function nn(t){if(!t.BITBUCKET_PIPELINE_UUID)return null;let e=t.BITBUCKET_WORKSPACE&&t.BITBUCKET_REPO_SLUG&&t.BITBUCKET_PIPELINE_UUID?`https://bitbucket.org/${t.BITBUCKET_WORKSPACE}/${t.BITBUCKET_REPO_SLUG}/pipelines/results/${t.BITBUCKET_PIPELINE_UUID}`:null;return {provider:"bitbucket-pipelines",buildId:t.BITBUCKET_BUILD_NUMBER??null,commitSha:t.BITBUCKET_COMMIT??null,branch:t.BITBUCKET_BRANCH??null,runUrl:e}}var sn=[Xr,en,tn,rn,nn];function D(t){let e=process.env;for(let r of sn){let n=r(e);if(n)return n}return null}var be=`
|
|
5
6
|
/* Theme Variables */
|
|
6
7
|
:root,[data-theme="dark"]{
|
|
7
8
|
--bg:#0f1117;--bg-1:#161b22;--bg-2:#1c2128;--bg-3:#21262d;--bg-code:#13111c;
|
|
@@ -558,15 +559,15 @@ body{
|
|
|
558
559
|
.detail-error .failure-message{margin-bottom:16px;padding:12px;background:rgba(239,68,68,0.06);border:1px solid rgba(239,68,68,0.15);border-radius:8px;font-size:12px;color:#f87171;text-align:left;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;white-space:pre-wrap;word-break:break-word}
|
|
559
560
|
.detail-error code{font-size:11px;padding:2px 6px;background:var(--bg-2);border-radius:4px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
|
|
560
561
|
.server-offline-banner{padding:8px 14px;background:rgba(251,191,36,0.08);border:1px solid rgba(251,191,36,0.2);border-radius:6px;font-size:11px;color:#fbbf24;text-align:center;margin-bottom:12px}
|
|
561
|
-
`;var
|
|
562
|
+
`;var we=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 196 247" fill="none">
|
|
562
563
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.75 1.08009C2.034 2.66209 -0.130999 7.63009 0.610001 10.5821C0.969001 12.0121 3.021 15.2131 5.17 17.6971C14.375 28.3321 18 39.7791 18 58.2101V71.0001H12.434C1.16501 71.0001 0 73.4641 0 97.3051C0 106.858 0.298003 128.922 0.662003 146.337L1.323 178H33.606C65.786 178 65.897 178.007 68.544 180.284C72.228 183.453 72.244 189.21 68.579 192.877L65.957 195.5L33.479 195.801L1 196.103V204.551V213H24.577H48.154L51.077 215.923C55.007 219.853 55.007 224.147 51.077 228.077L48.154 231H26.469H4.783L5.41901 233.534C5.76901 234.927 7.143 238.527 8.472 241.534L10.89 247H40.945H71L71.006 241.75C71.017 230.748 76.027 221.606 84.697 216.767C97.854 209.424 114.086 213.895 121.323 226.857C123.659 231.041 124.418 233.833 124.789 239.607L125.263 247H155.187H185.11L187.528 241.534C188.857 238.527 190.231 234.927 190.581 233.534L191.217 231H169.531H147.846L144.923 228.077C142.928 226.082 142 224.152 142 222C142 219.848 142.928 217.918 144.923 215.923L147.846 213H171.423H195V204.551V196.103L162.521 195.801L130.043 195.5L127.421 192.877C123.991 189.445 123.835 183.869 127.074 180.421L129.349 178H162.013H194.677L195.338 146.337C195.702 128.922 196 106.858 196 97.3051C196 73.4641 194.835 71.0001 183.566 71.0001H178V58.2101C178 39.6501 181.397 28.7731 190.538 18.0651C195.631 12.0971 196.572 9.00809 194.511 5.02109C192.672 1.46509 190.197 9.12233e-05 186.028 9.12233e-05C179.761 9.12233e-05 168.713 14.8831 163.388 30.5001C160.975 37.5771 160.608 40.3751 160.213 54.7501L159.765 71.0001H150.732H141.7L142.286 53.2501C142.904 34.5511 144.727 24.3761 148.938 16.1211C151.823 10.4671 151.628 5.90109 148.364 2.63609C145 -0.726907 140.105 -0.887909 136.596 2.25009C133.481 5.03609 128.686 17.0811 126.507 27.5921C125.569 32.1191 124.617 43.0901 124.28 53.2501L123.69 71.0001H115.345H107V38.4231V5.84609L104.077 2.92309C102.082 0.928088 100.152 9.12233e-05 98 9.12233e-05C95.848 9.12233e-05 93.918 0.928088 91.923 2.92309L89 5.84609V38.4231V71.0001H80.655H72.31L71.72 53.2501C71.383 43.0901 70.431 32.1191 69.493 27.5921C67.314 17.0811 62.519 5.03609 59.404 2.25009C55.998 -0.795909 51.059 -0.710905 47.646 2.45209C44.221 5.62609 44.191 9.92109 47.539 17.4911C51.71 26.9241 53.007 34.4791 53.676 53.2501L54.31 71.0001H45.272H36.235L35.787 54.7501C35.392 40.3751 35.025 37.5771 32.612 30.5001C27.194 14.6091 16.228 -0.02891 9.787 0.03009C7.979 0.04709 5.712 0.519093 4.75 1.08009ZM42.687 108.974C33.431 112.591 20.036 125.024 18.408 131.512C17.476 135.223 20.677 140.453 28.253 147.599C37.495 156.319 44.191 159.471 53.5 159.485C59.317 159.494 61.645 158.953 67.274 156.289C77.634 151.385 88.987 139.161 88.996 132.9C89.004 127.304 76.787 114.707 66.745 109.956C59.16 106.368 50.285 106.006 42.687 108.974ZM129.255 109.904C119.151 114.768 106.996 127.33 107.004 132.9C107.013 139.108 118.562 151.475 128.939 156.389C134.338 158.945 136.744 159.496 142.521 159.498C152.526 159.501 160.369 155.502 169.771 145.605C180.444 134.368 180.278 130.975 168.486 119.388C160.043 111.094 152.727 107.595 143 107.201C136.364 106.933 134.78 107.244 129.255 109.904ZM48.5 125.922C46.3 126.969 43.152 128.945 41.505 130.314L38.511 132.802L40.504 135.005C41.601 136.216 44.434 138.342 46.8 139.728C52.577 143.114 57.36 142.466 64.009 137.395L68.978 133.606L66.756 131.24C60.944 125.054 54.357 123.135 48.5 125.922ZM138.386 125.063C136.674 125.571 133.375 127.677 131.057 129.743L126.841 133.5L131.901 137.343C138.65 142.468 143.407 143.124 149.2 139.728C151.566 138.342 154.351 136.269 155.389 135.122C157.684 132.587 156.742 131.097 150.58 127.511C145.438 124.519 142.329 123.895 138.386 125.063ZM91.923 162.923C89.043 165.804 89 166.008 89 176.973C89 184.805 89.435 188.941 90.47 190.941C92.356 194.589 96.918 196.273 101.03 194.84C105.82 193.17 107 189.638 107 176.973C107 166.008 106.957 165.804 104.077 162.923C102.082 160.928 100.152 160 98 160C95.848 160 93.918 160.928 91.923 162.923ZM94.5 232.155C91.026 234.055 90 236.229 90 241.691V247H98H106V242.082C106 235.732 105.37 234.242 101.928 232.463C98.591 230.737 97.197 230.679 94.5 232.155Z" fill="url(#paint0_linear_55_11)"/>
|
|
563
564
|
<defs><linearGradient id="paint0_linear_55_11" x1="98" y1="0.000244141" x2="98" y2="247" gradientUnits="userSpaceOnUse">
|
|
564
565
|
<stop stop-color="#03B79C"/><stop offset="0.504808" stop-color="#4EDAA4"/><stop offset="0.865285" stop-color="#84F3AA"/>
|
|
565
|
-
</linearGradient></defs></svg>`,
|
|
566
|
+
</linearGradient></defs></svg>`,xe=`<svg width="32" height="40" viewBox="0 0 196 247" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
566
567
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.75 1.08009C2.034 2.66209 -0.130999 7.63009 0.610001 10.5821C0.969001 12.0121 3.021 15.2131 5.17 17.6971C14.375 28.3321 18 39.7791 18 58.2101V71.0001H12.434C1.16501 71.0001 0 73.4641 0 97.3051C0 106.858 0.298003 128.922 0.662003 146.337L1.323 178H33.606C65.786 178 65.897 178.007 68.544 180.284C72.228 183.453 72.244 189.21 68.579 192.877L65.957 195.5L33.479 195.801L1 196.103V204.551V213H24.577H48.154L51.077 215.923C55.007 219.853 55.007 224.147 51.077 228.077L48.154 231H26.469H4.783L5.41901 233.534C5.76901 234.927 7.143 238.527 8.472 241.534L10.89 247H40.945H71L71.006 241.75C71.017 230.748 76.027 221.606 84.697 216.767C97.854 209.424 114.086 213.895 121.323 226.857C123.659 231.041 124.418 233.833 124.789 239.607L125.263 247H155.187H185.11L187.528 241.534C188.857 238.527 190.231 234.927 190.581 233.534L191.217 231H169.531H147.846L144.923 228.077C142.928 226.082 142 224.152 142 222C142 219.848 142.928 217.918 144.923 215.923L147.846 213H171.423H195V204.551V196.103L162.521 195.801L130.043 195.5L127.421 192.877C123.991 189.445 123.835 183.869 127.074 180.421L129.349 178H162.013H194.677L195.338 146.337C195.702 128.922 196 106.858 196 97.3051C196 73.4641 194.835 71.0001 183.566 71.0001H178V58.2101C178 39.6501 181.397 28.7731 190.538 18.0651C195.631 12.0971 196.572 9.00809 194.511 5.02109C192.672 1.46509 190.197 9.12233e-05 186.028 9.12233e-05C179.761 9.12233e-05 168.713 14.8831 163.388 30.5001C160.975 37.5771 160.608 40.3751 160.213 54.7501L159.765 71.0001H150.732H141.7L142.286 53.2501C142.904 34.5511 144.727 24.3761 148.938 16.1211C151.823 10.4671 151.628 5.90109 148.364 2.63609C145 -0.726907 140.105 -0.887909 136.596 2.25009C133.481 5.03609 128.686 17.0811 126.507 27.5921C125.569 32.1191 124.617 43.0901 124.28 53.2501L123.69 71.0001H115.345H107V38.4231V5.84609L104.077 2.92309C102.082 0.928088 100.152 9.12233e-05 98 9.12233e-05C95.848 9.12233e-05 93.918 0.928088 91.923 2.92309L89 5.84609V38.4231V71.0001H80.655H72.31L71.72 53.2501C71.383 43.0901 70.431 32.1191 69.493 27.5921C67.314 17.0811 62.519 5.03609 59.404 2.25009C55.998 -0.795909 51.059 -0.710905 47.646 2.45209C44.221 5.62609 44.191 9.92109 47.539 17.4911C51.71 26.9241 53.007 34.4791 53.676 53.2501L54.31 71.0001H45.272H36.235L35.787 54.7501C35.392 40.3751 35.025 37.5771 32.612 30.5001C27.194 14.6091 16.228 -0.02891 9.787 0.03009C7.979 0.04709 5.712 0.519093 4.75 1.08009ZM42.687 108.974C33.431 112.591 20.036 125.024 18.408 131.512C17.476 135.223 20.677 140.453 28.253 147.599C37.495 156.319 44.191 159.471 53.5 159.485C59.317 159.494 61.645 158.953 67.274 156.289C77.634 151.385 88.987 139.161 88.996 132.9C89.004 127.304 76.787 114.707 66.745 109.956C59.16 106.368 50.285 106.006 42.687 108.974ZM129.255 109.904C119.151 114.768 106.996 127.33 107.004 132.9C107.013 139.108 118.562 151.475 128.939 156.389C134.338 158.945 136.744 159.496 142.521 159.498C152.526 159.501 160.369 155.502 169.771 145.605C180.444 134.368 180.278 130.975 168.486 119.388C160.043 111.094 152.727 107.595 143 107.201C136.364 106.933 134.78 107.244 129.255 109.904ZM48.5 125.922C46.3 126.969 43.152 128.945 41.505 130.314L38.511 132.802L40.504 135.005C41.601 136.216 44.434 138.342 46.8 139.728C52.577 143.114 57.36 142.466 64.009 137.395L68.978 133.606L66.756 131.24C60.944 125.054 54.357 123.135 48.5 125.922ZM138.386 125.063C136.674 125.571 133.375 127.677 131.057 129.743L126.841 133.5L131.901 137.343C138.65 142.468 143.407 143.124 149.2 139.728C151.566 138.342 154.351 136.269 155.389 135.122C157.684 132.587 156.742 131.097 150.58 127.511C145.438 124.519 142.329 123.895 138.386 125.063ZM91.923 162.923C89.043 165.804 89 166.008 89 176.973C89 184.805 89.435 188.941 90.47 190.941C92.356 194.589 96.918 196.273 101.03 194.84C105.82 193.17 107 189.638 107 176.973C107 166.008 106.957 165.804 104.077 162.923C102.082 160.928 100.152 160 98 160C95.848 160 93.918 160.928 91.923 162.923ZM94.5 232.155C91.026 234.055 90 236.229 90 241.691V247H98H106V242.082C106 235.732 105.37 234.242 101.928 232.463C98.591 230.737 97.197 230.679 94.5 232.155Z" fill="url(#paint0_linear_55_11)"/>
|
|
567
568
|
<defs><linearGradient id="paint0_linear_55_11" x1="98" y1="0.000244141" x2="98" y2="247" gradientUnits="userSpaceOnUse">
|
|
568
569
|
<stop stop-color="#03B79C"/><stop offset="0.504808" stop-color="#4EDAA4"/><stop offset="0.865285" stop-color="#84F3AA"/>
|
|
569
|
-
</linearGradient></defs></svg>`;var
|
|
570
|
+
</linearGradient></defs></svg>`;var ke=`
|
|
570
571
|
/* \u2500\u2500 Utilities \u2500\u2500 */
|
|
571
572
|
function esc(s){if(!s)return '';return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,''')}
|
|
572
573
|
function stripAnsi(s){return s?s.replace(/\\u001b\\[[0-9;]*m/g,'').replace(/\\x1b\\[[0-9;]*m/g,''):''}
|
|
@@ -897,21 +898,29 @@ body{
|
|
|
897
898
|
drawerBodyEl.innerHTML='<div class="detail-error">'+emsg+'<p>Server unavailable — run <code>npx testrelic serve <path></code> to view full details</p></div>';
|
|
898
899
|
return;
|
|
899
900
|
}
|
|
900
|
-
/* Merge index entry
|
|
901
|
+
/* Merge index entry with server detail metadata */
|
|
901
902
|
var idx=testMap[testId]||{};
|
|
902
903
|
var merged={};
|
|
903
904
|
var k;for(k in idx){if(idx.hasOwnProperty(k))merged[k]=idx[k];}
|
|
904
|
-
merged.networkRequests=detail.networkRequests||[];
|
|
905
|
-
merged.consoleLogs=detail.consoleLogs||[];
|
|
906
905
|
merged.actions=detail.actions||[];
|
|
907
|
-
merged.apiCalls=detail.apiCalls||[];
|
|
908
906
|
merged.apiAssertions=detail.apiAssertions||[];
|
|
909
907
|
merged.artifacts=detail.artifacts||null;
|
|
910
908
|
merged.failure=detail.failureDiagnostic||detail.failure||null;
|
|
911
909
|
merged.steps=detail.navigations||[];
|
|
912
910
|
if(detail.startedAt)merged.startedAt=detail.startedAt;
|
|
911
|
+
/* Mark counts for lazy loading */
|
|
912
|
+
merged._networkCount=detail.networkRequestsCount||idx.networkCount||0;
|
|
913
|
+
merged._consoleCount=detail.consoleLogsCount||idx.consoleCount||0;
|
|
914
|
+
merged._apiCallsCount=detail.apiCallsCount||0;
|
|
915
|
+
merged._testId=testId;
|
|
916
|
+
/* Initially empty \u2014 loaded on demand */
|
|
917
|
+
merged.networkRequests=[];
|
|
918
|
+
merged.consoleLogs=[];
|
|
919
|
+
merged.apiCalls=[];
|
|
913
920
|
cacheDetail(testId,merged);
|
|
914
921
|
renderDrawer(testId,merged);
|
|
922
|
+
/* Lazy-load heavy data after drawer is visible */
|
|
923
|
+
loadHeavyData(testId,merged);
|
|
915
924
|
});
|
|
916
925
|
}else{
|
|
917
926
|
var t=testMap[testId];
|
|
@@ -925,6 +934,55 @@ body{
|
|
|
925
934
|
drawerBackdropEl.classList.add('open');
|
|
926
935
|
document.body.style.overflow='hidden';
|
|
927
936
|
}
|
|
937
|
+
|
|
938
|
+
/* Lazy-load heavy data (network, console, API calls) after drawer renders */
|
|
939
|
+
function loadHeavyData(testId,merged){
|
|
940
|
+
var fetchData=window.__trFetchTestData;
|
|
941
|
+
if(!fetchData)return;
|
|
942
|
+
/* Load first page of network requests */
|
|
943
|
+
if(merged._networkCount>0){
|
|
944
|
+
fetchData(testId,'network',1,100,function(err,result){
|
|
945
|
+
if(err||!result)return;
|
|
946
|
+
merged.networkRequests=result.items;
|
|
947
|
+
merged._networkTotal=result.total;
|
|
948
|
+
merged._networkPage=1;
|
|
949
|
+
merged._networkPageSize=result.pageSize;
|
|
950
|
+
/* Re-render network section if drawer still shows this test */
|
|
951
|
+
var ndtEl=document.querySelector('.ndt[data-testid="'+testId+'"]');
|
|
952
|
+
if(ndtEl&&typeof renderNetworkDevtools==='function'){
|
|
953
|
+
ndtEl.outerHTML=renderNetworkDevtools(merged.networkRequests,merged._testId);
|
|
954
|
+
}else{
|
|
955
|
+
/* If no network section rendered yet, re-render drawer */
|
|
956
|
+
renderDrawer(testId,merged);
|
|
957
|
+
}
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
/* Load first page of console logs */
|
|
961
|
+
if(merged._consoleCount>0){
|
|
962
|
+
fetchData(testId,'console',1,200,function(err,result){
|
|
963
|
+
if(err||!result)return;
|
|
964
|
+
merged.consoleLogs=result.items;
|
|
965
|
+
merged._consoleTotal=result.total;
|
|
966
|
+
merged._consolePage=1;
|
|
967
|
+
/* Re-render if drawer still shows this test */
|
|
968
|
+
var conEl=document.querySelector('.console-panel[data-testid="'+testId+'"]');
|
|
969
|
+
if(conEl&&typeof renderConsolePanel==='function'){
|
|
970
|
+
conEl.outerHTML=renderConsolePanel(merged.consoleLogs,merged._testId);
|
|
971
|
+
}
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
/* Load first page of API calls */
|
|
975
|
+
if(merged._apiCallsCount>0){
|
|
976
|
+
fetchData(testId,'api-calls',1,50,function(err,result){
|
|
977
|
+
if(err||!result)return;
|
|
978
|
+
merged.apiCalls=result.items;
|
|
979
|
+
merged._apiCallsTotal=result.total;
|
|
980
|
+
merged._apiCallsPage=1;
|
|
981
|
+
/* Re-render drawer with API calls */
|
|
982
|
+
renderDrawer(testId,merged);
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
}
|
|
928
986
|
function closeDrawer(){
|
|
929
987
|
drawerEl.classList.remove('open');
|
|
930
988
|
drawerBackdropEl.classList.remove('open');
|
|
@@ -940,7 +998,7 @@ body{
|
|
|
940
998
|
clearTimeout(_searchTimer);
|
|
941
999
|
_searchTimer=setTimeout(function(){searchQuery=q;applyFilters();},150);
|
|
942
1000
|
}
|
|
943
|
-
`;var
|
|
1001
|
+
`;var Ce=`
|
|
944
1002
|
/* \u2500\u2500 Network Visualization Helpers \u2500\u2500 */
|
|
945
1003
|
var RES_COLORS={xhr:'#60a5fa',document:'#818cf8',script:'#fbbf24',stylesheet:'#a78bfa',image:'#34d399',font:'#f472b6',other:'#6b7280'};
|
|
946
1004
|
var RES_LABELS={xhr:'XHR',document:'Doc',script:'JS',stylesheet:'CSS',image:'Img',font:'Font',other:'Other'};
|
|
@@ -1507,7 +1565,7 @@ body{
|
|
|
1507
1565
|
var countEl=ndt.querySelector('.ndt-count');
|
|
1508
1566
|
if(countEl)countEl.textContent=visible+' / '+rows.length+' requests';
|
|
1509
1567
|
}
|
|
1510
|
-
`;var
|
|
1568
|
+
`;var Te=`
|
|
1511
1569
|
var _filterState={status:{},type:{},specFile:{}};
|
|
1512
1570
|
var _totalTests=0;
|
|
1513
1571
|
var _originalSummary=null;
|
|
@@ -1678,7 +1736,7 @@ function _updateCard(cls,val){
|
|
|
1678
1736
|
var el=document.querySelector('.'+cls+' .s-count');
|
|
1679
1737
|
if(el)el.textContent=''+val;
|
|
1680
1738
|
}
|
|
1681
|
-
`;var
|
|
1739
|
+
`;var Se=`
|
|
1682
1740
|
/* \u2500\u2500 Event Delegation \u2500\u2500 */
|
|
1683
1741
|
document.addEventListener('click',function(e){
|
|
1684
1742
|
var target=e.target;
|
|
@@ -1948,7 +2006,7 @@ function _updateCard(cls,val){
|
|
|
1948
2006
|
var d=document.getElementById('filter-drawer');if(d)d.classList.remove('open');
|
|
1949
2007
|
var b=document.getElementById('filter-drawer-backdrop');if(b)b.classList.remove('open');
|
|
1950
2008
|
}
|
|
1951
|
-
`;var
|
|
2009
|
+
`;var Re=`
|
|
1952
2010
|
/* \u2500\u2500 Category badge helpers \u2500\u2500 */
|
|
1953
2011
|
function actionBadgeClass(cat){
|
|
1954
2012
|
if(cat==='assertion')return 'action-badge-assertion';
|
|
@@ -1994,7 +2052,7 @@ function _updateCard(cls,val){
|
|
|
1994
2052
|
h+='</div>';
|
|
1995
2053
|
return h;
|
|
1996
2054
|
}
|
|
1997
|
-
`;var
|
|
2055
|
+
`;var Ae=`
|
|
1998
2056
|
/* \u2500\u2500 Console Log Level Colors & Labels \u2500\u2500 */
|
|
1999
2057
|
var LOG_COLORS={log:'#9ca3af',warn:'#fbbf24',error:'#f87171',info:'#60a5fa',debug:'#a78bfa',stdout:'#9ca3af',stderr:'#f87171'};
|
|
2000
2058
|
var LOG_LABELS={log:'LOG',warn:'WARN',error:'ERR',info:'INFO',debug:'DBG',stdout:'OUT',stderr:'ERR'};
|
|
@@ -2181,7 +2239,7 @@ function _updateCard(cls,val){
|
|
|
2181
2239
|
}
|
|
2182
2240
|
return h;
|
|
2183
2241
|
}
|
|
2184
|
-
`;var
|
|
2242
|
+
`;var _e=`
|
|
2185
2243
|
/* \u2500\u2500 Artifact Utilities \u2500\u2500 */
|
|
2186
2244
|
function formatBytes(bytes){
|
|
2187
2245
|
if(bytes===0)return '0 B';
|
|
@@ -2190,16 +2248,16 @@ function _updateCard(cls,val){
|
|
|
2190
2248
|
if(i>=sizes.length)i=sizes.length-1;
|
|
2191
2249
|
return parseFloat((bytes/Math.pow(k,i)).toFixed(1))+' '+sizes[i];
|
|
2192
2250
|
}
|
|
2193
|
-
`;var
|
|
2251
|
+
`;var an=`
|
|
2194
2252
|
(function(){
|
|
2195
2253
|
var data=JSON.parse(document.getElementById('report-data').textContent);
|
|
2196
|
-
${
|
|
2197
|
-
${
|
|
2198
|
-
${
|
|
2199
|
-
${
|
|
2200
|
-
${
|
|
2201
|
-
${
|
|
2202
|
-
${
|
|
2254
|
+
${ke}
|
|
2255
|
+
${Re}
|
|
2256
|
+
${Ae}
|
|
2257
|
+
${Ce}
|
|
2258
|
+
${Te}
|
|
2259
|
+
${_e}
|
|
2260
|
+
${Se}
|
|
2203
2261
|
applyTheme();
|
|
2204
2262
|
renderRunMeta();
|
|
2205
2263
|
renderSummary();
|
|
@@ -2207,7 +2265,7 @@ function _updateCard(cls,val){
|
|
|
2207
2265
|
renderFilterBar();
|
|
2208
2266
|
renderTestGrid();
|
|
2209
2267
|
var _lo=document.getElementById('loading-overlay');if(_lo)_lo.remove();
|
|
2210
|
-
})();`;function
|
|
2268
|
+
})();`;function mt(t,e,r){let n=t.replace(/<\//g,"<\\/"),s=r?r.replace(/<\//g,"<\\/"):null;return `<!-- TestRelic AI Analytics Report \u2014 self-contained, no external dependencies -->
|
|
2211
2269
|
<!DOCTYPE html>
|
|
2212
2270
|
<html lang="en" data-theme="">
|
|
2213
2271
|
<head>
|
|
@@ -2216,15 +2274,15 @@ function _updateCard(cls,val){
|
|
|
2216
2274
|
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; img-src data: blob: 'self'; media-src blob: 'self'; connect-src 'self' http://127.0.0.1:*;">
|
|
2217
2275
|
<title>TestRelic AI Analytics Report</title>
|
|
2218
2276
|
${""}
|
|
2219
|
-
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,${Buffer.from(
|
|
2220
|
-
<style>${
|
|
2277
|
+
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,${Buffer.from(we).toString("base64")}">
|
|
2278
|
+
<style>${be}</style>
|
|
2221
2279
|
<script>(function(){var p=localStorage.getItem('tr-theme')||'system';var t=p==='system'?(window.matchMedia('(prefers-color-scheme:light)').matches?'light':'dark'):p;document.documentElement.setAttribute('data-theme',t);})()</script>
|
|
2222
2280
|
</head>
|
|
2223
2281
|
<body>
|
|
2224
2282
|
<div class="wrap">
|
|
2225
2283
|
<div class="top-bar">
|
|
2226
2284
|
<div class="brand">
|
|
2227
|
-
${
|
|
2285
|
+
${xe}
|
|
2228
2286
|
<div class="brand-text">
|
|
2229
2287
|
<span class="brand-title">TestRelic AI</span>
|
|
2230
2288
|
<span class="brand-sub">Analytics Report</span>
|
|
@@ -2261,9 +2319,9 @@ ${""}
|
|
|
2261
2319
|
</aside>
|
|
2262
2320
|
<script id="report-data" type="application/json">${n}</script>
|
|
2263
2321
|
${s?`<script id="artifact-manifest-data" type="application/json">${s}</script>`:""}
|
|
2264
|
-
<script>${
|
|
2322
|
+
<script>${an}</script>
|
|
2265
2323
|
</body>
|
|
2266
|
-
</html>`}function
|
|
2324
|
+
</html>`}function vt(t,e,r,n){let s=t.replace(/<\//g,"<\\/"),a=e.replace(/<\//g,"<\\/"),o=n?n.replace(/<\//g,"<\\/"):null,i=`{
|
|
2267
2325
|
"schemaVersion":"2.0",
|
|
2268
2326
|
"reportMode":"streaming",
|
|
2269
2327
|
"serverPort":${"null"},
|
|
@@ -2277,7 +2335,7 @@ ${s?`<script id="artifact-manifest-data" type="application/json">${s}</script>`:
|
|
|
2277
2335
|
"ci":null,
|
|
2278
2336
|
"metadata":null,
|
|
2279
2337
|
"shardRunIds":null
|
|
2280
|
-
}`,
|
|
2338
|
+
}`,l=`
|
|
2281
2339
|
(function(){
|
|
2282
2340
|
var data=JSON.parse(document.getElementById('report-data').textContent);
|
|
2283
2341
|
var _serverPort=data.serverPort||null;
|
|
@@ -2318,7 +2376,7 @@ ${s?`<script id="artifact-manifest-data" type="application/json">${s}</script>`:
|
|
|
2318
2376
|
_detailCacheKeysS.push(testId);
|
|
2319
2377
|
}
|
|
2320
2378
|
|
|
2321
|
-
/* Fetch test detail from server */
|
|
2379
|
+
/* Fetch test detail metadata from server */
|
|
2322
2380
|
function fetchTestDetail(testId,cb){
|
|
2323
2381
|
if(_detailCache[testId]){cb(null,_detailCache[testId]);return;}
|
|
2324
2382
|
if(!_serverAvailable||!_apiBase){cb('Server unavailable');return;}
|
|
@@ -2330,19 +2388,30 @@ ${s?`<script id="artifact-manifest-data" type="application/json">${s}</script>`:
|
|
|
2330
2388
|
}).catch(function(e){cb(e.message||'Failed to fetch');});
|
|
2331
2389
|
}
|
|
2332
2390
|
|
|
2391
|
+
/* Fetch paginated heavy data (network, console, api-calls) */
|
|
2392
|
+
function fetchTestData(testId,dataType,page,pageSize,cb){
|
|
2393
|
+
if(!_serverAvailable||!_apiBase){cb('Server unavailable');return;}
|
|
2394
|
+
var url=_apiBase+'/api/tests/'+testId+'/'+dataType+'?page='+page+'&pageSize='+pageSize;
|
|
2395
|
+
fetch(url).then(function(r){
|
|
2396
|
+
if(!r.ok)throw new Error('HTTP '+r.status);
|
|
2397
|
+
return r.json();
|
|
2398
|
+
}).then(function(d){cb(null,d);}).catch(function(e){cb(e.message||'Failed to fetch');});
|
|
2399
|
+
}
|
|
2400
|
+
window.__trFetchTestData=fetchTestData;
|
|
2401
|
+
|
|
2333
2402
|
/* Make fetchTestDetail and index available globally for other modules */
|
|
2334
2403
|
window.__trStreamingFetchDetail=fetchTestDetail;
|
|
2335
2404
|
window.__trTestIndex=_testIndex;
|
|
2336
2405
|
window.__trServerPort=_serverPort;
|
|
2337
2406
|
window.__trIsStreaming=true;
|
|
2338
2407
|
|
|
2339
|
-
${
|
|
2340
|
-
${
|
|
2341
|
-
${
|
|
2342
|
-
${
|
|
2343
|
-
${
|
|
2344
|
-
${
|
|
2345
|
-
${
|
|
2408
|
+
${ke}
|
|
2409
|
+
${Re}
|
|
2410
|
+
${Ae}
|
|
2411
|
+
${Ce}
|
|
2412
|
+
${Te}
|
|
2413
|
+
${_e}
|
|
2414
|
+
${Se}
|
|
2346
2415
|
applyTheme();
|
|
2347
2416
|
renderRunMeta();
|
|
2348
2417
|
renderSummary();
|
|
@@ -2361,15 +2430,15 @@ ${s?`<script id="artifact-manifest-data" type="application/json">${s}</script>`:
|
|
|
2361
2430
|
<title>TestRelic AI Analytics Report</title>
|
|
2362
2431
|
${""}
|
|
2363
2432
|
${""}
|
|
2364
|
-
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,${Buffer.from(
|
|
2365
|
-
<style>${
|
|
2433
|
+
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,${Buffer.from(we).toString("base64")}">
|
|
2434
|
+
<style>${be}</style>
|
|
2366
2435
|
<script>(function(){var p=localStorage.getItem('tr-theme')||'system';var t=p==='system'?(window.matchMedia('(prefers-color-scheme:light)').matches?'light':'dark'):p;document.documentElement.setAttribute('data-theme',t);})()</script>
|
|
2367
2436
|
</head>
|
|
2368
2437
|
<body>
|
|
2369
2438
|
<div class="wrap">
|
|
2370
2439
|
<div class="top-bar">
|
|
2371
2440
|
<div class="brand">
|
|
2372
|
-
${
|
|
2441
|
+
${xe}
|
|
2373
2442
|
<div class="brand-text">
|
|
2374
2443
|
<span class="brand-title">TestRelic AI</span>
|
|
2375
2444
|
<span class="brand-sub">Analytics Report</span>
|
|
@@ -2405,60 +2474,61 @@ ${""}
|
|
|
2405
2474
|
<div class="filter-drawer-body" id="filter-drawer-body"></div>
|
|
2406
2475
|
</aside>
|
|
2407
2476
|
<script id="report-data" type="application/json">${i}</script>
|
|
2408
|
-
${
|
|
2409
|
-
<script>${
|
|
2477
|
+
${o?`<script id="artifact-manifest-data" type="application/json">${o}</script>`:""}
|
|
2478
|
+
<script>${l}</script>
|
|
2410
2479
|
</body>
|
|
2411
|
-
</html>`}function
|
|
2412
|
-
`);});}catch{}}var
|
|
2480
|
+
</html>`}function Ie(t){try{let e=process.platform,r;e==="darwin"?r=`open "${t}"`:e==="win32"?r=`start "" "${t}"`:r=`xdg-open "${t}"`,child_process.exec(r,n=>{n&&process.stderr.write(`[testrelic] Failed to open browser: ${n.message}
|
|
2481
|
+
`);});}catch{}}var yt=path.join(os$1.tmpdir(),"testrelic-data"),N=class{constructor(e){this.count=0;this.closed=false;fs$1.mkdirSync(yt,{recursive:true}),this.filePath=path.join(yt,`${e}-${crypto.randomUUID().substring(0,8)}.jsonl`),this.fd=fs$1.openSync(this.filePath,"w");}append(e){if(this.closed)return;let r=JSON.stringify(e)+`
|
|
2482
|
+
`;fs$1.writeSync(this.fd,r),this.count++;}getPath(){return this.filePath}getCount(){return this.count}close(){if(!this.closed){this.closed=true;try{fs$1.closeSync(this.fd);}catch{}}}cleanup(){try{fs$1.unlinkSync(this.filePath);}catch{}}};async function wt(t,e,r,n){let s=(e-1)*r,a=[],o=0,i=readline.createInterface({input:fs$1.createReadStream(t,{encoding:"utf-8"}),crlfDelay:1/0});for await(let d of i)if(d.length!==0){if(o>=s&&a.length<r)try{a.push(JSON.parse(d));}catch{}if(o++,a.length>=r&&n!==void 0)break}let l=n??o,c=Math.max(1,Math.ceil(l/r));return {items:a,total:l,page:e,pageSize:r,totalPages:c}}var Ct=/^[a-f0-9]{12}$/,Le=/^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}(-\d+)?$/,Tt=500;function w(t,e,r){t.writeHead(e,{"Content-Type":"application/json"}),t.end(JSON.stringify(r));}function St(t){t.setHeader("Access-Control-Allow-Origin","*"),t.setHeader("Access-Control-Allow-Methods","GET, DELETE, OPTIONS"),t.setHeader("Access-Control-Allow-Headers","Content-Type");}function re(t){try{return fs$1.existsSync(t)?JSON.parse(fs$1.readFileSync(t,"utf-8")):null}catch{return null}}function ne(t){let e=0;try{let r=fs$1.readdirSync(t,{withFileTypes:!0});for(let n of r){let s=path.join(t,n.name);n.isFile()?e+=fs$1.statSync(s).size:n.isDirectory()&&(e+=ne(s));}}catch{}return e}function Rt(t,e,r,n){let s=re(path.join(r,"index.json"));w(e,200,{status:"ok",reportMode:"streaming",testCount:s?.length??0,uptime:Math.floor((Date.now()-n)/1e3)});}function At(t,e,r){let n=re(path.join(r,"summary.json"));if(!n){w(e,404,{error:"Summary not found"});return}w(e,200,n);}function _t(t,e,r){let n=re(path.join(r,"index.json"));if(!n){w(e,404,{error:"Test index not found"});return}let a=new URL(t.url??"/",`http://${t.headers.host}`).searchParams,o=Math.max(1,parseInt(a.get("page")??"1",10)||1),i=Math.min(Tt,Math.max(1,parseInt(a.get("pageSize")??"100",10)||100)),l=a.get("status")?.split(",").filter(Boolean)??null,c=a.get("file")??null,d=a.get("search")?.toLowerCase()??null,p=a.get("tag")?.split(",").filter(Boolean)??null,f=a.get("sort")??"file",u=a.get("order")==="desc"?-1:1,g=n;l&&l.length>0&&(g=g.filter(b=>l.includes(b.status))),c&&(g=g.filter(b=>b.filePath===c||b.filePath.startsWith(c+"/"))),d&&(g=g.filter(b=>b.title.toLowerCase().includes(d)||b.filePath.toLowerCase().includes(d))),p&&p.length>0&&(g=g.filter(b=>p.some(y=>b.tags.includes(y)))),g=[...g].sort((b,y)=>{let T=0;switch(f){case "duration":T=b.duration-y.duration;break;case "status":T=b.status.localeCompare(y.status);break;case "title":T=b.title.localeCompare(y.title);break;default:T=b.filePath.localeCompare(y.filePath);break}return T*u});let h=g.length,m=Math.max(1,Math.ceil(h/i)),x=(o-1)*i,C=g.slice(x,x+i);w(e,200,{tests:C,pagination:{page:o,pageSize:i,totalItems:h,totalPages:m},filters:{status:l,file:c,search:d,tag:p}});}function It(t,e,r,n){if(!Ct.test(n)){w(e,400,{error:"Invalid test ID format"});return}let s=path.join(r,"tests",n,"meta.json"),a=path.join(r,"tests",`${n}.json`),o=fs$1.existsSync(s)?s:fs$1.existsSync(a)?a:null;if(!o){w(e,404,{error:`Test not found: ${n}`});return}try{let i=fs$1.readFileSync(o,"utf-8");e.writeHead(200,{"Content-Type":"application/json"}),e.end(i);}catch(i){w(e,500,{error:i instanceof Error?i.message:String(i)});}}async function Lt(t,e,r,n,s){if(!Ct.test(n)){w(e,400,{error:"Invalid test ID format"});return}let o=path.join(r,"tests",n,{network:"network.jsonl",console:"console.jsonl","api-calls":"api-calls.jsonl"}[s]);if(!fs$1.existsSync(o)){w(e,200,{items:[],total:0,page:1,pageSize:50,totalPages:0});return}try{let l=new URL(t.url??"/",`http://${t.headers.host}`).searchParams,c=Math.max(1,parseInt(l.get("page")??"1",10)||1),d=Math.min(Tt,Math.max(1,parseInt(l.get("pageSize")??"50",10)||50)),p,f=path.join(r,"tests",n,"meta.json");if(fs$1.existsSync(f))try{let g=JSON.parse(fs$1.readFileSync(f,"utf-8"));switch(s){case "network":p=g.networkRequestsCount;break;case "console":p=g.consoleLogsCount;break;case "api-calls":p=g.apiCallsCount;break}}catch{}let u=await wt(o,c,d,p);w(e,200,u);}catch(i){w(e,500,{error:i instanceof Error?i.message:String(i)});}}function Nt(t,e,r){let n=re(path.join(r,"index.json"));if(!n){w(e,404,{error:"Test index not found"});return}let s=new Map;for(let o of n){if(o.isRetry)continue;let i=s.get(o.filePath);switch(i||(i={total:0,passed:0,failed:0,flaky:0,skipped:0,timedOut:0},s.set(o.filePath,i)),i.total++,o.status){case "passed":i.passed++;break;case "failed":i.failed++;break;case "flaky":i.flaky++;break;case "skipped":i.skipped++;break;case "timedout":i.timedOut++;break}}let a=Array.from(s.entries()).map(([o,i])=>({filePath:o,...i})).sort((o,i)=>o.filePath.localeCompare(i.filePath));w(e,200,{files:a});}function Et(t,e,r){if(!fs$1.existsSync(r)){w(e,200,{runs:[],totalSizeBytes:0});return}try{let n=[],s=0,a=fs$1.readdirSync(r,{withFileTypes:!0});for(let o of a){if(!o.isDirectory()||!Le.test(o.name))continue;let i=path.join(r,o.name),l=ne(i),c=fs$1.readdirSync(i,{withFileTypes:!0}).filter(d=>d.isDirectory());n.push({folderName:o.name,totalSizeBytes:l,testCount:c.length}),s+=l;}n.sort((o,i)=>i.folderName.localeCompare(o.folderName)),w(e,200,{runs:n,totalSizeBytes:s});}catch(n){w(e,500,{error:n instanceof Error?n.message:String(n)});}}function Mt(t,e,r){try{let n=0,s=0;if(fs$1.existsSync(r)){let a=fs$1.readdirSync(r,{withFileTypes:!0});for(let o of a){if(!o.isDirectory()||!Le.test(o.name))continue;let i=path.join(r,o.name),l=ne(i);fs$1.rmSync(i,{recursive:!0,force:!0}),s+=l,n++;}}w(e,200,{deletedCount:n,freedBytes:s});}catch(n){w(e,500,{error:n instanceof Error?n.message:String(n)});}}function Pt(t,e,r,n){if(!Le.test(n)){w(e,400,{error:"Invalid folder name"});return}let s=path.join(r,n);try{if(!fs$1.statSync(s).isDirectory()){w(e,404,{error:"Not found"});return}}catch{w(e,404,{error:"Not found"});return}try{let a=ne(s);fs$1.rmSync(s,{recursive:!0,force:!0}),w(e,200,{deleted:n,freedBytes:a});}catch(a){w(e,500,{error:a instanceof Error?a.message:String(a)});}}function Dt(t,e,r){w(e,200,{status:"shutting_down"}),r.close();}function Ne(t,e,r){if(!fs$1.existsSync(r)){w(e,404,{error:"File not found"});return}try{let n=fs$1.readFileSync(r),s=path.extname(r).toLowerCase(),a=yn[s]??"application/octet-stream";e.writeHead(200,{"Content-Type":a}),e.end(n);}catch(n){w(e,500,{error:n instanceof Error?n.message:String(n)});}}var yn={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".webm":"video/webm",".mp4":"video/mp4",".json":"application/json",".html":"text/html",".css":"text/css",".js":"text/javascript",".svg":"image/svg+xml"};var kn=9323,Cn=10,Tn=1800*1e3;function G(t,e){return new Promise((r,n)=>{let s=e?.port??kn,a=Date.now(),o,i=0,l=fs$1.existsSync(path.join(t,"artifacts"))?path.join(t,"artifacts"):fs$1.existsSync(path.join(t,"..","artifacts"))?path.join(t,"..","artifacts"):path.join(t,"artifacts");function c(){clearTimeout(o),o=setTimeout(()=>{p.close();},Tn);}let d=e?.htmlPath??null;if(!d){let u=path.dirname(t);try{let g=fs$1.readdirSync(u).find(h=>h.endsWith(".html"));g&&(d=path.join(u,g));}catch{}}let p=http.createServer((u,g)=>{if(c(),St(g),u.method==="OPTIONS"){g.writeHead(204),g.end();return}let h;try{h=new URL(u.url??"/",`http://${u.headers.host??"localhost"}`).pathname;}catch{w(g,400,{error:"Invalid URL"});return}if(u.method==="GET"&&(h==="/"||h==="/index.html")){if(d&&fs$1.existsSync(d)){Ne(u,g,d);return}w(g,404,{error:"HTML report not found"});return}if(u.method==="GET"&&h==="/api/health"){Rt(u,g,t,a);return}if(u.method==="GET"&&h==="/api/summary"){At(u,g,t);return}if(u.method==="GET"&&h==="/api/tests"){_t(u,g,t);return}if(u.method==="GET"&&h==="/api/files"){Nt(u,g,t);return}let m=h.match(/^\/api\/tests\/([a-f0-9]+)\/(network|console|api-calls)$/);if(u.method==="GET"&&m){Lt(u,g,t,m[1],m[2]);return}let x=h.match(/^\/api\/tests\/([a-f0-9]+)$/);if(u.method==="GET"&&x){It(u,g,t,x[1]);return}if(u.method==="GET"&&h==="/api/artifacts"){Et(u,g,l);return}if(u.method==="DELETE"&&h==="/api/artifacts"){Mt(u,g,l);return}let C=h.match(/^\/api\/artifacts\/(.+)$/);if(u.method==="DELETE"&&C){Pt(u,g,l,decodeURIComponent(C[1]));return}if(u.method==="GET"&&h.startsWith("/artifacts/")){let b=decodeURIComponent(h.slice(11));if(b.includes("..")||b.includes("\0")){w(g,400,{error:"Invalid path"});return}Ne(u,g,path.join(l,b));return}if(u.method==="POST"&&h==="/api/shutdown"){Dt(u,g,p);return}w(g,404,{error:"Not found"});});function f(u){let g=h=>{h.code==="EADDRINUSE"&&i<Cn?(i++,f(u+1)):n(h);};p.once("error",g),p.listen(u,"127.0.0.1",()=>{p.removeListener("error",g);let h=p.address();if(!h||typeof h=="string"){n(new Error("Failed to get server address"));return}c(),r({port:h.port,dispose:()=>new Promise(m=>{clearTimeout(o),p.close(()=>m());})});});}f(s);})}async function Ft(t){let e=await G(t);return {port:e.port,dispose:e.dispose}}function In(t,e,r){let n=JSON.stringify(t),s=r?JSON.stringify(r):null;return mt(n,e,s)}async function Me(t,e,r){try{let n=null,s=null,a=e.reportMode==="streaming"||e.reportMode==="auto"&&t.timeline.length===0&&t.summary.total>=e.streamingThreshold,o,i=e.htmlReportPath,l=path.dirname(i);if(fs$1.mkdirSync(l,{recursive:!0}),a){let d=JSON.stringify(t.summary),p=path.dirname(e.outputPath),f=path.join(p,".testrelic-report"),u="[]";try{let h=path.join(f,"index-compact.json"),m=path.join(f,"index.json");fs$1.existsSync(h)?u=fs$1.readFileSync(h,"utf-8"):fs$1.existsSync(m)&&(u=fs$1.readFileSync(m,"utf-8"));}catch{}let g=r?JSON.stringify(r):null;o=vt(d,u,null,g);}else o=In(t,null,r);let c=i+".tmp";if(fs$1.writeFileSync(c,o,"utf-8"),fs$1.renameSync(c,i),a){if(t.ci===null){let d=path.dirname(e.outputPath),p=path.join(d,".testrelic-report"),f=path.resolve(i);try{if(await Nn(),n=await En(p),!n){s=await G(p,{htmlPath:f}),n=s.port;let u=setInterval(()=>{},6e4),g=()=>{clearInterval(u),s?.dispose();};process.on("SIGINT",g),process.on("SIGTERM",g),setTimeout(g,1800*1e3).unref();}n&&process.stderr.write(`
|
|
2413
2483
|
Report server: http://127.0.0.1:${n}
|
|
2414
|
-
`);}catch{}}}else if(
|
|
2415
|
-
`);}}var
|
|
2416
|
-
`).map(
|
|
2484
|
+
`);}catch{}}}else if(e.openReport&&t.ci===null&&e.includeArtifacts){let d=path.dirname(e.outputPath),p=path.join(d,"artifacts");if(fs$1.existsSync(p))try{let f=await Ft(p);n=f.port,process.on("exit",()=>{f.dispose();});}catch{}}if(e.openReport&&t.ci===null)if(a&&n)Ie(`http://127.0.0.1:${n}`);else {let d=path.resolve(i);Ie(d);}}catch(n){process.stderr.write(`[testrelic] Failed to write HTML report: ${n instanceof Error?n.message:String(n)}
|
|
2485
|
+
`);}}var ie=9323,qt=10;async function Ln(){for(let t=ie;t<ie+qt;t++)try{let e=new AbortController,r=setTimeout(()=>e.abort(),500),n=await fetch(`http://127.0.0.1:${t}/api/health`,{signal:e.signal});if(clearTimeout(r),n.ok)return t}catch{}return null}async function Nn(){for(let t=ie;t<ie+qt;t++)try{let e=new AbortController,r=setTimeout(()=>e.abort(),1e3);await fetch(`http://127.0.0.1:${t}/api/shutdown`,{method:"POST",signal:e.signal}),clearTimeout(r);}catch{}await new Promise(t=>setTimeout(t,300));}async function En(t){let r=[path.join(__dirname,"cli.cjs"),path.join(__dirname,"cli.js"),path.join(__dirname,"..","dist","cli.cjs"),path.join(__dirname,"..","dist","cli.js")].find(n=>fs$1.existsSync(n));if(!r){let n=await G(t);return process.on("exit",()=>{n?.dispose();}),n.port}return new Promise(n=>{let s=child_process.spawn(process.execPath,[r,"serve",t],{detached:true,stdio:["ignore","ignore","pipe"],env:{...process.env}}),a="",o=false,i=setTimeout(()=>{o||(o=true,s.stderr?.removeAllListeners(),Ln().then(n));},5e3);s.stderr?.on("data",l=>{a+=l.toString();let c=a.match(/127\.0\.0\.1:(\d+)/);c&&!o&&(o=true,clearTimeout(i),s.stderr?.removeAllListeners(),s.unref(),n(Number(c[1])));}),s.on("error",()=>{o||(o=true,clearTimeout(i),n(null));}),s.on("exit",()=>{o||(o=true,clearTimeout(i),n(null));}),s.unref();})}var Dn=20,Pe=0,De=[];async function Ut(t,e){Pe>=Dn&&await new Promise(r=>De.push(r)),Pe++;try{return await promises.copyFile(t,e),!0}catch{return false}finally{Pe--,De.length>0&&De.shift()();}}var K=[];async function $t(){K.length!==0&&(await Promise.allSettled(K),K.length=0);}function jt(t){let e=new Date,r=a=>String(a).padStart(2,"0"),n=`${e.getFullYear()}-${r(e.getMonth()+1)}-${r(e.getDate())}T${r(e.getHours())}-${r(e.getMinutes())}-${r(e.getSeconds())}`;if(!fs$1.existsSync(path.join(t,n)))return n;let s=1;for(;fs$1.existsSync(path.join(t,`${n}-${s}`));)s++;return `${n}-${s}`}function Fn(t){let e=t.replace(/[^a-zA-Z0-9\-_ ]/g,"-").replace(/\s+/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"");return e.length>100&&(e=e.substring(0,100).replace(/-+$/,"")),e||"unnamed-test"}function zt(t,e,r,n,s){let a=t.find(f=>f.name==="screenshot"&&f.path),o=t.find(f=>f.name==="video"&&f.path);if(!a&&!o)return null;let i=Fn(e);r>0&&(i+=`--retry-${r}`);let l=s?["artifacts",s,i]:["artifacts",i],c=path.join(n,...l),d=l,p={};try{fs$1.mkdirSync(c,{recursive:!0});}catch{return null}if(a?.path&&fs$1.existsSync(a.path)){let u=`screenshot${path.extname(a.path)||".png"}`,g=path.join(c,u);K.push(Ut(a.path,g).then(()=>{})),p.screenshot=`${d.join("/")}/${u}`;}if(o?.path&&fs$1.existsSync(o.path)){let u=`video${path.extname(o.path)||".webm"}`,g=path.join(c,u);K.push(Ut(o.path,g).then(()=>{})),p.video=`${d.join("/")}/${u}`;}return !p.screenshot&&!p.video?null:p}var qn=/^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}(-\d+)?$/,Hn="1.0";function Un(t){let e=path.extname(t).toLowerCase();return [".png",".jpg",".jpeg",".gif",".bmp",".webp"].includes(e)?"screenshot":[".webm",".mp4",".avi",".mov"].includes(e)?"video":"other"}function Vt(t,e,r){let n=[];try{let s=fs$1.readdirSync(t,{withFileTypes:!0});for(let a of s){if(!a.isFile())continue;let o=path.join(t,a.name),i=fs$1.statSync(o);n.push({name:a.name,type:Un(a.name),relativePath:`artifacts/${e}/${r}/${a.name}`,sizeBytes:i.size});}}catch{}return {testName:r,files:n}}function $n(t,e){let r=path.join(t,e),n=[],s=0;try{let o=fs$1.readdirSync(r,{withFileTypes:!0});for(let i of o){if(!i.isDirectory())continue;let l=Vt(path.join(r,i.name),e,i.name);n.push(l);for(let c of l.files)s+=c.sizeBytes;}}catch{}let a=e.replace(/^(\d{4}-\d{2}-\d{2})T(\d{2})-(\d{2})-(\d{2})/,"$1T$2:$3:$4").replace(/-\d+$/,"");return n.sort((o,i)=>o.testName.localeCompare(i.testName)),{folderName:e,timestamp:a,totalSizeBytes:s,testCount:n.length,tests:n,isCurrentRun:false}}function Wt(t,e){let r=path.join(t,"artifacts"),n=[],s=[],a=0;try{let i=fs$1.readdirSync(r,{withFileTypes:!0});for(let l of i)if(l.isDirectory())if(qn.test(l.name)){let c=$n(r,l.name);n.push({...c,isCurrentRun:l.name===e});}else {let c=Vt(path.join(r,l.name),l.name,l.name);s.push(c);for(let d of c.files)a+=d.sizeBytes;}}catch{}n.sort((i,l)=>l.timestamp.localeCompare(i.timestamp)),s.length>0&&(s.sort((i,l)=>i.testName.localeCompare(l.testName)),n.push({folderName:"__legacy__",timestamp:"1970-01-01T00:00:00",totalSizeBytes:a,testCount:s.length,tests:s,isCurrentRun:false}));let o=n.reduce((i,l)=>i+l.totalSizeBytes,0);return {schemaVersion:Hn,generatedAt:new Date().toISOString(),artifactBaseDir:"artifacts",totalSizeBytes:o,runs:n,serverPort:null}}function Gn(t){let e=t,{root:r}=path.parse(e);for(;e!==r;){if(fs$1.existsSync(path.join(e,".git")))return e;e=path.join(e,"..");}return null}function Jt(t){try{let e=Gn(t);if(!e)return;let r=path.join(e,".gitignore"),n=path.relative(e,t).replace(/\\/g,"/"),s=n.endsWith("/")?n:`${n}/`;if(fs$1.existsSync(r)&&fs$1.readFileSync(r,"utf-8").split(`
|
|
2486
|
+
`).map(l=>l.trim()).some(l=>l===s||l===n))return;let a=`
|
|
2417
2487
|
# TestRelic test artifacts
|
|
2418
2488
|
${s}
|
|
2419
|
-
`;fs.appendFileSync(r,a,"utf-8");}catch{}}function
|
|
2420
|
-
`}function
|
|
2489
|
+
`;fs$1.appendFileSync(r,a,"utf-8");}catch{}}function Zt(t,e){let r=[];for(let n of t){let s=Jn(n),a=Kn(n),o=Yn(n,s,a,e),i=Zn(n,s,a);if(o.length===0&&i.length===0){r.push({type:"navigation",url:"about:blank",timestamp:n.startedAt,durationOnUrl:n.duration,navigationType:"dummy",domContentLoadedAt:null,networkIdleAt:null,networkStats:null,specFile:n.specFile,test:s,tests:[a],_testTitle:n.title});continue}r.push(...o,...i);}return r.sort(Qn),Xn(r,t),r.map((n,s)=>n.type==="navigation"?{...{index:s,type:"navigation",url:n.url,timestamp:n.timestamp,durationOnUrl:n.durationOnUrl??0,navigationType:n.navigationType,domContentLoadedAt:n.domContentLoadedAt??null,networkIdleAt:n.networkIdleAt??null,networkStats:n.networkStats??null,specFile:n.specFile,test:n.test},tests:n.tests}:{...{index:s,type:"api_call",callId:n.callId,method:n.method,url:n.url,timestamp:n.timestamp,responseTime:n.responseTime??null,request:n.request,response:n.response??null,...n.error?{error:n.error}:{},assertions:n.assertions??[],specFile:n.specFile,test:n.test},tests:n.tests})}function Jn(t){return {title:t.title,fullTitle:t.titlePath,status:t.status,duration:t.duration,retries:t.retryCount,retry:t.retry,tags:t.tags,failure:t.failure}}function Kn(t){return {title:t.title,status:t.status,duration:t.duration,startedAt:t.startedAt,completedAt:t.completedAt,retryCount:t.retryCount,tags:t.tags,failure:t.failure,testId:t.testId,filePath:t.filePath,suiteName:t.suiteName,testType:t.testType,isFlaky:t.isFlaky,retryStatus:t.retryStatus,expectedStatus:t.expectedStatus,actualStatus:t.actualStatus,artifacts:t.artifacts,networkRequests:t.networkRequests,apiCalls:t.apiCalls,apiAssertions:t.apiAssertions,actions:t.actions,consoleLogs:t.consoleLogs}}function Yn(t,e,r,n){let s=[];for(let a of t.navigations)n.navigationTypes!==null&&!n.navigationTypes.includes(a.navigationType)||s.push({type:"navigation",url:a.url,timestamp:a.timestamp,durationOnUrl:0,navigationType:a.navigationType,domContentLoadedAt:a.domContentLoadedAt??null,networkIdleAt:a.networkIdleAt??null,networkStats:a.networkStats??null,specFile:t.specFile,test:e,tests:[r],_testTitle:t.title});return s}function Zn(t,e,r){if(!t.apiCalls||t.apiCalls.length===0)return [];let n=t.apiAssertions??[];return t.apiCalls.map(s=>{let a=n.filter(i=>i.callId===s.id).map(i=>({type:i.type,expected:i.expected,actual:i.actual,status:i.status,location:i.location,...i.expression!==void 0?{expression:i.expression}:{}})),o=null;return s.responseStatusCode!==null&&s.responseStatusText!==null&&(o={statusCode:s.responseStatusCode,statusText:s.responseStatusText,headers:s.responseHeaders,body:Yt(s.responseBody)}),{type:"api_call",callId:s.id,method:s.method,url:s.url,timestamp:s.timestamp,responseTime:s.error?null:s.responseTimeMs,request:{headers:s.requestHeaders,body:Yt(s.requestBody)},response:o,...s.error?{error:s.error}:{},assertions:a,specFile:t.specFile,test:e,tests:[r],_testTitle:t.title}})}function Qn(t,e){let r=new Date(t.timestamp).getTime(),n=new Date(e.timestamp).getTime();if(r!==n)return r-n;let s={navigation:0,api_call:1},a=s[t.type],o=s[e.type];return a!==o?a-o:t.type==="api_call"&&e.type==="api_call"&&t.callId&&e.callId?Kt(t.callId)-Kt(e.callId):0}function Kt(t){let e=t.match(/(\d+)$/);return e?parseInt(e[1],10):0}function Xn(t,e){for(let r=0;r<t.length;r++){let n=t[r];if(n.type!=="navigation")continue;let s=new Date(n.timestamp).getTime(),a=null;for(let o=r+1;o<t.length;o++)if(t[o]._testTitle===n._testTitle){a=new Date(t[o].timestamp).getTime();break}if(a!==null)n.durationOnUrl=Math.max(0,a-s);else {let o=e.find(i=>i.title===n._testTitle);if(o){let i=new Date(o.completedAt).getTime();n.durationOnUrl=Math.max(0,i-s);}}}}function Yt(t){if(t==null)return null;try{return JSON.parse(t)}catch{return t}}function Oe(t,e){let r=t.length,n=Math.min(Math.ceil(e/100*r)-1,r-1);return t[Math.max(0,n)]}function es(t){try{let e=new URL(t);return e.origin+e.pathname}catch{return t}}function ts(t){return t==null?"error":t>=200&&t<300?"2xx":t>=300&&t<400?"3xx":t>=400&&t<500?"4xx":t>=500&&t<600?"5xx":"error"}function Qt(t,e){let r=0,n=0,s=0,a=0,o=0;for(let v of t)switch(v.status){case "passed":r++;break;case "failed":n++;break;case "flaky":s++;break;case "skipped":a++;break;case "timedout":o++;break}let i=[];for(let v of t)v.apiCalls&&i.push(...v.apiCalls);let l=i.length,c=new Set,d={},p={"2xx":0,"3xx":0,"4xx":0,"5xx":0,error:0},f=[];for(let v of i)c.add(es(v.url)),d[v.method]=(d[v.method]??0)+1,p[ts(v.responseStatusCode)]+=1,f.push(v.responseTimeMs);let u=null;if(f.length>0){let v=[...f].sort((A,S)=>A-S),k=v.reduce((A,S)=>A+S,0);u={avg:Math.round(k/v.length),min:v[0],max:v[v.length-1],p50:Oe(v,50),p95:Oe(v,95),p99:Oe(v,99)};}let g=0,h=0,m=0;for(let v of t)if(v.apiAssertions)for(let k of v.apiAssertions)g++,k.status==="passed"?h++:m++;let x=0,C=new Set;for(let v of t){x+=v.navigations.length;for(let k of v.navigations)C.add(k.url);}let b=0,y={};function T(v){for(let k of v)b++,y[k.category]=(y[k.category]??0)+1,k.children.length>0&&T(k.children);}for(let v of t)v.actions&&T(v.actions);return {total:t.length,passed:r,failed:n,flaky:s,skipped:a,timedout:o,totalApiCalls:l,uniqueApiUrls:c.size,apiCallsByMethod:d,apiCallsByStatusRange:p,apiResponseTime:u,totalAssertions:g,passedAssertions:h,failedAssertions:m,totalNavigations:x,uniqueNavigationUrls:C.size,totalTimelineSteps:e,totalActionSteps:b,actionStepsByCategory:y}}function rs(t){let e=56-t.length;return e>0?t+" ".repeat(e):t}function I(t){return `\u2502 ${rs(t)} \u2502
|
|
2490
|
+
`}function qe(t,e,r,n){if(n||t.total===0)return;let s=`\u250C${"\u2500".repeat(58)}\u2510
|
|
2421
2491
|
`,a=`\u2514${"\u2500".repeat(58)}\u2518
|
|
2422
|
-
`,
|
|
2423
|
-
`,process.stderr.write(i);}var
|
|
2424
|
-
`)[0]?.trim();return n?
|
|
2492
|
+
`,o=I(""),i=s;i+=I("TestRelic AI - Playwright Test Report"),i+=o;let l=[];if(t.passed>0&&l.push(`${t.passed} \u2713`),t.failed>0&&l.push(`${t.failed} \u2717`),t.flaky>0&&l.push(`${t.flaky} \u26A0`),t.skipped>0&&l.push(`${t.skipped} skipped`),t.timedout>0&&l.push(`${t.timedout} timedout`),i+=I(`Tests: ${t.total} total (${l.join(" ")})`),t.totalNavigations>0&&(i+=I(`Navigations: ${t.totalNavigations} visits across ${t.uniqueNavigationUrls} unique URLs`)),t.totalApiCalls>0){i+=I(`API Calls: ${t.totalApiCalls} calls across ${t.uniqueApiUrls} unique endpoints`);let c=Object.entries(t.apiCallsByMethod).filter(([,p])=>p>0).map(([p,f])=>`${p}: ${f}`);c.length>0&&(i+=I(` ${c.join(" ")}`));let d=Object.entries(t.apiCallsByStatusRange).filter(([,p])=>p>0).map(([p,f])=>`${p}: ${f}`);d.length>0&&(i+=I(` ${d.join(" ")}`)),t.apiResponseTime&&(i+=I(` Avg response: ${t.apiResponseTime.avg}ms P95: ${t.apiResponseTime.p95}ms`));}if(t.totalAssertions>0&&(i+=I(`Assertions: ${t.totalAssertions} total (${t.passedAssertions} \u2713 ${t.failedAssertions} \u2717)`)),t.totalActionSteps>0){let c=[],d=t.actionStepsByCategory;d.ui_action&&c.push(`${d.ui_action} UI`),d.assertion&&c.push(`${d.assertion} assertions`),d.custom_step&&c.push(`${d.custom_step} custom`);let p=c.length>0?` (${c.join(" ")})`:"";i+=I(`Actions: ${t.totalActionSteps} steps${p}`);}i+=I(`Report: ${r}`),i+=I(`Data: ${e}`),i+=a,i+=`For more information visit us at https://docs.testrelic.ai
|
|
2493
|
+
`,process.stderr.write(i);}var ns=new Set(["pw:api","expect","test.step"]);function ss(t){return t==="expect"?"assertion":t==="test.step"?"custom_step":"ui_action"}function He(t,e,r){if(ns.has(t.category)){let n=[];for(let a of t.steps)He(a,e,n);let s=t.startTime.getTime()-e.getTime();r.push({title:t.title,category:ss(t.category),timestamp:t.startTime.toISOString(),duration:t.duration,videoOffset:s>=0?s/1e3:null,status:t.error?"failed":"passed",error:t.error?.message??null,children:n});}else for(let n of t.steps)He(n,e,r);}function Xt(t,e){let r=[];for(let n of t)He(n,e,r);return r}var os=new Set(["localhost","127.0.0.1","0.0.0.0"]);function tr(t){let e=new URL(t);if(e.protocol!=="https:"&&!(e.protocol==="http:"&&os.has(e.hostname)))throw core.createError(core.ErrorCode.CLOUD_CONFIG_INVALID,`HTTPS is required for cloud communication. Got: ${e.protocol}//${e.hostname}`)}var ls=3e3;async function Ue(t){let e=new AbortController,r=setTimeout(()=>e.abort(),ls);try{return (await fetch(`${t}/health`,{method:"GET",signal:e.signal})).ok}catch{return false}finally{clearTimeout(r);}}async function rr(t){return new Promise(e=>setTimeout(e,t))}async function er(t){try{let r=(await t.json()).error;if(r&&typeof r.message=="string"){let n=r.details;if(Array.isArray(n)&&n.length>0){let s=n.map(a=>`${a.field}: ${a.message}`).join(", ");return `${r.message} (${s})`}return r.message}}catch{}return `HTTP ${t.status}`}async function $e(t,e,r){let n=new AbortController,s=setTimeout(()=>n.abort(),r);try{let a=await fetch(`${t}/sdk/auth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:e}),signal:n.signal});if(a.ok){let i=await a.json();return {accessToken:i.accessToken,refreshToken:i.refreshToken,expiresIn:i.expiresIn,orgId:i.orgId,orgName:i.orgName,userId:i.userId,userName:i.userName}}if(a.status===429){let i=a.headers.get("Retry-After"),l=i?parseInt(i,10)*1e3:5e3;if(!isNaN(l)&&l>0){await rr(l);let c=await fetch(`${t}/sdk/auth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:e}),signal:n.signal});if(c.ok){let d=await c.json();return {accessToken:d.accessToken,refreshToken:d.refreshToken,expiresIn:d.expiresIn,orgId:d.orgId,orgName:d.orgName,userId:d.userId,userName:d.userName}}}return {code:"rate_limited",message:"Rate limited during token exchange.",statusCode:429}}return a.status===400?{code:"validation_error",message:await er(a),statusCode:400}:a.status===401?{code:"invalid_key",message:"API key is invalid or has been revoked.",statusCode:401}:a.status===403?{code:"expired_key",message:"API key has expired.",statusCode:403}:{code:"server_error",message:await er(a),statusCode:a.status}}catch(a){return a instanceof DOMException&&a.name==="AbortError"?{code:"timeout",message:"Token exchange timed out.",statusCode:null}:{code:"network_error",message:"Failed to reach cloud for token exchange.",statusCode:null}}finally{clearTimeout(s);}}function je(t){return "code"in t&&typeof t.code=="string"&&["invalid_key","expired_key","validation_error","rate_limited","server_error","network_error","timeout"].includes(t.code)}async function nr(t,e,r){let n=new AbortController,s=setTimeout(()=>n.abort(),r);try{let a=await fetch(`${t}/sdk/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e}),signal:n.signal});if(a.status===429){let i=a.headers.get("Retry-After"),l=i?parseInt(i,10)*1e3:5e3;!isNaN(l)&&l>0&&(await rr(l),a=await fetch(`${t}/sdk/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e}),signal:n.signal}));}if(!a.ok)return null;let o=await a.json();return {accessToken:o.accessToken,refreshToken:o.refreshToken,expiresIn:o.expiresIn}}catch{return null}finally{clearTimeout(s);}}async function sr(t,e,r,n,s,a){let o=new AbortController,i=setTimeout(()=>o.abort(),s);try{let l={gitId:r,displayName:n};a&&(l.branch=a);let c=await fetch(`${t}/repos/resolve`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify(l),signal:o.signal});if(!c.ok)return null;let d=await c.json();return {repoId:d.repoId,displayName:d.displayName}}catch{return null}finally{clearTimeout(i);}}var fs=5e3;function O(t,e){try{return child_process.execSync(t,{cwd:e,timeout:fs,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function ar(t){let e=O("git rev-parse --abbrev-ref HEAD",t),r=O("git rev-parse --short HEAD",t),n=O("git log -1 --pretty=%s",t),s=gs(t),a=s?Z(s):null;return {branch:e,commitSha:r,commitMessage:n,remoteUrl:a}}function gs(t){let e=O("git remote get-url origin",t);if(e)return e;let r=O("git remote",t);if(!r)return null;let n=r.split(`
|
|
2494
|
+
`)[0]?.trim();return n?O(`git remote get-url ${n}`,t):null}function Z(t){let e=t.trim();return e=e.replace(/^[a-z+]+:\/\//,""),e=e.replace(/^[^@]+@/,""),e=e.replace(/:(?!\d)/,"/"),e=e.replace(/\.git$/,""),e=e.replace(/\/+$/,""),e=e.replace(/^[^@/]+@/,""),e.toLowerCase()}function ir(t){let e=t.split("/").filter(Boolean);return e[e.length-1]??t}function ze(t){try{let e=fs$1.readFileSync(path.join(t,"package.json"),"utf-8"),r=JSON.parse(e);return typeof r.name=="string"&&r.name.length>0?r.name:null}catch{return null}}function Q(t){let e=ze(t);return e||`local/${path.basename(t)}`}var ws="1.0.0",or=10;function We(t,e,r,n,s,a,o,i){try{fs$1.mkdirSync(t,{recursive:!0});let l=Date.now(),c=`${l}-${e}-${r}.json`,d=path.join(t,c),p={version:ws,queuedAt:new Date(l).toISOString(),reason:n,retryCount:0,targetEndpoint:s,method:a,payload:o,headers:i},f=d+".tmp";fs$1.writeFileSync(f,JSON.stringify(p,null,2),"utf-8"),fs$1.renameSync(f,d);}catch(l){l.code==="ENOSPC"?process.stderr.write(`\u26A0 TestRelic: Disk full \u2014 unable to queue upload data.
|
|
2425
2495
|
`):process.stderr.write(`\u26A0 TestRelic: Unable to queue upload data.
|
|
2426
|
-
`);}}async function
|
|
2427
|
-
`),fs.unlinkSync(i);continue}let
|
|
2428
|
-
`);return}try{if(
|
|
2429
|
-
`);return}let r=await
|
|
2430
|
-
`),await this.resolveRepoId(),this.config.queueDirectory&&(
|
|
2431
|
-
`);}}getMode(){return this.authState.mode}isCloudMode(){return this.authState.mode==="cloud"}isLocalMode(){return this.authState.mode==="local"}getAccessToken(){return this.authState.accessToken}getRepoId(){return this.repoId}getGitMetadata(){return this.gitMetadata}getConfig(){return this.config}getFailureReason(){return this.failureReason}getEndpoint(){return this.config?.endpoint??"https://api.testrelic.com/api/v1"}async ensureValidToken(){if(!this.isCloudMode()||!this.authState.accessToken)return false;let
|
|
2432
|
-
`));}async dispose(){if(this.healthCheckTimer&&(clearInterval(this.healthCheckTimer),this.healthCheckTimer=null),this.flushPromise){try{await Promise.race([this.flushPromise,new Promise(
|
|
2433
|
-
\u2192 Manage keys: ${
|
|
2496
|
+
`);}}async function cr(t,e,r){let n;try{n=fs$1.readdirSync(t).filter(a=>a.endsWith(".json")&&!a.endsWith(".tmp")).sort();}catch{return}if(n.length===0)return;let s=[];for(let a=0;a<n.length;a+=or)s.push(n.slice(a,a+or));for(let a of s)for(let o of a){let i=path.join(t,o);try{if(!fs$1.statSync(i).isFile())continue;let c=fs$1.readFileSync(i,"utf-8"),d=JSON.parse(c);if(!core.isValidQueueEntry(d)){process.stderr.write(`\u26A0 TestRelic: Corrupted queue file deleted: ${o}
|
|
2497
|
+
`),fs$1.unlinkSync(i);continue}let p=d;if((await fetch(p.targetEndpoint,{method:p.method,headers:{...p.headers,Authorization:`Bearer ${r}`},body:JSON.stringify(p.payload)})).ok)fs$1.unlinkSync(i);else return}catch{return}}}function ur(t,e){try{let r=fs$1.readdirSync(t).filter(s=>s.endsWith(".json")&&!s.endsWith(".tmp")),n=Date.now();for(let s of r){let a=path.join(t,s);try{let o=fs$1.readFileSync(a,"utf-8"),l=JSON.parse(o).queuedAt;if(typeof l=="string"){let c=new Date(l).getTime();n-c>e&&fs$1.unlinkSync(a);}}catch{try{fs$1.unlinkSync(a);}catch{}}}}catch{}}var As=3e5,_s=864e5,Is=6e4,pr=3e4,Je="https://app.testrelic.com/settings/api-keys",de=class{constructor(e){this.gitMetadata=null;this.repoId=null;this.failureReason=null;this.flushPromise=null;this.healthCheckTimer=null;this.config=e,this.authState={mode:"pending",accessToken:null,refreshToken:null,expiresAt:null,orgId:null,orgName:null,userId:null,userName:null};}async initialize(){if(!this.config||!this.config.apiKey){this.setLocalMode("no_api_key"),process.stderr.write(`\u2139 TestRelic: No API key configured. Running in local mode.
|
|
2498
|
+
`);return}try{if(tr(this.config.endpoint),this.gitMetadata=ar(),!await Ue(this.config.endpoint)){this.setLocalMode("cloud_unreachable"),process.stderr.write(`\u26A0 TestRelic: Cloud unreachable. Switching to local mode. Data will be queued for later upload.
|
|
2499
|
+
`);return}let r=await $e(this.config.endpoint,this.config.apiKey,this.config.timeout);if(je(r)){this.handleAuthError(r.code,r.statusCode);return}let n=r;this.authState={mode:"cloud",accessToken:n.accessToken,refreshToken:n.refreshToken,expiresAt:Date.now()+n.expiresIn*1e3,orgId:n.orgId,orgName:n.orgName,userId:n.userId,userName:n.userName},process.stderr.write(`\u2713 TestRelic: Connected to cloud (${n.orgName} / ${n.userName})
|
|
2500
|
+
`),await this.resolveRepoId(),this.config.queueDirectory&&(ur(this.config.queueDirectory,this.config.queueMaxAge),this.startBackgroundFlush()),this.startHealthCheck();}catch{this.setLocalMode("unexpected_error"),process.stderr.write(`\u26A0 TestRelic: Unexpected error during cloud initialization. Running in local mode.
|
|
2501
|
+
`);}}getMode(){return this.authState.mode}isCloudMode(){return this.authState.mode==="cloud"}isLocalMode(){return this.authState.mode==="local"}getAccessToken(){return this.authState.accessToken}getRepoId(){return this.repoId}getGitMetadata(){return this.gitMetadata}getConfig(){return this.config}getFailureReason(){return this.failureReason}getEndpoint(){return this.config?.endpoint??"https://api.testrelic.com/api/v1"}async ensureValidToken(){if(!this.isCloudMode()||!this.authState.accessToken)return false;let e=this.authState.expiresAt??0;if(Date.now()+As<e)return true;if(!this.config||!this.authState.refreshToken)return this.switchToLocalMode("token_expired_no_refresh"),false;try{let r=await nr(this.config.endpoint,this.authState.refreshToken,this.config.timeout);return r?(this.authState.accessToken=r.accessToken,this.authState.refreshToken=r.refreshToken,this.authState.expiresAt=Date.now()+r.expiresIn*1e3,!0):(this.switchToLocalMode("token_refresh_failed"),!1)}catch{return this.switchToLocalMode("token_refresh_error"),false}}switchToLocalMode(e){this.authState.mode!=="local"&&(this.authState.mode="local",this.failureReason=e,process.stderr.write(`\u26A0 TestRelic: Switched to local mode (${e}).
|
|
2502
|
+
`));}async dispose(){if(this.healthCheckTimer&&(clearInterval(this.healthCheckTimer),this.healthCheckTimer=null),this.flushPromise){try{await Promise.race([this.flushPromise,new Promise(e=>setTimeout(e,pr))]);}catch{}this.flushPromise=null;}this.authState={mode:"local",accessToken:null,refreshToken:null,expiresAt:null,orgId:null,orgName:null,userId:null,userName:null},this.repoId=null,this.gitMetadata=null;}setLocalMode(e){this.authState.mode="local",this.failureReason=e;}handleAuthError(e,r){switch(e){case "invalid_key":this.setLocalMode("invalid_api_key"),process.stderr.write(`\u26A0 TestRelic: API key is invalid or revoked. Running in local mode.
|
|
2503
|
+
\u2192 Manage keys: ${Je}
|
|
2434
2504
|
`);break;case "expired_key":this.setLocalMode("expired_api_key"),process.stderr.write(`\u26A0 TestRelic: API key has expired. Running in local mode.
|
|
2435
|
-
\u2192 Generate a new key: ${
|
|
2505
|
+
\u2192 Generate a new key: ${Je}
|
|
2436
2506
|
`);break;case "validation_error":this.setLocalMode("validation_error"),process.stderr.write(`\u26A0 TestRelic: API key format invalid. Running in local mode.
|
|
2437
|
-
\u2192 Manage keys: ${
|
|
2507
|
+
\u2192 Manage keys: ${Je}
|
|
2438
2508
|
`);break;case "rate_limited":this.setLocalMode("rate_limited"),process.stderr.write(`\u26A0 TestRelic: Rate limited during authentication. Running in local mode.
|
|
2439
2509
|
`);break;case "timeout":this.setLocalMode("auth_timeout"),process.stderr.write(`\u26A0 TestRelic: Authentication timed out. Running in local mode.
|
|
2440
2510
|
`);break;default:this.setLocalMode(`auth_error_${r??"unknown"}`),process.stderr.write(`\u26A0 TestRelic: Cloud authentication failed. Running in local mode.
|
|
2441
|
-
`);break}}async resolveRepoId(){if(!this.config||!this.authState.accessToken)return;let
|
|
2442
|
-
`);}readRepoCache(
|
|
2443
|
-
`),this.startBackgroundFlush();}}}catch{}},
|
|
2444
|
-
`);}
|
|
2445
|
-
`),{navigations:s,
|
|
2446
|
-
`),this.activeReportMode==="streaming"){let s=path.dirname(this.config.outputPath);this.streamingWriter=new W(s);let a=()=>{if(this.streamingWriter){try{this.streamingWriter.writeIndex(this.testIndex);let
|
|
2447
|
-
`)[0]??null,networkCount:
|
|
2511
|
+
`);break}}async resolveRepoId(){if(!this.config||!this.authState.accessToken)return;let e=this.gitMetadata?.remoteUrl?Z(this.gitMetadata.remoteUrl):null,r=e?ir(e):this.config.projectName??Q(process.cwd()),n=e??this.config.projectName??Q(process.cwd()),s=this.readRepoCache(n);if(s){this.repoId=s.repoId;return}try{let a=await sr(this.config.endpoint,this.authState.accessToken,n,r,this.config.timeout,this.gitMetadata?.branch);a&&(this.repoId=a.repoId,this.writeRepoCache(n,a.repoId,a.displayName));}catch{}!e&&!this.config.projectName&&!ze(process.cwd())&&process.stderr.write(`\u2139 TestRelic: No git remote or package.json detected. Set project.name in .testrelic for stable project identity.
|
|
2512
|
+
`);}readRepoCache(e){if(!this.config)return null;let r=path.join(this.config.queueDirectory,"..","cache","repo.json");try{if(!fs$1.existsSync(r))return null;let n=fs$1.readFileSync(r,"utf-8"),s=JSON.parse(n);if(s.gitId!==e||Date.now()-s.resolvedAt>_s)return null;let a=this.hashApiKey();return a&&s.apiKeyHash!==a?null:s}catch{return null}}writeRepoCache(e,r,n){if(!this.config)return;let s=path.join(this.config.queueDirectory,"..","cache"),a=path.join(s,"repo.json");try{fs$1.mkdirSync(s,{recursive:!0});let o={repoId:r,gitId:e,displayName:n,resolvedAt:Date.now(),apiKeyHash:this.hashApiKey()??""},i=a+".tmp";fs$1.writeFileSync(i,JSON.stringify(o,null,2),"utf-8"),fs$1.renameSync(i,a);}catch{}}hashApiKey(){return this.config?.apiKey?crypto.createHash("sha256").update(this.config.apiKey).digest("hex").substring(0,16):null}startBackgroundFlush(){if(!this.config||!this.authState.accessToken)return;let e=this.authState.accessToken,r=this.config.queueDirectory,n=this.config.endpoint;this.flushPromise=Promise.race([cr(r,n,e),new Promise(s=>setTimeout(s,pr))]).catch(()=>{});}startHealthCheck(){if(!this.config)return;let e=this.config.endpoint;this.healthCheckTimer=setInterval(async()=>{if(!this.isCloudMode()&&!(!this.failureReason||!["cloud_unreachable","auth_timeout","network_error"].includes(this.failureReason)))try{if(!await Ue(e))return;if(this.config?.apiKey){let n=await $e(this.config.endpoint,this.config.apiKey,this.config.timeout);if(!je(n)){let s=n;this.authState={mode:"cloud",accessToken:s.accessToken,refreshToken:s.refreshToken,expiresAt:Date.now()+s.expiresIn*1e3,orgId:s.orgId,orgName:s.orgName,userId:s.userId,userName:s.userName},this.failureReason=null,process.stderr.write(`\u2713 TestRelic: Cloud connectivity restored.
|
|
2513
|
+
`),this.startBackgroundFlush();}}}catch{}},Is);}};var Ns=1048576,ce=[1e3,3e3,9e3],ue=3;function Ke(t,e,r,n){return {runId:t.testRunId,repoGitId:e,startedAt:t.startedAt,summary:t.summary,timeline:t.timeline,...r?.branch?{branch:r.branch}:{},...r?.commitSha?{commit:r.commitSha}:{},...r?.commitMessage?{commitMessage:r.commitMessage}:{},...t.completedAt?{finishedAt:t.completedAt}:{},...t.totalDuration?{duration:t.totalDuration}:{},...n?.provider?{ciProvider:n.provider}:{},...n?.runUrl?{ciRunUrl:n.runUrl}:{}}}async function pe(t){return new Promise(e=>setTimeout(e,t))}function Es(t){let e={};for(let[r,n]of Object.entries(t))n!=null&&(e[r]=n);return e}async function Ms(t,e,r){for(let n=0;n<ue;n++)try{let s=await fetch(t,e);if(s.ok)return s;if(s.status===401&&r&&n===0){let a=await r();if(a){let o={...e,headers:{...e.headers,Authorization:`Bearer ${a}`}},i=await fetch(t,o);if(i.ok)return i}return null}if(s.status===429&&n<ue-1){let a=s.headers.get("Retry-After"),o=a?parseInt(a,10)*1e3:ce[n];!isNaN(o)&&o>0?await pe(o):await pe(ce[n]);continue}if(s.status>=500&&n<ue-1){await pe(ce[n]);continue}return s}catch{if(n<ue-1){await pe(ce[n]);continue}return null}return null}function Ps(t){let e=JSON.stringify(t),r={"Content-Type":"application/json"};if(Buffer.byteLength(e,"utf-8")>Ns){let n=zlib.gzipSync(Buffer.from(e,"utf-8"));return r["Content-Encoding"]="gzip",{body:n,headers:r}}return {body:e,headers:r}}async function fr(t,e,r,n){let s=`${t}/runs`,{body:a,headers:o}=Ps(r);o.Authorization=`Bearer ${e}`;let i=await Ms(s,{method:"POST",headers:o,body:a},n);return i?.ok?{success:true,statusCode:i.status,error:null}:i?.status===409?{success:true,statusCode:409,error:null}:{success:false,reason:i?`Upload failed with status ${i.status}`:"Upload failed after retries",statusCode:i?.status??null,payload:r,targetEndpoint:s,method:"POST"}}async function gr(t,e,r){let n=`${t}/runs/init`;try{let s=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify(Es(r))});return s.ok?{runId:(await s.json()).runId}:null}catch{return null}}function hr(t,e,r,n){let s=`${t}/runs/${r}/tests`;fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify(n)}).catch(()=>{});}async function mr(t,e,r,n){let s=`${t}/runs/${r}/finalize`;try{return (await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify(n)})).ok}catch{return false}}function vr(t,e,r,n){let s=[],a=[],o=null,i=0,l=null,c=0,d=null,p=0,f=t.filter(h=>h.name===core.ATTACHMENT_NAME&&h.body),u=false;if(f.length>0)for(let h of f)try{let m=JSON.parse(h.body.toString());if(core.isTestRelicFilePayload(m)){s=s.concat(m.navigations),a=a.concat(m.apiAssertions),m.networkRequestsFile&&(o=m.networkRequestsFile,i+=m.networkRequestsCount),m.consoleLogsFile&&(l=m.consoleLogsFile,c+=m.consoleLogsCount),m.apiCallsFile&&(d=m.apiCallsFile,p+=m.apiCallsCount),u=!0;continue}if(core.isTestRelicDataPayload(m)){s=s.concat(m.navigations),Array.isArray(m.apiAssertions)&&(a=a.concat(m.apiAssertions)),i+=m.networkRequests?.length??0,p+=m.apiCalls?.length??0;let x=m.consoleLogs;Array.isArray(x)&&(c+=x.length),u=!0;}}catch{process.stderr.write(`[testrelic] Warning: Corrupt attachment for test "${r}"
|
|
2514
|
+
`);}return u||(s=e.filter(h=>h.type==="lambdatest-navigation"&&h.description).map(h=>{try{return JSON.parse(h.description)}catch{return null}}).filter(h=>h!==null)),s.length===0&&i===0&&p===0&&!n&&!u&&process.stderr.write(`[testrelic] Warning: No data found for test "${r}". Make sure your tests import { test, expect } from '@testrelic/playwright-analytics/fixture' instead of '@playwright/test'. Without the TestRelic fixture, network logs, video sync, and timeline data cannot be captured.
|
|
2515
|
+
`),{navigations:s,apiAssertions:a,networkRequestsFile:o,networkRequestsCount:i,consoleLogsFile:l,consoleLogsCount:c,apiCallsFile:d,apiCallsCount:p}}function Ye(t){let r=t.getGitMetadata()?.remoteUrl;return r?Z(r):t.getConfig()?.projectName??Q(process.cwd())}async function yr(t,e,r,n){if(!t.isCloudMode()||e!=="realtime"&&e!=="both"||!await t.ensureValidToken())return null;let a=t.getGitMetadata(),o=D();return (await gr(t.getEndpoint(),t.getAccessToken(),{runId:r,repoGitId:Ye(t),branch:a?.branch??null,commit:a?.commitSha??null,startedAt:n,totalTests:null,ciProvider:o?.provider??null,ciRunUrl:o?.runUrl??null}))?.runId??null}async function Ze(t,e,r,n,s,a,o,i,l){try{if(t.isCloudMode()&&s&&(r==="realtime"||r==="both")&&await t.ensureValidToken()&&await mr(t.getEndpoint(),t.getAccessToken(),s,{finishedAt:o,duration:i,summary:l}),t.isCloudMode()&&(!r||r==="batch"||r==="both"))if(await t.ensureValidToken()){let d=t.getGitMetadata(),p=D(),f=Ye(t),u=Ke(a,f,d,p),g=await fr(t.getEndpoint(),t.getAccessToken(),u,async()=>await t.ensureValidToken()?t.getAccessToken():null);if(!g.success){let h=g,m=e?.queueDirectory??".testrelic/queue";We(m,n,"batch",h.reason,h.targetEndpoint,h.method,h.payload,{"Content-Type":"application/json"});}}else {let d=e?.queueDirectory??".testrelic/queue",p=t.getGitMetadata(),f=D(),u=Ye(t),g=Ke(a,u,p,f);We(d,n,"batch",t.getFailureReason()??"token_invalid",`${t.getEndpoint()}/runs`,"POST",g,{"Content-Type":"application/json"});}await t.dispose();}catch{try{await t.dispose();}catch{}}}function Xe(t){switch(t){case "passed":return "passed";case "failed":return "failed";case "timedOut":return "timedout";case "skipped":return "skipped";case "interrupted":return "failed";default:return "failed"}}function $s(t,e,r){let n=`${t}::${e}::${r}`;return crypto.createHash("sha256").update(n).digest("hex").substring(0,16)}function js(t){return t.length<=4?"":t[t.length-2]}function zs(t){let e=t.findIndex(r=>r.status==="passed");return e>0?`passed on retry ${e}`:null}function Vs(t,e){let r=["e2e","api","unit"];for(let s of r)if(t.some(a=>a===`@${s}`||a===s))return s;let n=e.replace(/\\/g,"/");for(let s of r)if(n.includes(`/${s}/`))return s;return "unknown"}var Ws="__testrelic_api_config";function Gs(t){return JSON.stringify(t,(e,r)=>r instanceof RegExp?{__regexp:true,source:r.source,flags:r.flags}:r)}var fe=class{constructor(e){this.rootDir="";this.startedAt="";this.testRunId="";this.collectedTests=[];this.fixtureDataReceived=false;this.testCount=0;this.cloudClient=null;this.cloudRunId=null;this.runTimestamp="";this.activeReportMode="embedded";this.streamingWriter=null;this.testIndex=[];this.summaryCounters={total:0,passed:0,failed:0,flaky:0,skipped:0,timedOut:0,interrupted:0,totalApiCalls:0,totalAssertions:0,totalNavigations:0,totalNetworkRequests:0,totalConsoleLogs:0,totalActionSteps:0};this.config=ft(e),this.apiConfig=pt(e);}async onBegin(e,r){try{if(this.rootDir=e.rootDir,this.startedAt=new Date().toISOString(),this.testRunId=this.config.testRunId??crypto.randomUUID(),this.config.reportMode==="auto"){let s=r.allTests().length;this.activeReportMode=s>=this.config.streamingThreshold?"streaming":"embedded";}else this.activeReportMode=this.config.reportMode;let n=r.allTests().length;if(process.stderr.write(`[testrelic] Report mode: ${this.activeReportMode} (${n} tests)
|
|
2516
|
+
`),this.activeReportMode==="streaming"){let s=path.dirname(this.config.outputPath);this.streamingWriter=new W(s);let a=()=>{if(this.streamingWriter){try{this.streamingWriter.writeIndex(this.testIndex);let o={testRunId:this.testRunId??"",startedAt:this.startedAt,completedAt:new Date().toISOString(),totalDuration:Date.now()-new Date(this.startedAt).getTime(),...this.summaryCounters,metadata:null,reportMode:"streaming",files:[],enrichedSummary:null,validation:null,writeErrors:this.streamingWriter.getWriteErrors()};this.streamingWriter.writeSummary(o);}catch{}this.streamingWriter.dispose();}};process.on("SIGTERM",a),process.on("SIGINT",a);}if(this.config.includeArtifacts){let s=path.dirname(this.config.outputPath);this.runTimestamp=jt(path.join(s,"artifacts"));try{Jt(path.join(s,"artifacts"));}catch{}}try{this.cloudClient=new de(this.config.cloud),await this.cloudClient.initialize(),this.cloudRunId=await yr(this.cloudClient,this.config.cloud?.uploadStrategy,this.testRunId,this.startedAt);}catch{this.cloudClient?.switchToLocalMode("init_error");}}catch{}}onTestBegin(e,r){try{e.annotations.push({type:Ws,description:Gs(this.apiConfig)});}catch{}}onTestEnd(e,r){try{let n=r,s=e.outcome(),a;s==="flaky"?a="flaky":s==="skipped"?a="skipped":a=Xe(n.status);let o=n.startTime.toISOString(),i=new Date(n.startTime.getTime()+n.duration).toISOString(),l=e.tags?[...e.tags]:e.annotations.filter(S=>S.type==="tag").map(S=>S.description??""),c=vr(n.attachments,e.annotations,e.title,a==="skipped");(c.navigations.length>0||c.networkRequestsCount>0||c.apiCallsCount>0)&&(this.fixtureDataReceived=!0);let d=null;if(a==="failed"||a==="flaky"){let R=(a==="flaky"?e.results.find(P=>P.status!=="passed")?.errors??[]:n.errors)[0];if(R){let P=ht(this.config.redactPatterns),j=R.location?.line??null,z=null;this.config.includeCodeSnippets&&j!==null&&R.location?.file&&(z=gt(R.location.file,j,this.config.codeContextLines),z&&(z=P(z))),d={message:P(R.message??"Unknown error"),line:j,code:z,stack:this.config.includeStackTrace&&R.stack?P(R.stack):null};}}let p=e.titlePath().filter(Boolean),f=path.relative(this.rootDir||".",e.location.file),u=js(p),g=p.join(" > "),h=f,m=$s(h,u,g),x=Vs(l,h),C=s==="flaky",b=zs(e.results),y=Xe(e.expectedStatus),T=Xe(n.status),v=null;if(this.config.includeArtifacts&&a!=="skipped"&&n.attachments){let S=path.dirname(this.config.outputPath),R=p[p.length-1]??e.title;v=zt(n.attachments,R,n.retry,S,this.runTimestamp||void 0);}let k=this.config.includeActionSteps&&n.steps?Xt(n.steps,n.startTime):null,A={titlePath:p,title:g,status:a,duration:n.duration,startedAt:o,completedAt:i,retryCount:e.results.length-1,retry:n.retry,tags:l,failure:d,specFile:f,navigations:c.navigations,testId:m,filePath:h,suiteName:u,testType:x,isFlaky:C,retryStatus:b,expectedStatus:y,actualStatus:T,artifacts:v,apiAssertions:c.apiAssertions,actions:k,networkRequestsFile:c.networkRequestsFile,networkRequestsCount:c.networkRequestsCount,consoleLogsFile:c.consoleLogsFile,consoleLogsCount:c.consoleLogsCount,apiCallsFile:c.apiCallsFile,apiCallsCount:c.apiCallsCount};if(this.activeReportMode==="streaming"&&this.streamingWriter){let S=ve(h,p,e.id??"",n.retry),R=n.retry===e.results.length-1,P={id:S,navigations:c.navigations,apiAssertions:c.apiAssertions,actions:k??[],artifacts:v,failureDiagnostic:d,hasNetworkFile:c.networkRequestsFile!==null,networkRequestsCount:c.networkRequestsCount,hasConsoleFile:c.consoleLogsFile!==null,consoleLogsCount:c.consoleLogsCount,hasApiCallsFile:c.apiCallsFile!==null,apiCallsCount:c.apiCallsCount,startedAt:o};this.streamingWriter.writeTestDetail(S,P,{networkRequestsFile:c.networkRequestsFile,consoleLogsFile:c.consoleLogsFile,apiCallsFile:c.apiCallsFile});let j={id:S,title:p[p.length-1]??e.title,titlePath:p,filePath:h,status:a,duration:n.duration,project:p[1]??"",retryIndex:n.retry,tags:l,hasNetworkData:c.networkRequestsCount>0,hasConsoleData:c.consoleLogsCount>0,hasArtifacts:v!==null,hasActionSteps:(k?.length??0)>0,errorMessage:d?.message?.split(`
|
|
2517
|
+
`)[0]??null,networkCount:c.networkRequestsCount,consoleCount:c.consoleLogsCount,actionCount:k?.length??0,isRetry:!R};if(this.testIndex.push(j),R)switch(this.summaryCounters.total++,a){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}this.summaryCounters.totalApiCalls+=c.apiCallsCount,this.summaryCounters.totalAssertions+=c.apiAssertions.length,this.summaryCounters.totalNavigations+=c.navigations.length,this.summaryCounters.totalNetworkRequests+=c.networkRequestsCount,this.summaryCounters.totalConsoleLogs+=c.consoleLogsCount,this.summaryCounters.totalActionSteps+=k?.length??0,A.actions=null,A.apiAssertions=null,A.navigations=[],A.artifacts=null,A.failure=null,A.networkRequestsFile=null,A.consoleLogsFile=null,A.apiCallsFile=null;}this.activeReportMode!=="streaming"&&this.collectedTests.push(A),this.testCount++,this.checkMemoryPressure();try{let S=this.config.cloud?.uploadStrategy;if(this.cloudClient?.isCloudMode()&&this.cloudRunId&&(S==="realtime"||S==="both")){let R=this.cloudClient.getAccessToken();R&&hr(this.cloudClient.getEndpoint(),R,this.cloudRunId,this.toTestResult(A));}}catch{}}catch{}}async onEnd(e){try{let r=new Date().toISOString(),n=new Date(this.startedAt).getTime(),a=new Date(r).getTime()-n,o=this.activeReportMode==="streaming"?this.testIndex.some(l=>l.status!=="skipped"):this.collectedTests.some(l=>l.status!=="skipped");!this.fixtureDataReceived&&o&&process.stderr.write(`
|
|
2448
2518
|
\u26A0 TestRelic: No fixture data received from any test.
|
|
2449
2519
|
To enable network logs, video sync, and timeline tracking, import the TestRelic fixture:
|
|
2450
2520
|
import { test, expect } from '@testrelic/playwright-analytics/fixture';
|
|
2451
2521
|
instead of:
|
|
2452
2522
|
import { test, expect } from '@playwright/test';
|
|
2453
2523
|
|
|
2454
|
-
`),await
|
|
2455
|
-
`);let
|
|
2524
|
+
`),await $t();let i=null;if(this.config.includeArtifacts&&this.runTimestamp)try{let l=path.dirname(this.config.outputPath);i=Wt(l,this.runTimestamp);let c=path.join(l,"artifact-manifest.json"),d=JSON.stringify(i),p=c+".tmp";fs$1.writeFileSync(p,d,"utf-8"),fs$1.renameSync(p,c);}catch{}if(this.activeReportMode==="streaming"&&this.streamingWriter)await this.finalizeStreamingReport(r,a,e,i);else {let l=this.buildTimeline(),c=new Map;for(let u of this.collectedTests){let g=c.get(u.testId);(!g||u.retry>g.retry)&&c.set(u.testId,u);}let d=Array.from(c.values()),p=Qt(d,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 Me(f,this.config,i),qe(p,this.config.outputPath,this.config.htmlReportPath,this.config.quiet),this.cloudClient&&await Ze(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:c,totalActionSteps:d}=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:c,totalActionSteps:d};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
|
+
`);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:{}},x={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(x);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 Me(this.buildStreamingReport(x,m,e,r),this.config,s),qe(m,this.config.outputPath,this.config.htmlReportPath,this.config.quiet);let b=this.streamingWriter.getReportDir();if(process.stderr.write(`[testrelic] Streaming report written to ${b}
|
|
2456
2526
|
[testrelic] ${this.testIndex.length} test detail files on disk
|
|
2457
2527
|
`),this.streamingWriter.getWriteErrors().length>0&&process.stderr.write(`[testrelic] WARNING: ${this.streamingWriter.getWriteErrors().length} write error(s) during streaming
|
|
2458
|
-
`),this.streamingWriter.dispose(),this.cloudClient){let
|
|
2528
|
+
`),this.streamingWriter.dispose(),this.cloudClient){let y=this.buildStreamingReport(x,m,e,r);await Ze(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.
|
|
2459
2529
|
`),this.switchToStreamingMode()):n>.8&&process.stderr.write(`[testrelic] WARNING: Memory pressure detected (${Math.round(r)} MB used).
|
|
2460
|
-
`);}catch{}}switchToStreamingMode(){try{if(this.activeReportMode==="streaming")return;this.activeReportMode="streaming";let
|
|
2461
|
-
`)[0]??null,networkCount:r.
|
|
2462
|
-
`);}}};var Fs=["text/","application/json","application/xml","application/javascript","application/x-www-form-urlencoded","application/graphql"];function Hs(e){let t=e.toLowerCase();return Fs.some(r=>t.includes(r))}var mt=class e{constructor(t,r){this.page=t;this.records=[];this.listeners=[];this.currentNetworkCounter=null;this.pendingRequests=new Map;this.capturedRequests=[];this.pendingBodyReads=[];this.requestIdCounter=0;this.consoleLogs=[];this.includeNetworkStats=r?.includeNetworkStats??true,this.origGoto=t.goto.bind(t),this.origGoBack=t.goBack.bind(t),this.origGoForward=t.goForward.bind(t),this.origReload=t.reload.bind(t),this.interceptMethods(),this.attachListeners();}async init(){await this.injectSPADetection();}async getCapturedRequests(){await Promise.allSettled(this.pendingBodyReads),this.pendingBodyReads=[];for(let[t,r]of this.pendingRequests)this.capturedRequests.push({url:r.url,method:r.method,resourceType:r.resourceType,statusCode:0,responseTimeMs:Date.now()-r.startTimeMs,startedAt:r.startedAt,requestHeaders:r.headers,requestBody:r.postData,responseBody:null,responseHeaders:null,contentType:null,responseSize:0,requestBodyTruncated:r.postDataTruncated,responseBodyTruncated:false,isBinary:false,error:"incomplete"}),this.pendingRequests.delete(t);return [...this.capturedRequests].sort((t,r)=>t.startedAt.localeCompare(r.startedAt))}static mapConsoleType(t){switch(t){case "log":return "log";case "warning":return "warn";case "error":return "error";case "info":return "info";case "debug":return "debug";default:return "log"}}async getData(){this.includeNetworkStats&&this.currentNetworkCounter&&this.records.length>0&&(this.records[this.records.length-1].networkStats={totalRequests:this.currentNetworkCounter.totalRequests,failedRequests:this.currentNetworkCounter.failedRequests,failedRequestUrls:[...this.currentNetworkCounter.failedRequestUrls],totalBytes:this.currentNetworkCounter.totalBytes,byType:{...this.currentNetworkCounter.byType}});let t=this.records.map(n=>({url:n.url,navigationType:n.navigationType,timestamp:n.timestamp,domContentLoadedAt:n.domContentLoadedAt,networkIdleAt:n.networkIdleAt,networkStats:n.networkStats})),r=this.includeNetworkStats?await this.getCapturedRequests():[];return {navigations:t,networkRequests:r,consoleLogs:[...this.consoleLogs]}}async flushLegacyAnnotations(t){this.includeNetworkStats&&this.currentNetworkCounter&&this.records.length>0&&(this.records[this.records.length-1].networkStats={totalRequests:this.currentNetworkCounter.totalRequests,failedRequests:this.currentNetworkCounter.failedRequests,failedRequestUrls:[...this.currentNetworkCounter.failedRequestUrls],totalBytes:this.currentNetworkCounter.totalBytes,byType:{...this.currentNetworkCounter.byType}});for(let r of this.records){let n={url:r.url,navigationType:r.navigationType,timestamp:r.timestamp,domContentLoadedAt:r.domContentLoadedAt,networkIdleAt:r.networkIdleAt,networkStats:r.networkStats};t.annotations.push({type:"lambdatest-navigation",description:JSON.stringify(n)});}if(this.includeNetworkStats){let r=await this.getCapturedRequests();r.length>0&&t.annotations.push({type:"__testrelic_network_requests",description:JSON.stringify(r)});}}dispose(){this.page.goto=this.origGoto,this.page.goBack=this.origGoBack,this.page.goForward=this.origGoForward,this.page.reload=this.origReload;for(let{event:t,handler:r}of this.listeners)this.page.off(t,r);this.listeners=[],this.records=[],this.pendingRequests.clear(),this.capturedRequests=[],this.pendingBodyReads=[];}getRecords(){return this.records}interceptMethods(){let t=this,r=this.page;r.goto=async function(n,s){return t.recordNavigation(n,"goto"),t.origGoto(n,s)},r.goBack=async function(n){let s=await t.origGoBack(n);return t.recordNavigation(r.url(),"back"),s},r.goForward=async function(n){let s=await t.origGoForward(n);return t.recordNavigation(r.url(),"forward"),s},r.reload=async function(n){return t.recordNavigation(r.url(),"refresh"),t.origReload(n)};}attachListeners(){let t=()=>{this.lastDomContentLoaded=new Date().toISOString(),this.records.length>0&&(this.records[this.records.length-1].domContentLoadedAt=this.lastDomContentLoaded);};this.page.on("domcontentloaded",t),this.listeners.push({event:"domcontentloaded",handler:t});let r=s=>{try{let a=s;if(typeof a.parentFrame=="function"&&a.parentFrame()!==null)return;let l=a.url(),i=this.records[this.records.length-1];if(i&&Date.now()-new Date(i.timestamp).getTime()<50&&i.url===l)return;this.recordNavigation(l,"navigation");}catch{}};this.page.on("framenavigated",r),this.listeners.push({event:"framenavigated",handler:r});let n=s=>{try{let a=s,l=a.type(),i=a.text();if(l==="debug"&&i.startsWith("__testrelic_nav:")){try{let o=JSON.parse(i.slice(16));o.type&&o.url&&this.recordNavigation(o.url,o.type);}catch{}return}{let o=null;try{let d=a.location();d&&d.url&&(o=`${d.url}:${d.lineNumber}:${d.columnNumber}`);}catch{}let p=e.mapConsoleType(l);this.consoleLogs.push({level:p,text:i,timestamp:new Date().toISOString(),location:o});}}catch{}};if(this.page.on("console",n),this.listeners.push({event:"console",handler:n}),this.includeNetworkStats){let s=i=>{this.currentNetworkCounter&&this.currentNetworkCounter.totalRequests++;try{let o=i,p=String(this.requestIdCounter++),d=o.postData()??null,u={url:o.url(),method:o.method(),resourceType:this.mapResourceType(o.resourceType()),headers:o.headers(),postData:d,postDataTruncated:!1,startedAt:new Date().toISOString(),startTimeMs:Date.now()};this.pendingRequests.set(p,u),i.__testrelic_id=p;}catch{}};this.page.on("request",s),this.listeners.push({event:"request",handler:s});let a=i=>{try{let o=i;if(this.currentNetworkCounter){let x=o.status();x>=400&&(this.currentNetworkCounter.failedRequests++,this.currentNetworkCounter.failedRequestUrls.push(x+" "+o.url()));let k=o.headers()["content-length"];k&&(this.currentNetworkCounter.totalBytes+=parseInt(k,10)||0);let y=o.request().resourceType(),m=this.mapResourceType(y);this.currentNetworkCounter.byType[m]++;}let p=o.request().__testrelic_id;if(!p)return;let d=this.pendingRequests.get(p);if(!d)return;this.pendingRequests.delete(p);let u=Date.now()-d.startTimeMs,f=o.headers(),c=f["content-type"]??null,g=parseInt(f["content-length"]??"0",10)||0,h=c?!Hs(c):!1,b=(async()=>{let x=null;if(!h)try{x=(await o.body()).toString("utf-8");}catch{}let k={url:d.url,method:d.method,resourceType:d.resourceType,statusCode:o.status(),responseTimeMs:u,startedAt:d.startedAt,requestHeaders:d.headers,requestBody:d.postData,responseBody:x,responseHeaders:f,contentType:c,responseSize:g,requestBodyTruncated:d.postDataTruncated,responseBodyTruncated:!1,isBinary:h,error:null};this.capturedRequests.push(k);})();this.pendingBodyReads.push(b);}catch{}};this.page.on("response",a),this.listeners.push({event:"response",handler:a});let l=i=>{if(this.currentNetworkCounter){this.currentNetworkCounter.failedRequests++;try{let o=i;this.currentNetworkCounter.failedRequestUrls.push("ERR "+o.url());}catch{}}try{let o=i,p=o.__testrelic_id;if(!p)return;let d=this.pendingRequests.get(p);if(!d)return;this.pendingRequests.delete(p);let u={url:d.url,method:d.method,resourceType:d.resourceType,statusCode:0,responseTimeMs:Date.now()-d.startTimeMs,startedAt:d.startedAt,requestHeaders:d.headers,requestBody:d.postData,responseBody:null,responseHeaders:null,contentType:null,responseSize:0,requestBodyTruncated:d.postDataTruncated,responseBodyTruncated:!1,isBinary:!1,error:o.failure()?.errorText??"Unknown error"};this.capturedRequests.push(u);}catch{}};this.page.on("requestfailed",l),this.listeners.push({event:"requestfailed",handler:l});}}async injectSPADetection(){try{await this.page.addInitScript(()=>{let t=history.pushState.bind(history),r=history.replaceState.bind(history);history.pushState=function(...n){t(...n),console.debug("__testrelic_nav:"+JSON.stringify({type:"spa_route",url:location.href}));},history.replaceState=function(...n){r(...n),console.debug("__testrelic_nav:"+JSON.stringify({type:"spa_replace",url:location.href}));},window.addEventListener("popstate",()=>{console.debug("__testrelic_nav:"+JSON.stringify({type:"popstate",url:location.href}));}),window.addEventListener("hashchange",()=>{console.debug("__testrelic_nav:"+JSON.stringify({type:"hash_change",url:location.href}));});});}catch{}}recordNavigation(t,r){this.includeNetworkStats&&this.currentNetworkCounter&&this.records.length>0&&(this.records[this.records.length-1].networkStats={totalRequests:this.currentNetworkCounter.totalRequests,failedRequests:this.currentNetworkCounter.failedRequests,failedRequestUrls:[...this.currentNetworkCounter.failedRequestUrls],totalBytes:this.currentNetworkCounter.totalBytes,byType:{...this.currentNetworkCounter.byType}}),this.records.push({url:t,navigationType:r,timestamp:new Date().toISOString()}),this.includeNetworkStats&&(this.currentNetworkCounter=this.createNetworkCounter());}createNetworkCounter(){return {totalRequests:0,failedRequests:0,failedRequestUrls:[],totalBytes:0,byType:{xhr:0,document:0,script:0,stylesheet:0,image:0,font:0,other:0}}}mapResourceType(t){switch(t){case "xhr":case "fetch":return "xhr";case "document":return "document";case "script":return "script";case "stylesheet":return "stylesheet";case "image":return "image";case "font":return "font";default:return "other"}}};var vr=Symbol.for("__testrelic_call_id"),Us="__testrelic_api_assertions",q=new WeakMap,O=class{constructor(){this.assertions=[];this.currentCallId=null;}recordAssertion(t){this.assertions.push(t);}getAssertions(){return this.assertions}setCurrentCallId(t){this.currentCallId=t;}getCurrentCallId(){return this.currentCallId}getData(){return [...this.assertions]}flushLegacyAnnotations(t){this.assertions.length!==0&&t.annotations.push({type:Us,description:JSON.stringify(this.assertions)});}dispose(){this.assertions=[],this.currentCallId=null;}};var yr="[REDACTED]";function se(e,t){if(e===null||t.length===0)return e;let r=new Set(t.map(s=>s.toLowerCase())),n={};for(let s of Object.keys(e))Object.hasOwn(e,s)&&(n[s]=r.has(s.toLowerCase())?yr:e[s]);return n}function vt(e,t){if(e===null||t.length===0)return e;let r;try{r=JSON.parse(e);}catch{return e}if(typeof r!="object"||r===null)return e;let n=new Set(t),s=ne(r,n);return JSON.stringify(s)}function ne(e,t){if(Array.isArray(e))return e.map(r=>ne(r,t));if(typeof e=="object"&&e!==null){let r={};for(let n of Object.keys(e)){if(!Object.hasOwn(e,n))continue;let s=e[n];t.has(n)?r[n]=yr:r[n]=ne(s,t);}return r}return e}function wr(e,t,r){if(r.length>0){for(let n of r)if(br(e,n))return false}if(t.length>0){for(let n of t)if(br(e,n))return true;return false}return true}function br(e,t){try{return t instanceof RegExp?t.test(e):$s(t).test(e)}catch{return console.warn(`[testrelic] Invalid URL filter pattern: ${String(t)}`),false}}function $s(e){let t="",r=0;for(;r<e.length;){let n=e[r];n==="*"&&e[r+1]==="*"?(t+=".*",r+=2,e[r]==="/"&&r++):n==="*"?(t+="[^/]*",r++):n==="?"?(t+="[^/]",r++):".+^${}()|[]\\".includes(n)?(t+="\\"+n,r++):(t+=n,r++);}return new RegExp(t)}var zs=["get","post","put","patch","delete","head","fetch"],js=["text/","application/json","application/xml","application/javascript","application/x-www-form-urlencoded","application/graphql"],Vs="__testrelic_api_calls";function Gs(e){let t=e.toLowerCase();return js.some(r=>t.includes(r))}function Ws(e){if(!e)return null;if(e.data!==void 0&&e.data!==null){let t=e.data;return typeof t=="string"?t:Buffer.isBuffer(t)?t.toString("base64"):JSON.stringify(t)}if(e.form!==void 0&&e.form!==null)return JSON.stringify(e.form);if(e.multipart!==void 0&&e.multipart!==null){let t=e.multipart,r={};for(let[n,s]of Object.entries(t))typeof s=="string"||typeof s=="number"||typeof s=="boolean"?r[n]=String(s):s&&typeof s=="object"&&"name"in s?r[n]=`[file: ${s.name}]`:r[n]="[binary]";return JSON.stringify(r)}return null}var yt=class yt{constructor(t,r,n){this.originals=new Map;this.capturedCalls=[];this.callCounter=0;this.disposed=false;this._lastCallId=null;this.primitiveCallIds=new Map;this.context=t,this.assertionTracker=r??null,this.apiConfig=n??yt.DEFAULT_API_CONFIG;}get lastCallId(){return this._lastCallId}getCallIdForValue(t){return t!=null&&typeof t=="object"?q.get(t)??null:this.primitiveCallIds.get(t)??null}intercept(){for(let r of zs){let n=this.context[r].bind(this.context);this.originals.set(r,n),this.context[r]=this.createWrapper(r,n);}let t=this.context.dispose.bind(this.context);this.originals.set("dispose",t),this.context.dispose=async r=>(this.disposed=true,t(r));}getData(){return [...this.capturedCalls]}flushLegacyAnnotations(t){this.capturedCalls.length!==0&&t.annotations.push({type:Vs,description:JSON.stringify(this.capturedCalls)});}dispose(){for(let[t,r]of this.originals)this.context[t]=r;this.originals.clear(),this.capturedCalls=[],this.callCounter=0,this._lastCallId=null,this.primitiveCallIds.clear();}get isDisposed(){return this.disposed}getCapturedCalls(){return this.capturedCalls}tagResponseMethods(t,r){let n=this,s=t.headers.bind(t);t.headers=function(){let c=s();return q.set(c,r),c};let a=t.headersArray.bind(t);t.headersArray=function(){let c=a();return q.set(c,r),c};let l=t.json.bind(t);t.json=async function(){let c=await l();return c!=null&&typeof c=="object"&&q.set(c,r),c};let i=t.status.bind(t);t.status=function(){let c=i();return n.primitiveCallIds.set(c,r),c};let o=t.statusText.bind(t);t.statusText=function(){let c=o();return n.primitiveCallIds.set(c,r),c};let p=t.ok.bind(t);t.ok=function(){let c=p();return n.primitiveCallIds.set(c,r),c};let d=t.text.bind(t);t.text=async function(){let c=await d();return n.primitiveCallIds.set(c,r),c};let u=t.body.bind(t);t.body=async function(){let c=await u();return q.set(c,r),c};}createWrapper(t,r){let n=this;return async function(a,l){if(!wr(a,n.apiConfig.apiIncludeUrls,n.apiConfig.apiExcludeUrls))return r(a,l);let i=`api-call-${n.callCounter++}`,o=new Date().toISOString(),p=t==="fetch"?(l?.method??"GET").toUpperCase():t.toUpperCase(),d=Ws(l),u=perf_hooks.performance.now();n._lastCallId=i,n.assertionTracker&&n.assertionTracker.setCurrentCallId(i);let f;try{f=await r(a,l);}catch(c){let g=perf_hooks.performance.now();try{let h=n.apiConfig.captureRequestBody?vt(d,n.apiConfig.redactBodyFields):null,b={id:i,timestamp:o,method:p,url:a,requestHeaders:null,requestBody:h,responseStatusCode:null,responseStatusText:null,responseHeaders:null,responseBody:null,responseTimeMs:Math.round((g-u)*100)/100,isBinary:!1,error:c instanceof Error?c.message:String(c)};n.capturedCalls.push(b);}catch{}throw c}try{let c=perf_hooks.performance.now(),g=f.headers(),h=g["content-type"]??null,b=h?!Gs(h):!1,x=null;n.apiConfig.captureRequestHeaders&&l?.headers&&(x=l.headers);let k=null;n.apiConfig.captureResponseHeaders&&(k=g);let y=n.apiConfig.captureRequestBody?d:null,m=null;if(n.apiConfig.captureResponseBody)try{b?m=(await f.body()).toString("base64"):m=await f.text();}catch{}x=se(x,n.apiConfig.redactHeaders),k=se(k,n.apiConfig.redactHeaders),y=vt(y,n.apiConfig.redactBodyFields),m=vt(m,n.apiConfig.redactBodyFields);let C={id:i,timestamp:o,method:p,url:f.url(),requestHeaders:x,requestBody:y,responseStatusCode:f.status(),responseStatusText:f.statusText(),responseHeaders:k,responseBody:m,responseTimeMs:Math.round((c-u)*100)/100,isBinary:b,error:null};n.capturedCalls.push(C);}catch{}try{f[vr]=i,n.tagResponseMethods(f,i);}catch{}return f}}};yt.DEFAULT_API_CONFIG=Object.freeze({trackApiCalls:true,captureRequestHeaders:true,captureResponseHeaders:true,captureRequestBody:true,captureResponseBody:true,captureAssertions:true,redactHeaders:["authorization","cookie","set-cookie","x-api-key"],redactBodyFields:["password","secret","token","apiKey","api_key"],apiIncludeUrls:[],apiExcludeUrls:[]});var F=yt;var Ks="__testrelic_api_config",Ys="__testrelic_config_trackApiCalls";function ie(e){let t=e.annotations.find(n=>n.type===Ks&&n.description!==void 0);if(t)try{return JSON.parse(t.description,Zs)}catch{}let r=e.annotations.find(n=>n.type===Ys&&n.description!==void 0);return r?{trackApiCalls:r.description!=="false",captureRequestHeaders:true,captureResponseHeaders:true,captureRequestBody:true,captureResponseBody:true,captureAssertions:true,redactHeaders:["authorization","cookie","set-cookie","x-api-key"],redactBodyFields:["password","secret","token","apiKey","api_key"],apiIncludeUrls:[],apiExcludeUrls:[]}:{trackApiCalls:true,captureRequestHeaders:true,captureResponseHeaders:true,captureRequestBody:true,captureResponseBody:true,captureAssertions:true,redactHeaders:["authorization","cookie","set-cookie","x-api-key"],redactBodyFields:["password","secret","token","apiKey","api_key"],apiIncludeUrls:[],apiExcludeUrls:[]}}function Zs(e,t){if(typeof t=="object"&&t!==null&&t.__regexp===true&&typeof t.source=="string"){let{source:r,flags:n}=t;return new RegExp(r,n)}return t}var Cr={page:async({page:e},t,r)=>{let n=new mt(e);try{await n.init();}catch{}await t(e);try{let{navigations:s,networkRequests:a,consoleLogs:l}=await n.getData(),i={testRelicData:!0,version:core.PAYLOAD_VERSION,navigations:s,networkRequests:a,apiCalls:[],apiAssertions:[],consoleLogs:l};await r.attach(core.ATTACHMENT_NAME,{body:Buffer.from(JSON.stringify(i)),contentType:core.ATTACHMENT_CONTENT_TYPE});}catch{}try{await n.flushLegacyAnnotations(r);}catch{}n.dispose();},request:async({request:e},t,r)=>{let n=ie(r);if(!n.trackApiCalls){await t(e);return}let s=new O,a=new F(e,s,n);a.intercept(),await t(e);try{let l=a.getData(),i=n.captureAssertions?s.getData():[],o={testRelicData:!0,version:core.PAYLOAD_VERSION,navigations:[],networkRequests:[],apiCalls:l,apiAssertions:i,consoleLogs:[]};await r.attach(core.ATTACHMENT_NAME,{body:Buffer.from(JSON.stringify(o)),contentType:core.ATTACHMENT_CONTENT_TYPE});}catch{}try{a.flushLegacyAnnotations(r);}catch{}try{s.flushLegacyAnnotations(r);}catch{}a.dispose(),s.dispose();}};test.test.extend(Cr);var ea={request:async({request:e},t,r)=>{let n=ie(r);if(!n.trackApiCalls){await t(e);return}let s=new O,a=new F(e,s,n);a.intercept();let l=[],i=process.stdout.write,o=process.stderr.write;process.stdout.write=function(p,...d){try{let u=typeof p=="string"?p:Buffer.isBuffer(p)?p.toString("utf-8"):String(p);!u.startsWith("[testrelic]")&&!u.startsWith("\u2139 TestRelic")&&!u.startsWith("\u2713 TestRelic")&&!u.startsWith("\u26A0 TestRelic")&&l.push({level:"stdout",text:u.replace(/\n$/,""),timestamp:new Date().toISOString(),location:null});}catch{}return i.apply(process.stdout,[p,...d])},process.stderr.write=function(p,...d){try{let u=typeof p=="string"?p:Buffer.isBuffer(p)?p.toString("utf-8"):String(p);!u.startsWith("[testrelic]")&&!u.startsWith("\u26A0 TestRelic")&&l.push({level:"stderr",text:u.replace(/\n$/,""),timestamp:new Date().toISOString(),location:null});}catch{}return o.apply(process.stderr,[p,...d])};try{await t(e);}finally{process.stdout.write=i,process.stderr.write=o;}try{let p=a.getData(),d=n.captureAssertions?s.getData():[],u={testRelicData:!0,version:core.PAYLOAD_VERSION,navigations:[],networkRequests:[],apiCalls:p,apiAssertions:d,consoleLogs:l};await r.attach(core.ATTACHMENT_NAME,{body:Buffer.from(JSON.stringify(u)),contentType:core.ATTACHMENT_CONTENT_TYPE});}catch{}try{a.flushLegacyAnnotations(r);}catch{}try{s.flushLegacyAnnotations(r);}catch{}a.dispose(),s.dispose();}};var Sr="@testrelic/playwright-analytics";function na(e){return Array.isArray(e)?e.some(t=>Array.isArray(t)&&typeof t[0]=="string"&&t[0]===Sr):false}function sa(e,t){let n={video:"on",screenshot:"on",trace:"on",...e.use??{}},s;Array.isArray(e.reporter)?s=e.reporter:typeof e.reporter=="string"?s=[[e.reporter]]:s=[["list"]];let a=na(s)?s:[...s,[Sr,t??{}]];return test.defineConfig({...e,use:n,reporter:a})}var Rr=false;function Go(e,t,r="manual_record"){if(!e||!e.annotations){Rr||(Rr=true,process.stderr.write(`[testrelic] recordNavigation: reporter not active, navigation not recorded
|
|
2463
|
-
`));return}let n={url:
|
|
2530
|
+
`);}catch{}}switchToStreamingMode(){try{if(this.activeReportMode==="streaming")return;this.activeReportMode="streaming";let e=path.dirname(this.config.outputPath);this.streamingWriter=new W(e);for(let r of this.collectedTests){let n=ve(r.filePath,r.titlePath,r.testId,r.retry),s={id:n,navigations:r.navigations??[],apiAssertions:r.apiAssertions??[],actions:r.actions??[],artifacts:r.artifacts,failureDiagnostic:r.failure,hasNetworkFile:r.networkRequestsFile!==null,networkRequestsCount:r.networkRequestsCount,hasConsoleFile:r.consoleLogsFile!==null,consoleLogsCount:r.consoleLogsCount,hasApiCallsFile:r.apiCallsFile!==null,apiCallsCount:r.apiCallsCount,startedAt:r.startedAt};this.streamingWriter.writeTestDetail(n,s,{networkRequestsFile:r.networkRequestsFile,consoleLogsFile:r.consoleLogsFile,apiCallsFile:r.apiCallsFile});let a={id:n,title:r.titlePath[r.titlePath.length-1]??r.title,titlePath:r.titlePath,filePath:r.filePath,status:r.status,duration:r.duration,project:r.titlePath[1]??"",retryIndex:r.retry,tags:r.tags,hasNetworkData:r.networkRequestsCount>0,hasConsoleData:r.consoleLogsCount>0,hasArtifacts:r.artifacts!==null,hasActionSteps:(r.actions?.length??0)>0,errorMessage:r.failure?.message?.split(`
|
|
2531
|
+
`)[0]??null,networkCount:r.networkRequestsCount,consoleCount:r.consoleLogsCount,actionCount:r.actions?.length??0,isRetry:!1};switch(this.testIndex.push(a),this.summaryCounters.total++,r.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}this.summaryCounters.totalApiCalls+=r.apiCallsCount,this.summaryCounters.totalAssertions+=r.apiAssertions?.length??0,this.summaryCounters.totalNavigations+=r.navigations?.length??0,this.summaryCounters.totalNetworkRequests+=r.networkRequestsCount,this.summaryCounters.totalConsoleLogs+=r.consoleLogsCount,this.summaryCounters.totalActionSteps+=r.actions?.length??0;}this.collectedTests.length=0;}catch{}}buildTimeline(){let e=this.collectedTests.map(r=>({titlePath:r.titlePath,title:r.title,status:r.status,duration:r.duration,startedAt:r.startedAt,completedAt:r.completedAt,retryCount:r.retryCount,retry:r.retry,tags:r.tags,failure:r.failure,specFile:r.specFile,navigations:r.navigations,apiCalls:null,apiAssertions:r.apiAssertions,testId:r.testId,filePath:r.filePath,suiteName:r.suiteName,testType:r.testType,isFlaky:r.isFlaky,retryStatus:r.retryStatus,expectedStatus:r.expectedStatus,actualStatus:r.actualStatus,artifacts:r.artifacts,networkRequests:null,actions:r.actions,consoleLogs:null}));return Zt(e,{navigationTypes:this.config.navigationTypes})}toTestResult(e){return {title:e.title,status:e.status,duration:e.duration,startedAt:e.startedAt,completedAt:e.completedAt,retryCount:e.retryCount,tags:e.tags,failure:e.failure,testId:e.testId,filePath:e.filePath,suiteName:e.suiteName,testType:e.testType,isFlaky:e.isFlaky,retryStatus:e.retryStatus,expectedStatus:e.expectedStatus,actualStatus:e.actualStatus,artifacts:e.artifacts,networkRequests:null,apiCalls:null,apiAssertions:e.apiAssertions,actions:e.actions??null,consoleLogs:null}}writeReport(e){try{let r=JSON.stringify(e),n=this.config.outputPath,s=path.dirname(n);fs$1.mkdirSync(s,{recursive:!0});let a=n+".tmp";fs$1.writeFileSync(a,r,"utf-8"),fs$1.renameSync(a,n);}catch(r){process.stderr.write(`[testrelic] Failed to write report: ${r instanceof Error?r.message:String(r)}
|
|
2532
|
+
`);}}};var Qs=["text/","application/json","application/xml","application/javascript","application/x-www-form-urlencoded","application/graphql"];function Xs(t){let e=t.toLowerCase();return Qs.some(r=>e.includes(r))}var ge=class t{constructor(e,r){this.page=e;this.records=[];this.listeners=[];this.currentNetworkCounter=null;this.pendingRequests=new Map;this.networkWriter=null;this.consoleWriter=null;this.pendingBodyReads=[];this.requestIdCounter=0;this.networkRequestCount=0;this.consoleLogCount=0;this.includeNetworkStats=r?.includeNetworkStats??true,this.origGoto=e.goto.bind(e),this.origGoBack=e.goBack.bind(e),this.origGoForward=e.goForward.bind(e),this.origReload=e.reload.bind(e);try{this.includeNetworkStats&&(this.networkWriter=new N("network")),this.consoleWriter=new N("console");}catch{}this.interceptMethods(),this.attachListeners();}async init(){await this.injectSPADetection();}async finalizeCapturedRequests(){await Promise.allSettled(this.pendingBodyReads),this.pendingBodyReads=[];for(let[,e]of this.pendingRequests)this.networkWriter&&(this.networkWriter.append({url:e.url,method:e.method,resourceType:e.resourceType,statusCode:0,responseTimeMs:Date.now()-e.startTimeMs,startedAt:e.startedAt,requestHeaders:e.headers,requestBody:e.postData,responseBody:null,responseHeaders:null,contentType:null,responseSize:0,requestBodyTruncated:e.postDataTruncated,responseBodyTruncated:false,isBinary:false,error:"incomplete"}),this.networkRequestCount++);this.pendingRequests.clear(),this.networkWriter?.close(),this.consoleWriter?.close();}static mapConsoleType(e){switch(e){case "log":return "log";case "warning":return "warn";case "error":return "error";case "info":return "info";case "debug":return "debug";default:return "log"}}async getFileData(){this.includeNetworkStats&&this.currentNetworkCounter&&this.records.length>0&&(this.records[this.records.length-1].networkStats={totalRequests:this.currentNetworkCounter.totalRequests,failedRequests:this.currentNetworkCounter.failedRequests,failedRequestUrls:[...this.currentNetworkCounter.failedRequestUrls],totalBytes:this.currentNetworkCounter.totalBytes,byType:{...this.currentNetworkCounter.byType}});let e=this.records.map(r=>({url:r.url,navigationType:r.navigationType,timestamp:r.timestamp,domContentLoadedAt:r.domContentLoadedAt,networkIdleAt:r.networkIdleAt,networkStats:r.networkStats}));return this.includeNetworkStats?await this.finalizeCapturedRequests():this.consoleWriter?.close(),{navigations:e,networkRequestsFile:this.networkWriter?.getCount()?this.networkWriter.getPath():null,networkRequestsCount:this.networkWriter?.getCount()??0,consoleLogsFile:this.consoleWriter?.getCount()?this.consoleWriter.getPath():null,consoleLogsCount:this.consoleWriter?.getCount()??0}}async flushLegacyAnnotations(e){}dispose(){this.page.goto=this.origGoto,this.page.goBack=this.origGoBack,this.page.goForward=this.origGoForward,this.page.reload=this.origReload;for(let{event:e,handler:r}of this.listeners)this.page.off(e,r);this.listeners=[],this.records=[],this.pendingRequests.clear(),this.pendingBodyReads=[],this.networkWriter?.close(),this.consoleWriter?.close();}getRecords(){return this.records}interceptMethods(){let e=this,r=this.page;r.goto=async function(n,s){return e.recordNavigation(n,"goto"),e.origGoto(n,s)},r.goBack=async function(n){let s=await e.origGoBack(n);return e.recordNavigation(r.url(),"back"),s},r.goForward=async function(n){let s=await e.origGoForward(n);return e.recordNavigation(r.url(),"forward"),s},r.reload=async function(n){return e.recordNavigation(r.url(),"refresh"),e.origReload(n)};}attachListeners(){let e=()=>{this.lastDomContentLoaded=new Date().toISOString(),this.records.length>0&&(this.records[this.records.length-1].domContentLoadedAt=this.lastDomContentLoaded);};this.page.on("domcontentloaded",e),this.listeners.push({event:"domcontentloaded",handler:e});let r=s=>{try{let a=s;if(typeof a.parentFrame=="function"&&a.parentFrame()!==null)return;let o=a.url(),i=this.records[this.records.length-1];if(i&&Date.now()-new Date(i.timestamp).getTime()<50&&i.url===o)return;this.recordNavigation(o,"navigation");}catch{}};this.page.on("framenavigated",r),this.listeners.push({event:"framenavigated",handler:r});let n=s=>{try{let a=s,o=a.type(),i=a.text();if(o==="debug"&&i.startsWith("__testrelic_nav:")){try{let l=JSON.parse(i.slice(16));l.type&&l.url&&this.recordNavigation(l.url,l.type);}catch{}return}{let l=null;try{let d=a.location();d&&d.url&&(l=`${d.url}:${d.lineNumber}:${d.columnNumber}`);}catch{}let c=t.mapConsoleType(o);this.consoleWriter&&(this.consoleWriter.append({level:c,text:i,timestamp:new Date().toISOString(),location:l}),this.consoleLogCount++);}}catch{}};if(this.page.on("console",n),this.listeners.push({event:"console",handler:n}),this.includeNetworkStats){let s=i=>{this.currentNetworkCounter&&this.currentNetworkCounter.totalRequests++;try{let l=i,c=String(this.requestIdCounter++),d=l.postData()??null,p={url:l.url(),method:l.method(),resourceType:this.mapResourceType(l.resourceType()),headers:l.headers(),postData:d,postDataTruncated:!1,startedAt:new Date().toISOString(),startTimeMs:Date.now()};this.pendingRequests.set(c,p),i.__testrelic_id=c;}catch{}};this.page.on("request",s),this.listeners.push({event:"request",handler:s});let a=i=>{try{let l=i;if(this.currentNetworkCounter){let x=l.status();x>=400&&(this.currentNetworkCounter.failedRequests++,this.currentNetworkCounter.failedRequestUrls.push(x+" "+l.url()));let C=l.headers()["content-length"];C&&(this.currentNetworkCounter.totalBytes+=parseInt(C,10)||0);let b=l.request().resourceType(),y=this.mapResourceType(b);this.currentNetworkCounter.byType[y]++;}let c=l.request().__testrelic_id;if(!c)return;let d=this.pendingRequests.get(c);if(!d)return;this.pendingRequests.delete(c);let p=Date.now()-d.startTimeMs,f=l.headers(),u=f["content-type"]??null,g=parseInt(f["content-length"]??"0",10)||0,h=u?!Xs(u):!1,m=(async()=>{let x=null;if(!h)try{x=(await l.body()).toString("utf-8");}catch{}let C={url:d.url,method:d.method,resourceType:d.resourceType,statusCode:l.status(),responseTimeMs:p,startedAt:d.startedAt,requestHeaders:d.headers,requestBody:d.postData,responseBody:x,responseHeaders:f,contentType:u,responseSize:g,requestBodyTruncated:d.postDataTruncated,responseBodyTruncated:!1,isBinary:h,error:null};this.networkWriter&&(this.networkWriter.append(C),this.networkRequestCount++);})();this.pendingBodyReads.push(m);}catch{}};this.page.on("response",a),this.listeners.push({event:"response",handler:a});let o=i=>{if(this.currentNetworkCounter){this.currentNetworkCounter.failedRequests++;try{let l=i;this.currentNetworkCounter.failedRequestUrls.push("ERR "+l.url());}catch{}}try{let l=i,c=l.__testrelic_id;if(!c)return;let d=this.pendingRequests.get(c);if(!d)return;this.pendingRequests.delete(c);let p={url:d.url,method:d.method,resourceType:d.resourceType,statusCode:0,responseTimeMs:Date.now()-d.startTimeMs,startedAt:d.startedAt,requestHeaders:d.headers,requestBody:d.postData,responseBody:null,responseHeaders:null,contentType:null,responseSize:0,requestBodyTruncated:d.postDataTruncated,responseBodyTruncated:!1,isBinary:!1,error:l.failure()?.errorText??"Unknown error"};this.networkWriter&&(this.networkWriter.append(p),this.networkRequestCount++);}catch{}};this.page.on("requestfailed",o),this.listeners.push({event:"requestfailed",handler:o});}}async injectSPADetection(){try{await this.page.addInitScript(()=>{let e=history.pushState.bind(history),r=history.replaceState.bind(history);history.pushState=function(...n){e(...n),console.debug("__testrelic_nav:"+JSON.stringify({type:"spa_route",url:location.href}));},history.replaceState=function(...n){r(...n),console.debug("__testrelic_nav:"+JSON.stringify({type:"spa_replace",url:location.href}));},window.addEventListener("popstate",()=>{console.debug("__testrelic_nav:"+JSON.stringify({type:"popstate",url:location.href}));}),window.addEventListener("hashchange",()=>{console.debug("__testrelic_nav:"+JSON.stringify({type:"hash_change",url:location.href}));});});}catch{}}recordNavigation(e,r){this.includeNetworkStats&&this.currentNetworkCounter&&this.records.length>0&&(this.records[this.records.length-1].networkStats={totalRequests:this.currentNetworkCounter.totalRequests,failedRequests:this.currentNetworkCounter.failedRequests,failedRequestUrls:[...this.currentNetworkCounter.failedRequestUrls],totalBytes:this.currentNetworkCounter.totalBytes,byType:{...this.currentNetworkCounter.byType}}),this.records.push({url:e,navigationType:r,timestamp:new Date().toISOString()}),this.includeNetworkStats&&(this.currentNetworkCounter=this.createNetworkCounter());}createNetworkCounter(){return {totalRequests:0,failedRequests:0,failedRequestUrls:[],totalBytes:0,byType:{xhr:0,document:0,script:0,stylesheet:0,image:0,font:0,other:0}}}mapResourceType(e){switch(e){case "xhr":case "fetch":return "xhr";case "document":return "document";case "script":return "script";case "stylesheet":return "stylesheet";case "image":return "image";case "font":return "font";default:return "other"}}};var xr=Symbol.for("__testrelic_call_id"),ea="__testrelic_api_assertions",U=new WeakMap,H=class{constructor(){this.assertions=[];this.currentCallId=null;}recordAssertion(e){this.assertions.push(e);}getAssertions(){return this.assertions}setCurrentCallId(e){this.currentCallId=e;}getCurrentCallId(){return this.currentCallId}getData(){return [...this.assertions]}flushLegacyAnnotations(e){this.assertions.length!==0&&e.annotations.push({type:ea,description:JSON.stringify(this.assertions)});}dispose(){this.assertions=[],this.currentCallId=null;}};var kr="[REDACTED]";function tt(t,e){if(t===null||e.length===0)return t;let r=new Set(e.map(s=>s.toLowerCase())),n={};for(let s of Object.keys(t))Object.hasOwn(t,s)&&(n[s]=r.has(s.toLowerCase())?kr:t[s]);return n}function he(t,e){if(t===null||e.length===0)return t;let r;try{r=JSON.parse(t);}catch{return t}if(typeof r!="object"||r===null)return t;let n=new Set(e),s=et(r,n);return JSON.stringify(s)}function et(t,e){if(Array.isArray(t))return t.map(r=>et(r,e));if(typeof t=="object"&&t!==null){let r={};for(let n of Object.keys(t)){if(!Object.hasOwn(t,n))continue;let s=t[n];e.has(n)?r[n]=kr:r[n]=et(s,e);}return r}return t}function Tr(t,e,r){if(r.length>0){for(let n of r)if(Cr(t,n))return false}if(e.length>0){for(let n of e)if(Cr(t,n))return true;return false}return true}function Cr(t,e){try{return e instanceof RegExp?e.test(t):ta(e).test(t)}catch{return console.warn(`[testrelic] Invalid URL filter pattern: ${String(e)}`),false}}function ta(t){let e="",r=0;for(;r<t.length;){let n=t[r];n==="*"&&t[r+1]==="*"?(e+=".*",r+=2,t[r]==="/"&&r++):n==="*"?(e+="[^/]*",r++):n==="?"?(e+="[^/]",r++):".+^${}()|[]\\".includes(n)?(e+="\\"+n,r++):(e+=n,r++);}return new RegExp(e)}var ra=["get","post","put","patch","delete","head","fetch"],na=["text/","application/json","application/xml","application/javascript","application/x-www-form-urlencoded","application/graphql"];function sa(t){let e=t.toLowerCase();return na.some(r=>e.includes(r))}function aa(t){if(!t)return null;if(t.data!==void 0&&t.data!==null){let e=t.data;return typeof e=="string"?e:Buffer.isBuffer(e)?e.toString("base64"):JSON.stringify(e)}if(t.form!==void 0&&t.form!==null)return JSON.stringify(t.form);if(t.multipart!==void 0&&t.multipart!==null){let e=t.multipart,r={};for(let[n,s]of Object.entries(e))typeof s=="string"||typeof s=="number"||typeof s=="boolean"?r[n]=String(s):s&&typeof s=="object"&&"name"in s?r[n]=`[file: ${s.name}]`:r[n]="[binary]";return JSON.stringify(r)}return null}var me=class me{constructor(e,r,n){this.originals=new Map;this.apiCallWriter=null;this.callCounter=0;this.apiCallCount=0;this.disposed=false;this._lastCallId=null;this.primitiveCallIds=new Map;this.context=e,this.assertionTracker=r??null,this.apiConfig=n??me.DEFAULT_API_CONFIG;try{this.apiCallWriter=new N("api-calls");}catch{}}get lastCallId(){return this._lastCallId}getCallIdForValue(e){return e!=null&&typeof e=="object"?U.get(e)??null:this.primitiveCallIds.get(e)??null}intercept(){for(let r of ra){let n=this.context[r].bind(this.context);this.originals.set(r,n),this.context[r]=this.createWrapper(r,n);}let e=this.context.dispose.bind(this.context);this.originals.set("dispose",e),this.context.dispose=async r=>(this.disposed=true,e(r));}getFileData(){return this.apiCallWriter?.close(),{apiCallsFile:this.apiCallWriter?.getCount()?this.apiCallWriter.getPath():null,apiCallsCount:this.apiCallWriter?.getCount()??0}}flushLegacyAnnotations(e){}dispose(){for(let[e,r]of this.originals)this.context[e]=r;this.originals.clear(),this.apiCallWriter?.close(),this.callCounter=0,this.apiCallCount=0,this._lastCallId=null,this.primitiveCallIds.clear();}get isDisposed(){return this.disposed}getCapturedCallCount(){return this.apiCallCount}tagResponseMethods(e,r){let n=this,s=e.headers.bind(e);e.headers=function(){let u=s();return U.set(u,r),u};let a=e.headersArray.bind(e);e.headersArray=function(){let u=a();return U.set(u,r),u};let o=e.json.bind(e);e.json=async function(){let u=await o();return u!=null&&typeof u=="object"&&U.set(u,r),u};let i=e.status.bind(e);e.status=function(){let u=i();return n.primitiveCallIds.set(u,r),u};let l=e.statusText.bind(e);e.statusText=function(){let u=l();return n.primitiveCallIds.set(u,r),u};let c=e.ok.bind(e);e.ok=function(){let u=c();return n.primitiveCallIds.set(u,r),u};let d=e.text.bind(e);e.text=async function(){let u=await d();return n.primitiveCallIds.set(u,r),u};let p=e.body.bind(e);e.body=async function(){let u=await p();return U.set(u,r),u};}createWrapper(e,r){let n=this;return async function(a,o){if(!Tr(a,n.apiConfig.apiIncludeUrls,n.apiConfig.apiExcludeUrls))return r(a,o);let i=`api-call-${n.callCounter++}`,l=new Date().toISOString(),c=e==="fetch"?(o?.method??"GET").toUpperCase():e.toUpperCase(),d=aa(o),p=perf_hooks.performance.now();n._lastCallId=i,n.assertionTracker&&n.assertionTracker.setCurrentCallId(i);let f;try{f=await r(a,o);}catch(u){let g=perf_hooks.performance.now();try{let h=n.apiConfig.captureRequestBody?he(d,n.apiConfig.redactBodyFields):null,m={id:i,timestamp:l,method:c,url:a,requestHeaders:null,requestBody:h,responseStatusCode:null,responseStatusText:null,responseHeaders:null,responseBody:null,responseTimeMs:Math.round((g-p)*100)/100,isBinary:!1,error:u instanceof Error?u.message:String(u)};n.apiCallWriter&&(n.apiCallWriter.append(m),n.apiCallCount++);}catch{}throw u}try{let u=perf_hooks.performance.now(),g=f.headers(),h=g["content-type"]??null,m=h?!sa(h):!1,x=null;n.apiConfig.captureRequestHeaders&&o?.headers&&(x=o.headers);let C=null;n.apiConfig.captureResponseHeaders&&(C=g);let b=n.apiConfig.captureRequestBody?d:null,y=null;if(n.apiConfig.captureResponseBody)try{m?y=(await f.body()).toString("base64"):y=await f.text();}catch{}x=tt(x,n.apiConfig.redactHeaders),C=tt(C,n.apiConfig.redactHeaders),b=he(b,n.apiConfig.redactBodyFields),y=he(y,n.apiConfig.redactBodyFields);let T={id:i,timestamp:l,method:c,url:f.url(),requestHeaders:x,requestBody:b,responseStatusCode:f.status(),responseStatusText:f.statusText(),responseHeaders:C,responseBody:y,responseTimeMs:Math.round((u-p)*100)/100,isBinary:m,error:null};n.apiCallWriter&&(n.apiCallWriter.append(T),n.apiCallCount++);}catch{}try{f[xr]=i,n.tagResponseMethods(f,i);}catch{}return f}}};me.DEFAULT_API_CONFIG=Object.freeze({trackApiCalls:true,captureRequestHeaders:true,captureResponseHeaders:true,captureRequestBody:true,captureResponseBody:true,captureAssertions:true,redactHeaders:["authorization","cookie","set-cookie","x-api-key"],redactBodyFields:["password","secret","token","apiKey","api_key"],apiIncludeUrls:[],apiExcludeUrls:[]});var $=me;var oa="__testrelic_api_config",la="__testrelic_config_trackApiCalls";function nt(t){let e=t.annotations.find(n=>n.type===oa&&n.description!==void 0);if(e)try{return JSON.parse(e.description,da)}catch{}let r=t.annotations.find(n=>n.type===la&&n.description!==void 0);return r?{trackApiCalls:r.description!=="false",captureRequestHeaders:true,captureResponseHeaders:true,captureRequestBody:true,captureResponseBody:true,captureAssertions:true,redactHeaders:["authorization","cookie","set-cookie","x-api-key"],redactBodyFields:["password","secret","token","apiKey","api_key"],apiIncludeUrls:[],apiExcludeUrls:[]}:{trackApiCalls:true,captureRequestHeaders:true,captureResponseHeaders:true,captureRequestBody:true,captureResponseBody:true,captureAssertions:true,redactHeaders:["authorization","cookie","set-cookie","x-api-key"],redactBodyFields:["password","secret","token","apiKey","api_key"],apiIncludeUrls:[],apiExcludeUrls:[]}}function da(t,e){if(typeof e=="object"&&e!==null&&e.__regexp===true&&typeof e.source=="string"){let{source:r,flags:n}=e;return new RegExp(r,n)}return e}var _r={page:async({page:t},e,r)=>{let n=new ge(t);try{await n.init();}catch{}await e(t);try{let{navigations:s,networkRequestsFile:a,networkRequestsCount:o,consoleLogsFile:i,consoleLogsCount:l}=await n.getFileData(),c={testRelicData:!0,version:core.PAYLOAD_VERSION,navigations:s,apiAssertions:[],networkRequestsFile:a,networkRequestsCount:o,consoleLogsFile:i,consoleLogsCount:l,apiCallsFile:null,apiCallsCount:0};await r.attach(core.ATTACHMENT_NAME,{body:Buffer.from(JSON.stringify(c)),contentType:core.ATTACHMENT_CONTENT_TYPE});}catch{}n.dispose();},request:async({request:t},e,r)=>{let n=nt(r);if(!n.trackApiCalls){await e(t);return}let s=new H,a=new $(t,s,n);a.intercept(),await e(t);try{let{apiCallsFile:o,apiCallsCount:i}=a.getFileData(),l=n.captureAssertions?s.getData():[],c={testRelicData:!0,version:core.PAYLOAD_VERSION,navigations:[],apiAssertions:l,networkRequestsFile:null,networkRequestsCount:0,consoleLogsFile:null,consoleLogsCount:0,apiCallsFile:o,apiCallsCount:i};await r.attach(core.ATTACHMENT_NAME,{body:Buffer.from(JSON.stringify(c)),contentType:core.ATTACHMENT_CONTENT_TYPE});}catch{}a.dispose(),s.dispose();}};test.test.extend(_r);var fa={request:async({request:t},e,r)=>{let n=nt(r);if(!n.trackApiCalls){await e(t);return}let s=new H,a=new $(t,s,n);a.intercept();let o=null;try{o=new N("api-console");}catch{}let i=0,l=process.stdout.write,c=process.stderr.write;process.stdout.write=function(d,...p){try{let f=typeof d=="string"?d:Buffer.isBuffer(d)?d.toString("utf-8"):String(d);!f.startsWith("[testrelic]")&&!f.startsWith("\u2139 TestRelic")&&!f.startsWith("\u2713 TestRelic")&&!f.startsWith("\u26A0 TestRelic")&&o&&(o.append({level:"stdout",text:f.replace(/\n$/,""),timestamp:new Date().toISOString(),location:null}),i++);}catch{}return l.apply(process.stdout,[d,...p])},process.stderr.write=function(d,...p){try{let f=typeof d=="string"?d:Buffer.isBuffer(d)?d.toString("utf-8"):String(d);!f.startsWith("[testrelic]")&&!f.startsWith("\u26A0 TestRelic")&&o&&(o.append({level:"stderr",text:f.replace(/\n$/,""),timestamp:new Date().toISOString(),location:null}),i++);}catch{}return c.apply(process.stderr,[d,...p])};try{await e(t);}finally{process.stdout.write=l,process.stderr.write=c;}try{o?.close();let{apiCallsFile:d,apiCallsCount:p}=a.getFileData(),f=n.captureAssertions?s.getData():[],u={testRelicData:!0,version:core.PAYLOAD_VERSION,navigations:[],apiAssertions:f,networkRequestsFile:null,networkRequestsCount:0,consoleLogsFile:i>0?o?.getPath()??null:null,consoleLogsCount:i,apiCallsFile:d,apiCallsCount:p};await r.attach(core.ATTACHMENT_NAME,{body:Buffer.from(JSON.stringify(u)),contentType:core.ATTACHMENT_CONTENT_TYPE});}catch{}a.dispose(),s.dispose();}};var Ir="@testrelic/playwright-analytics";function ha(t){return Array.isArray(t)?t.some(e=>Array.isArray(e)&&typeof e[0]=="string"&&e[0]===Ir):false}function ma(t,e){let n={video:"on",screenshot:"on",trace:"on",...t.use??{}},s;Array.isArray(t.reporter)?s=t.reporter:typeof t.reporter=="string"?s=[[t.reporter]]:s=[["list"]];let a=ha(s)?s:[...s,[Ir,e??{}]];return test.defineConfig({...t,use:n,reporter:a})}var Lr=false;function hl(t,e,r="manual_record"){if(!t||!t.annotations){Lr||(Lr=true,process.stderr.write(`[testrelic] recordNavigation: reporter not active, navigation not recorded
|
|
2533
|
+
`));return}let n={url:e,navigationType:r,timestamp:new Date().toISOString()};t.annotations.push({type:"lambdatest-navigation",description:JSON.stringify(n)});}Object.defineProperty(exports,"ATTACHMENT_CONTENT_TYPE",{enumerable:true,get:function(){return core.ATTACHMENT_CONTENT_TYPE}});Object.defineProperty(exports,"ATTACHMENT_NAME",{enumerable:true,get:function(){return core.ATTACHMENT_NAME}});Object.defineProperty(exports,"PAYLOAD_VERSION",{enumerable:true,get:function(){return core.PAYLOAD_VERSION}});Object.defineProperty(exports,"isTestRelicDataPayload",{enumerable:true,get:function(){return core.isTestRelicDataPayload}});exports.SCHEMA_VERSION=X;exports.default=fe;exports.defineConfig=ma;exports.recordNavigation=hl;exports.testRelicApiFixture=fa;exports.testRelicFixture=_r;//# sourceMappingURL=index.cjs.map
|
|
2464
2534
|
//# sourceMappingURL=index.cjs.map
|