@testrelic/playwright-analytics 1.3.0 → 2.0.0

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/index.cjs CHANGED
@@ -1,6 +1,6 @@
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');var rt=[/AKIA[A-Z0-9]{16}/g,/Bearer\s+[A-Za-z0-9\-._~+/]+=*/g,/-----BEGIN\s+(RSA\s+)?PRIVATE\sKEY-----[\s\S]*?-----END/g,/\/\/[^:]+:[^@]+@/g];function A(e){if(e!==void 0&&!core.isValidConfig(e))throw core.createError(core.ErrorCode.CONFIG_INVALID,"Invalid reporter configuration");let t=Object.create(null);t.outputPath=e?.outputPath??"./test-results/analytics-timeline.json",t.includeStackTrace=e?.includeStackTrace??false,t.includeCodeSnippets=e?.includeCodeSnippets??true,t.codeContextLines=e?.codeContextLines??3,t.includeNetworkStats=e?.includeNetworkStats??true,t.navigationTypes=e?.navigationTypes??null,t.redactPatterns=[...rt,...e?.redactPatterns??[]],t.testRunId=e?.testRunId??null,t.metadata=e?.metadata??null;let a=t.outputPath;return t.openReport=e?.openReport??true,t.htmlReportPath=e?.htmlReportPath??a.replace(/\.json$/,".html"),t.includeArtifacts=e?.includeArtifacts??true,Object.freeze(t)}var x="1.2.0";function I(e,t,a){try{let s=fs.readFileSync(e,"utf-8").split(`
2
- `);if(t<1||t>s.length)return null;let i=Math.max(1,t-a),o=Math.min(s.length,t+a),d=[];for(let n=i;n<=o;n++){let c=n===t?">":" ",p=String(n).padStart(String(o).length," ");d.push(`${c} ${p} | ${s[n-1]}`);}return d.join(`
3
- `)}catch{return null}}function M(e){return t=>{let a=t;for(let r of e)if(typeof r=="string"){let s=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");a=a.replace(new RegExp(s,"g"),"[REDACTED]");}else {let s=r.flags.includes("g")?r.flags:r.flags+"g",i=new RegExp(r.source,s);a=a.replace(i,"[REDACTED]");}return a}}function it(e){return e.GITHUB_ACTIONS!=="true"?null:{provider:"github-actions",buildId:e.GITHUB_RUN_ID??null,commitSha:e.GITHUB_SHA??null,branch:e.GITHUB_REF_NAME??null}}function nt(e){return e.GITLAB_CI!=="true"?null:{provider:"gitlab-ci",buildId:e.CI_PIPELINE_ID??null,commitSha:e.CI_COMMIT_SHA??null,branch:e.CI_COMMIT_BRANCH??e.CI_COMMIT_REF_NAME??null}}function ot(e){if(!e.JENKINS_URL)return null;let t=e.GIT_BRANCH??null;return t?.startsWith("origin/")&&(t=t.slice(7)),{provider:"jenkins",buildId:e.BUILD_ID??null,commitSha:e.GIT_COMMIT??null,branch:t}}function lt(e){return e.CIRCLECI!=="true"?null:{provider:"circleci",buildId:e.CIRCLE_BUILD_NUM??null,commitSha:e.CIRCLE_SHA1??null,branch:e.CIRCLE_BRANCH??null}}var dt=[it,nt,ot,lt];function F(e){let t=process.env;for(let a of dt){let r=a(t);if(r)return r}return null}var E=`
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'),test=require('@playwright/test'),perf_hooks=require('perf_hooks');var Et=[/AKIA[A-Z0-9]{16}/g,/Bearer\s+[A-Za-z0-9\-._~+/]+=*/g,/-----BEGIN\s+(RSA\s+)?PRIVATE\sKEY-----[\s\S]*?-----END/g,/\/\/[^:]+:[^@]+@/g],Ft=["authorization","cookie","set-cookie","x-api-key"],Mt=["password","secret","token","apiKey","api_key"];function G(e){let t=Object.create(null);return t.trackApiCalls=e?.trackApiCalls??true,t.captureRequestHeaders=e?.captureRequestHeaders??true,t.captureResponseHeaders=e?.captureResponseHeaders??true,t.captureRequestBody=e?.captureRequestBody??true,t.captureResponseBody=e?.captureResponseBody??true,t.captureAssertions=e?.captureAssertions??true,t.redactHeaders=e?.redactHeaders??[...Ft],t.redactBodyFields=e?.redactBodyFields??[...Mt],t.apiIncludeUrls=e?.apiIncludeUrls??[],t.apiExcludeUrls=e?.apiExcludeUrls??[],Object.freeze(t)}function V(e){if(e!==void 0&&!core.isValidConfig(e))throw core.createError(core.ErrorCode.CONFIG_INVALID,"Invalid reporter configuration");let t=Object.create(null);t.outputPath=e?.outputPath??"./test-results/analytics-timeline.json",t.includeStackTrace=e?.includeStackTrace??false,t.includeCodeSnippets=e?.includeCodeSnippets??true,t.codeContextLines=e?.codeContextLines??3,t.includeNetworkStats=e?.includeNetworkStats??true,t.navigationTypes=e?.navigationTypes??null,t.redactPatterns=[...Et,...e?.redactPatterns??[]],t.testRunId=e?.testRunId??null,t.metadata=e?.metadata??null;let r=t.outputPath;return t.openReport=e?.openReport??true,t.htmlReportPath=e?.htmlReportPath??r.replace(/\.json$/,".html"),t.includeArtifacts=e?.includeArtifacts??true,t.trackApiCalls=e?.trackApiCalls??true,t.quiet=e?.quiet??false,Object.freeze(t)}var M="1.3.0";function J(e,t,r){try{let n=fs.readFileSync(e,"utf-8").split(`
2
+ `);if(t<1||t>n.length)return null;let s=Math.max(1,t-r),i=Math.min(n.length,t+r),o=[];for(let d=s;d<=i;d++){let p=d===t?">":" ",l=String(d).padStart(String(i).length," ");o.push(`${p} ${l} | ${n[d-1]}`);}return o.join(`
3
+ `)}catch{return null}}function Y(e){return t=>{let r=t;for(let a of e)if(typeof a=="string"){let n=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");r=r.replace(new RegExp(n,"g"),"[REDACTED]");}else {let n=a.flags.includes("g")?a.flags:a.flags+"g",s=new RegExp(a.source,n);r=r.replace(s,"[REDACTED]");}return r}}function Pt(e){return e.GITHUB_ACTIONS!=="true"?null:{provider:"github-actions",buildId:e.GITHUB_RUN_ID??null,commitSha:e.GITHUB_SHA??null,branch:e.GITHUB_REF_NAME??null}}function Ot(e){return e.GITLAB_CI!=="true"?null:{provider:"gitlab-ci",buildId:e.CI_PIPELINE_ID??null,commitSha:e.CI_COMMIT_SHA??null,branch:e.CI_COMMIT_BRANCH??e.CI_COMMIT_REF_NAME??null}}function Ht(e){if(!e.JENKINS_URL)return null;let t=e.GIT_BRANCH??null;return t?.startsWith("origin/")&&(t=t.slice(7)),{provider:"jenkins",buildId:e.BUILD_ID??null,commitSha:e.GIT_COMMIT??null,branch:t}}function zt(e){return e.CIRCLECI!=="true"?null:{provider:"circleci",buildId:e.CIRCLE_BUILD_NUM??null,commitSha:e.CIRCLE_SHA1??null,branch:e.CIRCLE_BRANCH??null}}var Ut=[Pt,Ot,Ht,zt];function Z(e){let t=process.env;for(let r of Ut){let a=r(t);if(a)return a}return null}var K=`
4
4
  /* Theme Variables */
