screw-bugs 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -16
- package/dist/browser-playwright/launch.d.ts +4 -2
- package/dist/browser-playwright/launch.js +8 -1
- package/dist/browser-playwright/page.d.ts +2 -2
- package/dist/browser-playwright/page.js +15 -2
- package/dist/browser-playwright/still.d.ts +12 -0
- package/dist/browser-playwright/still.js +51 -0
- package/dist/build-info.json +3 -3
- package/dist/cli/app.d.ts +1 -1
- package/dist/cli/commands.js +57 -12
- package/dist/cli/mcp.d.ts +11 -4
- package/dist/cli/mcp.js +86 -23
- package/dist/cli/operations.d.ts +30 -2
- package/dist/cli/operations.js +126 -20
- package/dist/cli/report-links.js +2 -2
- package/dist/cli/report-server.d.ts +41 -9
- package/dist/cli/report-server.js +139 -23
- package/dist/cli/share.d.ts +71 -4
- package/dist/cli/share.js +549 -118
- package/dist/cli/sign-in.d.ts +22 -10
- package/dist/cli/sign-in.js +23 -23
- package/dist/core/engine.js +67 -17
- package/dist/core/liveness.js +3 -1
- package/dist/core/services.d.ts +30 -5
- package/dist/core/share.d.ts +31 -0
- package/dist/core/share.js +139 -0
- package/dist/core/steps.d.ts +5 -0
- package/dist/core/steps.js +15 -1
- package/dist/core/video.d.ts +31 -0
- package/dist/core/video.js +132 -0
- package/dist/report/html.d.ts +4 -2
- package/dist/report/html.js +45 -13
- package/dist/report/icons.d.ts +3 -0
- package/dist/report/icons.js +5 -1
- package/dist/report/index.d.ts +3 -1
- package/dist/report/index.js +3 -1
- package/dist/report/live.d.ts +7 -0
- package/dist/report/live.js +135 -0
- package/dist/report/menu-bar.d.ts +3 -3
- package/dist/report/menu-bar.js +4 -4
- package/dist/report/player.d.ts +3 -3
- package/dist/report/player.js +3 -3
- package/dist/report/share-page.d.ts +48 -0
- package/dist/report/share-page.js +291 -0
- package/dist/report/styles.d.ts +2 -0
- package/dist/report/styles.js +2 -2
- package/dist/report/view.d.ts +16 -5
- package/dist/report/view.js +60 -24
- package/dist/report/walkthrough.d.ts +7 -3
- package/dist/report/walkthrough.js +21 -8
- package/dist/schema/accounts.js +10 -1
- package/dist/schema/evidence.d.ts +30 -8
- package/dist/schema/evidence.js +17 -4
- package/dist/schema/findings.js +1 -1
- package/dist/schema/job.d.ts +205 -65
- package/dist/schema/job.js +63 -11
- package/dist/schema/ledger.d.ts +88 -16
- package/dist/schema/ledger.js +36 -0
- package/dist/schema/share.d.ts +17 -0
- package/dist/schema/share.js +22 -0
- package/package.json +1 -1
package/dist/report/view.d.ts
CHANGED
|
@@ -202,7 +202,7 @@ export interface UrlPoint {
|
|
|
202
202
|
export declare const urlTimeline: (bundle: ReportBundle, views?: ReadonlyArray<CaseView>) => ReadonlyArray<UrlPoint>;
|
|
203
203
|
/** The address at `ms` into a session's video: the last one recorded by then, if any. */
|
|
204
204
|
export declare const urlAt: (points: ReadonlyArray<UrlPoint>, session: number, ms: number) => string | undefined;
|
|
205
|
-
/** A stretch of a session's video in which
|
|
205
|
+
/** A stretch of a session's video in which nothing happened: what "Skip inactive" jumps over. */
|
|
206
206
|
export interface IdleStretch {
|
|
207
207
|
readonly session: number;
|
|
208
208
|
readonly fromMs: number;
|
|
@@ -213,10 +213,21 @@ export declare const IDLE_MIN_MS = 1500;
|
|
|
213
213
|
/** How much of an idle stretch is still played at either end, so a step's result can be seen. */
|
|
214
214
|
export declare const IDLE_MARGIN_MS = 300;
|
|
215
215
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
|
|
216
|
+
* Around a recorded action (a press of the mouse or a key) the video is never idle, even where
|
|
217
|
+
* it stands still: the walkthrough's cursor glides to it before (`GLIDE_S`) and its ripple and
|
|
218
|
+
* label show after.
|
|
219
|
+
*/
|
|
220
|
+
export declare const ACTION_BEFORE_MS = 600;
|
|
221
|
+
export declare const ACTION_AFTER_MS = 1500;
|
|
222
|
+
/**
|
|
223
|
+
* The stretches of each session's video where nothing happened, at least `IDLE_MIN_MS` long once
|
|
224
|
+
* `IDLE_MARGIN_MS` is kept at either end (none at the very start of the video). Where the run
|
|
225
|
+
* measured its video (`Session.still`), they are where its picture stood still, even while a step
|
|
226
|
+
* waited, except around each recorded action (`ACTION_BEFORE_MS`, `ACTION_AFTER_MS`; the whole
|
|
227
|
+
* step for an action recorded without a time, whose label shows while its step plays). For an
|
|
228
|
+
* older run they are where no step ran: before the first step, between steps and after the last
|
|
229
|
+
* one (to the end of the video, when its length is known); there a step that waited is not idle,
|
|
230
|
+
* since what it waited for may show at any moment.
|
|
220
231
|
*/
|
|
221
232
|
export declare const idleStretches: (bundle: ReportBundle) => ReadonlyArray<IdleStretch>;
|
|
222
233
|
/**
|
package/dist/report/view.js
CHANGED
|
@@ -67,6 +67,8 @@ export const stepParts = (step) => {
|
|
|
67
67
|
return [t('Reload the page')];
|
|
68
68
|
case 'click':
|
|
69
69
|
return [t('Click '), ...targetParts(step.target)];
|
|
70
|
+
case 'hover':
|
|
71
|
+
return [t('Hover over '), ...targetParts(step.target)];
|
|
70
72
|
case 'fill':
|
|
71
73
|
return step.value === ''
|
|
72
74
|
? [t('Clear '), ...targetParts(step.target)]
|
|
@@ -513,35 +515,69 @@ export const IDLE_MIN_MS = 1500;
|
|
|
513
515
|
/** How much of an idle stretch is still played at either end, so a step's result can be seen. */
|
|
514
516
|
export const IDLE_MARGIN_MS = 300;
|
|
515
517
|
/**
|
|
516
|
-
*
|
|
517
|
-
*
|
|
518
|
-
*
|
|
519
|
-
|
|
518
|
+
* Around a recorded action (a press of the mouse or a key) the video is never idle, even where
|
|
519
|
+
* it stands still: the walkthrough's cursor glides to it before (`GLIDE_S`) and its ripple and
|
|
520
|
+
* label show after.
|
|
521
|
+
*/
|
|
522
|
+
export const ACTION_BEFORE_MS = 600;
|
|
523
|
+
export const ACTION_AFTER_MS = 1500;
|
|
524
|
+
/** `spans` with every part `busy` covers taken out; both in time order or not. */
|
|
525
|
+
const without = (spans, busy) => busy.reduce((left, [b0, b1]) => left.flatMap(([a0, a1]) => b1 <= a0 || b0 >= a1
|
|
526
|
+
? [[a0, a1]]
|
|
527
|
+
: [...(b0 > a0 ? [[a0, b0]] : []), ...(b1 < a1 ? [[b1, a1]] : [])]), spans);
|
|
528
|
+
/**
|
|
529
|
+
* The stretches of each session's video where nothing happened, at least `IDLE_MIN_MS` long once
|
|
530
|
+
* `IDLE_MARGIN_MS` is kept at either end (none at the very start of the video). Where the run
|
|
531
|
+
* measured its video (`Session.still`), they are where its picture stood still, even while a step
|
|
532
|
+
* waited, except around each recorded action (`ACTION_BEFORE_MS`, `ACTION_AFTER_MS`; the whole
|
|
533
|
+
* step for an action recorded without a time, whose label shows while its step plays). For an
|
|
534
|
+
* older run they are where no step ran: before the first step, between steps and after the last
|
|
535
|
+
* one (to the end of the video, when its length is known); there a step that waited is not idle,
|
|
536
|
+
* since what it waited for may show at any moment.
|
|
520
537
|
*/
|
|
521
538
|
export const idleStretches = (bundle) => {
|
|
522
|
-
const
|
|
523
|
-
|
|
539
|
+
const steps = new Map();
|
|
540
|
+
const actions = new Map();
|
|
541
|
+
for (const entry of bundle.ledger.cases) {
|
|
542
|
+
const session = sessionNumber(entry);
|
|
524
543
|
for (const s of entry.steps ?? []) {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
at = Math.max(at, end);
|
|
544
|
+
steps.set(session, [
|
|
545
|
+
...(steps.get(session) ?? []),
|
|
546
|
+
[s.startMs, Math.max(s.startMs, s.endMs)],
|
|
547
|
+
]);
|
|
548
|
+
if (s.action === undefined)
|
|
549
|
+
continue;
|
|
550
|
+
const at = s.action.atMs;
|
|
551
|
+
// An action whose input was not seen (a fill, a frame's click) is labelled while its step
|
|
552
|
+
// plays: all of that step is kept.
|
|
553
|
+
const busy = at !== undefined
|
|
554
|
+
? [at - ACTION_BEFORE_MS, at + ACTION_AFTER_MS]
|
|
555
|
+
: [s.startMs, Math.max(s.startMs, s.endMs)];
|
|
556
|
+
actions.set(session, [...(actions.get(session) ?? []), busy]);
|
|
539
557
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
558
|
+
}
|
|
559
|
+
const measured = new Map((bundle.ledger.sessions ?? []).flatMap((s) => s.still !== undefined ? [[s.number, s.still]] : []));
|
|
560
|
+
const sessions = [...new Set([...steps.keys(), ...measured.keys()])].toSorted((a, b) => a - b);
|
|
561
|
+
return sessions.flatMap((session) => {
|
|
562
|
+
const still = measured.get(session);
|
|
563
|
+
const gaps = still !== undefined
|
|
564
|
+
? without(still.map((s) => [s.fromMs, s.toMs]), actions.get(session) ?? [])
|
|
565
|
+
: (() => {
|
|
566
|
+
const sorted = (steps.get(session) ?? []).toSorted((a, b) => a[0] - b[0]);
|
|
567
|
+
const found = [];
|
|
568
|
+
let at = 0;
|
|
569
|
+
for (const [start, end] of sorted) {
|
|
570
|
+
if (start > at)
|
|
571
|
+
found.push([at, start]);
|
|
572
|
+
at = Math.max(at, end);
|
|
573
|
+
}
|
|
574
|
+
const length = sessionLength(bundle, session);
|
|
575
|
+
if (length !== undefined && length > at)
|
|
576
|
+
found.push([at, length]);
|
|
577
|
+
return found;
|
|
578
|
+
})();
|
|
543
579
|
return gaps.flatMap(([from, to]) => {
|
|
544
|
-
const [a, b] = [from
|
|
580
|
+
const [a, b] = [from <= 0 ? 0 : from + IDLE_MARGIN_MS, to - IDLE_MARGIN_MS];
|
|
545
581
|
return b - a >= IDLE_MIN_MS ? [{ session, fromMs: a, toMs: b }] : [];
|
|
546
582
|
});
|
|
547
583
|
});
|
|
@@ -19,7 +19,8 @@ export declare const GLIDE_S = 0.6;
|
|
|
19
19
|
* the reader prefers less; the top row that shows, below the top bar and, on a narrow screen, the
|
|
20
20
|
* pinned player and its fade, when the page has scrolled the script under them), draws the box of the element it acted on over the video while that was
|
|
21
21
|
* measured, makes timecodes and rows seek (and switch session videos) instead of opening the file,
|
|
22
|
-
* and, with "Skip inactive" on, jumps over the stretches where
|
|
22
|
+
* and, with "Skip inactive" on (remembered like the theme), jumps over the stretches where
|
|
23
|
+
* nothing happened (`idleStretches`) while it plays.
|
|
23
24
|
* "Expand" shows the whole script and makes the video smaller. Fullscreen takes the whole page
|
|
24
25
|
* (`.wt`), not only the video; on a wide screen (a desktop) it never takes the browser's screen,
|
|
25
26
|
* only lays the page out again (`.focus`, see `PLAYER_JS`): the top bar, the video as big as fits with its address over it and
|
|
@@ -35,12 +36,15 @@ export declare const GLIDE_S = 0.6;
|
|
|
35
36
|
* typed into (when that box shows: a fill records no time or element of its own), and a short
|
|
36
37
|
* label of the action (the latest one that happened, else the one the cursor is gliding to; the
|
|
37
38
|
* box's own label gives way to it; one whose time was not recorded is labelled while its step
|
|
38
|
-
* plays, and has no cursor or ripple).
|
|
39
|
+
* plays, and has no cursor or ripple). A hover moves the mouse but records no point (see
|
|
40
|
+
* `StepAction.atMs`), so from when its step starts (any hover step that ran, also one that failed
|
|
41
|
+
* or was blocked, which may have moved the mouse all the same; its row's `data-hv`) the cursor is
|
|
42
|
+
* hidden until the next point the mouse pressed, rather than shown where the mouse no longer is. All of it follows the player's time, so seeking or pausing
|
|
39
43
|
* shows the state at that moment. With less motion preferred, the cursor jumps instead of gliding
|
|
40
44
|
* and there is no ripple. A "Cursor" switch turns it off, remembered like the theme. Nothing is
|
|
41
45
|
* added to the page under test or to the video.
|
|
42
46
|
*/
|
|
43
|
-
export declare const WALKTHROUGH_SCRIPT = "(()=>{const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.menubar');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst themeCycle=(b,key)=>{\n const r=document.documentElement,T=['light','dark','system'],N={light:'Light theme',dark:'Dark theme',system:'Theme from system'};\n const at=()=>{const i=T.indexOf(r.dataset.theme);return i<0?2:i};\n const show=()=>{const i=at(),f=document.getElementById('favicon'),h=f&&f.dataset[T[i]];if(h)f.href=h;b.setAttribute('aria-label',N[T[i]]+'. Switch to '+N[T[(i+1)%3]].toLowerCase());b.title=N[T[i]]};\n show();\n b.addEventListener('click',()=>{const m=T[(at()+1)%3];r.dataset.theme=m;if(key)try{localStorage.setItem(key,m)}catch(e){}show()});\n};\nconst chrome=()=>{\n d.querySelectorAll('.menubar .theme').forEach(b=>{themeCycle(b,K);b.hidden=false});\n if(location.protocol==='http:'&&(location.hostname==='127.0.0.1'||location.hostname==='localhost'))d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n const y=d.createElement('span');y.className='year';y.textContent=', '+p.year;\n e.replaceChildren(p.month+' '+p.day,y,' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute);\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),errs=new Map(),empty=d.getElementById(p+'-none');let shown=0,cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>{grow();v.play().catch(()=>{})});v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){++shown;note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}const ft=note.querySelector('.fix-text'),fd=note.querySelector('.fix-done');if(ft){ft.hidden=true;ft.value=''}if(fd)fd.textContent=''}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{const e=v.error;if(!e)return;dead.add(cur);errs.set(cur,'error code '+e.code+(e.message?': '+e.message:''));if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n const fix=d.getElementById(p+'-fix');\n if(fix){const box=fix.parentElement,ta=box.querySelector('.fix-text'),said=box.querySelector('.fix-done');\n fix.addEventListener('click',()=>{\n let t=ta.dataset.template||'';\n [['video',down?srcs.get(down)||'':''],['page',location.href],['browser',navigator.userAgent],['error',errs.get(down)||'nothing']].forEach(([k,x])=>{t=t.split('{'+k+'}').join(x)});\n const g=shown;ta.value=t;const ok=()=>{if(g!==shown)return;said.textContent='Copied. Paste it into your coding agent.'};\n const by=()=>{if(g!==shown)return;ta.hidden=false;ta.focus();ta.setSelectionRange(0,t.length);ta.scrollTop=0;let c=false;try{c=d.execCommand('copy')}catch(x){}if(c)ok();else said.textContent='Copy the prompt below.'};\n if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(t).then(ok,by);else by();\n })}\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n v.addEventListener('click',()=>{if(down!==null)return;if(grow())v.play().catch(()=>{});else play.click()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n const api=!!(d.fullscreenEnabled&&screen.requestFullscreen),inPage=()=>!!o.inPage&&(o.inPage()||!api);\n const mark=()=>{const f=d.fullscreenElement===screen||screen.classList.contains('focus');full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()};\n let back=0;const focus=on=>{if(on)back=scrollY;screen.classList.toggle('focus',on);scrollTo({top:on?0:back,behavior:'auto'});mark()};\n const grow=()=>{if(!o.expand||!o.inPage||!o.inPage()||d.fullscreenElement||screen.classList.contains('focus'))return false;focus(true);return true};\n if(!api&&!o.inPage)full.hidden=true;\n else{full.addEventListener('click',()=>{const f=screen.classList.contains('focus');if(d.fullscreenElement){d.exitFullscreen().catch(()=>{});if(f)focus(false)}else if(f)focus(false);else if(inPage())focus(true);else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',mark);\n d.addEventListener('keydown',e=>{if(e.key==='Escape'&&!e.defaultPrevented&&screen.classList.contains('focus')&&!d.querySelector('dialog[open]')){e.preventDefault();focus(false)}})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();\n const stg=d.querySelector('.wt-stage');let fr=0;\n const fit=()=>{fr=0;if(!stg)return;const t=stg.getBoundingClientRect().top;stg.style.setProperty('--wt-top',Math.round(t)+'px');stg.style.setProperty('--wt-y',Math.round(t+scrollY)+'px')};\n const refit=()=>{if(!fr)fr=requestAnimationFrame(fit)};\n fit();addEventListener('resize',refit);addEventListener('load',refit);addEventListener('scroll',refit,{passive:true});d.addEventListener('fullscreenchange',refit);\n if(window.ResizeObserver)new ResizeObserver(refit).observe(d.body);\n const v=d.getElementById('wt-video');if(!v)return;\n const w=d.querySelector('.wt'),panel=d.getElementById('wt-script'),box=d.getElementById('wt-box'),cap=d.getElementById('wt-cap');\n const say=a=>{const x=a&&a.querySelector('.wt-text');cap.replaceChildren(...(x?[...x.childNodes].filter(n=>!(n instanceof Element&&n.classList.contains('wt-state'))).map(n=>n.cloneNode(true)):[]));cap.hidden=!x};\n const steps=[...d.querySelectorAll('.wt-step[data-t]')];\n const idle=[...d.querySelectorAll('.idle[data-a]')].map(e=>({s:e.closest('.track').dataset.s,a:Number(e.dataset.a),b:Number(e.dataset.b)}));\n const skipB=d.getElementById('wt-skip'),expB=d.getElementById('wt-expand');\n let on=null,skip=!!skipB&&skipB.getAttribute('aria-pressed')==='true',P=null;\n w.classList.add('live');\n const hide=()=>{box.hidden=true};\n const geo=()=>{const vw=v.videoWidth,vh=v.videoHeight,cw=v.clientWidth,ch=v.clientHeight;if(!vw||!vh||!cw||!ch)return null;const s=Math.min(cw/vw,ch/vh);return{x:v.offsetLeft+(cw-vw*s)/2,y:v.offsetTop+(ch-vh*s)/2,w:vw*s,h:vh*s}};\n const put=(e,x,y,bw,bh)=>{e.style.left=x+'px';e.style.top=y+'px';if(bw!==undefined){e.style.width=bw+'px';e.style.height=bh+'px'}};\n const draw=(t,g)=>{if(P.down()!==null||!g||!on||!on.dataset.box||t<Number(on.dataset.b0)||t>Number(on.dataset.b1))return hide();const b=on.dataset.box.split(' ').map(Number);put(box,g.x+b[0]*g.w,g.y+b[1]*g.h,b[2]*g.w,b[3]*g.h);box.querySelector('span').textContent=on.dataset.label||'';box.hidden=false};\n const C=d.getElementById('wt-cursor'),R=d.getElementById('wt-ripple'),G=d.getElementById('wt-ring'),L=d.getElementById('wt-act'),T=d.getElementById('wt-cursor-on'),ck='screw-bugs-cursor';\n const nums=x=>x?x.split(' ').map(Number):null;\n const acts=[...d.querySelectorAll('.wt-step[data-act][data-s]')].map(e=>({s:e.dataset.s,at:e.dataset.at?Number(e.dataset.at):NaN,t0:Number(e.dataset.t),t1:Number(e.dataset.a1),b0:Number(e.dataset.b0),b1:Number(e.dataset.b1),k:e.dataset.act,p:nums(e.dataset.pt),b:nums(e.dataset.tb),l:e.dataset.al||''})).sort((a,b)=>(a.at>=0?a.at:a.t0)-(b.at>=0?b.at:b.t0));\n let fon=true;try{fon=localStorage.getItem(ck)!=='off'}catch(e){}\n const fx=(t,g)=>{\n C.hidden=R.hidden=G.hidden=L.hidden=true;box.querySelector('span').hidden=false;\n if(!fon||P.down()!==null||!g)return;\n const m=still(),mine=acts.filter(a=>a.s===P.cur()),ptr=mine.filter(a=>a.p),xy=p=>[g.x+p[0]*g.w,g.y+p[1]*g.h];\n let i=-1;ptr.forEach((a,j)=>{if(a.at<=t)i=j});\n const a=ptr[i],n=ptr[i+1];let c=a?a.p:null;\n if(n&&a){const gw=Math.min(0.6,n.at-a.at),q=gw>0?(t-n.at+gw)/gw:1;if(q>=0){const e=q<.5?4*q*q*q:1-Math.pow(2-2*q,3)/2;c=!m&&q<1?[a.p[0]+(n.p[0]-a.p[0])*e,a.p[1]+(n.p[1]-a.p[1])*e]:n.p}}\n if(c){const xy0=xy(c);put(C,xy0[0]-3,xy0[1]-2);C.hidden=false}\n if(a&&!m&&t-a.at<.6){const q=(t-a.at)/.6,xy1=xy(a.p);put(R,xy1[0],xy1[1]);R.style.transform='translate(-50%,-50%) scale('+(.35+q*1.3)+')';R.style.opacity=String(1-q);R.hidden=false}\n let f=null,l=null,u=null;\n for(const x of mine){if(x.k==='fill'&&x.b&&t>=x.b0&&t<=x.b1)f=x;if(x.k==='fill'||!(x.at>=0)?t>=x.t0&&t<=x.t1:t>=x.at&&t<=x.at+1.5)l=x;else if(!u&&x.p&&x.at>t&&x.at-t<=0.6)u=x}\n l=l||u;\n if(f){const xy2=xy(f.b);put(G,xy2[0],xy2[1],f.b[2]*g.w,f.b[3]*g.h);G.hidden=false;box.hidden=true}\n if(l&&l.l){L.textContent=l.l;L.hidden=false;let x=g.x+10,y=g.y+10;if(l.p){const q=xy(l.p);x=q[0]+14;y=q[1]+20}else if(l.b){const q=xy(l.b);x=q[0];y=q[1]+l.b[3]*g.h+10}if(y+L.offsetHeight>g.y+g.h-4)y=l.b?g.y+l.b[1]*g.h-L.offsetHeight-10:g.y+g.h-L.offsetHeight-4;put(L,Math.max(g.x+4,Math.min(x,g.x+g.w-L.offsetWidth-4)),Math.max(g.y+4,y))}\n box.querySelector('span').hidden=!L.hidden;\n };\n const stage=d.querySelector('.wt-stage');\n const cover=()=>{let y=topEdge();if(stage&&getComputedStyle(stage).position==='sticky')y=Math.max(y,stage.getBoundingClientRect().bottom+16);return y};\n const anchor=a=>{const hid=Math.max(0,cover()-panel.getBoundingClientRect().top);panel.scrollTo({top:Math.max(0,a.offsetTop-6-hid),behavior:still()?'auto':'smooth'})};\n const tick=t=>{\n const cur=P.cur();\n if(skip&&!v.paused&&!v.seeking){const gap=idle.find(x=>x.s===cur&&t>=x.a&&t<x.b-0.05);if(gap){v.currentTime=gap.b;return}}\n let a=null;for(const s of steps){if(s.dataset.s===cur&&Number(s.dataset.t)<=t+0.02)a=s}\n if(a!==on){if(on){on.classList.remove('on');on.removeAttribute('aria-current');on.closest('.wt-case').classList.remove('on')}on=a;say(a);if(a){a.classList.add('on');a.setAttribute('aria-current','step');a.closest('.wt-case').classList.add('on');anchor(a)}}\n const g=geo();draw(t,g);fx(t,g);\n };\n P=player('wt',{tick,full:w,expand:true,inPage:()=>matchMedia('(min-width: 901px)').matches,broken:()=>{hide();fx(0,null);w.classList.remove('live')},fine:()=>{w.classList.add('live')}});\n if(T&&acts.length){T.checked=fon;T.closest('label').hidden=false;T.addEventListener('change',()=>{fon=T.checked;try{localStorage.setItem(ck,fon?'on':'off')}catch(e){}P.update()})}\n if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip))});\n if(expB)expB.addEventListener('click',()=>{const x=w.classList.toggle('expanded');expB.setAttribute('aria-expanded',String(x));expB.querySelector('span').textContent=x?'Collapse':'Expand';P.update();if(on)anchor(on)});\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const a=t.closest('a[data-t][data-s],.wt-step[data-t][data-s]');if(!a||!P.has(a.dataset.s))return;\n e.preventDefault();const fig=v.closest('.player');\n if(fig.getBoundingClientRect().bottom<topEdge())fig.scrollIntoView({block:'start',behavior:still()?'auto':'smooth'});\n P.load(a.dataset.s,Number(a.dataset.t),P.playing());\n });\n P.update();\n});\n})();";
|
|
47
|
+
export declare const WALKTHROUGH_SCRIPT = "(()=>{const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.menubar');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst themeCycle=(b,key)=>{\n const r=document.documentElement,T=['light','dark','system'],N={light:'Light theme',dark:'Dark theme',system:'Theme from system'};\n const at=()=>{const i=T.indexOf(r.dataset.theme);return i<0?2:i};\n const show=()=>{const i=at(),f=document.getElementById('favicon'),h=f&&f.dataset[T[i]];if(h)f.href=h;b.setAttribute('aria-label',N[T[i]]+'. Switch to '+N[T[(i+1)%3]].toLowerCase());b.title=N[T[i]]};\n show();\n b.addEventListener('click',()=>{const m=T[(at()+1)%3];r.dataset.theme=m;if(key)try{localStorage.setItem(key,m)}catch(e){}show()});\n};\nconst chrome=()=>{\n d.querySelectorAll('.menubar .theme').forEach(b=>{themeCycle(b,K);b.hidden=false});\n if(location.protocol==='http:')d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n const y=d.createElement('span');y.className='year';y.textContent=', '+p.year;\n e.replaceChildren(p.month+' '+p.day,y,' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute);\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),errs=new Map(),empty=d.getElementById(p+'-none');let shown=0,cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>{grow();v.play().catch(()=>{})});v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){++shown;note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}const ft=note.querySelector('.fix-text'),fd=note.querySelector('.fix-done');if(ft){ft.hidden=true;ft.value=''}if(fd)fd.textContent=''}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{const e=v.error;if(!e)return;dead.add(cur);errs.set(cur,'error code '+e.code+(e.message?': '+e.message:''));if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n const fix=d.getElementById(p+'-fix');\n if(fix){const box=fix.parentElement,ta=box.querySelector('.fix-text'),said=box.querySelector('.fix-done');\n fix.addEventListener('click',()=>{\n let t=ta.dataset.template||'';\n [['video',down?srcs.get(down)||'':''],['page',location.href],['browser',navigator.userAgent],['error',errs.get(down)||'nothing']].forEach(([k,x])=>{t=t.split('{'+k+'}').join(x)});\n const g=shown;ta.value=t;const ok=()=>{if(g!==shown)return;said.textContent='Copied. Paste it into your coding agent.'};\n const by=()=>{if(g!==shown)return;ta.hidden=false;ta.focus();ta.setSelectionRange(0,t.length);ta.scrollTop=0;let c=false;try{c=d.execCommand('copy')}catch(x){}if(c)ok();else said.textContent='Copy the prompt below.'};\n if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(t).then(ok,by);else by();\n })}\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n v.addEventListener('click',()=>{if(down!==null)return;if(grow())v.play().catch(()=>{});else play.click()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n const api=!!(d.fullscreenEnabled&&screen.requestFullscreen),inPage=()=>!!o.inPage&&(o.inPage()||!api);\n const mark=()=>{const f=d.fullscreenElement===screen||screen.classList.contains('focus');full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()};\n let back=0;const focus=on=>{if(on)back=scrollY;screen.classList.toggle('focus',on);scrollTo({top:on?0:back,behavior:'auto'});mark()};\n const grow=()=>{if(!o.expand||!o.inPage||!o.inPage()||d.fullscreenElement||screen.classList.contains('focus'))return false;focus(true);return true};\n if(!api&&!o.inPage)full.hidden=true;\n else{full.addEventListener('click',()=>{const f=screen.classList.contains('focus');if(d.fullscreenElement){d.exitFullscreen().catch(()=>{});if(f)focus(false)}else if(f)focus(false);else if(inPage())focus(true);else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',mark);\n d.addEventListener('keydown',e=>{if(e.key==='Escape'&&!e.defaultPrevented&&screen.classList.contains('focus')&&!d.querySelector('dialog[open]')){e.preventDefault();focus(false)}})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();\n const stg=d.querySelector('.wt-stage');let fr=0;\n const fit=()=>{fr=0;if(!stg)return;const t=stg.getBoundingClientRect().top;stg.style.setProperty('--wt-top',Math.round(t)+'px');stg.style.setProperty('--wt-y',Math.round(t+scrollY)+'px')};\n const refit=()=>{if(!fr)fr=requestAnimationFrame(fit)};\n fit();addEventListener('resize',refit);addEventListener('load',refit);addEventListener('scroll',refit,{passive:true});d.addEventListener('fullscreenchange',refit);\n if(window.ResizeObserver)new ResizeObserver(refit).observe(d.body);\n const v=d.getElementById('wt-video');if(!v)return;\n const w=d.querySelector('.wt'),panel=d.getElementById('wt-script'),box=d.getElementById('wt-box'),cap=d.getElementById('wt-cap');\n const say=a=>{const x=a&&a.querySelector('.wt-text');cap.replaceChildren(...(x?[...x.childNodes].filter(n=>!(n instanceof Element&&n.classList.contains('wt-state'))).map(n=>n.cloneNode(true)):[]));cap.hidden=!x};\n const steps=[...d.querySelectorAll('.wt-step[data-t]')];\n const idle=[...d.querySelectorAll('.idle[data-a]')].map(e=>({s:e.closest('.track').dataset.s,a:Number(e.dataset.a),b:Number(e.dataset.b)}));\n const skipB=d.getElementById('wt-skip'),expB=d.getElementById('wt-expand');\n let on=null,skip=!!skipB,P=null;const sk='screw-bugs-skip';try{skip=skip&&localStorage.getItem(sk)!=='off'}catch(e){}if(skipB)skipB.setAttribute('aria-pressed',String(skip));\n w.classList.add('live');\n const hide=()=>{box.hidden=true};\n const geo=()=>{const vw=v.videoWidth,vh=v.videoHeight,cw=v.clientWidth,ch=v.clientHeight;if(!vw||!vh||!cw||!ch)return null;const s=Math.min(cw/vw,ch/vh);return{x:v.offsetLeft+(cw-vw*s)/2,y:v.offsetTop+(ch-vh*s)/2,w:vw*s,h:vh*s}};\n const put=(e,x,y,bw,bh)=>{e.style.left=x+'px';e.style.top=y+'px';if(bw!==undefined){e.style.width=bw+'px';e.style.height=bh+'px'}};\n const draw=(t,g)=>{if(P.down()!==null||!g||!on||!on.dataset.box||t<Number(on.dataset.b0)||t>Number(on.dataset.b1))return hide();const b=on.dataset.box.split(' ').map(Number);put(box,g.x+b[0]*g.w,g.y+b[1]*g.h,b[2]*g.w,b[3]*g.h);box.querySelector('span').textContent=on.dataset.label||'';box.hidden=false};\n const C=d.getElementById('wt-cursor'),R=d.getElementById('wt-ripple'),G=d.getElementById('wt-ring'),L=d.getElementById('wt-act'),T=d.getElementById('wt-cursor-on'),ck='screw-bugs-cursor';\n const nums=x=>x?x.split(' ').map(Number):null;\n const acts=[...d.querySelectorAll('.wt-step[data-act][data-s]')].map(e=>({s:e.dataset.s,at:e.dataset.at?Number(e.dataset.at):NaN,t0:Number(e.dataset.t),t1:Number(e.dataset.a1),b0:Number(e.dataset.b0),b1:Number(e.dataset.b1),k:e.dataset.act,p:nums(e.dataset.pt),b:nums(e.dataset.tb),l:e.dataset.al||''})).sort((a,b)=>(a.at>=0?a.at:a.t0)-(b.at>=0?b.at:b.t0));\n const hv=[...d.querySelectorAll('.wt-step[data-hv][data-s]')].map(e=>({s:e.dataset.s,t0:Number(e.dataset.t)}));\n let fon=true;try{fon=localStorage.getItem(ck)!=='off'}catch(e){}\n const fx=(t,g)=>{\n C.hidden=R.hidden=G.hidden=L.hidden=true;box.querySelector('span').hidden=false;\n if(!fon||P.down()!==null||!g)return;\n const m=still(),mine=acts.filter(a=>a.s===P.cur()),ptr=mine.filter(a=>a.p),xy=p=>[g.x+p[0]*g.w,g.y+p[1]*g.h];\n let i=-1;ptr.forEach((a,j)=>{if(a.at<=t)i=j});\n const a=ptr[i],n=ptr[i+1];let c=a?a.p:null;\n if(n&&a){const gw=Math.min(0.6,n.at-a.at),q=gw>0?(t-n.at+gw)/gw:1;if(q>=0){const e=q<.5?4*q*q*q:1-Math.pow(2-2*q,3)/2;c=!m&&q<1?[a.p[0]+(n.p[0]-a.p[0])*e,a.p[1]+(n.p[1]-a.p[1])*e]:n.p}}\n if(a&&hv.some(x=>x.s===P.cur()&&x.t0>a.at&&x.t0<=t))c=null;\n if(c){const xy0=xy(c);put(C,xy0[0]-3,xy0[1]-2);C.hidden=false}\n if(a&&!m&&t-a.at<.6){const q=(t-a.at)/.6,xy1=xy(a.p);put(R,xy1[0],xy1[1]);R.style.transform='translate(-50%,-50%) scale('+(.35+q*1.3)+')';R.style.opacity=String(1-q);R.hidden=false}\n let f=null,l=null,u=null;\n for(const x of mine){if(x.k==='fill'&&x.b&&t>=x.b0&&t<=x.b1)f=x;if(x.k==='fill'||!(x.at>=0)?t>=x.t0&&t<=x.t1:t>=x.at&&t<=x.at+1.5)l=x;else if(!u&&x.p&&x.at>t&&x.at-t<=0.6)u=x}\n l=l||u;\n if(f){const xy2=xy(f.b);put(G,xy2[0],xy2[1],f.b[2]*g.w,f.b[3]*g.h);G.hidden=false;box.hidden=true}\n if(l&&l.l){L.textContent=l.l;L.hidden=false;let x=g.x+10,y=g.y+10;if(l.p){const q=xy(l.p);x=q[0]+14;y=q[1]+20}else if(l.b){const q=xy(l.b);x=q[0];y=q[1]+l.b[3]*g.h+10}if(y+L.offsetHeight>g.y+g.h-4)y=l.b?g.y+l.b[1]*g.h-L.offsetHeight-10:g.y+g.h-L.offsetHeight-4;put(L,Math.max(g.x+4,Math.min(x,g.x+g.w-L.offsetWidth-4)),Math.max(g.y+4,y))}\n box.querySelector('span').hidden=!L.hidden;\n };\n const stage=d.querySelector('.wt-stage');\n const cover=()=>{let y=topEdge();if(stage&&getComputedStyle(stage).position==='sticky')y=Math.max(y,stage.getBoundingClientRect().bottom+16);return y};\n const anchor=a=>{const hid=Math.max(0,cover()-panel.getBoundingClientRect().top);panel.scrollTo({top:Math.max(0,a.offsetTop-6-hid),behavior:still()?'auto':'smooth'})};\n const tick=t=>{\n const cur=P.cur();\n if(skip&&!v.paused&&!v.seeking){const gap=idle.find(x=>x.s===cur&&t>=x.a&&t<x.b-0.05);if(gap){v.currentTime=gap.b;return}}\n let a=null;for(const s of steps){if(s.dataset.s===cur&&Number(s.dataset.t)<=t+0.02)a=s}\n if(a!==on){if(on){on.classList.remove('on');on.removeAttribute('aria-current');on.closest('.wt-case').classList.remove('on')}on=a;say(a);if(a){a.classList.add('on');a.setAttribute('aria-current','step');a.closest('.wt-case').classList.add('on');anchor(a)}}\n const g=geo();draw(t,g);fx(t,g);\n };\n P=player('wt',{tick,full:w,expand:true,inPage:()=>matchMedia('(min-width: 901px)').matches,broken:()=>{hide();fx(0,null);w.classList.remove('live')},fine:()=>{w.classList.add('live')}});\n if(T&&acts.length){T.checked=fon;T.closest('label').hidden=false;T.addEventListener('change',()=>{fon=T.checked;try{localStorage.setItem(ck,fon?'on':'off')}catch(e){}P.update()})}\n if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip));try{localStorage.setItem(sk,skip?'on':'off')}catch(e){}});\n if(expB)expB.addEventListener('click',()=>{const x=w.classList.toggle('expanded');expB.setAttribute('aria-expanded',String(x));expB.querySelector('span').textContent=x?'Collapse':'Expand';P.update();if(on)anchor(on)});\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const a=t.closest('a[data-t][data-s],.wt-step[data-t][data-s]');if(!a||!P.has(a.dataset.s))return;\n e.preventDefault();const fig=v.closest('.player');\n if(fig.getBoundingClientRect().bottom<topEdge())fig.scrollIntoView({block:'start',behavior:still()?'auto':'smooth'});\n P.load(a.dataset.s,Number(a.dataset.t),P.playing());\n });\n P.update();\n});\n})();";
|
|
44
48
|
/**
|
|
45
49
|
* As the report's: the video by relative path, one script by hash, and from the network only
|
|
46
50
|
* Google Fonts' stylesheet and its fonts.
|
|
@@ -33,7 +33,8 @@ export const GLIDE_S = 0.6;
|
|
|
33
33
|
* the reader prefers less; the top row that shows, below the top bar and, on a narrow screen, the
|
|
34
34
|
* pinned player and its fade, when the page has scrolled the script under them), draws the box of the element it acted on over the video while that was
|
|
35
35
|
* measured, makes timecodes and rows seek (and switch session videos) instead of opening the file,
|
|
36
|
-
* and, with "Skip inactive" on, jumps over the stretches where
|
|
36
|
+
* and, with "Skip inactive" on (remembered like the theme), jumps over the stretches where
|
|
37
|
+
* nothing happened (`idleStretches`) while it plays.
|
|
37
38
|
* "Expand" shows the whole script and makes the video smaller. Fullscreen takes the whole page
|
|
38
39
|
* (`.wt`), not only the video; on a wide screen (a desktop) it never takes the browser's screen,
|
|
39
40
|
* only lays the page out again (`.focus`, see `PLAYER_JS`): the top bar, the video as big as fits with its address over it and
|
|
@@ -49,7 +50,10 @@ export const GLIDE_S = 0.6;
|
|
|
49
50
|
* typed into (when that box shows: a fill records no time or element of its own), and a short
|
|
50
51
|
* label of the action (the latest one that happened, else the one the cursor is gliding to; the
|
|
51
52
|
* box's own label gives way to it; one whose time was not recorded is labelled while its step
|
|
52
|
-
* plays, and has no cursor or ripple).
|
|
53
|
+
* plays, and has no cursor or ripple). A hover moves the mouse but records no point (see
|
|
54
|
+
* `StepAction.atMs`), so from when its step starts (any hover step that ran, also one that failed
|
|
55
|
+
* or was blocked, which may have moved the mouse all the same; its row's `data-hv`) the cursor is
|
|
56
|
+
* hidden until the next point the mouse pressed, rather than shown where the mouse no longer is. All of it follows the player's time, so seeking or pausing
|
|
53
57
|
* shows the state at that moment. With less motion preferred, the cursor jumps instead of gliding
|
|
54
58
|
* and there is no ripple. A "Cursor" switch turns it off, remembered like the theme. Nothing is
|
|
55
59
|
* added to the page under test or to the video.
|
|
@@ -68,7 +72,7 @@ d.addEventListener('DOMContentLoaded',()=>{
|
|
|
68
72
|
const steps=[...d.querySelectorAll('.wt-step[data-t]')];
|
|
69
73
|
const idle=[...d.querySelectorAll('.idle[data-a]')].map(e=>({s:e.closest('.track').dataset.s,a:Number(e.dataset.a),b:Number(e.dataset.b)}));
|
|
70
74
|
const skipB=d.getElementById('wt-skip'),expB=d.getElementById('wt-expand');
|
|
71
|
-
let on=null,skip=!!skipB&&skipB.
|
|
75
|
+
let on=null,skip=!!skipB,P=null;const sk='screw-bugs-skip';try{skip=skip&&localStorage.getItem(sk)!=='off'}catch(e){}if(skipB)skipB.setAttribute('aria-pressed',String(skip));
|
|
72
76
|
w.classList.add('live');
|
|
73
77
|
const hide=()=>{box.hidden=true};
|
|
74
78
|
const geo=()=>{const vw=v.videoWidth,vh=v.videoHeight,cw=v.clientWidth,ch=v.clientHeight;if(!vw||!vh||!cw||!ch)return null;const s=Math.min(cw/vw,ch/vh);return{x:v.offsetLeft+(cw-vw*s)/2,y:v.offsetTop+(ch-vh*s)/2,w:vw*s,h:vh*s}};
|
|
@@ -77,6 +81,7 @@ d.addEventListener('DOMContentLoaded',()=>{
|
|
|
77
81
|
const C=d.getElementById('wt-cursor'),R=d.getElementById('wt-ripple'),G=d.getElementById('wt-ring'),L=d.getElementById('wt-act'),T=d.getElementById('wt-cursor-on'),ck='screw-bugs-cursor';
|
|
78
82
|
const nums=x=>x?x.split(' ').map(Number):null;
|
|
79
83
|
const acts=[...d.querySelectorAll('.wt-step[data-act][data-s]')].map(e=>({s:e.dataset.s,at:e.dataset.at?Number(e.dataset.at):NaN,t0:Number(e.dataset.t),t1:Number(e.dataset.a1),b0:Number(e.dataset.b0),b1:Number(e.dataset.b1),k:e.dataset.act,p:nums(e.dataset.pt),b:nums(e.dataset.tb),l:e.dataset.al||''})).sort((a,b)=>(a.at>=0?a.at:a.t0)-(b.at>=0?b.at:b.t0));
|
|
84
|
+
const hv=[...d.querySelectorAll('.wt-step[data-hv][data-s]')].map(e=>({s:e.dataset.s,t0:Number(e.dataset.t)}));
|
|
80
85
|
let fon=true;try{fon=localStorage.getItem(ck)!=='off'}catch(e){}
|
|
81
86
|
const fx=(t,g)=>{
|
|
82
87
|
C.hidden=R.hidden=G.hidden=L.hidden=true;box.querySelector('span').hidden=false;
|
|
@@ -85,6 +90,7 @@ d.addEventListener('DOMContentLoaded',()=>{
|
|
|
85
90
|
let i=-1;ptr.forEach((a,j)=>{if(a.at<=t)i=j});
|
|
86
91
|
const a=ptr[i],n=ptr[i+1];let c=a?a.p:null;
|
|
87
92
|
if(n&&a){const gw=Math.min(${GLIDE_S},n.at-a.at),q=gw>0?(t-n.at+gw)/gw:1;if(q>=0){const e=q<.5?4*q*q*q:1-Math.pow(2-2*q,3)/2;c=!m&&q<1?[a.p[0]+(n.p[0]-a.p[0])*e,a.p[1]+(n.p[1]-a.p[1])*e]:n.p}}
|
|
93
|
+
if(a&&hv.some(x=>x.s===P.cur()&&x.t0>a.at&&x.t0<=t))c=null;
|
|
88
94
|
if(c){const xy0=xy(c);put(C,xy0[0]-3,xy0[1]-2);C.hidden=false}
|
|
89
95
|
if(a&&!m&&t-a.at<.6){const q=(t-a.at)/.6,xy1=xy(a.p);put(R,xy1[0],xy1[1]);R.style.transform='translate(-50%,-50%) scale('+(.35+q*1.3)+')';R.style.opacity=String(1-q);R.hidden=false}
|
|
90
96
|
let f=null,l=null,u=null;
|
|
@@ -106,7 +112,7 @@ d.addEventListener('DOMContentLoaded',()=>{
|
|
|
106
112
|
};
|
|
107
113
|
P=player('wt',{tick,full:w,expand:true,inPage:()=>matchMedia('(min-width: 901px)').matches,broken:()=>{hide();fx(0,null);w.classList.remove('live')},fine:()=>{w.classList.add('live')}});
|
|
108
114
|
if(T&&acts.length){T.checked=fon;T.closest('label').hidden=false;T.addEventListener('change',()=>{fon=T.checked;try{localStorage.setItem(ck,fon?'on':'off')}catch(e){}P.update()})}
|
|
109
|
-
if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip))});
|
|
115
|
+
if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip));try{localStorage.setItem(sk,skip?'on':'off')}catch(e){}});
|
|
110
116
|
if(expB)expB.addEventListener('click',()=>{const x=w.classList.toggle('expanded');expB.setAttribute('aria-expanded',String(x));expB.querySelector('span').textContent=x?'Collapse':'Expand';P.update();if(on)anchor(on)});
|
|
111
117
|
d.addEventListener('click',e=>{
|
|
112
118
|
const t=e.target;if(!(t instanceof Element))return;
|
|
@@ -379,6 +385,8 @@ export const actionLabel = (step) => {
|
|
|
379
385
|
switch (step.action) {
|
|
380
386
|
case 'click':
|
|
381
387
|
return quoted(0) === undefined ? undefined : `Click ${quoted(0)}`;
|
|
388
|
+
case 'hover':
|
|
389
|
+
return quoted(0) === undefined ? undefined : `Hover ${quoted(0)}`;
|
|
382
390
|
case 'fill':
|
|
383
391
|
return step.value === ''
|
|
384
392
|
? quoted(0) === undefined
|
|
@@ -444,10 +452,12 @@ const agentWhy = (view) => html `<p class="wt-why s-failed wt-case-why">
|
|
|
444
452
|
</p>`;
|
|
445
453
|
/**
|
|
446
454
|
* The input a step gives the page, as an icon by its words in the fullscreen caption: a left
|
|
447
|
-
* click, typing, a key or the mouse wheel. Steps that only look
|
|
455
|
+
* click, a pointer moved over something, typing, a key or the mouse wheel. Steps that only look
|
|
456
|
+
* or wait have none.
|
|
448
457
|
*/
|
|
449
458
|
const stepIcon = {
|
|
450
459
|
click: 'mouse-left',
|
|
460
|
+
hover: 'mouse-pointer-2',
|
|
451
461
|
fill: 'text-cursor',
|
|
452
462
|
press: 'keyboard',
|
|
453
463
|
scroll: 'mouse',
|
|
@@ -461,9 +471,11 @@ const stepRow = (view, step, sessions) => {
|
|
|
461
471
|
const timed = ms !== undefined && sessions.has(session);
|
|
462
472
|
const box = timed ? stepBox(entry, step) : undefined;
|
|
463
473
|
const acted = timed ? stepAction(step.timing?.action) : undefined;
|
|
464
|
-
// A fill records no element of its own (its input is not watched): its ring
|
|
465
|
-
//
|
|
466
|
-
|
|
474
|
+
// A fill or a hover records no element of its own (its input is not watched): its ring (a
|
|
475
|
+
// fill's) and its label are placed by the step's box, when there is one, from the screenshot
|
|
476
|
+
// taken at the step.
|
|
477
|
+
const unwatched = step.timing?.action?.kind === 'fill' || step.timing?.action?.kind === 'hover';
|
|
478
|
+
const action = acted !== undefined && acted.tb === undefined && unwatched && box
|
|
467
479
|
? { ...acted, tb: box.box }
|
|
468
480
|
: acted;
|
|
469
481
|
const decided = step.state === 'decided';
|
|
@@ -472,6 +484,7 @@ const stepRow = (view, step, sessions) => {
|
|
|
472
484
|
class="wt-step st-${step.state}${decided ? ` s-${view.checkStatus}` : ''}"
|
|
473
485
|
id="${`wt-${entry.id}-${step.index}`}"
|
|
474
486
|
${timed ? html ` data-s="${String(session)}" data-t="${fragmentSeconds(ms)}"` : ''}
|
|
487
|
+
${timed && step.step.action === 'hover' ? html ` data-hv` : ''}
|
|
475
488
|
${box
|
|
476
489
|
? html ` data-box="${box.box}" data-b0="${fragmentSeconds(box.from)}"
|
|
477
490
|
data-b1="${fragmentSeconds(box.to)}" data-label="${stepLabel(step)}"`
|
package/dist/schema/accounts.js
CHANGED
|
@@ -10,6 +10,8 @@ export const ACCOUNT_ABOUT_MAX = 200;
|
|
|
10
10
|
/** A label such as `trial-user`: lower-case letters, digits and dashes, also a file name. */
|
|
11
11
|
export const AccountLabel = Schema.String.check(Schema.isPattern(/^[a-z0-9][a-z0-9-]{0,39}$/, {
|
|
12
12
|
message: 'Use 1-40 lower-case letters, digits or dashes, starting with a letter or digit',
|
|
13
|
+
// Effect leaves isPattern out of JSON Schema; this puts it in.
|
|
14
|
+
toJsonSchema: () => ({ pattern: '^[a-z0-9][a-z0-9-]{0,39}$' }),
|
|
13
15
|
})).annotate({ description: 'Label of a test account, such as trial-user.' });
|
|
14
16
|
/** What kind of user an account is, for the agent picking one: one line. */
|
|
15
17
|
export const AccountAbout = Schema.String.check(Schema.makeFilter((text) => !text.trim()
|
|
@@ -18,7 +20,14 @@ export const AccountAbout = Schema.String.check(Schema.makeFilter((text) => !tex
|
|
|
18
20
|
? `At most ${ACCOUNT_ABOUT_MAX} characters`
|
|
19
21
|
: /[\r\n]/.test(text)
|
|
20
22
|
? 'Must be one line'
|
|
21
|
-
: undefined
|
|
23
|
+
: undefined, {
|
|
24
|
+
// Approximate (looser): JSON Schema's maxLength counts characters, the filter counts
|
|
25
|
+
// UTF-16 code units, where an emoji can count as 2.
|
|
26
|
+
toJsonSchema: () => [
|
|
27
|
+
{ maxLength: ACCOUNT_ABOUT_MAX, pattern: '^[^\\r\\n]*\\S[^\\r\\n]*$' },
|
|
28
|
+
true,
|
|
29
|
+
],
|
|
30
|
+
})).annotate({
|
|
22
31
|
description: 'What kind of user this is, such as "On a 14-day trial, no card on file".',
|
|
23
32
|
});
|
|
24
33
|
/** A job's account: its label, or the label with what it is and whether to sign in again. */
|
|
@@ -83,10 +83,11 @@ export declare const Shot: Schema.Struct<{
|
|
|
83
83
|
export type Shot = typeof Shot.Type;
|
|
84
84
|
/**
|
|
85
85
|
* What a step did to the page, by its action: `click` (and an `upload` through a file chooser)
|
|
86
|
-
* moved the mouse and pressed it; `
|
|
87
|
-
* `goto` and `reload` moved or loaded
|
|
86
|
+
* moved the mouse and pressed it; `hover` moved the mouse over an element without pressing it;
|
|
87
|
+
* `fill` typed into a field; `press` pressed a key; `scroll`, `goto` and `reload` moved or loaded
|
|
88
|
+
* the page.
|
|
88
89
|
*/
|
|
89
|
-
export declare const ActionKind: Schema.Literals<readonly ["click", "fill", "upload", "press", "scroll", "goto", "reload"]>;
|
|
90
|
+
export declare const ActionKind: Schema.Literals<readonly ["click", "hover", "fill", "upload", "press", "scroll", "goto", "reload"]>;
|
|
90
91
|
export type ActionKind = typeof ActionKind.Type;
|
|
91
92
|
/** A point in the viewport, in CSS pixels. */
|
|
92
93
|
export declare const Point: Schema.Struct<{
|
|
@@ -99,13 +100,16 @@ export type Point = typeof Point.Type;
|
|
|
99
100
|
* that acted on an element, where. Never what was typed: the job's own step says that.
|
|
100
101
|
*/
|
|
101
102
|
export declare const StepAction: Schema.Struct<{
|
|
102
|
-
readonly kind: Schema.Literals<readonly ["click", "fill", "upload", "press", "scroll", "goto", "reload"]>;
|
|
103
|
+
readonly kind: Schema.Literals<readonly ["click", "hover", "fill", "upload", "press", "scroll", "goto", "reload"]>;
|
|
103
104
|
/**
|
|
104
105
|
* When it happened, in ms from the start of the session's video (as `StepTiming`): for a click
|
|
105
106
|
* or a key, when the browser dispatched its input event to the page (the mouse press, the key
|
|
106
107
|
* going down), not when the page's handlers for it were done. Missing when that event was not
|
|
107
108
|
* seen (see `point`), and always for a fill and for files set on a file input directly: a page
|
|
108
|
-
* can make their edits itself, so an edit is no proof of when they acted.
|
|
109
|
+
* can make their edits itself, so an edit is no proof of when they acted. Always missing for a
|
|
110
|
+
* hover too: when the page moves or scrolls under a pointer that stands still, the browser
|
|
111
|
+
* itself sends trusted mouse events (`mouseover`, and in some versions `mousemove`), at a time
|
|
112
|
+
* the page chooses, so none proves when or where a hover moved the mouse.
|
|
109
113
|
*/
|
|
110
114
|
readonly atMs: Schema.optionalKey<Schema.Number>;
|
|
111
115
|
/**
|
|
@@ -149,7 +153,7 @@ export type OnScreenProblem = typeof OnScreenProblem.Type;
|
|
|
149
153
|
/**
|
|
150
154
|
* How the element a step checked or acted on showed on the screen, measured by code as the step
|
|
151
155
|
* ran: for a check (waitFor visible, expectText, expectLink) once it held, for a click before it
|
|
152
|
-
* and for a fill after it. A measurement only, for whoever writes the case up: it never changes
|
|
156
|
+
* and for a fill or a hover after it. A measurement only, for whoever writes the case up: it never changes
|
|
153
157
|
* a status.
|
|
154
158
|
*/
|
|
155
159
|
export declare const OnScreen: Schema.Struct<{
|
|
@@ -179,13 +183,16 @@ export declare const StepTiming: Schema.Struct<{
|
|
|
179
183
|
}>>>;
|
|
180
184
|
/** What it did to the page, when it acted. Missing in older ledgers and for checks. */
|
|
181
185
|
readonly action: Schema.optionalKey<Schema.Struct<{
|
|
182
|
-
readonly kind: Schema.Literals<readonly ["click", "fill", "upload", "press", "scroll", "goto", "reload"]>;
|
|
186
|
+
readonly kind: Schema.Literals<readonly ["click", "hover", "fill", "upload", "press", "scroll", "goto", "reload"]>;
|
|
183
187
|
/**
|
|
184
188
|
* When it happened, in ms from the start of the session's video (as `StepTiming`): for a click
|
|
185
189
|
* or a key, when the browser dispatched its input event to the page (the mouse press, the key
|
|
186
190
|
* going down), not when the page's handlers for it were done. Missing when that event was not
|
|
187
191
|
* seen (see `point`), and always for a fill and for files set on a file input directly: a page
|
|
188
|
-
* can make their edits itself, so an edit is no proof of when they acted.
|
|
192
|
+
* can make their edits itself, so an edit is no proof of when they acted. Always missing for a
|
|
193
|
+
* hover too: when the page moves or scrolls under a pointer that stands still, the browser
|
|
194
|
+
* itself sends trusted mouse events (`mouseover`, and in some versions `mousemove`), at a time
|
|
195
|
+
* the page chooses, so none proves when or where a hover moved the mouse.
|
|
189
196
|
*/
|
|
190
197
|
readonly atMs: Schema.optionalKey<Schema.Number>;
|
|
191
198
|
/**
|
|
@@ -320,6 +327,12 @@ export declare const FACT_IMAGES_MAX = 12;
|
|
|
320
327
|
export declare const FACT_LINKS_MAX = 12;
|
|
321
328
|
/** Image sources and link addresses are cut to this many characters. */
|
|
322
329
|
export declare const URL_MAX = 300;
|
|
330
|
+
/** A stretch of a session's video, in ms on its clock. */
|
|
331
|
+
export declare const StillStretch: Schema.Struct<{
|
|
332
|
+
readonly fromMs: Schema.Number;
|
|
333
|
+
readonly toMs: Schema.Number;
|
|
334
|
+
}>;
|
|
335
|
+
export type StillStretch = typeof StillStretch.Type;
|
|
323
336
|
/**
|
|
324
337
|
* One test user in one browser, start to end, recorded as one continuous video. A run without a
|
|
325
338
|
* login is one session; jobs have at most one account today, so a run has one session.
|
|
@@ -339,6 +352,15 @@ export declare const Session: Schema.Struct<{
|
|
|
339
352
|
readonly videoDurationMs: Schema.optionalKey<Schema.Number>;
|
|
340
353
|
/** Why the video is missing or incomplete, in plain language. Never changes a status. */
|
|
341
354
|
readonly videoProblem: Schema.optionalKey<Schema.String>;
|
|
355
|
+
/**
|
|
356
|
+
* The stretches of the video in which its picture did not change, in ms on its clock, measured
|
|
357
|
+
* from the saved video once the session ended. Missing when that could not be measured (older
|
|
358
|
+
* runs, no video); empty when nothing stood still.
|
|
359
|
+
*/
|
|
360
|
+
readonly still: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
361
|
+
readonly fromMs: Schema.Number;
|
|
362
|
+
readonly toMs: Schema.Number;
|
|
363
|
+
}>>>;
|
|
342
364
|
}>;
|
|
343
365
|
export type Session = typeof Session.Type;
|
|
344
366
|
/**
|
package/dist/schema/evidence.js
CHANGED
|
@@ -72,11 +72,13 @@ export const Shot = Schema.Struct({
|
|
|
72
72
|
});
|
|
73
73
|
/**
|
|
74
74
|
* What a step did to the page, by its action: `click` (and an `upload` through a file chooser)
|
|
75
|
-
* moved the mouse and pressed it; `
|
|
76
|
-
* `goto` and `reload` moved or loaded
|
|
75
|
+
* moved the mouse and pressed it; `hover` moved the mouse over an element without pressing it;
|
|
76
|
+
* `fill` typed into a field; `press` pressed a key; `scroll`, `goto` and `reload` moved or loaded
|
|
77
|
+
* the page.
|
|
77
78
|
*/
|
|
78
79
|
export const ActionKind = Schema.Literals([
|
|
79
80
|
'click',
|
|
81
|
+
'hover',
|
|
80
82
|
'fill',
|
|
81
83
|
'upload',
|
|
82
84
|
'press',
|
|
@@ -97,7 +99,10 @@ export const StepAction = Schema.Struct({
|
|
|
97
99
|
* or a key, when the browser dispatched its input event to the page (the mouse press, the key
|
|
98
100
|
* going down), not when the page's handlers for it were done. Missing when that event was not
|
|
99
101
|
* seen (see `point`), and always for a fill and for files set on a file input directly: a page
|
|
100
|
-
* can make their edits itself, so an edit is no proof of when they acted.
|
|
102
|
+
* can make their edits itself, so an edit is no proof of when they acted. Always missing for a
|
|
103
|
+
* hover too: when the page moves or scrolls under a pointer that stands still, the browser
|
|
104
|
+
* itself sends trusted mouse events (`mouseover`, and in some versions `mousemove`), at a time
|
|
105
|
+
* the page chooses, so none proves when or where a hover moved the mouse.
|
|
101
106
|
*/
|
|
102
107
|
atMs: Schema.optionalKey(Schema.Number),
|
|
103
108
|
/**
|
|
@@ -128,7 +133,7 @@ export const OnScreenProblem = Schema.Literals(['clipped', 'covered', 'offscreen
|
|
|
128
133
|
/**
|
|
129
134
|
* How the element a step checked or acted on showed on the screen, measured by code as the step
|
|
130
135
|
* ran: for a check (waitFor visible, expectText, expectLink) once it held, for a click before it
|
|
131
|
-
* and for a fill after it. A measurement only, for whoever writes the case up: it never changes
|
|
136
|
+
* and for a fill or a hover after it. A measurement only, for whoever writes the case up: it never changes
|
|
132
137
|
* a status.
|
|
133
138
|
*/
|
|
134
139
|
export const OnScreen = Schema.Struct({
|
|
@@ -212,6 +217,8 @@ export const FACT_IMAGES_MAX = 12;
|
|
|
212
217
|
export const FACT_LINKS_MAX = 12;
|
|
213
218
|
/** Image sources and link addresses are cut to this many characters. */
|
|
214
219
|
export const URL_MAX = 300;
|
|
220
|
+
/** A stretch of a session's video, in ms on its clock. */
|
|
221
|
+
export const StillStretch = Schema.Struct({ fromMs: Schema.Number, toMs: Schema.Number });
|
|
215
222
|
/**
|
|
216
223
|
* One test user in one browser, start to end, recorded as one continuous video. A run without a
|
|
217
224
|
* login is one session; jobs have at most one account today, so a run has one session.
|
|
@@ -231,6 +238,12 @@ export const Session = Schema.Struct({
|
|
|
231
238
|
videoDurationMs: Schema.optionalKey(Schema.Number),
|
|
232
239
|
/** Why the video is missing or incomplete, in plain language. Never changes a status. */
|
|
233
240
|
videoProblem: Schema.optionalKey(Schema.String),
|
|
241
|
+
/**
|
|
242
|
+
* The stretches of the video in which its picture did not change, in ms on its clock, measured
|
|
243
|
+
* from the saved video once the session ended. Missing when that could not be measured (older
|
|
244
|
+
* runs, no video); empty when nothing stood still.
|
|
245
|
+
*/
|
|
246
|
+
still: Schema.optionalKey(Schema.Array(StillStretch)),
|
|
234
247
|
});
|
|
235
248
|
/**
|
|
236
249
|
* Attributes of an element that a CSS selector may name, such as `data-test`, `title`, `href` or
|
package/dist/schema/findings.js
CHANGED
|
@@ -48,7 +48,7 @@ export const CaseFindings = Schema.Struct({
|
|
|
48
48
|
'case did not do what its success says, even if every check passed: what is wrong, in ' +
|
|
49
49
|
'one line. The case then counts as failed by your review everywhere results are shown. ' +
|
|
50
50
|
'Leave it out when the case did what it should; minor issues go in didnt. It can never ' +
|
|
51
|
-
'make a case pass.').check(Schema.makeFilter((text) => /[\r\n]/.test(text) ? 'Use one line, with no line breaks' : undefined))),
|
|
51
|
+
'make a case pass.').check(Schema.makeFilter((text) => (/[\r\n]/.test(text) ? 'Use one line, with no line breaks' : undefined), { toJsonSchema: () => ({ pattern: '^[^\\r\\n]*$' }) }))),
|
|
52
52
|
highlights: Schema.optionalKey(Schema.Array(Highlight)
|
|
53
53
|
.check(Schema.isMaxLength(6, { message: 'Use at most 6 highlights per case' }))
|
|
54
54
|
.annotate({ description: 'Elements to mark on this case’s screenshots. At most 6.' })),
|