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
29 changes: 21 additions & 8 deletions apps/web/playwright/grounded-spec-review.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ test.beforeEach(({ baseURL }) => {
test.skip(!process.env.BASE_URL || !baseURL || !['localhost', '127.0.0.1', '[::1]'].includes(new URL(baseURL).hostname), 'Synthetic review fixtures are local-only, not production smoke tests.');
});

async function openCodeAndSpecTab(page: Page) {
const deliverablesDockTab = page.getByRole('tab', { name: 'Deliverables', exact: true });
if (await deliverablesDockTab.isVisible()) {
await deliverablesDockTab.click();
}
await page.getByTestId('studio-ide-output-tab-code').click();
}

async function seedReview(page: Page, baseURL: string | undefined, storageBlocked = false) {
if (!baseURL || !['localhost', '127.0.0.1', '[::1]'].includes(new URL(baseURL).hostname)) {
throw new Error('Synthetic review tests require an explicit local BASE_URL; never run against production.');
Expand Down Expand Up @@ -55,9 +63,10 @@ async function seedReview(page: Page, baseURL: string | undefined, storageBlocke
}
}, { key: storageKey, videos, storageBlocked });
await page.goto('/studio');
const selector = page.getByRole('combobox', { name: 'Stored packs' });
const selector = page.getByRole('combobox', { name: 'Saved videos' });
await expect(selector).toBeVisible();
await selector.selectOption('synthetic-0');
await openCodeAndSpecTab(page);
await expect(page.getByRole('button', { name: 'Acknowledge review', exact: true })).toBeEnabled();
return unexpectedRequests;
}
Expand All @@ -84,23 +93,26 @@ for (const viewport of [{ width: 830, height: 709 }, { width: 390, height: 844 }
await mkdir('/tmp/agent-browser', { recursive: true });
await review.screenshot({ path: `/tmp/agent-browser/grounded-review-${viewport.width}.png` });
await page.reload();
await page.getByRole('combobox', { name: 'Stored packs' }).selectOption('synthetic-0');
await page.getByRole('combobox', { name: 'Saved videos' }).selectOption('synthetic-0');
await openCodeAndSpecTab(page);
await expect(page.getByRole('button', { name: 'Clear local acknowledgment' })).toBeVisible();
await page.getByRole('combobox', { name: 'Stored packs' }).selectOption('synthetic-1');
await page.getByRole('combobox', { name: 'Saved videos' }).selectOption('synthetic-1');
await expect(review).toContainText('Grounded specification unavailable for this pack.');
await expect(acknowledgment).toHaveCount(0);
await page.getByRole('combobox', { name: 'Stored packs' }).selectOption('synthetic-2');
await page.getByRole('combobox', { name: 'Saved videos' }).selectOption('synthetic-2');
await expect(review).toContainText('Content digest does not match.');
await expect(acknowledgment).toBeDisabled();
await expect(page.getByRole('button', { name: 'Clear local acknowledgment' })).toHaveCount(0);
await page.getByRole('combobox', { name: 'Stored packs' }).selectOption('synthetic-0');
await page.getByRole('combobox', { name: 'Saved videos' }).selectOption('synthetic-0');
await page.getByRole('button', { name: 'Clear local acknowledgment' }).click();
await expect(acknowledgment).toBeEnabled();
await page.reload();
await page.getByRole('combobox', { name: 'Stored packs' }).selectOption('synthetic-0');
await page.getByRole('combobox', { name: 'Saved videos' }).selectOption('synthetic-0');
await openCodeAndSpecTab(page);
await expect(acknowledgment).toBeEnabled();
await expect(page.getByRole('button', { name: 'Clear local acknowledgment' })).toHaveCount(0);
await expect(page.getByTestId('studio-deploy-button')).toHaveText('Check preflight');
await expect(page.getByTestId('studio-ide-ship')).toHaveText('Export');
await expect(page.getByTestId('studio-deploy-button')).toHaveCount(0);
expect(unexpected).toEqual([]);
});
}
Expand All @@ -110,7 +122,8 @@ test('synthetic storage failure is session-only and cannot survive reload', asyn
await page.getByRole('button', { name: 'Acknowledge review', exact: true }).click();
await expect(page.getByTestId('grounded-spec-review')).toContainText('Session-only review state — not saved for reload.');
await page.reload();
await page.getByRole('combobox', { name: 'Stored packs' }).selectOption('synthetic-0');
await page.getByRole('combobox', { name: 'Saved videos' }).selectOption('synthetic-0');
await openCodeAndSpecTab(page);
await expect(page.getByRole('button', { name: 'Acknowledge review', exact: true })).toBeEnabled();
await expect(page.getByRole('button', { name: 'Clear local acknowledgment' })).toHaveCount(0);
expect(unexpected).toEqual([]);
Expand Down
64 changes: 50 additions & 14 deletions apps/web/playwright/studio-accessibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function expectNoOverflow(page: Page) {
expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true);
}