5
5
  :root,[data-theme="dark"]{
6
6
  --bg:#0f1117;--bg-1:#161b22;--bg-2:#1c2128;--bg-3:#21262d;--bg-code:#13111c;
@@ -80,7 +80,7 @@ body{
80
80
  .s-timedout{background:rgba(249,115,22,0.06)}.s-timedout .s-count{color:#f97316}
81
81
 
82
82
  /* \u2500\u2500 Filter Bar \u2500\u2500 */
83
- .filter-bar{display:flex;align-items:center;gap:12px;margin-bottom:24px;flex-wrap:wrap}
83
+ .filter-bar{display:flex;align-items:center;gap:8px;margin-bottom:24px;flex-wrap:wrap}
84
84
  .filter-chips{display:flex;gap:5px;flex-wrap:wrap}
85
85
  .filter-chip{
86
86
  font-size:12px;font-weight:500;padding:5px 14px;border-radius:9999px;
@@ -91,14 +91,32 @@ body{
91
91
  .filter-chip.active{background:rgba(3,183,156,0.12);border-color:#03b79c;color:#2dd4a8}
92
92
  .chip-count{font-weight:700;margin-left:3px}
93
93
  .filter-chip--zero{opacity:.35;pointer-events:none}
94
- .filter-section{display:flex;align-items:center;gap:5px;flex-wrap:wrap}
95
- .filter-section-label{font-size:10px;font-weight:600;color:var(--fg-2);text-transform:uppercase;letter-spacing:.04em;margin-right:4px}
96
94
  .filter-chip--dimmed{opacity:.45}
97
- .filter-actions{display:flex;align-items:center;gap:12px;margin-left:auto}
98
95
  .filter-clear{font-size:11px;font-weight:600;color:#03b79c;background:none;border:none;cursor:pointer;padding:4px 8px;border-radius:6px;font-family:inherit;transition:background .15s}
99
96
  .filter-clear:hover{background:rgba(3,183,156,0.1)}
100
97
  .filter-indicator{font-size:11px;color:var(--fg-2)}
101
- .search-box{position:relative;margin-left:auto;width:220px;flex-shrink:0}
98
+
99
+ /* \u2500\u2500 Filter Icon Button \u2500\u2500 */
100
+ .filter-icon-btn{position:relative;display:flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:8px;border:1px solid var(--bd-m);background:transparent;color:var(--fg-2);cursor:pointer;transition:all .15s;flex-shrink:0;margin-left:auto}
101
+ .filter-icon-btn:hover{background:var(--hvr);color:var(--fg);border-color:var(--bd-l)}
102
+ .filter-icon-badge{position:absolute;top:5px;right:5px;width:7px;height:7px;border-radius:50%;background:#03b79c}
103
+
104
+ /* \u2500\u2500 Filter Drawer \u2500\u2500 */
105
+ .filter-drawer-backdrop{position:fixed;inset:0;background:var(--overlay-bg);z-index:100;opacity:0;pointer-events:none;transition:opacity .25s ease}
106
+ .filter-drawer-backdrop.open{opacity:1;pointer-events:auto}
107
+ .filter-drawer{position:fixed;top:0;right:0;bottom:0;width:340px;max-width:90vw;z-index:110;background:var(--bg-1);border-left:1px solid var(--bd);transform:translateX(100%);transition:transform .3s cubic-bezier(.4,0,.2,1);display:flex;flex-direction:column;overflow:hidden;box-shadow:-4px 0 24px var(--shadow-c)}
108
+ .filter-drawer.open{transform:translateX(0)}
109
+ .filter-drawer-bar{display:flex;align-items:center;justify-content:space-between;padding:14px 20px;border-bottom:1px solid var(--bd);background:linear-gradient(180deg,rgba(3,183,156,0.04) 0%,transparent 100%);flex-shrink:0}
110
+ .filter-drawer-title{font-size:12px;font-weight:600;color:var(--fg-1);text-transform:uppercase;letter-spacing:.06em}
111
+ .filter-drawer-close{width:32px;height:32px;border-radius:8px;border:1px solid var(--bd-m);background:transparent;color:var(--fg-1);font-size:18px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s,color .15s}
112
+ .filter-drawer-close:hover{background:var(--bd);color:var(--fg)}
113
+ .filter-drawer-body{flex:1;overflow-y:auto;padding:20px;scrollbar-width:thin;scrollbar-color:var(--scroll-thumb) transparent}
114
+ .filter-drawer-body::-webkit-scrollbar{width:5px}
115
+ .filter-drawer-body::-webkit-scrollbar-thumb{background:var(--bg-3);border-radius:3px}
116
+ .filter-drawer-section{margin-bottom:20px}
117
+ .filter-drawer-section-label{display:block;font-size:10px;font-weight:600;color:var(--fg-2);text-transform:uppercase;letter-spacing:.04em;margin-bottom:8px}
118
+ .filter-drawer-actions{display:flex;align-items:center;gap:12px;padding-top:16px;border-top:1px solid var(--bd)}
119
+ .search-box{position:relative;width:280px;flex-shrink:1;min-width:180px;margin-left:0}
102
120
  .search-input{
103
121
  width:100%;padding:6px 10px 6px 32px;
104
122
  border:1px solid var(--bd-m);border-radius:8px;
@@ -437,6 +455,8 @@ body{
437
455
  .summary-chip{min-width:70px}
438
456
  .filter-bar{flex-direction:column;align-items:stretch}
439
457
  .search-box{width:100%;margin-left:0}
458
+ .filter-icon-btn{margin-left:auto}
459
+ .filter-drawer{width:100%;max-width:100%}
440
460
  .drawer{width:100%;max-width:100%}
441
461
  .cta-btn{font-size:10px;padding:5px 10px;order:10}
442
462
  .detail-title{font-size:14px}
@@ -446,22 +466,22 @@ body{
446
466
  /* \u2500\u2500 Print \u2500\u2500 */
447
467
  @media print{
448
468
  body{background:#fff;color:#000}
449
- .drawer-backdrop,.drawer{display:none}
469
+ .drawer-backdrop,.drawer,.filter-drawer-backdrop,.filter-drawer{display:none}
450
470
  .lightbox-overlay,.lightbox-close{display:none}
451
471
  .test-row-arrow{display:none}
452
472
  .summary-chip,.filter-chip,.status-indicator,.detail-status-badge,.dm-badge,.nav-badge,.trb,.step-node{
453
473
  print-color-adjust:exact;-webkit-print-color-adjust:exact;
454
474
  }
455
475
  }
456
- `;var _=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 196 247" fill="none">
476
+ `;var X=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 196 247" fill="none">
457
477
  <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)"/>
458
478
  <defs><linearGradient id="paint0_linear_55_11" x1="98" y1="0.000244141" x2="98" y2="247" gradientUnits="userSpaceOnUse">
459
479
  <stop stop-color="#03B79C"/><stop offset="0.504808" stop-color="#4EDAA4"/><stop offset="0.865285" stop-color="#84F3AA"/>
460
- </linearGradient></defs></svg>`,N=`<svg width="32" height="40" viewBox="0 0 196 247" fill="none" xmlns="http://www.w3.org/2000/svg">
480
+ </linearGradient></defs></svg>`,W=`<svg width="32" height="40" viewBox="0 0 196 247" fill="none" xmlns="http://www.w3.org/2000/svg">
461
481
  <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)"/>
462
482
  <defs><linearGradient id="paint0_linear_55_11" x1="98" y1="0.000244141" x2="98" y2="247" gradientUnits="userSpaceOnUse">
463
483
  <stop stop-color="#03B79C"/><stop offset="0.504808" stop-color="#4EDAA4"/><stop offset="0.865285" stop-color="#84F3AA"/>
464
- </linearGradient></defs></svg>`;var q=`
484
+ </linearGradient></defs></svg>`;var Q=`
465
485
  /* \u2500\u2500 Utilities \u2500\u2500 */
466
486
  function esc(s){if(!s)return '';return String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;').replace(/'/g,'&#39;')}
467
487
  function stripAnsi(s){return s?s.replace(/\\u001b\\[[0-9;]*m/g,'').replace(/\\x1b\\[[0-9;]*m/g,''):''}
@@ -483,15 +503,23 @@ body{
483
503
  tags:t.tags,failure:t.failure,filePath:t.filePath,suiteName:t.suiteName,
484
504
  testType:t.testType,isFlaky:t.isFlaky,retryStatus:t.retryStatus,
485
505
  expectedStatus:t.expectedStatus,actualStatus:t.actualStatus,
486
- artifacts:t.artifacts,networkRequests:t.networkRequests||[],steps:[]
506
+ artifacts:t.artifacts,networkRequests:t.networkRequests||[],steps:[],apiCalls:[]
487
507
  };
488
508
  }
489
- testMap[t.testId].steps.push({
490
- url:entry.url,navigationType:entry.navigationType,
491
- visitedAt:entry.visitedAt,duration:entry.duration,specFile:entry.specFile,
492
- domContentLoadedAt:entry.domContentLoadedAt,networkIdleAt:entry.networkIdleAt,
493
- networkStats:entry.networkStats
494
- });
509
+ if(entry.type==='api_call'){
510
+ testMap[t.testId].apiCalls.push({
511
+ callId:entry.callId,method:entry.method,url:entry.url,
512
+ responseTime:entry.responseTime,timestamp:entry.timestamp,
513
+ request:entry.request,response:entry.response,assertions:entry.assertions
514
+ });
515
+ }else{
516
+ testMap[t.testId].steps.push({
517
+ url:entry.url,navigationType:entry.navigationType,
518
+ visitedAt:entry.visitedAt,duration:entry.duration,specFile:entry.specFile,
519
+ domContentLoadedAt:entry.domContentLoadedAt,networkIdleAt:entry.networkIdleAt,
520
+ networkStats:entry.networkStats
521
+ });
522
+ }
495
523
  }
496
524
  }
497
525
  var tests=[];
@@ -624,13 +652,15 @@ body{
624
652
  if((t.status==='failed'||t.status==='flaky')&&t.failure)h+=renderFailure(t.failure);
625
653
  else if(t.status==='failed'&&!t.failure)h+='<div style="margin-bottom:20px;padding:14px;background:var(--bg-2);border:1px solid var(--bd);border-radius:10px;font-size:12px;color:var(--fg-2);font-style:italic">No diagnostic information available</div>';
626
654
 
627
- /* \u2500\u2500 Stacked sections: 1) Artifacts 2) Timeline / Network \u2500\u2500 */
655
+ /* \u2500\u2500 Stacked sections: 1) Artifacts 2) Timeline / Network 3) API Calls \u2500\u2500 */
628
656
  var hasArt=t.artifacts&&(t.artifacts.screenshot||t.artifacts.video);
629
657
  var hasSteps=t.steps&&t.steps.length>0;
630
- if(hasArt||hasSteps){
658
+ var hasApiCalls=t.apiCalls&&t.apiCalls.length>0;
659
+ if(hasArt||hasSteps||hasApiCalls){
631
660
  h+='<div class="drawer-sections">';
632
661
  if(hasArt)h+='<div class="drawer-section">'+renderArtifactColumn(t.artifacts)+'</div>';
633
662
  if(hasSteps)h+='<div class="drawer-section">'+renderTimelineColumn(t.steps,t.networkRequests)+'</div>';
663
+ if(hasApiCalls)h+='<div class="drawer-section">'+renderApiCallsColumn(t.apiCalls)+'</div>';
634
664
  h+='</div>';
635
665
  }
636
666
 
@@ -657,7 +687,7 @@ body{
657
687
 
658
688
  /* \u2500\u2500 Search \u2500\u2500 */
659
689
  function doSearch(q){searchQuery=q;applyFilters();}
660
- `;var B=`
690
+ `;var tt=`
661
691
  /* \u2500\u2500 Network Visualization Helpers \u2500\u2500 */
662
692
  var RES_COLORS={xhr:'#60a5fa',document:'#818cf8',script:'#fbbf24',stylesheet:'#a78bfa',image:'#34d399',font:'#f472b6',other:'#6b7280'};
663
693
  var RES_LABELS={xhr:'XHR',document:'Doc',script:'JS',stylesheet:'CSS',image:'Img',font:'Font',other:'Other'};
@@ -853,6 +883,85 @@ body{
853
883
  }
854
884
 
855
885
  /* \u2500\u2500 Network DevTools Filter Logic \u2500\u2500 */
886
+ /* \u2500\u2500 API Calls Column (for API-only tests) \u2500\u2500 */
887
+ var API_METHOD_COLORS={GET:'#60a5fa',POST:'#34d399',PUT:'#fbbf24',PATCH:'#a78bfa',DELETE:'#f87171',HEAD:'#6b7280',OPTIONS:'#6b7280'};
888
+
889
+ function renderApiCallDetail(ac,idx){
890
+ var did='ndt-d-api-'+idx;
891
+ var reqHeaders=ac.request?ac.request.headers:null;
892
+ var reqBody=ac.request?ac.request.body:null;
893
+ var resHeaders=ac.response?ac.response.headers:null;
894
+ var resBody=ac.response?ac.response.body:null;
895
+ var ct=(resHeaders&&resHeaders['content-type'])?resHeaders['content-type']:'';
896
+ var reqBodyStr=(reqBody!==null&&reqBody!==undefined)?((typeof reqBody==='string')?reqBody:JSON.stringify(reqBody,null,2)):null;
897
+ var resBodyStr=(resBody!==null&&resBody!==undefined)?((typeof resBody==='string')?resBody:JSON.stringify(resBody,null,2)):null;
898
+
899
+ var h='<div class="ndt-detail" id="'+did+'">';
900
+ h+='<div class="ndt-detail-tabs">';
901
+ h+='<button class="ndt-detail-tab active" data-ndt-tab="general" data-ndt-target="'+did+'">General</button>';
902
+ h+='<button class="ndt-detail-tab" data-ndt-tab="req-headers" data-ndt-target="'+did+'">Request Headers</button>';
903
+ h+='<button class="ndt-detail-tab" data-ndt-tab="req-body" data-ndt-target="'+did+'">Payload</button>';
904
+ h+='<button class="ndt-detail-tab" data-ndt-tab="res-headers" data-ndt-target="'+did+'">Response Headers</button>';
905
+ h+='<button class="ndt-detail-tab" data-ndt-tab="res-body" data-ndt-target="'+did+'">Response</button>';
906
+ h+='</div>';
907
+
908
+ /* General tab */
909
+ h+='<div class="ndt-detail-pane active" data-ndt-pane="general"><div class="ndt-general">';
910
+ h+='<span class="ndt-general-k">Request URL</span><span class="ndt-general-v">'+esc(ac.url)+'</span>';
911
+ h+='<span class="ndt-general-k">Method</span><span class="ndt-general-v">'+esc(ac.method)+'</span>';
912
+ var sc=ac.response?ac.response.statusCode:0;
913
+ var st=ac.response?ac.response.statusText:'';
914
+ h+='<span class="ndt-general-k">Status Code</span><span class="ndt-general-v'+(sc>=400?' ndt-err':'')+'">'+sc+(st?' '+esc(st):'')+'</span>';
915
+ h+='<span class="ndt-general-k">Response Time</span><span class="ndt-general-v">'+(ac.responseTime!==null?fmtDur(ac.responseTime):'N/A')+'</span>';
916
+ if(ac.timestamp)h+='<span class="ndt-general-k">Timestamp</span><span class="ndt-general-v">'+fmtDate(ac.timestamp)+'</span>';
917
+ h+='</div></div>';
918
+
919
+ h+='<div class="ndt-detail-pane" data-ndt-pane="req-headers">'+renderNdtHeaders(reqHeaders,'request')+'</div>';
920
+ h+='<div class="ndt-detail-pane" data-ndt-pane="req-body">'+renderNdtBody(reqBodyStr,false,false,ct,'No request body')+'</div>';
921
+ h+='<div class="ndt-detail-pane" data-ndt-pane="res-headers">'+renderNdtHeaders(resHeaders,'response')+'</div>';
922
+ h+='<div class="ndt-detail-pane" data-ndt-pane="res-body">'+renderNdtBody(resBodyStr,false,false,ct,'No response body captured')+'</div>';
923
+ h+='</div>';
924
+ return h;
925
+ }
926
+
927
+ function renderApiCallsColumn(apiCalls){
928
+ if(!apiCalls||apiCalls.length===0)return '<div class="artifact-empty">No API calls captured</div>';
929
+ var uid='api-'+Math.random().toString(36).substr(2,6);
930
+ var h='<div class="ndt" id="'+uid+'">';
931
+
932
+ /* Toolbar */
933
+ h+='<div class="ndt-toolbar"><div class="ndt-filter">';
934
+ h+='<button class="ndt-filter-btn active" data-ndt-filter="all">All</button>';
935
+ var methodCounts={};
936
+ for(var mi=0;mi<apiCalls.length;mi++){var m=apiCalls[mi].method;methodCounts[m]=(methodCounts[m]||0)+1;}
937
+ var methodKeys=[];for(var mk in methodCounts){if(methodCounts.hasOwnProperty(mk))methodKeys.push(mk);}
938
+ methodKeys.sort();
939
+ for(var ki=0;ki<methodKeys.length;ki++){var mk=methodKeys[ki];h+='<button class="ndt-filter-btn" data-ndt-filter="'+mk+'">'+mk+' <span style="opacity:.6">'+methodCounts[mk]+'</span></button>';}
940
+ h+='</div>';
941
+ h+='<input class="ndt-search" placeholder="Filter URLs..." data-ndt-search="'+uid+'">';
942
+ h+='<span class="ndt-count" data-ndt-count="'+uid+'">'+apiCalls.length+' API calls</span>';
943
+ h+='</div>';
944
+
945
+ /* Request list */
946
+ h+='<div class="ndt-list" data-ndt-list="'+uid+'">';
947
+ for(var i=0;i<apiCalls.length;i++){
948
+ var ac=apiCalls[i];
949
+ var sc=ac.response?ac.response.statusCode:0;
950
+ var isFail=sc>=400||sc===0;
951
+ h+='<div class="ndt-row'+(isFail?' ndt-row--fail':'')+'" data-ndt-idx="api-'+i+'" data-ndt-type="'+esc(ac.method)+'" data-ndt-url="'+esc(ac.url.toLowerCase())+'">';
952
+ h+='<span class="ndt-status '+ndtStatusClass(sc)+'">'+sc+'</span>';
953
+ h+='<span class="ndt-method" style="color:'+(API_METHOD_COLORS[ac.method]||'#6b7280')+'">'+esc(ac.method)+'</span>';
954
+ h+='<span class="ndt-url" title="'+esc(ac.url)+'">'+esc(urlPath(ac.url))+'</span>';
955
+ h+='<span class="ndt-type"></span>';
956
+ h+='<span class="ndt-size"></span>';
957
+ h+='<span class="ndt-time">'+(ac.responseTime!==null?fmtDur(ac.responseTime):'')+'</span>';
958
+ h+='</div>';
959
+ h+=renderApiCallDetail(ac,i);
960
+ }
961
+ h+='</div></div>';
962
+ return h;
963
+ }
964
+
856
965
  function ndtApplyFilters(ndt,filterType,searchVal){
857
966
  var list=ndt.querySelector('.ndt-list');if(!list)return;
858
967
  var searchInput=ndt.querySelector('.ndt-search');
@@ -876,12 +985,14 @@ body{
876
985
  var countEl=ndt.querySelector('.ndt-count');
877
986
  if(countEl)countEl.textContent=visible+' / '+rows.length+' requests';
878
987
  }
879
- `;var D=`
988
+ `;var et=`
880
989
  var _filterState={status:{},type:{},specFile:{}};
881
990
  var _totalTests=0;
882
991
  var _originalSummary=null;
883
992
 
884
993
  function renderFilterBar(){
994
+ var filterEl=document.getElementById('filter-bar');
995
+ var drawerBodyEl=document.getElementById('filter-drawer-body');
885
996
  var statusCounts={passed:0,failed:0,flaky:0,skipped:0,timedout:0};
886
997
  var typeCounts={},specCounts={};
887
998
  for(var i=0;i<tests.length;i++){
@@ -894,12 +1005,17 @@ function renderFilterBar(){
894
1005
  var hasStatus=Object.keys(_filterState.status).length>0;
895
1006
  var hasType=Object.keys(_filterState.type).length>0;
896
1007
  var hasSpec=Object.keys(_filterState.specFile).length>0;
897
- var hasAny=hasStatus||hasType||hasSpec;
1008
+ var hasAny=hasStatus||hasType||hasSpec||!!searchQuery;
1009
+ var hasAdvanced=hasType||hasSpec;
1010
+
1011
+ /* \u2500\u2500 Filter Bar (search + status chips + filter icon) \u2500\u2500 */
1012
+ var h='';
898
1013
 
899
- var h='<div class="filter-chips">';
1014
+ /* Search box (left-aligned, wider) */
1015
+ h+='<div class="search-box"><svg class="search-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><path d="M21 21l-4.35-4.35"/></svg><input class="search-input" id="search-input" type="text" placeholder="Search tests..." value="'+esc(searchQuery)+'"></div>';
900
1016
 
901
- /* Status section */
902
- h+='<div class="filter-section"><span class="filter-section-label">Status</span>';
1017
+ /* Status chips (inline) */
1018
+ h+='<div class="filter-chips">';
903
1019
  var statuses=['passed','failed','flaky','skipped','timedout'];
904
1020
  var statusLabels={passed:'Passed',failed:'Failed',flaky:'Flaky',skipped:'Skipped',timedout:'Timed Out'};
905
1021
  for(var i=0;i<statuses.length;i++){
@@ -909,43 +1025,52 @@ function renderFilterBar(){
909
1025
  }
910
1026
  h+='</div>';
911
1027
 
1028
+ /* Filter icon button */
1029
+ h+='<button class="filter-icon-btn" title="More filters">';
1030
+ h+='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 3H2l8 9.46V19l4 2v-8.54L22 3z"/></svg>';
1031
+ if(hasAdvanced)h+='<span class="filter-icon-badge"></span>';
1032
+ h+='</button>';
1033
+
1034
+ if(filterEl)filterEl.innerHTML=h;
1035
+
1036
+ /* \u2500\u2500 Filter Drawer Body (type + file + actions) \u2500\u2500 */
1037
+ var d='';
1038
+
912
1039
  /* Type section */
913
1040
  var types=Object.keys(typeCounts).sort();
914
1041
  if(types.length>0){
915
- h+='<div class="filter-section"><span class="filter-section-label">Type</span>';
1042
+ d+='<div class="filter-drawer-section"><span class="filter-drawer-section-label">Type</span>';
1043
+ d+='<div class="filter-chips">';
916
1044
  for(var i=0;i<types.length;i++){
917
1045
  var tp=types[i];var cnt=typeCounts[tp]||0;
918
1046
  var cls='filter-chip'+(!!_filterState.type[tp]?' active':'')+(cnt===0?' filter-chip--dimmed':'');
919
- h+='<button class="'+cls+'" data-dimension="type" data-value="'+esc(tp)+'">'+esc(tp)+' <span class="chip-count">'+cnt+'</span></button>';
1047
+ d+='<button class="'+cls+'" data-dimension="type" data-value="'+esc(tp)+'">'+esc(tp)+' <span class="chip-count">'+cnt+'</span></button>';
920
1048
  }
921
- h+='</div>';
1049
+ d+='</div></div>';
922
1050
  }
923
1051
 
924
- /* Spec file section (only if multiple files) */
1052
+ /* Spec file section */
925
1053
  var specs=Object.keys(specCounts).sort();
926
1054
  if(specs.length>1){
927
- h+='<div class="filter-section"><span class="filter-section-label">File</span>';
1055
+ d+='<div class="filter-drawer-section"><span class="filter-drawer-section-label">File</span>';
1056
+ d+='<div class="filter-chips">';
928
1057
  for(var i=0;i<specs.length;i++){
929
1058
  var sp=specs[i];var cnt=specCounts[sp]||0;
930
1059
  var short=sp.split('/').pop()||sp;
931
1060
  var cls='filter-chip'+(!!_filterState.specFile[sp]?' active':'')+(cnt===0?' filter-chip--dimmed':'');
932
- h+='<button class="'+cls+'" data-dimension="specFile" data-value="'+esc(sp)+'" title="'+esc(sp)+'">'+esc(short)+' <span class="chip-count">'+cnt+'</span></button>';
1061
+ d+='<button class="'+cls+'" data-dimension="specFile" data-value="'+esc(sp)+'" title="'+esc(sp)+'">'+esc(short)+' <span class="chip-count">'+cnt+'</span></button>';
933
1062
  }
934
- h+='</div>';
1063
+ d+='</div></div>';
935
1064
  }
936
- h+='</div>';
937
1065
 
938
- /* Search box */
939
- h+='<div class="search-box"><svg class="search-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><path d="M21 21l-4.35-4.35"/></svg><input class="search-input" id="search-input" type="text" placeholder="Search tests..." value="'+esc(searchQuery)+'"></div>';
1066
+ /* Actions (Clear all + indicator) */
1067
+ d+='<div class="filter-drawer-actions">';
1068
+ d+='<button class="filter-clear" id="filter-clear" style="display:'+(hasAny?'inline-block':'none')+'">Clear all</button>';
1069
+ d+='<span class="filter-indicator" id="filter-indicator" style="display:'+(hasAny?'inline':'none')+'">';
1070
+ d+='Showing <span id="filter-shown">0</span> of <span id="filter-total">'+_totalTests+'</span> tests</span>';
1071
+ d+='</div>';
940
1072
 
941
- /* Actions row */
942
- h+='<div class="filter-actions">';
943
- h+='<button class="filter-clear" id="filter-clear" style="display:'+(hasAny?'inline-block':'none')+'">Clear all</button>';
944
- h+='<span class="filter-indicator" id="filter-indicator" style="display:'+(hasAny?'inline':'none')+'">';
945
- h+='Showing <span id="filter-shown">0</span> of <span id="filter-total">'+_totalTests+'</span> tests</span>';
946
- h+='</div>';
947
-
948
- filterEl.innerHTML=h;
1073
+ if(drawerBodyEl)drawerBodyEl.innerHTML=d;
949
1074
  }
950
1075
 
951
1076
  function initFilters(){
@@ -990,6 +1115,8 @@ function toggleFilter(dim,val){
990
1115
  function clearAllFilters(){
991
1116
  _filterState={status:{},type:{},specFile:{}};
992
1117
  searchQuery='';
1118
+ var si=document.getElementById('search-input');
1119
+ if(si)si.value='';
993
1120
  applyFilters();
994
1121
  }
995
1122
 
@@ -999,7 +1126,7 @@ function applyFilters(){
999
1126
  var hasStatus=Object.keys(_filterState.status).length>0;
1000
1127
  var hasType=Object.keys(_filterState.type).length>0;
1001
1128
  var hasSpec=Object.keys(_filterState.specFile).length>0;
1002
- var hasAny=hasStatus||hasType||hasSpec;
1129
+ var hasAny=hasStatus||hasType||hasSpec||!!searchQuery;
1003
1130
  if(hasAny){
1004
1131
  var filtered=getFilteredTests();
1005
1132
  var byStatus={passed:0,failed:0,flaky:0,skipped:0,timedout:0};
@@ -1029,7 +1156,7 @@ function _updateCard(cls,val){
1029
1156
  var el=document.querySelector('.'+cls+' .s-count');
1030
1157
  if(el)el.textContent=''+val;
1031
1158
  }
1032
- `;var z=`
1159
+ `;var rt=`
1033
1160
  /* \u2500\u2500 Event Delegation \u2500\u2500 */
1034
1161
  document.addEventListener('click',function(e){
1035
1162
  var target=e.target;
@@ -1050,6 +1177,13 @@ function _updateCard(cls,val){
1050
1177
  /* Clear all filters */
1051
1178
  if(target.closest('.filter-clear')){clearAllFilters();return;}
1052
1179
 
1180
+ /* Filter icon \u2192 open filter drawer */
1181
+ if(target.closest('.filter-icon-btn')){openFilterDrawer();return;}
1182
+
1183
+ /* Filter drawer close */
1184
+ if(target.closest('#filter-drawer-close')){closeFilterDrawer();return;}
1185
+ if(target.closest('#filter-drawer-backdrop')){closeFilterDrawer();return;}
1186
+
1053
1187
  /* Step header \u2192 expand/collapse */
1054
1188
  var stepH=target.closest('[data-step]');
1055
1189
  if(stepH){var sd=document.getElementById('step-detail-'+stepH.getAttribute('data-step'));if(sd)sd.classList.toggle('show');return;}
@@ -1152,7 +1286,7 @@ function _updateCard(cls,val){
1152
1286
 
1153
1287
  /* Keyboard */
1154
1288
  document.addEventListener('keydown',function(e){
1155
- if(e.key==='Escape'){closeLightbox();closeDrawer();}
1289
+ if(e.key==='Escape'){closeLightbox();closeDrawer();closeFilterDrawer();}
1156
1290
  });
1157
1291
 
1158
1292
  /* \u2500\u2500 Theme Management \u2500\u2500 */
@@ -1178,38 +1312,48 @@ function _updateCard(cls,val){
1178
1312
  var o=document.querySelector('.lightbox-overlay');if(o)o.remove();
1179
1313
  var b=document.querySelector('.lightbox-close');if(b)b.remove();
1180
1314
  }
1181
- `;var ct=`
1315
+
1316
+ /* \u2500\u2500 Filter Drawer \u2500\u2500 */
1317
+ function openFilterDrawer(){
1318
+ var d=document.getElementById('filter-drawer');if(d)d.classList.add('open');
1319
+ var b=document.getElementById('filter-drawer-backdrop');if(b)b.classList.add('open');
1320
+ }
1321
+ function closeFilterDrawer(){
1322
+ var d=document.getElementById('filter-drawer');if(d)d.classList.remove('open');
1323
+ var b=document.getElementById('filter-drawer-backdrop');if(b)b.classList.remove('open');
1324
+ }
1325
+ `;var jt=`
1182
1326
  (function(){
1183
1327
  var data=JSON.parse(document.getElementById('report-data').textContent);
1184
- ${q}
1185
- ${B}
1186
- ${D}
1187
- ${z}
1328
+ ${Q}
1329
+ ${tt}
1330
+ ${et}
1331
+ ${rt}
1188
1332
  applyTheme();
1189
1333
  renderRunMeta();
1190
1334
  renderSummary();
1191
1335
  initFilters();
1192
1336
  renderFilterBar();
1193
1337
  renderTestGrid();
1194
- })();`;function H(e){let t=e.replace(/<\//g,"<\\/");return `<!-- TestRelic Analytics Report \u2014 self-contained, no external dependencies -->
1338
+ })();`;function at(e){let t=e.replace(/<\//g,"<\\/");return `<!-- TestRelic AI Analytics Report \u2014 self-contained, no external dependencies -->
1195
1339
  <!DOCTYPE html>
1196
1340
  <html lang="en" data-theme="">
1197
1341
  <head>
1198
1342
  <meta charset="UTF-8">
1199
1343
  <meta name="viewport" content="width=device-width,initial-scale=1">
1200
1344
  <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';">
1201
- <title>TestRelic Analytics Report</title>
1202
- <link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,${Buffer.from(_).toString("base64")}">
1203
- <style>${E}</style>
1345
+ <title>TestRelic AI Analytics Report</title>
1346
+ <link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,${Buffer.from(X).toString("base64")}">
1347
+ <style>${K}</style>
1204
1348
  <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>
1205
1349
  </head>
1206
1350
  <body>
1207
1351
  <div class="wrap">
1208
1352
  <div class="top-bar">
1209
1353
  <div class="brand">
1210
- ${N}
1354
+ ${W}
1211
1355
  <div class="brand-text">
1212
- <span class="brand-title">TestRelic</span>
1356
+ <span class="brand-title">TestRelic AI</span>
1213
1357
  <span class="brand-sub">Analytics Report</span>
1214
1358
  </div>
1215
1359
  </div>
@@ -1219,7 +1363,7 @@ function _updateCard(cls,val){
1219
1363
  <button class="theme-btn" data-theme-val="light" title="Light"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="5"/><path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/></svg></button>
1220
1364
  <button class="theme-btn" data-theme-val="dark" title="Dark"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg></button>
1221
1365
  </div>
1222
- <a class="cta-btn" href="https://testrelic.co" target="_blank" rel="noopener noreferrer"><svg class="cta-icon" viewBox="0 0 16 16" fill="none"><path d="M8 1l1.545 4.955L14.5 7.5l-4.955 1.545L8 14l-1.545-4.955L1.5 7.5l4.955-1.545L8 1z" fill="currentColor"/></svg>Advanced Insights with AI<span class="cta-sep">\u2013</span><strong>Get Started</strong><svg class="cta-arrow" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M2.5 6h7M6.5 3l3 3-3 3"/></svg></a>
1366
+ <a class="cta-btn" href="https://testrelic.ai" target="_blank" rel="noopener noreferrer"><svg class="cta-icon" viewBox="0 0 16 16" fill="none"><path d="M8 1l1.545 4.955L14.5 7.5l-4.955 1.545L8 14l-1.545-4.955L1.5 7.5l4.955-1.545L8 1z" fill="currentColor"/></svg>Advanced Insights with AI<span class="cta-sep">\u2013</span><strong>Get Started</strong><svg class="cta-arrow" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M2.5 6h7M6.5 3l3 3-3 3"/></svg></a>
1223
1367
  </div>
1224
1368
  <div id="summary-strip" class="summary-strip"></div>
1225
1369
  <div id="filter-bar" class="filter-bar"></div>
@@ -1233,12 +1377,25 @@ function _updateCard(cls,val){
1233
1377
  </div>
1234
1378
  <div class="drawer-body" id="drawer-body"></div>
1235
1379
  </aside>
1380
+ <div class="filter-drawer-backdrop" id="filter-drawer-backdrop"></div>
1381
+ <aside class="filter-drawer" id="filter-drawer">
1382
+ <div class="filter-drawer-bar">
1383
+ <span class="filter-drawer-title">Filters</span>
1384
+ <button class="filter-drawer-close" id="filter-drawer-close">&times;</button>
1385
+ </div>
1386
+ <div class="filter-drawer-body" id="filter-drawer-body"></div>
1387
+ </aside>
1236
1388
  <script id="report-data" type="application/json">${t}</script>
1237
- <script>${ct}</script>
1389
+ <script>${jt}</script>
1238
1390
  </body>
1239
- </html>`}function P(e){try{let t=process.platform,a;t==="darwin"?a=`open "${e}"`:t==="win32"?a=`start "" "${e}"`:a=`xdg-open "${e}"`,child_process.exec(a,r=>{r&&process.stderr.write(`[testrelic] Failed to open browser: ${r.message}
1240
- `);});}catch{}}function vt(e){let t=JSON.stringify(e);return H(t)}function O(e,t){try{let a=vt(e),r=t.htmlReportPath,s=path.dirname(r);fs.mkdirSync(s,{recursive:!0});let i=r+".tmp";if(fs.writeFileSync(i,a,"utf-8"),fs.renameSync(i,r),t.openReport&&e.ci===null){let o=path.resolve(r);P(o);}}catch(a){process.stderr.write(`[testrelic] Failed to write HTML report: ${a instanceof Error?a.message:String(a)}
1241
- `);}}function xt(e){let t=e.replace(/[^a-zA-Z0-9\-_ ]/g,"-").replace(/\s+/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"");return t.length>100&&(t=t.substring(0,100).replace(/-+$/,"")),t||"unnamed-test"}function G(e,t,a,r){let s=e.find(c=>c.name==="screenshot"&&c.path),i=e.find(c=>c.name==="video"&&c.path);if(!s&&!i)return null;let o=xt(t);a>0&&(o+=`--retry-${a}`);let d=path.join(r,"artifacts",o),n={};try{fs.mkdirSync(d,{recursive:!0});}catch{return null}if(s?.path)try{if(fs.existsSync(s.path)){let p=`screenshot${path.extname(s.path)||".png"}`;fs.copyFileSync(s.path,path.join(d,p)),n.screenshot=`artifacts/${o}/${p}`;}}catch{}if(i?.path)try{if(fs.existsSync(i.path)){let p=`video${path.extname(i.path)||".webm"}`;fs.copyFileSync(i.path,path.join(d,p)),n.video=`artifacts/${o}/${p}`;}}catch{}return !n.screenshot&&!n.video?null:n}function w(e){switch(e){case "passed":return "passed";case "failed":return "failed";case "timedOut":return "timedout";case "skipped":return "skipped";case "interrupted":return "failed";default:return "failed"}}function Rt(e,t,a){let r=`${e}::${t}::${a}`;return crypto.createHash("sha256").update(r).digest("hex").substring(0,16)}function Lt(e){return e.length<=4?"":e[e.length-2]}function At(e){let t=e.findIndex(a=>a.status==="passed");return t>0?`passed on retry ${t}`:null}function It(e,t){let a=["e2e","api","unit"];for(let r of a)if(e.some(s=>s===`@${r}`||s===r))return r;for(let r of a)if(t.includes(`/${r}/`))return r;return "unknown"}var h=class{constructor(t){this.rootDir="";this.startedAt="";this.testRunId="";this.collectedTests=[];this.config=A(t);}onBegin(t,a){try{this.rootDir=t.rootDir,this.startedAt=new Date().toISOString(),this.testRunId=this.config.testRunId??crypto.randomUUID();}catch{}}onTestEnd(t,a){try{let r=a,s=t.outcome(),i;s==="flaky"?i="flaky":s==="skipped"?i="skipped":i=w(r.status);let o=r.startTime.toISOString(),d=new Date(r.startTime.getTime()+r.duration).toISOString(),n=t.tags?[...t.tags]:t.annotations.filter(l=>l.type==="tag").map(l=>l.description??""),c=t.annotations.filter(l=>l.type==="lambdatest-navigation"&&l.description).map(l=>{try{return JSON.parse(l.description)}catch{return null}}).filter(l=>l!==null),p=null,k=t.annotations.find(l=>l.type==="__testrelic_network_requests"&&l.description);if(k)try{p=JSON.parse(k.description);}catch{}let C=null;if(i==="failed"||i==="flaky"){let u=(i==="flaky"?t.results.find(f=>f.status!=="passed")?.errors??[]:r.errors)[0];if(u){let f=M(this.config.redactPatterns),m=u.location?.line??null,b=null;this.config.includeCodeSnippets&&m!==null&&u.location?.file&&(b=I(u.location.file,m,this.config.codeContextLines),b&&(b=f(b))),C={message:f(u.message??"Unknown error"),line:m,code:b,stack:this.config.includeStackTrace&&u.stack?f(u.stack):null};}}let g=t.titlePath().filter(Boolean),S=path.relative(this.rootDir||".",t.location.file),T=Lt(g),R=g.join(" > "),v=S,Z=Rt(v,T,R),K=It(n,v),Q=s==="flaky",W=At(t.results),X=w(t.expectedStatus),Y=w(r.status),L=null;if(this.config.includeArtifacts&&i!=="skipped"&&r.attachments){let l=path.dirname(this.config.outputPath),u=g[g.length-1]??t.title;L=G(r.attachments,u,r.retry,l);}this.collectedTests.push({titlePath:g,title:R,status:i,duration:r.duration,startedAt:o,completedAt:d,retryCount:t.results.length-1,tags:n,failure:C,specFile:S,navigations:c,testId:Z,filePath:v,suiteName:T,testType:K,isFlaky:Q,retryStatus:W,expectedStatus:X,actualStatus:Y,artifacts:L,networkRequests:p});}catch{}}onEnd(t){try{let a=new Date().toISOString(),r=new Date(this.startedAt).getTime(),i=new Date(a).getTime()-r,o=this.buildTimeline(),d=this.buildSummary(),n={schemaVersion:x,testRunId:this.testRunId,startedAt:this.startedAt,completedAt:a,totalDuration:i,summary:d,ci:F(),metadata:this.config.metadata,timeline:o,shardRunIds:null};this.writeReport(n),O(n,this.config);}catch{}}printsToStdio(){return false}buildTimeline(){let t=[];for(let a of this.collectedTests){if(a.navigations.length===0){t.push({url:"about:blank",navigationType:"dummy",visitedAt:a.startedAt,duration:a.duration,specFile:a.specFile,domContentLoadedAt:null,networkIdleAt:null,networkStats:null,tests:[this.toTestResult(a)]});continue}for(let r=0;r<a.navigations.length;r++){let s=a.navigations[r],i=a.navigations[r+1];if(this.config.navigationTypes!==null&&!this.config.navigationTypes.includes(s.navigationType))continue;let o=new Date(s.timestamp).getTime(),n=(i?new Date(i.timestamp).getTime():new Date(a.completedAt).getTime())-o;t.push({url:s.url,navigationType:s.navigationType,visitedAt:s.timestamp,duration:Math.max(0,n),specFile:a.specFile,domContentLoadedAt:s.domContentLoadedAt??null,networkIdleAt:s.networkIdleAt??null,networkStats:s.networkStats??null,tests:[this.toTestResult(a)]});}}return t.sort((a,r)=>new Date(a.visitedAt).getTime()-new Date(r.visitedAt).getTime()),t}buildSummary(){let t=0,a=0,r=0,s=0,i=0;for(let o of this.collectedTests)switch(o.status){case "passed":t++;break;case "failed":a++;break;case "flaky":r++;break;case "skipped":s++;break;case "timedout":i++;break}return {total:this.collectedTests.length,passed:t,failed:a,flaky:r,skipped:s,timedout:i}}toTestResult(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}}writeReport(t){try{let a=JSON.stringify(t,null,2),r=this.config.outputPath,s=path.dirname(r);fs.mkdirSync(s,{recursive:!0});let i=r+".tmp";fs.writeFileSync(i,a,"utf-8"),fs.renameSync(i,r);}catch(a){process.stderr.write(`[testrelic] Failed to write report: ${a instanceof Error?a.message:String(a)}
1242
- `);}}};var J=false;function ve(e,t,a="manual_record"){if(!e||!e.annotations){J||(J=true,process.stderr.write(`[testrelic] recordNavigation: reporter not active, navigation not recorded
1243
- `));return}let r={url:t,navigationType:a,timestamp:new Date().toISOString()};e.annotations.push({type:"lambdatest-navigation",description:JSON.stringify(r)});}exports.SCHEMA_VERSION=x;exports.default=h;exports.recordNavigation=ve;//# sourceMappingURL=index.cjs.map
1391
+ </html>`}function nt(e){try{let t=process.platform,r;t==="darwin"?r=`open "${e}"`:t==="win32"?r=`start "" "${e}"`:r=`xdg-open "${e}"`,child_process.exec(r,a=>{a&&process.stderr.write(`[testrelic] Failed to open browser: ${a.message}
1392
+ `);});}catch{}}function Kt(e){let t=JSON.stringify(e);return at(t)}function st(e,t){try{let r=Kt(e),a=t.htmlReportPath,n=path.dirname(a);fs.mkdirSync(n,{recursive:!0});let s=a+".tmp";if(fs.writeFileSync(s,r,"utf-8"),fs.renameSync(s,a),t.openReport&&e.ci===null){let i=path.resolve(a);nt(i);}}catch(r){process.stderr.write(`[testrelic] Failed to write HTML report: ${r instanceof Error?r.message:String(r)}
1393
+ `);}}function Wt(e){let t=e.replace(/[^a-zA-Z0-9\-_ ]/g,"-").replace(/\s+/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"");return t.length>100&&(t=t.substring(0,100).replace(/-+$/,"")),t||"unnamed-test"}function dt(e,t,r,a){let n=e.find(p=>p.name==="screenshot"&&p.path),s=e.find(p=>p.name==="video"&&p.path);if(!n&&!s)return null;let i=Wt(t);r>0&&(i+=`--retry-${r}`);let o=path.join(a,"artifacts",i),d={};try{fs.mkdirSync(o,{recursive:!0});}catch{return null}if(n?.path)try{if(fs.existsSync(n.path)){let l=`screenshot${path.extname(n.path)||".png"}`;fs.copyFileSync(n.path,path.join(o,l)),d.screenshot=`artifacts/${i}/${l}`;}}catch{}if(s?.path)try{if(fs.existsSync(s.path)){let l=`video${path.extname(s.path)||".webm"}`;fs.copyFileSync(s.path,path.join(o,l)),d.video=`artifacts/${i}/${l}`;}}catch{}return !d.screenshot&&!d.video?null:d}function ut(e,t){let r=[];for(let a of e){let n=Qt(a),s=te(a),i=ee(a,n,s,t),o=re(a,n,s);if(i.length===0&&o.length===0){r.push({type:"navigation",url:"about:blank",timestamp:a.startedAt,durationOnUrl:a.duration,navigationType:"dummy",domContentLoadedAt:null,networkIdleAt:null,networkStats:null,specFile:a.specFile,test:n,tests:[s],_testTitle:a.title});continue}r.push(...i,...o);}return r.sort(ae),ne(r,e),r.map((a,n)=>a.type==="navigation"?{...{index:n,type:"navigation",url:a.url,timestamp:a.timestamp,durationOnUrl:a.durationOnUrl??0,navigationType:a.navigationType,domContentLoadedAt:a.domContentLoadedAt??null,networkIdleAt:a.networkIdleAt??null,networkStats:a.networkStats??null,specFile:a.specFile,test:a.test},tests:a.tests}:{...{index:n,type:"api_call",callId:a.callId,method:a.method,url:a.url,timestamp:a.timestamp,responseTime:a.responseTime??null,request:a.request,response:a.response??null,...a.error?{error:a.error}:{},assertions:a.assertions??[],specFile:a.specFile,test:a.test},tests:a.tests})}function Qt(e){return {title:e.title,fullTitle:e.titlePath,status:e.status,duration:e.duration,retries:e.retryCount,retry:e.retry,tags:e.tags,failure:e.failure}}function te(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:e.networkRequests,apiCalls:e.apiCalls,apiAssertions:e.apiAssertions}}function ee(e,t,r,a){let n=[];for(let s of e.navigations)a.navigationTypes!==null&&!a.navigationTypes.includes(s.navigationType)||n.push({type:"navigation",url:s.url,timestamp:s.timestamp,durationOnUrl:0,navigationType:s.navigationType,domContentLoadedAt:s.domContentLoadedAt??null,networkIdleAt:s.networkIdleAt??null,networkStats:s.networkStats??null,specFile:e.specFile,test:t,tests:[r],_testTitle:e.title});return n}function re(e,t,r){if(!e.apiCalls||e.apiCalls.length===0)return [];let a=e.apiAssertions??[];return e.apiCalls.map(n=>{let s=a.filter(o=>o.callId===n.id).map(o=>({type:o.type,expected:o.expected,actual:o.actual,status:o.status,location:o.location,...o.expression!==void 0?{expression:o.expression}:{}})),i=null;return n.responseStatusCode!==null&&n.responseStatusText!==null&&(i={statusCode:n.responseStatusCode,statusText:n.responseStatusText,headers:n.responseHeaders,body:pt(n.responseBody)}),{type:"api_call",callId:n.id,method:n.method,url:n.url,timestamp:n.timestamp,responseTime:n.error?null:n.responseTimeMs,request:{headers:n.requestHeaders,body:pt(n.requestBody)},response:i,...n.error?{error:n.error}:{},assertions:s,specFile:e.specFile,test:t,tests:[r],_testTitle:e.title}})}function ae(e,t){let r=new Date(e.timestamp).getTime(),a=new Date(t.timestamp).getTime();if(r!==a)return r-a;let n={navigation:0,api_call:1},s=n[e.type],i=n[t.type];return s!==i?s-i:e.type==="api_call"&&t.type==="api_call"&&e.callId&&t.callId?ct(e.callId)-ct(t.callId):0}function ct(e){let t=e.match(/(\d+)$/);return t?parseInt(t[1],10):0}function ne(e,t){for(let r=0;r<e.length;r++){let a=e[r];if(a.type!=="navigation")continue;let n=new Date(a.timestamp).getTime(),s=null;for(let i=r+1;i<e.length;i++)if(e[i]._testTitle===a._testTitle){s=new Date(e[i].timestamp).getTime();break}if(s!==null)a.durationOnUrl=Math.max(0,s-n);else {let i=t.find(o=>o.title===a._testTitle);if(i){let o=new Date(i.completedAt).getTime();a.durationOnUrl=Math.max(0,o-n);}}}}function pt(e){if(e==null)return null;try{return JSON.parse(e)}catch{return e}}function P(e,t){let r=e.length,a=Math.min(Math.ceil(t/100*r)-1,r-1);return e[Math.max(0,a)]}function se(e){try{let t=new URL(e);return t.origin+t.pathname}catch{return e}}function ie(e){return e==null?"error":e>=200&&e<300?"2xx":e>=300&&e<400?"3xx":e>=400&&e<500?"4xx":e>=500&&e<600?"5xx":"error"}function gt(e,t){let r=0,a=0,n=0,s=0,i=0;for(let u of e)switch(u.status){case "passed":r++;break;case "failed":a++;break;case "flaky":n++;break;case "skipped":s++;break;case "timedout":i++;break}let o=[];for(let u of e)u.apiCalls&&o.push(...u.apiCalls);let d=o.length,p=new Set,l={},f={"2xx":0,"3xx":0,"4xx":0,"5xx":0,error:0},g=[];for(let u of o)p.add(se(u.url)),l[u.method]=(l[u.method]??0)+1,f[ie(u.responseStatusCode)]+=1,g.push(u.responseTimeMs);let c=null;if(g.length>0){let u=[...g].sort((T,S)=>T-S),v=u.reduce((T,S)=>T+S,0);c={avg:Math.round(v/u.length),min:u[0],max:u[u.length-1],p50:P(u,50),p95:P(u,95),p99:P(u,99)};}let w=0,C=0,k=0;for(let u of e)if(u.apiAssertions)for(let v of u.apiAssertions)w++,v.status==="passed"?C++:k++;let m=0,y=new Set;for(let u of e){m+=u.navigations.length;for(let v of u.navigations)y.add(v.url);}return {total:e.length,passed:r,failed:a,flaky:n,skipped:s,timedout:i,totalApiCalls:d,uniqueApiUrls:p.size,apiCallsByMethod:l,apiCallsByStatusRange:f,apiResponseTime:c,totalAssertions:w,passedAssertions:C,failedAssertions:k,totalNavigations:m,uniqueNavigationUrls:y.size,totalTimelineSteps:t}}function oe(e){let t=56-e.length;return t>0?e+" ".repeat(t):e}function R(e){return `\u2502 ${oe(e)} \u2502
1394
+ `}function ft(e,t,r){if(r||e.total===0)return;let a=`\u250C${"\u2500".repeat(58)}\u2510
1395
+ `,n=`\u2514${"\u2500".repeat(58)}\u2518
1396
+ `,s=R(""),i=a;i+=R("TestRelic Timeline Generated"),i+=s;let o=[];if(e.passed>0&&o.push(`${e.passed} \u2713`),e.failed>0&&o.push(`${e.failed} \u2717`),e.flaky>0&&o.push(`${e.flaky} \u26A0`),e.skipped>0&&o.push(`${e.skipped} skipped`),e.timedout>0&&o.push(`${e.timedout} timedout`),i+=R(`Tests: ${e.total} total (${o.join(" ")})`),e.totalNavigations>0&&(i+=R(`Navigations: ${e.totalNavigations} visits across ${e.uniqueNavigationUrls} unique URLs`)),e.totalApiCalls>0){i+=R(`API Calls: ${e.totalApiCalls} calls across ${e.uniqueApiUrls} unique endpoints`);let d=Object.entries(e.apiCallsByMethod).filter(([,l])=>l>0).map(([l,f])=>`${l}: ${f}`);d.length>0&&(i+=R(` ${d.join(" ")}`));let p=Object.entries(e.apiCallsByStatusRange).filter(([,l])=>l>0).map(([l,f])=>`${l}: ${f}`);p.length>0&&(i+=R(` ${p.join(" ")}`)),e.apiResponseTime&&(i+=R(` Avg response: ${e.apiResponseTime.avg}ms P95: ${e.apiResponseTime.p95}ms`));}e.totalAssertions>0&&(i+=R(`Assertions: ${e.totalAssertions} total (${e.passedAssertions} \u2713 ${e.failedAssertions} \u2717)`)),i+=R(`Output: ${t}`),i+=n,process.stderr.write(i);}function O(e){switch(e){case "passed":return "passed";case "failed":return "failed";case "timedOut":return "timedout";case "skipped":return "skipped";case "interrupted":return "failed";default:return "failed"}}function me(e,t,r){let a=`${e}::${t}::${r}`;return crypto.createHash("sha256").update(a).digest("hex").substring(0,16)}function be(e){return e.length<=4?"":e[e.length-2]}function ve(e){let t=e.findIndex(r=>r.status==="passed");return t>0?`passed on retry ${t}`:null}function ye(e,t){let r=["e2e","api","unit"];for(let a of r)if(e.some(n=>n===`@${a}`||n===a))return a;for(let a of r)if(t.includes(`/${a}/`))return a;return "unknown"}var xe="__testrelic_api_config";function we(e){return JSON.stringify(e,(t,r)=>r instanceof RegExp?{__regexp:true,source:r.source,flags:r.flags}:r)}var L=class{constructor(t){this.rootDir="";this.startedAt="";this.testRunId="";this.collectedTests=[];this.config=V(t),this.apiConfig=G(t);}onBegin(t,r){try{this.rootDir=t.rootDir,this.startedAt=new Date().toISOString(),this.testRunId=this.config.testRunId??crypto.randomUUID();}catch{}}onTestBegin(t,r){try{t.annotations.push({type:xe,description:we(this.apiConfig)});}catch{}}onTestEnd(t,r){try{let a=r,n=t.outcome(),s;n==="flaky"?s="flaky":n==="skipped"?s="skipped":s=O(a.status);let i=a.startTime.toISOString(),o=new Date(a.startTime.getTime()+a.duration).toISOString(),d=t.tags?[...t.tags]:t.annotations.filter(x=>x.type==="tag").map(x=>x.description??""),p=[],l=null,f=null,g=null,c=a.attachments.filter(x=>x.name===core.ATTACHMENT_NAME&&x.body),w=!1;if(c.length>0)for(let x of c)try{let h=JSON.parse(x.body.toString());core.isTestRelicDataPayload(h)&&(p=p.concat(h.navigations),h.networkRequests.length>0&&(l=(l??[]).concat(h.networkRequests)),h.apiCalls.length>0&&(f=(f??[]).concat(h.apiCalls)),h.apiAssertions.length>0&&(g=(g??[]).concat(h.apiAssertions)),w=!0);}catch{process.stderr.write(`[testrelic] Warning: Corrupt attachment for test "${t.title}", falling back to annotations
1397
+ `);}if(!w){p=t.annotations.filter(b=>b.type==="lambdatest-navigation"&&b.description).map(b=>{try{return JSON.parse(b.description)}catch{return null}}).filter(b=>b!==null);let x=t.annotations.find(b=>b.type==="__testrelic_network_requests"&&b.description);if(x)try{l=JSON.parse(x.description);}catch{}let h=t.annotations.find(b=>b.type==="__testrelic_api_calls"&&b.description);if(h)try{f=JSON.parse(h.description);}catch{}let A=t.annotations.find(b=>b.type==="__testrelic_api_assertions"&&b.description);if(A)try{g=JSON.parse(A.description);}catch{}}p.length===0&&!l&&!f&&!g&&s!=="skipped"&&process.stderr.write(`[testrelic] Warning: No data found for test "${t.title}", data may be incomplete due to worker crash
1398
+ `);let k=null;if(s==="failed"||s==="flaky"){let h=(s==="flaky"?t.results.find(A=>A.status!=="passed")?.errors??[]:a.errors)[0];if(h){let A=Y(this.config.redactPatterns),b=h.location?.line??null,I=null;this.config.includeCodeSnippets&&b!==null&&h.location?.file&&(I=J(h.location.file,b,this.config.codeContextLines),I&&(I=A(I))),k={message:A(h.message??"Unknown error"),line:b,code:I,stack:this.config.includeStackTrace&&h.stack?A(h.stack):null};}}let m=t.titlePath().filter(Boolean),y=path.relative(this.rootDir||".",t.location.file),u=be(m),v=m.join(" > "),T=y,S=me(T,u,v),St=ye(d,T),At=n==="flaky",Nt=ve(t.results),_t=O(t.expectedStatus),qt=O(a.status),$=null;if(this.config.includeArtifacts&&s!=="skipped"&&a.attachments){let x=path.dirname(this.config.outputPath),h=m[m.length-1]??t.title;$=dt(a.attachments,h,a.retry,x);}this.collectedTests.push({titlePath:m,title:v,status:s,duration:a.duration,startedAt:i,completedAt:o,retryCount:t.results.length-1,retry:a.retry,tags:d,failure:k,specFile:y,navigations:p,testId:S,filePath:T,suiteName:u,testType:St,isFlaky:At,retryStatus:Nt,expectedStatus:_t,actualStatus:qt,artifacts:$,networkRequests:l,apiCalls:f,apiAssertions:g});}catch{}}onEnd(t){try{let r=new Date().toISOString(),a=new Date(this.startedAt).getTime(),s=new Date(r).getTime()-a,i=this.buildTimeline(),o=gt(this.collectedTests,i.length),d={schemaVersion:M,testRunId:this.testRunId,startedAt:this.startedAt,completedAt:r,totalDuration:s,summary:o,ci:Z(),metadata:this.config.metadata,timeline:i,shardRunIds:null};this.writeReport(d),st(d,this.config),ft(o,this.config.outputPath,this.config.quiet);}catch{}}printsToStdio(){return false}buildTimeline(){let t=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:r.apiCalls,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:r.networkRequests}));return ut(t,{navigationTypes:this.config.navigationTypes})}toTestResult(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}}writeReport(t){try{let r=JSON.stringify(t,null,2),a=this.config.outputPath,n=path.dirname(a);fs.mkdirSync(n,{recursive:!0});let s=a+".tmp";fs.writeFileSync(s,r,"utf-8"),fs.renameSync(s,a);}catch(r){process.stderr.write(`[testrelic] Failed to write report: ${r instanceof Error?r.message:String(r)}
1399
+ `);}}};var Se=["text/","application/json","application/xml","application/javascript","application/x-www-form-urlencoded","application/graphql"];function Ae(e){let t=e.toLowerCase();return Se.some(r=>t.includes(r))}function mt(e,t){let r=new TextEncoder().encode(e);return r.length<=t?{text:e,truncated:false}:{text:new TextDecoder().decode(r.slice(0,t)),truncated:true}}var B=class{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.requestCaptureCount=0;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))}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(a=>({url:a.url,navigationType:a.navigationType,timestamp:a.timestamp,domContentLoadedAt:a.domContentLoadedAt,networkIdleAt:a.networkIdleAt,networkStats:a.networkStats})),r=this.includeNetworkStats?await this.getCapturedRequests():[];return {navigations:t,networkRequests:r}}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 a={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(a)});}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=[],this.requestCaptureCount=0;}getRecords(){return this.records}interceptMethods(){let t=this,r=this.page;r.goto=async function(a,n){return t.recordNavigation(a,"goto"),t.origGoto(a,n)},r.goBack=async function(a){let n=await t.origGoBack(a);return t.recordNavigation(r.url(),"back"),n},r.goForward=async function(a){let n=await t.origGoForward(a);return t.recordNavigation(r.url(),"forward"),n},r.reload=async function(a){return t.recordNavigation(r.url(),"refresh"),t.origReload(a)};}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=n=>{try{let s=n;if(typeof s.parentFrame=="function"&&s.parentFrame()!==null)return;let i=s.url(),o=this.records[this.records.length-1];if(o&&Date.now()-new Date(o.timestamp).getTime()<50&&o.url===i)return;this.recordNavigation(i,"navigation");}catch{}};this.page.on("framenavigated",r),this.listeners.push({event:"framenavigated",handler:r});let a=n=>{try{let s=n;if(s.type()!=="debug")return;let i=s.text();if(!i.startsWith("__testrelic_nav:"))return;let o=JSON.parse(i.slice(16));o.type&&o.url&&this.recordNavigation(o.url,o.type);}catch{}};if(this.page.on("console",a),this.listeners.push({event:"console",handler:a}),this.includeNetworkStats){let n=o=>{if(this.currentNetworkCounter&&this.currentNetworkCounter.totalRequests++,!(this.requestCaptureCount>=500)){this.requestCaptureCount++;try{let d=o,p=String(this.requestIdCounter++),l=d.postData()??null,f=!1;if(l!==null){let c=mt(l,10240);l=c.text,f=c.truncated;}let g={url:d.url(),method:d.method(),resourceType:this.mapResourceType(d.resourceType()),headers:d.headers(),postData:l,postDataTruncated:f,startedAt:new Date().toISOString(),startTimeMs:Date.now()};this.pendingRequests.set(p,g),o.__testrelic_id=p;}catch{}}};this.page.on("request",n),this.listeners.push({event:"request",handler:n});let s=o=>{try{let d=o;if(this.currentNetworkCounter){let m=d.status();m>=400&&(this.currentNetworkCounter.failedRequests++,this.currentNetworkCounter.failedRequestUrls.push(m+" "+d.url()));let y=d.headers()["content-length"];y&&(this.currentNetworkCounter.totalBytes+=parseInt(y,10)||0);let u=d.request().resourceType(),v=this.mapResourceType(u);this.currentNetworkCounter.byType[v]++;}let p=d.request().__testrelic_id;if(!p)return;let l=this.pendingRequests.get(p);if(!l)return;this.pendingRequests.delete(p);let f=Date.now()-l.startTimeMs,g=d.headers(),c=g["content-type"]??null,w=parseInt(g["content-length"]??"0",10)||0,C=c?!Ae(c):!1,k=(async()=>{let m=null,y=!1;if(!C)try{let T=(await d.body()).toString("utf-8"),S=mt(T,10240);m=S.text,y=S.truncated;}catch{}let u={url:l.url,method:l.method,resourceType:l.resourceType,statusCode:d.status(),responseTimeMs:f,startedAt:l.startedAt,requestHeaders:l.headers,requestBody:l.postData,responseBody:m,responseHeaders:g,contentType:c,responseSize:w,requestBodyTruncated:l.postDataTruncated,responseBodyTruncated:y,isBinary:C,error:null};this.capturedRequests.push(u);})();this.pendingBodyReads.push(k);}catch{}};this.page.on("response",s),this.listeners.push({event:"response",handler:s});let i=o=>{if(this.currentNetworkCounter){this.currentNetworkCounter.failedRequests++;try{let d=o;this.currentNetworkCounter.failedRequestUrls.push("ERR "+d.url());}catch{}}try{let d=o,p=d.__testrelic_id;if(!p)return;let l=this.pendingRequests.get(p);if(!l)return;this.pendingRequests.delete(p);let f={url:l.url,method:l.method,resourceType:l.resourceType,statusCode:0,responseTimeMs:Date.now()-l.startTimeMs,startedAt:l.startedAt,requestHeaders:l.headers,requestBody:l.postData,responseBody:null,responseHeaders:null,contentType:null,responseSize:0,requestBodyTruncated:l.postDataTruncated,responseBodyTruncated:!1,isBinary:!1,error:d.failure()?.errorText??"Unknown error"};this.capturedRequests.push(f);}catch{}};this.page.on("requestfailed",i),this.listeners.push({event:"requestfailed",handler:i});}}async injectSPADetection(){try{await this.page.addInitScript(()=>{let t=history.pushState.bind(history),r=history.replaceState.bind(history);history.pushState=function(...a){t(...a),console.debug("__testrelic_nav:"+JSON.stringify({type:"spa_route",url:location.href}));},history.replaceState=function(...a){r(...a),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 bt=Symbol.for("__testrelic_call_id"),Ne="__testrelic_api_assertions",_=new WeakMap,N=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:Ne,description:JSON.stringify(this.assertions)});}dispose(){this.assertions=[],this.currentCallId=null;}};var vt="[REDACTED]";function z(e,t){if(e===null||t.length===0)return e;let r=new Set(t.map(n=>n.toLowerCase())),a={};for(let n of Object.keys(e))Object.hasOwn(e,n)&&(a[n]=r.has(n.toLowerCase())?vt:e[n]);return a}function E(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 a=new Set(t),n=H(r,a);return JSON.stringify(n)}function H(e,t){if(Array.isArray(e))return e.map(r=>H(r,t));if(typeof e=="object"&&e!==null){let r={};for(let a of Object.keys(e)){if(!Object.hasOwn(e,a))continue;let n=e[a];t.has(a)?r[a]=vt:r[a]=H(n,t);}return r}return e}function xt(e,t,r){if(r.length>0){for(let a of r)if(yt(e,a))return false}if(t.length>0){for(let a of t)if(yt(e,a))return true;return false}return true}function yt(e,t){try{return t instanceof RegExp?t.test(e):_e(t).test(e)}catch{return console.warn(`[testrelic] Invalid URL filter pattern: ${String(t)}`),false}}function _e(e){let t="",r=0;for(;r<e.length;){let a=e[r];a==="*"&&e[r+1]==="*"?(t+=".*",r+=2,e[r]==="/"&&r++):a==="*"?(t+="[^/]*",r++):a==="?"?(t+="[^/]",r++):".+^${}()|[]\\".includes(a)?(t+="\\"+a,r++):(t+=a,r++);}return new RegExp(t)}var qe=["get","post","put","patch","delete","head","fetch"],Ie=["text/","application/json","application/xml","application/javascript","application/x-www-form-urlencoded","application/graphql"],Le="__testrelic_api_calls";function Be(e){let t=e.toLowerCase();return Ie.some(r=>t.includes(r))}function Ee(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[a,n]of Object.entries(t))typeof n=="string"||typeof n=="number"||typeof n=="boolean"?r[a]=String(n):n&&typeof n=="object"&&"name"in n?r[a]=`[file: ${n.name}]`:r[a]="[binary]";return JSON.stringify(r)}return null}var F=class F{constructor(t,r,a){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=a??F.DEFAULT_API_CONFIG;}get lastCallId(){return this._lastCallId}getCallIdForValue(t){return t!=null&&typeof t=="object"?_.get(t)??null:this.primitiveCallIds.get(t)??null}intercept(){for(let r of qe){let a=this.context[r].bind(this.context);this.originals.set(r,a),this.context[r]=this.createWrapper(r,a);}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:Le,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 a=this,n=t.headers.bind(t);t.headers=function(){let c=n();return _.set(c,r),c};let s=t.headersArray.bind(t);t.headersArray=function(){let c=s();return _.set(c,r),c};let i=t.json.bind(t);t.json=async function(){let c=await i();return c!=null&&typeof c=="object"&&_.set(c,r),c};let o=t.status.bind(t);t.status=function(){let c=o();return a.primitiveCallIds.set(c,r),c};let d=t.statusText.bind(t);t.statusText=function(){let c=d();return a.primitiveCallIds.set(c,r),c};let p=t.ok.bind(t);t.ok=function(){let c=p();return a.primitiveCallIds.set(c,r),c};let l=t.text.bind(t);t.text=async function(){let c=await l();return a.primitiveCallIds.set(c,r),c};let f=t.body.bind(t);t.body=async function(){let c=await f();return _.set(c,r),c};}createWrapper(t,r){let a=this;return async function(s,i){if(!xt(s,a.apiConfig.apiIncludeUrls,a.apiConfig.apiExcludeUrls))return r(s,i);let o=`api-call-${a.callCounter++}`,d=new Date().toISOString(),p=t==="fetch"?(i?.method??"GET").toUpperCase():t.toUpperCase(),l=Ee(i),f=perf_hooks.performance.now();a._lastCallId=o,a.assertionTracker&&a.assertionTracker.setCurrentCallId(o);let g;try{g=await r(s,i);}catch(c){let w=perf_hooks.performance.now();try{let C=a.apiConfig.captureRequestBody?E(l,a.apiConfig.redactBodyFields):null,k={id:o,timestamp:d,method:p,url:s,requestHeaders:null,requestBody:C,responseStatusCode:null,responseStatusText:null,responseHeaders:null,responseBody:null,responseTimeMs:Math.round((w-f)*100)/100,isBinary:!1,error:c instanceof Error?c.message:String(c)};a.capturedCalls.push(k);}catch{}throw c}try{let c=perf_hooks.performance.now(),w=g.headers(),C=w["content-type"]??null,k=C?!Be(C):!1,m=null;a.apiConfig.captureRequestHeaders&&i?.headers&&(m=i.headers);let y=null;a.apiConfig.captureResponseHeaders&&(y=w);let u=a.apiConfig.captureRequestBody?l:null,v=null;if(a.apiConfig.captureResponseBody)try{k?v=(await g.body()).toString("base64"):v=await g.text();}catch{}m=z(m,a.apiConfig.redactHeaders),y=z(y,a.apiConfig.redactHeaders),u=E(u,a.apiConfig.redactBodyFields),v=E(v,a.apiConfig.redactBodyFields);let T={id:o,timestamp:d,method:p,url:g.url(),requestHeaders:m,requestBody:u,responseStatusCode:g.status(),responseStatusText:g.statusText(),responseHeaders:y,responseBody:v,responseTimeMs:Math.round((c-f)*100)/100,isBinary:k,error:null};a.capturedCalls.push(T);}catch{}try{g[bt]=o,a.tagResponseMethods(g,o);}catch{}return g}}};F.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 q=F;var Me="__testrelic_api_config",De="__testrelic_config_trackApiCalls";function j(e){let t=e.annotations.find(a=>a.type===Me&&a.description!==void 0);if(t)try{return JSON.parse(t.description,Pe)}catch{}let r=e.annotations.find(a=>a.type===De&&a.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 Pe(e,t){if(typeof t=="object"&&t!==null&&t.__regexp===true&&typeof t.source=="string"){let{source:r,flags:a}=t;return new RegExp(r,a)}return t}var Tt={page:async({page:e},t,r)=>{let a=new B(e);try{await a.init();}catch{}await t(e);try{let{navigations:n,networkRequests:s}=await a.getData(),i={testRelicData:!0,version:core.PAYLOAD_VERSION,navigations:n,networkRequests:s,apiCalls:[],apiAssertions:[]};await r.attach(core.ATTACHMENT_NAME,{body:Buffer.from(JSON.stringify(i)),contentType:core.ATTACHMENT_CONTENT_TYPE});}catch{}try{await a.flushLegacyAnnotations(r);}catch{}a.dispose();},request:async({request:e},t,r)=>{let a=j(r);if(!a.trackApiCalls){await t(e);return}let n=new N,s=new q(e,n,a);s.intercept(),await t(e);try{let i=s.getData(),o=a.captureAssertions?n.getData():[],d={testRelicData:!0,version:core.PAYLOAD_VERSION,navigations:[],networkRequests:[],apiCalls:i,apiAssertions:o};await r.attach(core.ATTACHMENT_NAME,{body:Buffer.from(JSON.stringify(d)),contentType:core.ATTACHMENT_CONTENT_TYPE});}catch{}try{s.flushLegacyAnnotations(r);}catch{}try{n.flushLegacyAnnotations(r);}catch{}s.dispose(),n.dispose();}};test.test.extend(Tt);var Ue={request:async({request:e},t,r)=>{let a=j(r);if(!a.trackApiCalls){await t(e);return}let n=new N,s=new q(e,n,a);s.intercept(),await t(e);try{let i=s.getData(),o=a.captureAssertions?n.getData():[],d={testRelicData:!0,version:core.PAYLOAD_VERSION,navigations:[],networkRequests:[],apiCalls:i,apiAssertions:o};await r.attach(core.ATTACHMENT_NAME,{body:Buffer.from(JSON.stringify(d)),contentType:core.ATTACHMENT_CONTENT_TYPE});}catch{}try{s.flushLegacyAnnotations(r);}catch{}try{n.flushLegacyAnnotations(r);}catch{}s.dispose(),n.dispose();}};var Rt=false;function ca(e,t,r="manual_record"){if(!e||!e.annotations){Rt||(Rt=true,process.stderr.write(`[testrelic] recordNavigation: reporter not active, navigation not recorded
1400
+ `));return}let a={url:t,navigationType:r,timestamp:new Date().toISOString()};e.annotations.push({type:"lambdatest-navigation",description:JSON.stringify(a)});}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=M;exports.default=L;exports.recordNavigation=ca;exports.testRelicApiFixture=Ue;exports.testRelicFixture=Tt;//# sourceMappingURL=index.cjs.map
1244
1401
  //# sourceMappingURL=index.cjs.map