Skip to content

Commit 48a4d5b

Browse files
alanbldclaude
andcommitted
Add E2E tests and demo video for Focus View example
- Add E2E test to load focus example and verify it schedules - Add behavioral test: focus pattern reduces visible task labels - Add Focus View Demo to demo-features.spec.js - Narrative: large project → overwhelming Gantt → apply focus → clarity Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5b0574e commit 48a4d5b

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed

playground/tests/demo-features.spec.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,52 @@ milestone golive "Go Live" {
266266
await hideSubtitle(page);
267267
await page.waitForTimeout(1000);
268268
});
269+
270+
(skipDemo ? test.skip : test)('Focus View Demo', async ({ page }) => {
271+
await page.goto('/');
272+
await waitForWasm(page);
273+
await waitForEditor(page);
274+
await injectSubtitleOverlay(page);
275+
276+
// SCENE 1: Introduction - Large project problem
277+
await showSubtitle(page, 'Focus View: Cut Through the Noise (RFC-0006)', 3000);
278+
await hideSubtitle(page);
279+
await page.waitForTimeout(500);
280+
281+
// SCENE 2: Load large project
282+
await showSubtitle(page, 'Large project with 20+ tasks across 4 streams', 2500);
283+
await page.selectOption('#example-select', 'focus');
284+
await page.waitForTimeout(500);
285+
await hideSubtitle(page);
286+
await page.waitForTimeout(500);
287+
288+
// SCENE 3: Show overwhelming Gantt
289+
await clickSchedule(page);
290+
await waitForSchedule(page);
291+
await clickGanttTab(page);
292+
await waitForGantt(page);
293+
294+
await showSubtitle(page, 'Full Gantt: hard to find what you need', 2500);
295+
await hideSubtitle(page);
296+
await page.waitForTimeout(1500);
297+
298+
// SCENE 4: Apply focus filter
299+
await showSubtitle(page, 'Enter "backend" in the Focus field', 2000);
300+
await page.fill('#focus-input', 'backend');
301+
await hideSubtitle(page);
302+
await page.waitForTimeout(500);
303+
304+
// SCENE 5: Re-schedule with focus
305+
await clickSchedule(page);
306+
await waitForSchedule(page);
307+
await page.waitForTimeout(500);
308+
309+
await showSubtitle(page, 'Now showing only backend-related tasks', 2500);
310+
await hideSubtitle(page);
311+
await page.waitForTimeout(2000);
312+
313+
// SCENE 6: Finale
314+
await showSubtitle(page, 'Focus on what matters, hide the rest', 2500);
315+
await hideSubtitle(page);
316+
await page.waitForTimeout(1000);
317+
});

playground/tests/e2e.spec.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,57 @@ test.describe('Example Loading', () => {
280280
const status = await getStatusMessage(page);
281281
expect(status).toContain('Scheduled successfully');
282282
});
283+
284+
test('can load focus view example', async ({ page }) => {
285+
await page.selectOption('#example-select', 'focus');
286+
await page.waitForTimeout(500);
287+
288+
await clickSchedule(page);
289+
await waitForSchedule(page);
290+
291+
const status = await getStatusMessage(page);
292+
expect(status).toContain('Scheduled successfully');
293+
});
294+
295+
test('focus example filters tasks when pattern applied', async ({ page }) => {
296+
// Load the focus example (large project with multiple streams)
297+
await page.selectOption('#example-select', 'focus');
298+
// Wait for editor to update with the focus example content
299+
await page.waitForFunction(() => {
300+
const models = window.monaco?.editor?.getModels();
301+
return models && models[0]?.getValue().includes('Enterprise Platform');
302+
}, { timeout: 5000 });
303+
304+
// Schedule without focus
305+
await clickSchedule(page);
306+
await waitForSchedule(page);
307+
await clickGanttTab(page);
308+
await waitForGantt(page);
309+
310+
// Verify unfiltered view shows both backend and frontend tasks
311+
const iframe = page.frameLocator('#gantt-output iframe');
312+
const unfilteredHtml = await iframe.locator('body').innerHTML();
313+
expect(unfilteredHtml).toContain('Backend'); // Has backend tasks
314+
expect(unfilteredHtml).toContain('Frontend'); // Has frontend tasks
315+
316+
// Count text elements (task labels) in unfiltered view
317+
const unfilteredLabels = (unfilteredHtml.match(/<text/g) || []).length;
318+
319+
// Apply focus pattern to filter to backend tasks only
320+
await page.fill('#focus-input', 'backend');
321+
await clickSchedule(page);
322+
await waitForSchedule(page);
323+
await waitForGantt(page);
324+
325+
// Verify filtered view has fewer task labels
326+
const filteredHtml = await iframe.locator('body').innerHTML();
327+
const filteredLabels = (filteredHtml.match(/<text/g) || []).length;
328+
329+
// Focus should reduce the number of visible task labels
330+
expect(filteredLabels).toBeLessThan(unfilteredLabels);
331+
// But should still show some content (not empty)
332+
expect(filteredLabels).toBeGreaterThan(0);
333+
});
283334
});
284335

285336
test.describe('Resource Leveling', () => {

0 commit comments

Comments
 (0)