for (const width of [390, 900]) {
for (const width of [390, 640]) {
test(`selected Studio tabs stay visually distinct and retain a main landmark at ${width}px`, async ({ page }) => {
await openStudio(page, width);
const main = page.getByRole('main');
Expand Down Expand Up @@ -64,26 +64,62 @@ for (const width of [390, 900]) {
});
}

for (const width of [901, 1000, 1100, 1280, 1440]) {
test(`Studio renders the split workbench (Source + Chat left, Deliverables right) at ${width}px`, async ({ page }) => {
for (const width of [720, 900, 1000, 1280, 1440]) {
test(`Studio renders side-by-side split workbench with single-row 4-tab Deliverables at ${width}px`, async ({ page }) => {
await openStudio(page, width);
await expect(page.getByRole('main')).toHaveCount(1);
await expect(page.getByRole('main')).toBeVisible();
const videoBox = await page.getByTestId('studio-ide-video-pane').boundingBox();
const chatBox = await page.getByTestId('studio-ide-chat-pane').boundingBox();
const outputBox = await page.getByTestId('studio-ide-output-pane').boundingBox();
expect(videoBox && chatBox && outputBox).toBeTruthy();
// Deliverables sits side-by-side to the right of Source, near the top of the 900px viewport.
expect(outputBox!.x).toBeGreaterThan(videoBox!.x);
expect(outputBox!.y).toBeLessThanOrEqual(150);
// Source video is height-capped and stacked above Chat in the left column.

const chatPane = page.getByTestId('studio-ide-chat-pane');
const videoPane = page.getByTestId('studio-ide-video-pane');
const outputPane = page.getByTestId('studio-ide-output-pane');
await expect(chatPane).toBeVisible();
await expect(videoPane).toBeVisible();
await expect(outputPane).toBeVisible();

const chatBox = await chatPane.boundingBox();
const videoBox = await videoPane.boundingBox();
const outputBox = await outputPane.boundingBox();
expect(chatBox && videoBox && outputBox).toBeTruthy();

// Conversation owns the full-height left column; Video + Deliverables share the right column.
expect(chatBox!.x).toBeLessThan(videoBox!.x);
expect(chatBox!.x).toBeLessThan(outputBox!.x);
expect(chatBox!.y).toBeLessThanOrEqual(150);
expect(chatBox!.height).toBeGreaterThan(videoBox!.height);
expect(videoBox!.height).toBeLessThanOrEqual(300);
expect(videoBox!.x).toBeLessThanOrEqual(chatBox!.x + 2);
expect(videoBox!.y).toBeLessThan(chatBox!.y);
expect(Math.abs(videoBox!.x - outputBox!.x)).toBeLessThanOrEqual(2);
expect(videoBox!.y).toBeLessThan(outputBox!.y);
expect(outputBox!.y).toBeLessThan(500);

// Deliverables tablist exposes 4 plain-English tabs on one single non-wrapping row.
const outputTabs = page.getByTestId('studio-ide-output-tablist').getByRole('tab');
await expect(outputTabs).toHaveCount(4);
await expect(outputTabs).toHaveText(['Preview', 'Tasks & Tools', 'Code & Spec', 'Transcript']);
const tabBoxes = await Promise.all(
[0, 1, 2, 3].map((idx) => outputTabs.nth(idx).boundingBox()),
);
expect(tabBoxes.every(Boolean)).toBe(true);
const firstTabY = tabBoxes[0]!.y;
for (const box of tabBoxes) {
expect(Math.abs(box!.y - firstTabY)).toBeLessThanOrEqual(4);
}

await expectNoOverflow(page);
});
}

test('Home primary navigation links remain visible without horizontal overflow at 720x900 half-screen', async ({ page }) => {
await page.setViewportSize({ width: 720, height: 900 });
await page.goto('/');
const primaryNav = page.locator('nav.template-nav').first();
await expect(primaryNav).toBeVisible();
for (const label of ['Home', 'Studio', 'Pricing', 'API Docs']) {
await expect(primaryNav.getByRole('link', { name: label, exact: true })).toBeVisible();
}
await expectNoOverflow(page);
});

test('Studio collapse/restore controls and responsive breakpoint switching stay accessible', async ({ page }) => {
await openStudio(page, 1440);
await page.getByRole('button', { name: 'Collapse video pane' }).click();
Expand All @@ -96,7 +132,7 @@ test('Studio collapse/restore controls and responsive breakpoint switching stay
await page.getByRole('button', { name: 'Show deliverables' }).click();
await expect(page.getByTestId('studio-ide-output-pane')).toBeVisible();

for (const width of [900, 390, 1280]) {
for (const width of [720, 640, 390, 1280]) {
await page.setViewportSize({ width, height: 900 });
await expect(page.getByRole('main')).toBeVisible();
await expectNoOverflow(page);
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ export default async function HomePage() {
const showCustomBadge = await customBadge();

return (
<main className="min-h-screen" style={{ background: 'var(--uvai-bg)' }}>
<main className="min-h-screen overflow-x-clip" style={{ background: 'var(--uvai-bg)' }}>
<Nav />

<section aria-labelledby="home-heading" className="template-home home-shipper px-4 sm:px-6 lg:px-10 pb-16 pt-4">
<section aria-labelledby="home-heading" className="template-home home-shipper px-4 sm:px-6 lg:px-10 pb-14 pt-3 sm:pt-4">
<div className="mx-auto max-w-[1400px]">
<div className="template-use-cases" aria-label="Supported source examples">
{SHOWCASE.map(({ Icon, title, note }) => (
Expand Down
64 changes: 51 additions & 13 deletions apps/web/src/components/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { useEffect, useState, useSyncExternalStore } from 'react';
import { useEffect, useRef, useState, useSyncExternalStore } from 'react';
import {
BookOpen,
Clapperboard,
Expand All @@ -14,7 +14,9 @@ import {
Moon,
PanelLeftClose,
PanelLeftOpen,
Sparkles,
Sun,
User,
X,
} from 'lucide-react';
import '@/styles/theme-tokens.css';
Expand Down Expand Up @@ -143,6 +145,7 @@ function RailNav({
defaultCollapsed = false,
}: Pick<NavProps, 'rightSlot' | 'subtitle' | 'defaultCollapsed'> & { pathname: string }) {
const [collapsed, setCollapsed] = useState(defaultCollapsed);
const ctaRef = useRef<HTMLDivElement>(null);

useEffect(() => {
const onKeyDown = (event: KeyboardEvent) => {
Expand All @@ -155,6 +158,15 @@ function RailNav({
return () => window.removeEventListener('keydown', onKeyDown);
}, []);

const expandToAccount = () => {
setCollapsed(false);
if (typeof requestAnimationFrame === 'function') {
requestAnimationFrame(() => {
ctaRef.current?.querySelector<HTMLElement>('a, button')?.focus();
});
}
};

return (
<nav
className="uvai-rail-shell template-nav"
Expand All @@ -180,7 +192,7 @@ function RailNav({
</div>

{subtitle && !collapsed && (
<span className="px-4 pt-3 text-sm" style={{ color: 'var(--uvai-ink-soft)' }}>{subtitle}</span>
<span className="uvai-rail-subtitle px-4 pt-3 text-sm" style={{ color: 'var(--uvai-ink-soft)' }}>{subtitle}</span>
)}

<div className="uvai-rail-links">
Expand All @@ -201,14 +213,40 @@ function RailNav({
})}
</div>

<div className="uvai-rail-cta">
<div ref={ctaRef} className="uvai-rail-cta">
{rightSlot || (
<Link href="/#get-pro" className="uvai-btn uvai-btn-primary w-full py-2 px-5 text-sm">
Get Pro
</Link>
)}
</div>

{collapsed && (
rightSlot ? (
<button
type="button"
onClick={expandToAccount}
aria-label="Sign in or account"
aria-expanded={false}
title="Sign in / Account"
className="uvai-rail-collapsed-cta"
>
<User className="h-4 w-4" aria-hidden="true" />
<span className="uvai-rail-label">Sign in</span>
</button>
) : (
<Link
href="/#get-pro"
aria-label="Get Pro"
title="Get Pro"
className="uvai-rail-collapsed-cta"
>
<Sparkles className="h-4 w-4" aria-hidden="true" />
<span className="uvai-rail-label">Get Pro</span>
</Link>
)
)}

<ThemeBar compact={false} />
</nav>
);
Expand Down Expand Up @@ -241,7 +279,7 @@ export default function Nav({

return (
<nav
className="template-nav flex flex-wrap items-center justify-between px-4 sm:px-6 lg:px-10 py-3 z-50"
className="template-nav flex flex-wrap items-center justify-between gap-2 px-3 min-[600px]:px-5 lg:px-10 py-2 min-[901px]:py-3 z-50"
style={{
borderBottom: '1px solid var(--uvai-border)',
background: 'var(--uvai-bg)',
Expand All @@ -251,8 +289,8 @@ export default function Nav({
right: fixed ? 0 : undefined,
}}
>
<div className="flex items-center gap-6">
<Link href="/" className="flex items-center gap-2.5">
<div className="flex min-w-0 items-center gap-3 md:gap-5">
<Link href="/" className="flex shrink-0 items-center gap-2">
<div
className="w-8 h-8 rounded-lg flex items-center justify-center text-white font-semibold text-sm"
style={{ background: 'var(--uvai-accent)' }}
Expand All @@ -265,18 +303,18 @@ export default function Nav({
</Link>

{subtitle && (
<span className="text-sm" style={{ color: 'var(--uvai-ink-soft)' }}>{subtitle}</span>
<span className="hidden lg:inline text-sm whitespace-nowrap" style={{ color: 'var(--uvai-ink-soft)' }}>{subtitle}</span>
)}

<div className="hidden md:flex items-center gap-1">
<div className="hidden min-[600px]:flex items-center gap-0.5 sm:gap-1">
{NAV_LINKS.map(({ href, label }) => {
const active = isNavActive(pathname, href);
return (
<Link
key={href}
href={href}
aria-current={active ? 'page' : undefined}
className="text-sm px-3 py-2 rounded-lg transition-colors"
className="whitespace-nowrap text-xs sm:text-sm px-2 sm:px-2.5 lg:px-3 py-1.5 sm:py-2 rounded-lg transition-colors"
style={{
color: active ? 'var(--uvai-ink)' : 'var(--uvai-ink-soft)',
background: active ? 'var(--uvai-surface-warm)' : 'transparent',
Expand All @@ -289,10 +327,10 @@ export default function Nav({
</div>
</div>

<div className="flex items-center gap-3">
<div className="flex shrink-0 items-center gap-2 sm:gap-3">
<ThemeBar compact />
{rightSlot || (
<Link href="/#get-pro" className="uvai-btn uvai-btn-primary py-2 px-5 text-sm">
<Link href="/#get-pro" className="uvai-btn uvai-btn-primary whitespace-nowrap !py-2 !px-3.5 sm:!px-4 lg:!px-5 text-xs sm:text-sm">
Get Pro
</Link>
)}
Expand All @@ -302,15 +340,15 @@ export default function Nav({
aria-expanded={mobileOpen}
aria-controls="mobile-nav"
aria-label={mobileOpen ? 'Close navigation menu' : 'Open navigation menu'}
className="md:hidden inline-flex items-center justify-center w-10 h-10 rounded-lg"
className="min-[600px]:hidden inline-flex items-center justify-center w-9 h-9 rounded-lg"
style={{ color: 'var(--uvai-ink-soft)' }}
>
{mobileOpen ? <X className="h-5 w-5" /> : <Menu className="h-5 w-5" />}
</button>
</div>

{mobileOpen && (
<div id="mobile-nav" className="md:hidden w-full mt-3 flex flex-col gap-1 pt-3" style={{ borderTop: '1px solid var(--uvai-border)' }}>
<div id="mobile-nav" className="min-[600px]:hidden w-full mt-2 flex flex-col gap-1 pt-2" style={{ borderTop: '1px solid var(--uvai-border)' }}>
{NAV_LINKS.map(({ href, label }) => (
<Link
key={href}
Expand Down
Loading
Loading