Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/showcase_ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"test:run-header": "node scripts/run-header-audit.mjs",
"test:step-timeline": "node scripts/run-header-audit.mjs --timeline",
"test:controls": "node scripts/layout-audit/screenshots.mjs screenshots controls --controls",
"test:device-pane": "node scripts/run-header-audit.mjs --evidence",
"test:preview-path": "node scripts/preview-path.test.mjs",
"test:build-info": "node --test scripts/write-build-info.test.mjs",
"test:whats-new": "node --test scripts/validate-whats-new.test.mjs scripts/check-whats-new-entry.test.mjs",
Expand Down
105 changes: 100 additions & 5 deletions apps/showcase_ui/scripts/run-header-audit.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import path from 'node:path';

const dist = path.resolve('dist/frontend/browser');
const timeline = process.argv.includes('--timeline');
const shots = path.resolve(process.env.SHOTS || (timeline ? 'step-timeline-evidence' : 'run-header-evidence'));
const evidence = process.argv.includes('--evidence');
const shots = path.resolve(process.env.SHOTS || (evidence ? 'device-pane-evidence' : timeline ? 'step-timeline-evidence' : 'run-header-evidence'));
const runId = '00000001-5d7e-4a10-9c33-0e1f2a3b4c5d';
let videoChecks = 0;
const started = Math.floor(Date.now() / 1000) - 65;
const run = {
session_id: runId, prompt: '# Open Settings and check the app\n\nVerify that Settings opens without an error.',
Expand All @@ -21,7 +23,7 @@ const steps = [{
session_id: runId, step_id: 'step-1', step_number: 1, timestamp: started + 1,
action_taken: { action: 'launch_app', package_name: 'com.android.settings' }
}];
if (timeline) {
if (timeline || evidence) {
steps.push(...['tap', 'input_text', 'tap'].map((action, index) => ({
session_id: runId, step_id: `step-${index + 2}`, step_number: index + 2, timestamp: started + (index + 2) * 10,
duration: 1.2 + index, action_taken: { action, args: { text: index === 1 ? 'Settings' : 'Network and internet' } },
Expand All @@ -40,7 +42,10 @@ const server = createServer((request, response) => {
if (pathname.endsWith('/steps')) return json(response, steps);
if (pathname.endsWith('/notes')) return json(response, { notes: { 'output.md': 'Settings opened. The app is ready for the next task.' } });
if (pathname.endsWith('/checks')) return json(response, { records: [], streams: [], run_outcome: null });
if (pathname.endsWith('/video')) return json(response, { session_id: runId, status: 'unavailable', has_video: false, video_url: null, video_segments: [] });
if (pathname.endsWith('/video')) {
videoChecks++;
return json(response, { session_id: runId, status: 'unavailable', has_video: false, video_url: null, video_segments: [] });
}
if (pathname === '/api/system/whoami') return json(response, { email: 'qa@example.test', admin: false, auth_mode: 'cloudflare', reason: null });
if (pathname === '/api/sessions') return json(response, [{ session_id: runId, initial_goal: run.prompt, start_time: started, end_time: run.end_time, status: run.status, model_info: { name: 'Flash', id: 'fixture-flash', provider: 'fixture' } }]);
if (pathname === '/api/hosts') return json(response, { enabled: true, hosts: [], devices: [] });
Expand Down Expand Up @@ -113,10 +118,10 @@ try {
await send('Network.enable');
if (process.env.DEBUG_AUDIT) console.log('Chrome ready', base);
mkdirSync(shots, { recursive: true });
for (const state of timeline ? ['failed'] : ['completed', 'running']) {
for (const state of timeline || evidence ? ['failed'] : ['completed', 'running']) {
run.status = state;
run.end_time = state === 'running' ? null : started + 60;
for (const width of [1440, 390]) {
for (const width of evidence ? [1440, 1200, 1024, 390] : [1440, 390]) {
await send('Emulation.setDeviceMetricsOverride', { width, height: 1000, deviceScaleFactor: 1, mobile: width < 800 });
await send('Page.navigate', { url: `${base}/runs/${runId}` });
let ready = false;
Expand All @@ -128,6 +133,96 @@ try {
assert.ok(ready, `${state} @${width}: header loads`);
await wait(250);
await evaluate('document.fonts.ready.then(() => true)');
if (evidence) {
await evaluate(`(() => {
const canvas = document.createElement('canvas');
canvas.width = 180; canvas.height = 320;
const context = canvas.getContext('2d');
context.fillStyle = '#fafafa'; context.fillRect(0, 0, 180, 320);
context.fillStyle = '#27272a'; context.font = '18px sans-serif'; context.fillText('Settings', 16, 42);
context.font = '11px sans-serif';
['Network and internet', 'Connected devices', 'Apps', 'Notifications', 'Battery'].forEach((label, index) => context.fillText(label, 16, 82 + index * 38));
const view = ng.getComponent(document.querySelector('app-run-view'));
view.storedSteps.set(view.steps().map(step => ({ ...step, post_image_name: canvas.toDataURL() })));
})()`);
await wait(150);
assert.equal(await evaluate(`!!document.querySelector('.step-scrubber')`), true, 'B10 native step scrubber exists');
await evaluate(`document.querySelector('.step-scrubber').focus()`);
for (const [key, code, expected] of [['Home', 36, 1], ['ArrowRight', 39, 2], ['End', 35, 4], ['ArrowLeft', 37, 3]]) {
await send('Input.dispatchKeyEvent', { type: 'keyDown', key, code: key, windowsVirtualKeyCode: code });
await send('Input.dispatchKeyEvent', { type: 'keyUp', key, code: key, windowsVirtualKeyCode: code });
await wait(80);
assert.equal(await evaluate(`ng.getComponent(document.querySelector('app-run-view')).selectedStep().step_number`), expected, `${key} selects step ${expected}`);
}
const snapshot = await evaluate(`(() => {
const panel = document.querySelector('.evidence');
const frame = panel.querySelector('.phone-frame');
const filmstrip = panel.querySelector('.screenshot-filmstrip');
return { paneWidth: panel.getBoundingClientRect().width,
frameDisplay: getComputedStyle(frame).display, filmstripDisplay: getComputedStyle(filmstrip).display,
filmstripAboveTimeline: panel.getBoundingClientRect().top < document.querySelector('.steps').getBoundingClientRect().top,
overflow: document.documentElement.scrollWidth - innerWidth,
controls: [...panel.querySelectorAll('button, input, summary')].filter(control => control.getBoundingClientRect().width > 0).map(control => {
const box = control.getBoundingClientRect(); return { width: box.width, height: box.height };
}) };
})()`);
assert.ok(snapshot.overflow <= 0, 'no page overflow');
assert.ok(snapshot.controls.every(box => box.width >= 44 && box.height >= 44), JSON.stringify(snapshot));
if (width >= 1440) {
assert.equal(snapshot.paneWidth, 300);
assert.equal(snapshot.filmstripDisplay, 'none');
assert.notEqual(snapshot.frameDisplay, 'none');
} else {
assert.equal(snapshot.frameDisplay, 'none');
assert.notEqual(snapshot.filmstripDisplay, 'none');
assert.equal(snapshot.filmstripAboveTimeline, true);
await evaluate(`document.querySelector('.filmstrip-step').click()`);
await wait(80);
assert.equal(await evaluate(`ng.getComponent(document.querySelector('app-run-view')).selectedStep().step_number`), 1);
}
const videoSource = readFileSync('src/app/components/run-view/tiny-video.testing.ts', 'utf8').match(/const WEBM_BASE64 = '([^']+)'/)[1];
await evaluate(`(() => {
const view = ng.getComponent(document.querySelector('app-run-view'));
const bytes = Uint8Array.from(atob('${videoSource}'), character => character.charCodeAt(0));
view.video.set({ session_id: '${runId}', status: 'ready', has_video: true,
video_url: URL.createObjectURL(new Blob([bytes], { type: 'video/webm' })), video_segments: [] });
})()`);
await wait(150);
assert.equal(await evaluate(`!!document.querySelector('.evidence video')`), true, 'finished run defaults to playable video');
assert.ok(await evaluate(`[...document.querySelectorAll('.media-switch button')].every(button => {
const box = button.getBoundingClientRect(); return box.width >= 44 && box.height >= 44;
})`), 'media buttons have their own 44px boxes');
await evaluate(`document.querySelector('[data-media="screenshot"]').click()`);
await wait(80);
assert.equal(await evaluate(`!!document.querySelector('.evidence video')`), false, 'screenshot switch hides video');
await evaluate(`document.querySelector('[data-media="video"]').click()`);
await wait(150);
assert.equal(await evaluate(`!!document.querySelector('.evidence video')`), true, 'video switch restores player');
assert.ok(await evaluate(`document.querySelector('.evidence video').readyState > 0`), 'real fixture video decodes');
if (width === 1440) {
const screenshot = await send('Page.captureScreenshot', { format: 'png' });
writeFileSync(path.join(shots, 'device-video-1440.png'), Buffer.from(screenshot.data, 'base64'));
}
await evaluate(`document.querySelector('.evidence video').dispatchEvent(new Event('error'))`);
await wait(80);
assert.equal(await evaluate(`!!document.querySelector('.evidence video')`), false, 'player failure falls back');
assert.equal(await evaluate(`document.querySelector('.evidence-caption .secondary-button').textContent.trim()`), 'Check again');
assert.match(await evaluate(`document.querySelector('.evidence-caption .recording-copy').textContent`), /could not be played/);
assert.ok(await evaluate(`(() => {
const box = document.querySelector('.evidence-caption .secondary-button').getBoundingClientRect();
return box.width >= 44 && box.height >= 44;
})()`), 'retry has its own 44px box');
const screenshot = await send('Page.captureScreenshot', { format: 'png' });
writeFileSync(path.join(shots, `device-pane-${width}.png`), Buffer.from(screenshot.data, 'base64'));
const previousChecks = videoChecks;
await evaluate(`document.querySelector('.evidence-caption .secondary-button').click()`);
await wait(150);
assert.equal(videoChecks, previousChecks + 1, 'Check again rechecks the video API');
assert.equal(await evaluate(`ng.getComponent(document.querySelector('app-run-view')).playerFailed()`), false, 'retry clears player failure');
results.push({ state, width, ...snapshot, keyboard: 'PASS', mediaSwitch: 'PASS', failureCaption: 'PASS' });
console.log(`PASS device pane @${width}: layout, keyboard, media switch, failure caption, 44px controls`);
continue;
}
if (timeline) {
await evaluate(`(() => {
const canvas = document.createElement('canvas');
Expand Down
15 changes: 15 additions & 0 deletions apps/showcase_ui/src/app/components/run-presentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ selection, keyboard navigation, details and the verdict-jump hook, and writes
PNG screenshots plus `results.json`. The screenshots are mocked API evidence,
not Android-device or live-backend evidence. Karma specs run in GitHub CI.

## Device evidence (B10)

The shared evidence panel renders a 300 px navy phone pane from 1440 px and a
horizontal step screenshot filmstrip above the timeline below 1440 px. The
native 44 px range control and filmstrip emit step IDs to the existing viewer
selection and seek path. Finished runs default to playable video; active runs
default to screenshots. Screenshot/Video buttons change only the media view.
Recording failure, technical details and Check again stay inside the caption.

`npm run test:device-pane` checks the mock fixture at 1440, 1200, 1024 and 390 px,
including trusted Chrome scrubber keys, media switching, player failure, 44 px
controls and responsive geometry. Build with the development configuration for
these audits. PNG screenshots and `results.json` go to `device-pane-evidence`
or the `SHOTS` directory. These are UI fixtures, not device acceptance evidence.

## Unified controller (U2)

`RunViewComponent` now owns the run layout on both Workspace and `/runs/:id`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,73 @@
100% { transform: rotate(360deg); }
}

.evidence-video, .evidence-image { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: var(--color-ink); }
:host { min-width: 0; }

.media-switch {
display: flex;
margin-bottom: 8px;
button {
flex: 1;
min-width: 44px;
min-height: 44px;
padding: 8px;
border: 0;
border-radius: var(--radius-sm);
color: var(--evidence-text);
background: var(--evidence-surface);
font: inherit;
cursor: pointer;
&[aria-pressed='true'] { color: var(--color-primary); background: var(--color-primary-tint); }
}
}

.phone-frame {
display: none;
overflow: hidden;
border: 8px solid var(--color-device-edge);
border-radius: var(--radius-lg);
color: var(--color-device-text);
background: var(--color-device);
&.video-active { display: block; }
}
.evidence-video, .evidence-image {
display: block;
width: 100%;
max-height: 240px;
object-fit: contain;
background: var(--color-device);
}
.frame-placeholder { min-height: 240px; display: grid; place-items: center; color: var(--color-device-muted); }
.screenshot-filmstrip { display: flex; gap: 8px; overflow-x: auto; padding: 4px; }
.filmstrip-step {
position: relative;
flex: 0 0 64px;
min-width: 64px;
min-height: 104px;
padding: 4px;
border: 0;
border-radius: var(--radius-sm);
color: var(--color-device-text);
background: var(--color-device);
cursor: pointer;
&[aria-current='step'] .filmstrip-number { color: var(--color-on-primary); background: var(--color-primary); font-weight: 600; }
img { display: block; width: 52px; height: 80px; object-fit: contain; }
}
.no-image { display: grid; height: 80px; place-items: center; color: var(--color-device-muted); font-size: 12px; }
.filmstrip-number { display: block; font: 12px/16px var(--font-mono); }
.step-scrubber { display: block; box-sizing: border-box; width: 100%; min-width: 44px; height: 44px; margin: 4px 0; accent-color: var(--color-primary); cursor: pointer; }
.evidence-caption { overflow-wrap: anywhere; font-size: 13px; }
.step-caption { margin: 0 0 8px; }
.media-switch button:focus-visible, .filmstrip-step:focus-visible, .step-scrubber:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

@media (min-width: 1440px) {
.phone-frame { display: block; }
.evidence-video, .evidence-image { height: 440px; max-height: 55vh; }
.screenshot-filmstrip { display: none; }
}

.recording-ribbon { margin: 0 0 8px; padding: 6px 12px; border-radius: 6px; font-weight: 600; color: var(--status-warn-fg); background: var(--status-warn-bg); }
.recording-copy { margin: 0 0 8px; font-weight: 600; }
.recording-copy { margin: 0 0 8px; }
.muted { color: var(--evidence-muted); }
.secondary-button { min-height: var(--target); min-width: var(--target); font-size: var(--text-ui); padding: 0 18px; border-radius: var(--radius-md); cursor: pointer; border: 0; color: var(--evidence-text); background: var(--color-surface-subtle); }
.secondary-button:focus-visible, video:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
Expand Down
Loading
Loading