e2e-video
# E2E Video Room Tests
What this skill does
# E2E Video Room Tests
Playwright test suite for Constellation v3 video room features. Tests the video room API routes (create room, generate token, auth guards), the prejoin screen (device selection, camera preview, join flow), and the in-room controls bar (mute, camera, screenshare, leave). Uses `page.route()` to mock LiveKit Cloud API calls so tests run without a real LiveKit server.
## When to Use This Skill
Use this skill when the user says:
- "test video rooms"
- "add video e2e tests"
- "e2e video"
- "test livekit ui"
- "playwright video tests"
- "test video controls"
## Prerequisites
- Next.js app with App Router
- `e2e` skill installed (Playwright configured with `playwright.config.ts`)
- `video-room` skill installed (API routes at `/api/video/rooms` and `/api/video/token`)
- `video-ui` skill installed (prejoin screen, controls bar components)
- `auth-dev` skill installed (seed users for authentication)
- Dev server running on `localhost:3000`
## Installation
No additional packages required. The `e2e` skill provides `@playwright/test` and the Playwright configuration.
## What Gets Created
```
e2e/
├── fixtures/
│ └── mock-livekit.ts # LiveKit API mock helpers using page.route()
├── helpers/
│ └── video-auth.ts # Reusable sign-in helper for video tests
├── video-room.spec.ts # API route tests (create room, token, auth)
├── video-controls.spec.ts # Controls bar UI tests (mute, camera, leave)
└── video-prejoin.spec.ts # Prejoin screen tests (devices, preview, join)
```
## Setup Steps
### Step 1: Create `e2e/fixtures/mock-livekit.ts`
This helper intercepts LiveKit Cloud API calls and returns consistent mock data so tests never hit a real LiveKit server.
```typescript
import type { Page } from "@playwright/test";
/**
* Mock data for a LiveKit room.
* Matches the VideoRoom type from lib/video/types.ts.
*/
export const mockRoom = {
name: "test-room",
sid: "RM_test123abc",
numParticipants: 0,
maxParticipants: 20,
creationTime: 1708300800,
metadata: "",
} as const;
/**
* Mock data for a LiveKit participant.
* Matches the VideoParticipant type from lib/video/types.ts.
*/
export const mockParticipant = {
sid: "PA_participant456",
identity: "user-1",
name: "Admin User",
metadata: JSON.stringify({ userId: "user-1", email: "[email protected]" }),
joinedAt: 1708300900,
isSpeaking: false,
connectionQuality: "excellent",
} as const;
/**
* A mock JWT token string for testing.
* This is NOT a valid JWT — it is only used to verify the token route
* returns a string in the expected shape.
*/
export const mockToken =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLTEiLCJyb29tIjoidGVzdC1yb29tIn0.mock-signature";
/**
* Intercepts outgoing requests to the LiveKit Cloud REST API and
* returns mock responses. Call this in test.beforeEach to ensure
* no real LiveKit calls are made.
*
* Intercepts:
* - POST /api/video/rooms -> returns mockRoom
* - GET /api/video/rooms -> returns [mockRoom]
* - POST /api/video/token -> returns { token, url }
*/
export async function interceptLiveKitApi(page: Page): Promise<void> {
// Mock the room creation endpoint
await page.route("**/api/video/rooms", async (route) => {
const method = route.request().method();
if (method === "POST") {
const body = route.request().postDataJSON() as { name?: string };
await route.fulfill({
status: 201,
contentType: "application/json",
body: JSON.stringify({
room: {
...mockRoom,
name: body?.name ?? mockRoom.name,
},
}),
});
return;
}
if (method === "GET") {
await route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({
rooms: [mockRoom],
}),
});
return;
}
await route.continue();
});
// Mock the token generation endpoint
await page.route("**/api/video/token", async (route) => {
const method = route.request().method();
if (method === "POST") {
await route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({
token: mockToken,
url: "wss://mock-livekit.example.com",
}),
});
return;
}
await route.continue();
});
}
/**
* Intercepts LiveKit WebSocket connections so tests don't attempt
* real signaling. Returns a mock response that prevents connection errors.
*/
export async function interceptLiveKitWebSocket(page: Page): Promise<void> {
await page.route("**/rtc**", async (route) => {
await route.abort("connectionrefused");
});
await page.route("wss://**livekit**", async (route) => {
await route.abort("connectionrefused");
});
}
```
### Step 2: Create `e2e/helpers/video-auth.ts`
Reusable helper that signs in as the dev admin user via the `/dev` page. Used by all video test files that require authentication.
```typescript
import type { Page } from "@playwright/test";
import { expect } from "@playwright/test";
/**
* Signs in as the admin test user using the auth-dev quick sign-in flow.
*
* Steps:
* 1. Navigate to /dev
* 2. Click the "Seed Users" button to ensure users exist
* 3. Click the "Sign In" button on the admin user card
* 4. Wait for redirect to homepage
*
* Call this in test.beforeEach for any test that requires authentication.
*/
export async function signInAsTestUser(page: Page): Promise<void> {
// Navigate to the dev console
await page.goto("/dev");
await expect(page.getByRole("heading", { name: /dev console/i })).toBeVisible({
timeout: 10_000,
});
// Seed users to ensure they exist in the database
const seedButton = page.getByRole("button", { name: /seed users/i });
await seedButton.click();
// Wait for seed to complete — the result message appears after seeding
await expect(page.getByText(/seeded|exists|created/i)).toBeVisible({
timeout: 15_000,
});
// Find the admin user card and click Sign In
const adminCard = page.locator("div", {
has: page.getByText("[email protected]"),
});
const signInButton = adminCard.getByRole("button", { name: /sign in/i });
await signInButton.click();
// Wait for redirect after successful sign-in
await page.waitForURL(/\/(?!dev)/, { timeout: 15_000 });
}
/**
* Signs out the current user by navigating to /dev and clicking sign out.
*/
export async function signOutTestUser(page: Page): Promise<void> {
await page.goto("/dev");
const signOutButton = page.getByRole("button", { name: /sign out/i });
if (await signOutButton.isVisible()) {
await signOutButton.click();
await expect(page.getByText(/not signed in/i)).toBeVisible({
timeout: 10_000,
});
}
}
```
### Step 3: Create `e2e/video-room.spec.ts`
Tests the video room API routes directly using `fetch` within Playwright. Validates room creation, token generation, and authentication guards.
```typescript
import { test, expect } from "@playwright/test";
import { signInAsTestUser, signOutTestUser } from "./helpers/video-auth";
test.describe("Video Room API Routes", () => {
/**
* Test: POST /api/video/rooms creates a room.
*
* This test mocks the internal LiveKit call by intercepting the route
* at the browser level. The API route handler calls LiveKit server SDK,
* so we intercept the outbound request from the Next.js server by
* sending a direct fetch to the local API and verifying the response shape.
*
* Note: Since page.route() only intercepts browser-originated requests,
* we test the API routes by calling them via the Playwright request context
* which sends real HTTP requests. The Next.js server must be running with
* valid (or mocked) LiveKit env vars.
*/
test("POST /api/video/rooms creates a room and returns room object", async ({
request,
}) => {
const response = await request.post("/api/video/rooms", {
Related in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.