reporting-labs 0.6.23 → 0.6.24
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/README.md +1 -1
- package/dist/auto.js +14 -0
- package/dist/reporter.d.ts +2 -0
- package/dist/reporter.js +20 -2
- package/dist/template.html +31 -11
- package/dist/template.js +31 -11
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -317,7 +317,7 @@ are right; data tables and the steps left unrun need 8+.
|
|
|
317
317
|
### Failures: everything you need to triage
|
|
318
318
|
|
|
319
319
|
- **Bug report** button on every failed test: a ready-to-paste ticket with priority, owner, story, environment, test data, steps to reproduce (taken from the test's own steps, the failing one marked), expected vs actual, the error, API calls and attachment names. Pick Markdown, Jira or plain text, edit if you like, copy or download.
|
|
320
|
-
- **Video in step with the test**: with `video` on, a test's video sits above its steps. Click ▶ on any step to watch that moment, or **Watch the failure** to see the 5 seconds before it; the step playing lights up as the video runs.
|
|
320
|
+
- **Video in step with the test**: with `video` on, a test's video sits above its steps. Click ▶ on any step to watch that moment, or **Watch the failure** to see the 5 seconds before it; the step playing lights up as the video runs. A popup or second tab has its own recording, and every player follows the steps.
|
|
321
321
|
- **Run again**: every test shows the command that runs just that test, with a Copy button, e.g. `npx playwright test tests/checkout.spec.ts:12 --project=chromium`. **Copy re-run command** on the Failures tab does the same for all failed tests at once. With playwright-bdd it runs `npx bddgen` first; Cypress and WebdriverIO re-run the spec file (`--spec`).
|
|
322
322
|
- **By owner**: who to ping, with failed and flaky counts. Click an owner to filter.
|
|
323
323
|
- **Download CSV / JSON**: all failed and flaky tests with title, spec, project, priority, owner, ticket, attempts, duration, first error line and new/known status. Ready for Jira or a sheet.
|
package/dist/auto.js
CHANGED
|
@@ -171,12 +171,26 @@ function note(ev) {
|
|
|
171
171
|
return;
|
|
172
172
|
info.attach('rl:browser', { body: JSON.stringify({ t: Date.now(), ...ev }), contentType: 'application/x-rl-browser' }).catch(() => { });
|
|
173
173
|
}
|
|
174
|
+
/** A recorded page opened. Playwright names the test's videos video.webm, video-1.webm, ... in the order their pages
|
|
175
|
+
* opened, so the n-th note here is when video n starts: the report can then play a popup's recording in step too. */
|
|
176
|
+
const pagesSeen = new Map();
|
|
177
|
+
function notePage() {
|
|
178
|
+
const info = currentTest();
|
|
179
|
+
if (!info)
|
|
180
|
+
return;
|
|
181
|
+
const key = info.testId + ':' + info.retry;
|
|
182
|
+
const i = pagesSeen.get(key) ?? 0;
|
|
183
|
+
pagesSeen.set(key, i + 1);
|
|
184
|
+
info.attach('rl:page', { body: JSON.stringify({ i, t: Date.now() }), contentType: 'application/x-rl-page' }).catch(() => { });
|
|
185
|
+
}
|
|
174
186
|
/** Listen to a browser context: uncaught page errors, console.error, and requests that failed or got 4xx/5xx. */
|
|
175
187
|
function watchContext(ctx) {
|
|
176
188
|
if (!ctx || typeof ctx.on !== 'function' || ctx[WATCHED])
|
|
177
189
|
return;
|
|
178
190
|
ctx[WATCHED] = true;
|
|
179
191
|
const onPage = (page) => {
|
|
192
|
+
if (safe(() => page.video()))
|
|
193
|
+
notePage();
|
|
180
194
|
page.on('pageerror', (err) => note({ kind: 'error', text: oneLine(err?.message || err), stack: oneLine(err?.stack, 4000), url: safe(() => page.url()) }));
|
|
181
195
|
page.on('console', (msg) => {
|
|
182
196
|
if (msg.type() !== 'error')
|
package/dist/reporter.d.ts
CHANGED
|
@@ -61,6 +61,8 @@ export default class ReportingLabsReporter implements Reporter {
|
|
|
61
61
|
private serializeError;
|
|
62
62
|
private outcome;
|
|
63
63
|
private titlePath;
|
|
64
|
+
/** A video's first frame: Playwright saves the n-th recorded page of a test as video-n.webm (the first as video.webm). */
|
|
65
|
+
private withVideoStart;
|
|
64
66
|
private serializeResult;
|
|
65
67
|
private browserEvent;
|
|
66
68
|
private serializeStep;
|
package/dist/reporter.js
CHANGED
|
@@ -52,7 +52,7 @@ const comments_1 = require("./comments");
|
|
|
52
52
|
const DEFAULT_EMBED_LIMIT = 2 * 1024 * 1024;
|
|
53
53
|
/** Attach steps created by log() and the automatic API capture; the data shows in its own section, so hide the step. */
|
|
54
54
|
function isInternalAttach(s) {
|
|
55
|
-
return s.category === 'test.attach' && /^Attach "(rl:log|rl:browser|(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS) )/.test(s.title);
|
|
55
|
+
return s.category === 'test.attach' && /^Attach "(rl:log|rl:browser|rl:page|(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS) )/.test(s.title);
|
|
56
56
|
}
|
|
57
57
|
/** Playwright 1.63+ moved the target out of the title: title `Click`, subtitle `getByRole('button')`; title `Navigate`,
|
|
58
58
|
* subtitle `/login`. Put it back next to the title, as the report showed before. A test.step's own subtitle and
|
|
@@ -621,9 +621,18 @@ class ReportingLabsReporter {
|
|
|
621
621
|
}
|
|
622
622
|
return parts;
|
|
623
623
|
}
|
|
624
|
+
/** A video's first frame: Playwright saves the n-th recorded page of a test as video-n.webm (the first as video.webm). */
|
|
625
|
+
withVideoStart(out, a, pageOpened) {
|
|
626
|
+
if (!out || !a.path || !a.contentType.startsWith('video/'))
|
|
627
|
+
return out;
|
|
628
|
+
const m = /^video(?:-(\d+))?\.webm$/.exec(path.basename(a.path));
|
|
629
|
+
const t = m ? pageOpened[m[1] ? Number(m[1]) : 0] : undefined;
|
|
630
|
+
return t != null ? { ...out, videoStart: t } : out;
|
|
631
|
+
}
|
|
624
632
|
serializeResult(r, test) {
|
|
625
633
|
const logs = [], data = [], api = [], browser = [];
|
|
626
634
|
const normal = [];
|
|
635
|
+
const pageOpened = []; // when each recorded page opened, in order (reporting-labs/auto)
|
|
627
636
|
for (const a of r.attachments) {
|
|
628
637
|
const body = a.body ?? (a.path && fs.existsSync(a.path) ? fs.readFileSync(a.path) : undefined);
|
|
629
638
|
if (a.contentType === 'application/x-rl-log' && body) {
|
|
@@ -641,6 +650,15 @@ class ReportingLabsReporter {
|
|
|
641
650
|
catch { /* ignore */ }
|
|
642
651
|
continue;
|
|
643
652
|
}
|
|
653
|
+
if (a.contentType === 'application/x-rl-page' && body) {
|
|
654
|
+
try {
|
|
655
|
+
const pg = JSON.parse(body.toString());
|
|
656
|
+
if (Number.isInteger(pg.i) && typeof pg.t === 'number')
|
|
657
|
+
pageOpened[pg.i] = pg.t;
|
|
658
|
+
}
|
|
659
|
+
catch { /* ignore */ }
|
|
660
|
+
continue;
|
|
661
|
+
}
|
|
644
662
|
if (a.contentType === 'application/x-rl-browser' && body) {
|
|
645
663
|
try {
|
|
646
664
|
browser.push(this.browserEvent(JSON.parse(body.toString())));
|
|
@@ -675,7 +693,7 @@ class ReportingLabsReporter {
|
|
|
675
693
|
workerIndex: r.parallelIndex,
|
|
676
694
|
errors: r.errors.map(e => this.serializeError(e)),
|
|
677
695
|
steps: r.steps.filter(s => !isInternalAttach(s)).map(s => this.serializeStep(s)),
|
|
678
|
-
attachments: normal.map(a => this.serializeAttachment(a, test)).filter(Boolean),
|
|
696
|
+
attachments: normal.map(a => this.withVideoStart(this.serializeAttachment(a, test), a, pageOpened)).filter(Boolean),
|
|
679
697
|
stdout: r.stdout.map(c => this.masker.maskStr(stripAnsi(c.toString()))),
|
|
680
698
|
stderr: r.stderr.map(c => this.masker.maskStr(stripAnsi(c.toString()))),
|
|
681
699
|
...(browser.length ? { browser: browser.sort((x, y) => x.t - y.t) } : {}),
|
package/dist/template.html
CHANGED
|
@@ -316,6 +316,7 @@ li.collapsed>ul{display:none}
|
|
|
316
316
|
.vids figure{margin:0;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;background:#000}
|
|
317
317
|
.vids video{width:100%;display:block;max-height:420px;background:#000}
|
|
318
318
|
.vids figcaption{font:11px var(--mono);padding:6px 8px;color:var(--ink-2);background:var(--surface-2)}
|
|
319
|
+
.vids figure{transition:opacity .2s} .vids figure.off{opacity:.45}
|
|
319
320
|
.trace-card{border:1px solid var(--line);border-radius:var(--radius);padding:12px 14px;display:flex;flex-direction:column;gap:8px;font-size:13px}
|
|
320
321
|
.trace-how{color:var(--ink-2);font-size:12px} .trace-how code{font:12px var(--mono);background:var(--surface-2);padding:1px 5px;border-radius:3px}
|
|
321
322
|
.trace-card .dl{align-self:flex-start;font-size:12px;padding:6px 10px;border:1px solid var(--accent);border-radius:var(--radius);text-decoration:none}
|
|
@@ -1820,17 +1821,36 @@ function renderDetail(t, d, retryIdx){
|
|
|
1820
1821
|
const near=fail!=null? (r.browser||[]).filter(e=>e.t<=fail&&fail-e.t<=5000).length : 0;
|
|
1821
1822
|
if(near&&bsec) body.append(h('button',{class:'bev-jump',type:'button',onclick:()=>bsec.scrollIntoView({block:'start',behavior:'smooth'})}, 'The browser reported '+near+' problem'+(near>1?'s':'')+' in the 5 seconds before this failure. See what the browser saw ↓')); }
|
|
1822
1823
|
if(bsec&&failedRun) body.append(bsec);
|
|
1823
|
-
//
|
|
1824
|
-
|
|
1824
|
+
// each video's first frame on the wall clock: given by the runner (Node.js: when its page opened; Java, Python: the
|
|
1825
|
+
// page closed minus the video's length), or for an older Node.js report the first video from its "Create page" step.
|
|
1826
|
+
// A popup or second tab has its own recording: every player follows the steps, each from its own start.
|
|
1827
|
+
const allVids=r.attachments.filter(a=>a.src&&a.contentType.startsWith('video/')),
|
|
1828
|
+
starts=allVids.map((a,i)=>a.videoStart||(i===0? videoStart(r.steps) : null)), v0=starts.some(x=>x!=null)? Math.min(...starts.filter(x=>x!=null)) : null;
|
|
1825
1829
|
let sync=null;
|
|
1826
1830
|
if(v0!=null){
|
|
1827
|
-
const
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1831
|
+
const many=allVids.length>1;
|
|
1832
|
+
const figs=allVids.map((a,i)=>videoFigure(a, many? 'page '+(i+1)+(starts[i]!=null&&i>0? ', opened at '+ms(Math.max(0,starts[i]-r.startTime)) : '') : null)),
|
|
1833
|
+
players=figs.map((f,i)=>({...f, s0:starts[i]})).filter(p=>p.s0!=null), tree=()=>body.querySelectorAll('.step[data-s]');
|
|
1834
|
+
const len=p=>isFinite(p.v.duration)? p.v.duration*1000 : Infinity, covers=(p,abs)=>abs>=p.s0&&abs<=p.s0+len(p);
|
|
1835
|
+
const light=at=>{ let cur=null; for(const el of tree()){ if(el.offsetParent&&+el.dataset.s<=at&&at<=+el.dataset.e) cur=el; } for(const el of body.querySelectorAll('.step.now')) if(el!==cur) el.classList.remove('now'); if(cur) cur.classList.add('now'); };
|
|
1836
|
+
const show=(p,on)=>{ if(many){ p.fig.classList.toggle('off',!on); } };
|
|
1837
|
+
sync={ from:v0, seek:abs=>{
|
|
1838
|
+
// the players recording at that moment play from it; the others wait (dimmed) and join when their page opens
|
|
1839
|
+
let first=null;
|
|
1840
|
+
for(const p of players){ if(covers(p,abs)){ p.v.currentTime=(abs-p.s0)/1000; p.v.play().catch(()=>{}); show(p,true); first=first||p; } else { p.v.pause(); p.v.currentTime=abs<p.s0||!isFinite(len(p))? 0 : len(p)/1000; show(p,false); } }
|
|
1841
|
+
if(!first){ first=players.reduce((a,b)=>b.s0<a.s0?b:a); first.v.currentTime=Math.max(0,(abs-first.s0)/1000); first.v.play().catch(()=>{}); show(first,true); }
|
|
1842
|
+
first.v.scrollIntoView({block:'nearest',behavior:'smooth'}); } };
|
|
1843
|
+
// a step that starts after every recording ended (closing the browser) has nothing to show
|
|
1844
|
+
const hideLate=()=>{ if(players.some(p=>!isFinite(p.v.duration))) return; const end=Math.max(...players.map(p=>p.s0+len(p))); for(const b of body.querySelectorAll('.vplay[data-s]')) if(+b.dataset.s>=end) b.hidden=true; };
|
|
1845
|
+
for(const p of players){
|
|
1846
|
+
p.v.addEventListener('loadedmetadata',hideLate);
|
|
1847
|
+
p.v.addEventListener('timeupdate',()=>{ if(many&&p.fig.classList.contains('off')) return; const at=p.s0+p.v.currentTime*1000; light(at);
|
|
1848
|
+
// a page opened while this one plays: start its recording too
|
|
1849
|
+
if(many&&!p.v.paused) for(const o of players) if(o!==p&&o.v.paused&&covers(o,at)&&o.v.currentTime*1000<at-o.s0-400){ o.v.currentTime=(at-o.s0)/1000; o.v.play().catch(()=>{}); show(o,true); } });
|
|
1850
|
+
if(many) p.v.addEventListener('ended',()=>show(p,false));
|
|
1851
|
+
}
|
|
1852
|
+
body.append(h('h4',{},many?'Videos':'Video'), h('div',{class:'vsync'},
|
|
1853
|
+
h('span',{class:'hint'}, many? 'In step with the test: each page (a popup, a second tab) has its own recording, and they play together. The step playing lights up below. Click ▶ on a step to watch it.' : 'In step with the test: the step playing lights up below. Click ▶ on a step to watch it.'),
|
|
1834
1854
|
fail!=null? h('button',{class:'btn primary',type:'button',onclick:()=>sync.seek(fail-5000)},'▶ Watch the failure') : null),
|
|
1835
1855
|
h('div',{class:'vids'}, figs.map(f=>f.fig)));
|
|
1836
1856
|
}
|
|
@@ -1865,9 +1885,9 @@ function renderDetail(t, d, retryIdx){
|
|
|
1865
1885
|
if(!body.children.length) body.append(h('p',{style:'color:var(--ink-3)'}, r.status==='skipped'?'Skipped — nothing was executed.'+(skipReason(t)?' Reason: '+skipReason(t):''):'Passed with no steps or attachments recorded.'));
|
|
1866
1886
|
d.append(body);
|
|
1867
1887
|
}
|
|
1868
|
-
function videoFigure(a){ const fig=h('figure',{}); const v=h('video',{src:a.src,controls:'',preload:'metadata',playsinline:''});
|
|
1888
|
+
function videoFigure(a, label){ const fig=h('figure',{}); const v=h('video',{src:a.src,controls:'',preload:'metadata',playsinline:''});
|
|
1869
1889
|
v.addEventListener('error',()=>{ const code=v.error&&v.error.code; const why=code===4?'The file is missing, or it is not a format this browser can play.':code===2?'The file could not be read.':'The file could not be decoded.'; v.replaceWith(h('div',{class:'att-err'}, h('b',{},'Video could not be loaded.'), ' '+why+' Expected at ', h('code',{},a.src), '. Common causes: on macOS, Chrome cannot read files next to a report opened from Downloads, Desktop or Documents until you allow it under System Settings → Privacy & Security → Files and Folders (or move the project elsewhere); or the assets folder was replaced by a newer run. Setting embedVideos: true in the reporter options puts videos inside the HTML and avoids both.')); });
|
|
1870
|
-
fig.append(v, h('figcaption',{}, a.name, a.size?h('span',{},' · '+kb(a.size)):null, ' · ', h('a',{href:a.src,download:'',target:'_blank',rel:'noopener',title:'Downloads when the report is served over http; opens in a new tab when opened as a file'},'download'))); return {fig, v}; }
|
|
1890
|
+
fig.append(v, h('figcaption',{}, a.name, label?h('span',{},' · '+label):null, a.size?h('span',{},' · '+kb(a.size)):null, ' · ', h('a',{href:a.src,download:'',target:'_blank',rel:'noopener',title:'Downloads when the report is served over http; opens in a new tab when opened as a file'},'download'))); return {fig, v}; }
|
|
1871
1891
|
/* Playwright starts recording a page's video when the page is created: the first "Create page" step ends at the
|
|
1872
1892
|
video's 0:00 (measured within ~20ms). Without that step (other runners) the video is not lined up with steps. */
|
|
1873
1893
|
function videoStart(steps){ for(const s of steps){ if(s.category==='pw:api'&&/^Create page\b/.test(s.title)&&s.start!=null) return s.start+s.duration; const k=videoStart(s.steps); if(k!=null) return k; } return null; }
|
package/dist/template.js
CHANGED
|
@@ -387,6 +387,7 @@ li.collapsed>ul{display:none}
|
|
|
387
387
|
.vids figure{margin:0;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;background:#000}
|
|
388
388
|
.vids video{width:100%;display:block;max-height:420px;background:#000}
|
|
389
389
|
.vids figcaption{font:11px var(--mono);padding:6px 8px;color:var(--ink-2);background:var(--surface-2)}
|
|
390
|
+
.vids figure{transition:opacity .2s} .vids figure.off{opacity:.45}
|
|
390
391
|
.trace-card{border:1px solid var(--line);border-radius:var(--radius);padding:12px 14px;display:flex;flex-direction:column;gap:8px;font-size:13px}
|
|
391
392
|
.trace-how{color:var(--ink-2);font-size:12px} .trace-how code{font:12px var(--mono);background:var(--surface-2);padding:1px 5px;border-radius:3px}
|
|
392
393
|
.trace-card .dl{align-self:flex-start;font-size:12px;padding:6px 10px;border:1px solid var(--accent);border-radius:var(--radius);text-decoration:none}
|
|
@@ -1886,17 +1887,36 @@ function renderDetail(t, d, retryIdx){
|
|
|
1886
1887
|
const near=fail!=null? (r.browser||[]).filter(e=>e.t<=fail&&fail-e.t<=5000).length : 0;
|
|
1887
1888
|
if(near&&bsec) body.append(h('button',{class:'bev-jump',type:'button',onclick:()=>bsec.scrollIntoView({block:'start',behavior:'smooth'})}, 'The browser reported '+near+' problem'+(near>1?'s':'')+' in the 5 seconds before this failure. See what the browser saw ↓')); }
|
|
1888
1889
|
if(bsec&&failedRun) body.append(bsec);
|
|
1889
|
-
//
|
|
1890
|
-
|
|
1890
|
+
// each video's first frame on the wall clock: given by the runner (Node.js: when its page opened; Java, Python: the
|
|
1891
|
+
// page closed minus the video's length), or for an older Node.js report the first video from its "Create page" step.
|
|
1892
|
+
// A popup or second tab has its own recording: every player follows the steps, each from its own start.
|
|
1893
|
+
const allVids=r.attachments.filter(a=>a.src&&a.contentType.startsWith('video/')),
|
|
1894
|
+
starts=allVids.map((a,i)=>a.videoStart||(i===0? videoStart(r.steps) : null)), v0=starts.some(x=>x!=null)? Math.min(...starts.filter(x=>x!=null)) : null;
|
|
1891
1895
|
let sync=null;
|
|
1892
1896
|
if(v0!=null){
|
|
1893
|
-
const
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1897
|
+
const many=allVids.length>1;
|
|
1898
|
+
const figs=allVids.map((a,i)=>videoFigure(a, many? 'page '+(i+1)+(starts[i]!=null&&i>0? ', opened at '+ms(Math.max(0,starts[i]-r.startTime)) : '') : null)),
|
|
1899
|
+
players=figs.map((f,i)=>({...f, s0:starts[i]})).filter(p=>p.s0!=null), tree=()=>body.querySelectorAll('.step[data-s]');
|
|
1900
|
+
const len=p=>isFinite(p.v.duration)? p.v.duration*1000 : Infinity, covers=(p,abs)=>abs>=p.s0&&abs<=p.s0+len(p);
|
|
1901
|
+
const light=at=>{ let cur=null; for(const el of tree()){ if(el.offsetParent&&+el.dataset.s<=at&&at<=+el.dataset.e) cur=el; } for(const el of body.querySelectorAll('.step.now')) if(el!==cur) el.classList.remove('now'); if(cur) cur.classList.add('now'); };
|
|
1902
|
+
const show=(p,on)=>{ if(many){ p.fig.classList.toggle('off',!on); } };
|
|
1903
|
+
sync={ from:v0, seek:abs=>{
|
|
1904
|
+
// the players recording at that moment play from it; the others wait (dimmed) and join when their page opens
|
|
1905
|
+
let first=null;
|
|
1906
|
+
for(const p of players){ if(covers(p,abs)){ p.v.currentTime=(abs-p.s0)/1000; p.v.play().catch(()=>{}); show(p,true); first=first||p; } else { p.v.pause(); p.v.currentTime=abs<p.s0||!isFinite(len(p))? 0 : len(p)/1000; show(p,false); } }
|
|
1907
|
+
if(!first){ first=players.reduce((a,b)=>b.s0<a.s0?b:a); first.v.currentTime=Math.max(0,(abs-first.s0)/1000); first.v.play().catch(()=>{}); show(first,true); }
|
|
1908
|
+
first.v.scrollIntoView({block:'nearest',behavior:'smooth'}); } };
|
|
1909
|
+
// a step that starts after every recording ended (closing the browser) has nothing to show
|
|
1910
|
+
const hideLate=()=>{ if(players.some(p=>!isFinite(p.v.duration))) return; const end=Math.max(...players.map(p=>p.s0+len(p))); for(const b of body.querySelectorAll('.vplay[data-s]')) if(+b.dataset.s>=end) b.hidden=true; };
|
|
1911
|
+
for(const p of players){
|
|
1912
|
+
p.v.addEventListener('loadedmetadata',hideLate);
|
|
1913
|
+
p.v.addEventListener('timeupdate',()=>{ if(many&&p.fig.classList.contains('off')) return; const at=p.s0+p.v.currentTime*1000; light(at);
|
|
1914
|
+
// a page opened while this one plays: start its recording too
|
|
1915
|
+
if(many&&!p.v.paused) for(const o of players) if(o!==p&&o.v.paused&&covers(o,at)&&o.v.currentTime*1000<at-o.s0-400){ o.v.currentTime=(at-o.s0)/1000; o.v.play().catch(()=>{}); show(o,true); } });
|
|
1916
|
+
if(many) p.v.addEventListener('ended',()=>show(p,false));
|
|
1917
|
+
}
|
|
1918
|
+
body.append(h('h4',{},many?'Videos':'Video'), h('div',{class:'vsync'},
|
|
1919
|
+
h('span',{class:'hint'}, many? 'In step with the test: each page (a popup, a second tab) has its own recording, and they play together. The step playing lights up below. Click ▶ on a step to watch it.' : 'In step with the test: the step playing lights up below. Click ▶ on a step to watch it.'),
|
|
1900
1920
|
fail!=null? h('button',{class:'btn primary',type:'button',onclick:()=>sync.seek(fail-5000)},'▶ Watch the failure') : null),
|
|
1901
1921
|
h('div',{class:'vids'}, figs.map(f=>f.fig)));
|
|
1902
1922
|
}
|
|
@@ -1931,9 +1951,9 @@ function renderDetail(t, d, retryIdx){
|
|
|
1931
1951
|
if(!body.children.length) body.append(h('p',{style:'color:var(--ink-3)'}, r.status==='skipped'?'Skipped — nothing was executed.'+(skipReason(t)?' Reason: '+skipReason(t):''):'Passed with no steps or attachments recorded.'));
|
|
1932
1952
|
d.append(body);
|
|
1933
1953
|
}
|
|
1934
|
-
function videoFigure(a){ const fig=h('figure',{}); const v=h('video',{src:a.src,controls:'',preload:'metadata',playsinline:''});
|
|
1954
|
+
function videoFigure(a, label){ const fig=h('figure',{}); const v=h('video',{src:a.src,controls:'',preload:'metadata',playsinline:''});
|
|
1935
1955
|
v.addEventListener('error',()=>{ const code=v.error&&v.error.code; const why=code===4?'The file is missing, or it is not a format this browser can play.':code===2?'The file could not be read.':'The file could not be decoded.'; v.replaceWith(h('div',{class:'att-err'}, h('b',{},'Video could not be loaded.'), ' '+why+' Expected at ', h('code',{},a.src), '. Common causes: on macOS, Chrome cannot read files next to a report opened from Downloads, Desktop or Documents until you allow it under System Settings → Privacy & Security → Files and Folders (or move the project elsewhere); or the assets folder was replaced by a newer run. Setting embedVideos: true in the reporter options puts videos inside the HTML and avoids both.')); });
|
|
1936
|
-
fig.append(v, h('figcaption',{}, a.name, a.size?h('span',{},' · '+kb(a.size)):null, ' · ', h('a',{href:a.src,download:'',target:'_blank',rel:'noopener',title:'Downloads when the report is served over http; opens in a new tab when opened as a file'},'download'))); return {fig, v}; }
|
|
1956
|
+
fig.append(v, h('figcaption',{}, a.name, label?h('span',{},' · '+label):null, a.size?h('span',{},' · '+kb(a.size)):null, ' · ', h('a',{href:a.src,download:'',target:'_blank',rel:'noopener',title:'Downloads when the report is served over http; opens in a new tab when opened as a file'},'download'))); return {fig, v}; }
|
|
1937
1957
|
/* Playwright starts recording a page's video when the page is created: the first "Create page" step ends at the
|
|
1938
1958
|
video's 0:00 (measured within ~20ms). Without that step (other runners) the video is not lined up with steps. */
|
|
1939
1959
|
function videoStart(steps){ for(const s of steps){ if(s.category==='pw:api'&&/^Create page\b/.test(s.title)&&s.start!=null) return s.start+s.duration; const k=videoStart(s.steps); if(k!=null) return k; } return null; }
|
package/dist/types.d.ts
CHANGED
|
@@ -234,6 +234,8 @@ export interface AttachmentData {
|
|
|
234
234
|
text?: string;
|
|
235
235
|
/** bytes on disk, when known */
|
|
236
236
|
size?: number;
|
|
237
|
+
/** A video's first frame (ms since epoch), when the runner knows it: lines the video up with the steps. */
|
|
238
|
+
videoStart?: number;
|
|
237
239
|
}
|
|
238
240
|
export interface ResultData {
|
|
239
241
|
retry: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reporting-labs",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.24",
|
|
4
4
|
"description": "reportingLabs – beautiful, customizable single-file HTML test reports. One line of config. Playwright adapter included, more runners on the way.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"test-report",
|