mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-09-30 12:39:42 +02:00
chore: bump version to 0.1444
This commit is contained in:
@@ -16,7 +16,7 @@ When user says "COM":
|
||||
1. Increment version in BOTH `package.json` AND `CLAUDE.md`
|
||||
2. Run: `git add -A && git commit -m "chore: bump version to X.XXXX" && git push && npm run build && systemctl --user restart claudeman-web`
|
||||
|
||||
**Version**: 0.1443 (must match `package.json`)
|
||||
**Version**: 0.1444 (must match `package.json`)
|
||||
|
||||
## Project Overview
|
||||
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
# Mobile E2E Testing Report
|
||||
|
||||
**Date**: 2026-01-31
|
||||
**Status**: All 32 tests passing
|
||||
|
||||
## Overview
|
||||
|
||||
Comprehensive mobile E2E testing was performed using Playwright with Chromium in mobile emulation mode. Tests validate touch interactions, responsive design, mobile-specific UI behaviors, and edge cases across various device viewports.
|
||||
|
||||
## Test Coverage Summary
|
||||
|
||||
| Test File | Tests | Description |
|
||||
|-----------|-------|-------------|
|
||||
| `mobile-safari.e2e.ts` | 6 | Core mobile Safari/iPhone tests |
|
||||
| `mobile-comprehensive.e2e.ts` | 13 | UI components, modals, interactions |
|
||||
| `mobile-edge-cases.e2e.ts` | 13 | Edge cases: orientation, narrow screens, safe areas |
|
||||
|
||||
## Bugs Found and Fixed
|
||||
|
||||
### 1. Monitor Panel Overlapping Toolbar on Mobile
|
||||
|
||||
**File**: `src/web/public/styles.css` (lines 7969-7982)
|
||||
|
||||
**Problem**: The monitor panel was positioned at `bottom: var(--toolbar-height)` (40px), but the mobile toolbar has `height: auto` with `flex-wrap: wrap`, causing it to be taller than 40px. This resulted in the monitor panel header intercepting tap events on the "Run Claude" button.
|
||||
|
||||
**Error message**:
|
||||
```
|
||||
<div class="monitor-panel-title">Monitor</div> from <div id="monitorPanel" class="monitor-panel">…</div> subtree intercepts pointer events
|
||||
```
|
||||
|
||||
**Fix**: Hide monitor and subagents panels on phones by default:
|
||||
```css
|
||||
@media (max-width: 430px) {
|
||||
.monitor-panel,
|
||||
.subagents-panel {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Rationale**: On phone screens (<430px), there isn't enough space for these panels anyway. Users can still access session info via the header and session options modal.
|
||||
|
||||
---
|
||||
|
||||
### 2. WebKit Browser Missing System Dependencies
|
||||
|
||||
**File**: `test/e2e/fixtures/mobile-browser.fixture.ts`
|
||||
|
||||
**Problem**: WebKit requires system libraries (libgtk-4, libgstreamer, etc.) that may not be installed on all systems, causing mobile tests to fail.
|
||||
|
||||
**Fix**: Added fallback to Chromium with mobile emulation:
|
||||
```typescript
|
||||
try {
|
||||
browser = await webkit.launch({ headless: true });
|
||||
userAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X)...';
|
||||
} catch {
|
||||
// WebKit failed, use Chromium with mobile emulation
|
||||
browser = await chromium.launch({ headless: true, args: [...] });
|
||||
userAgent = 'Mozilla/5.0 (Linux; Android 14; Pixel 8)...';
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 3. Race Condition in Session Tab Detection
|
||||
|
||||
**File**: `test/e2e/workflows/mobile-safari.e2e.ts`
|
||||
|
||||
**Problem**: Test waited for `.session-tab` selector but then checked `.session-tab.active`, causing timing issues where the tab existed but wasn't yet marked as active.
|
||||
|
||||
**Fix**: Wait for the active tab directly:
|
||||
```typescript
|
||||
// Before (race condition)
|
||||
await page.waitForSelector('.session-tab', { timeout: ... });
|
||||
const tabVisible = await page.isVisible('.session-tab.active');
|
||||
|
||||
// After (correct)
|
||||
await page.waitForSelector('.session-tab.active', { timeout: ... });
|
||||
const tabVisible = await page.isVisible('.session-tab.active');
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Known Limitations
|
||||
|
||||
### No Kill All Button on Mobile
|
||||
|
||||
**Status**: By design (not a bug)
|
||||
|
||||
The "Kill All" button is located in the Monitor panel, which is hidden on mobile devices (<430px). Users can close sessions individually via the close button on each session tab.
|
||||
|
||||
**Consideration for future**: Could add a "Kill All" option in the app settings modal or a long-press context menu on session tabs.
|
||||
|
||||
### No Help Button on Mobile
|
||||
|
||||
**Status**: By design
|
||||
|
||||
There is no dedicated help button in the mobile UI. Help is accessible via:
|
||||
- Keyboard shortcut (`?` key)
|
||||
- App settings modal
|
||||
|
||||
---
|
||||
|
||||
## Test Coverage
|
||||
|
||||
### mobile-safari.e2e.ts (Port 3191)
|
||||
|
||||
| Test | Description |
|
||||
|------|-------------|
|
||||
| Touch-friendly UI rendering | Verifies `touch-device` and `device-mobile` body classes |
|
||||
| 44px minimum touch targets | Ensures buttons meet WCAG AA touch target requirements |
|
||||
| Tap gestures for session creation | Creates session via tap on Run Claude button |
|
||||
| Always-visible close buttons | Verifies opacity:1 on touch devices (no hover dependency) |
|
||||
| Header hiding on small screens | Brand, stats, font controls hidden on phones |
|
||||
| Tablet viewport rendering | iPad Pro 11" (834x1194) renders with `device-desktop` + `touch-device` |
|
||||
|
||||
### mobile-comprehensive.e2e.ts (Port 3192)
|
||||
|
||||
| Test | Description |
|
||||
|------|-------------|
|
||||
| Welcome overlay buttons | Touch-friendly welcome overlay with 44px+ button height |
|
||||
| Run Claude button prominence | Button visible with `flex: 1` on mobile |
|
||||
| Case dropdown visibility | Dropdown accessible and functional |
|
||||
| Version display hiding | `.toolbar-center` hidden on phones |
|
||||
| Horizontal tab scrolling | Session tabs allow `overflow-x: auto` scrolling |
|
||||
| Tab switching on tap | Tapping tabs switches active session |
|
||||
| Full-screen modals | Modals use 100% width/height on phones |
|
||||
| Create case modal | Case creation modal accessible via + button |
|
||||
| Notification button | Notification bell visible and tappable |
|
||||
| Settings button | Settings gear has adequate touch target |
|
||||
| Close confirmation modal | Close button triggers confirmation dialog |
|
||||
| Token count display | Token counter visible in header |
|
||||
| Ralph wizard full-screen | Wizard modal renders full-screen |
|
||||
|
||||
### mobile-edge-cases.e2e.ts (Port 3193)
|
||||
|
||||
| Test | Description |
|
||||
|------|-------------|
|
||||
| Landscape orientation handling | 874x402 landscape mode with proper classes |
|
||||
| Terminal in landscape | Terminal renders with adequate height |
|
||||
| Very narrow viewport (280px) | Galaxy Fold folded state usable |
|
||||
| Narrow screen toolbar | Toolbar doesn't overflow on 280px |
|
||||
| Session options via gear icon | Gear icon visible, modal opens on tap |
|
||||
| Modal tab switching | Session options modal tabs work on touch |
|
||||
| Terminal tap interactions | Terminal responds to touch events |
|
||||
| Primary touch targets | Main buttons meet 44px height requirement |
|
||||
| iOS safe area CSS variables | `--safe-area-*` variables defined |
|
||||
| Double-tap zoom prevention | touch-action styles applied |
|
||||
| Modal body scrolling | `overflow-y: auto` for touch scrolling |
|
||||
| Viewport meta tag | Proper mobile viewport configuration |
|
||||
| Android Pixel viewport | 412x915 Pixel 7a renders correctly |
|
||||
|
||||
---
|
||||
|
||||
## Mobile CSS Breakpoints
|
||||
|
||||
| Breakpoint | Class | Description |
|
||||
|------------|-------|-------------|
|
||||
| < 430px | `device-mobile` | Phone - most features hidden/simplified |
|
||||
| 430-768px | `device-tablet` | Tablet - intermediate layout |
|
||||
| > 768px | `device-desktop` | Desktop - full features |
|
||||
|
||||
Touch devices also get `touch-device` class regardless of screen size.
|
||||
|
||||
---
|
||||
|
||||
## Viewports Tested
|
||||
|
||||
| Device | Width | Height | Scale | Notes |
|
||||
|--------|-------|--------|-------|-------|
|
||||
| iPhone 17 Pro | 402 | 874 | 3x | Primary phone test |
|
||||
| iPhone 17 Pro Landscape | 874 | 402 | 3x | Orientation testing |
|
||||
| iPhone 17 Pro Max | 440 | 956 | 3x | Larger phone |
|
||||
| iPad Pro 11" | 834 | 1194 | 2x | Tablet testing |
|
||||
| Galaxy Fold (folded) | 280 | 653 | 3x | Extreme narrow test |
|
||||
| Pixel 7a | 412 | 915 | 2.625x | Android testing |
|
||||
|
||||
---
|
||||
|
||||
## Running Mobile Tests
|
||||
|
||||
```bash
|
||||
# Install Playwright browsers (Chromium is required, WebKit optional)
|
||||
npx playwright install chromium
|
||||
|
||||
# Run individual test files
|
||||
npx vitest run test/e2e/workflows/mobile-safari.e2e.ts
|
||||
npx vitest run test/e2e/workflows/mobile-comprehensive.e2e.ts
|
||||
npx vitest run test/e2e/workflows/mobile-edge-cases.e2e.ts
|
||||
|
||||
# Run all mobile tests together
|
||||
npx vitest run test/e2e/workflows/mobile-safari.e2e.ts test/e2e/workflows/mobile-comprehensive.e2e.ts test/e2e/workflows/mobile-edge-cases.e2e.ts
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Port Allocations
|
||||
|
||||
| Port | Test File |
|
||||
|------|-----------|
|
||||
| 3191 | mobile-safari.e2e.ts |
|
||||
| 3192 | mobile-comprehensive.e2e.ts |
|
||||
| 3193 | mobile-edge-cases.e2e.ts |
|
||||
|
||||
---
|
||||
|
||||
## Key Mobile UI Behaviors
|
||||
|
||||
1. **Monitor/Subagents panels**: Hidden on phones (<430px)
|
||||
2. **Toolbar**: Wraps content with `flex-wrap: wrap`, variable height
|
||||
3. **Session tabs**: Horizontal scroll with hidden scrollbar
|
||||
4. **Modals**: Full-screen on phones (100% width/height)
|
||||
5. **Touch targets**: Minimum 44px height for WCAG compliance
|
||||
6. **Close buttons**: Always visible (opacity: 1) on touch devices
|
||||
7. **Header**: Brand, stats, font controls hidden on phones
|
||||
8. **Safe areas**: CSS variables for iOS notch handling
|
||||
|
||||
---
|
||||
|
||||
## Future Improvements
|
||||
|
||||
1. Add swipe gesture tests for tab navigation
|
||||
2. Add virtual keyboard handling tests (show/hide behavior)
|
||||
3. Add orientation change tests (dynamic portrait/landscape switching)
|
||||
4. Add safe area inset tests for iOS notch handling with actual device values
|
||||
5. Consider showing a condensed monitor indicator on mobile
|
||||
6. Add "Kill All" option accessible from mobile UI
|
||||
7. Test pull-to-refresh prevention on iOS Safari
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "claudeman",
|
||||
"version": "0.1443",
|
||||
"version": "0.1444",
|
||||
"description": "The missing control plane for Claude Code - run 20 autonomous agents with real-time monitoring and session persistence",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
|
||||
@@ -494,8 +494,15 @@ attach_screen() {
|
||||
echo -e "${D}(Ctrl+A D to detach)${R}"
|
||||
sleep 0.3
|
||||
|
||||
# Use -x for attached screens (multi-display mode), -r for detached
|
||||
# -x allows joining a screen that's already attached elsewhere
|
||||
# IMPORTANT: Claudeman attaches to screen via PTY with -x for streaming.
|
||||
# Using -rd here would detach Claudeman and break terminal output.
|
||||
#
|
||||
# For mobile access without squeezing the desktop view:
|
||||
# - Use the web UI from mobile Safari (responsive, works on iPhone)
|
||||
# - The web UI at http://yourserver:3000 works great on mobile browsers
|
||||
#
|
||||
# If you attach via screen -x, the terminal will resize to the smallest
|
||||
# attached client (your mobile). Use Ctrl+A D to detach when done.
|
||||
if [[ "$state" == "Attached" ]] || [[ "$state" == "Multi" ]]; then
|
||||
screen -x "$pid.$name"
|
||||
else
|
||||
|
||||
@@ -342,6 +342,13 @@ export class Session extends EventEmitter {
|
||||
// Flicker filter setting (per-session toggle, applied on frontend)
|
||||
private _flickerFilterEnabled: boolean = false;
|
||||
|
||||
// Claude Code CLI info (parsed from terminal startup)
|
||||
private _cliVersion: string = '';
|
||||
private _cliModel: string = '';
|
||||
private _cliAccountType: string = '';
|
||||
private _cliLatestVersion: string = '';
|
||||
private _cliInfoParsed: boolean = false; // Only parse once per session
|
||||
|
||||
// Timer tracking for cleanup (prevents memory leaks)
|
||||
private _autoCompactTimer: NodeJS.Timeout | null = null;
|
||||
private _autoClearTimer: NodeJS.Timeout | null = null;
|
||||
@@ -747,6 +754,10 @@ export class Session extends EventEmitter {
|
||||
niceValue: this._niceConfig.niceValue,
|
||||
color: this._color,
|
||||
flickerFilterEnabled: this._flickerFilterEnabled,
|
||||
cliVersion: this._cliVersion || undefined,
|
||||
cliModel: this._cliModel || undefined,
|
||||
cliAccountType: this._cliAccountType || undefined,
|
||||
cliLatestVersion: this._cliLatestVersion || undefined,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -967,6 +978,9 @@ export class Session extends EventEmitter {
|
||||
// Parse token count from status line (e.g., "123.4k tokens" or "5234 tokens")
|
||||
this.parseTokensFromStatusLine(data);
|
||||
|
||||
// Parse Claude Code CLI info (version, model, account type) from startup
|
||||
this.parseClaudeCodeInfo(data);
|
||||
|
||||
// Parse task descriptions from terminal output (e.g., "Explore(Check files)")
|
||||
// This enables correlating subagent windows with their short descriptions
|
||||
this.parseTaskDescriptionsFromTerminalData(data);
|
||||
@@ -1636,6 +1650,80 @@ export class Session extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
// Parse Claude Code CLI info from terminal startup output
|
||||
// Extracts version, model, and account type for display in Claudeman UI
|
||||
private parseClaudeCodeInfo(data: string): void {
|
||||
// Only parse once per session (during startup)
|
||||
if (this._cliInfoParsed) return;
|
||||
|
||||
// Quick pre-checks
|
||||
if (!data.includes('Claude') && !data.includes('current:') && !data.includes('Opus') && !data.includes('Sonnet')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const cleanData = data.replace(ANSI_ESCAPE_PATTERN_FULL, '');
|
||||
let changed = false;
|
||||
|
||||
// Match "Claude Code v2.1.27" or "Claude Code vX.Y.Z"
|
||||
if (!this._cliVersion) {
|
||||
const versionMatch = cleanData.match(/Claude Code v(\d+\.\d+\.\d+)/);
|
||||
if (versionMatch) {
|
||||
this._cliVersion = versionMatch[1];
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Match model and account: "Opus 4.5 · Claude Max" or "Sonnet 4 · API"
|
||||
// The · character separates model from account type
|
||||
if (!this._cliModel || !this._cliAccountType) {
|
||||
// Try various model patterns
|
||||
const modelPatterns = [
|
||||
/(Opus \d+(?:\.\d+)?)\s*[·•]\s*(.+?)(?:\s*$|\s+[~/])/,
|
||||
/(Sonnet \d+(?:\.\d+)?)\s*[·•]\s*(.+?)(?:\s*$|\s+[~/])/,
|
||||
/(Haiku \d+(?:\.\d+)?)\s*[·•]\s*(.+?)(?:\s*$|\s+[~/])/,
|
||||
];
|
||||
|
||||
for (const pattern of modelPatterns) {
|
||||
const match = cleanData.match(pattern);
|
||||
if (match) {
|
||||
if (!this._cliModel) {
|
||||
this._cliModel = match[1].trim();
|
||||
changed = true;
|
||||
}
|
||||
if (!this._cliAccountType) {
|
||||
this._cliAccountType = match[2].trim();
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Match version check: "current: 2.1.27" and "latest: 2.1.27"
|
||||
if (!this._cliLatestVersion) {
|
||||
const latestMatch = cleanData.match(/latest:\s*(\d+\.\d+\.\d+)/);
|
||||
if (latestMatch) {
|
||||
this._cliLatestVersion = latestMatch[1];
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Mark as parsed once we have the essential info
|
||||
if (this._cliVersion && this._cliModel) {
|
||||
this._cliInfoParsed = true;
|
||||
}
|
||||
|
||||
// Emit update if anything changed
|
||||
if (changed) {
|
||||
this.emit('cliInfoUpdated', {
|
||||
version: this._cliVersion,
|
||||
model: this._cliModel,
|
||||
accountType: this._cliAccountType,
|
||||
latestVersion: this._cliLatestVersion,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we should auto-compact based on token threshold
|
||||
private checkAutoCompact(): void {
|
||||
if (this._isStopped) return; // Early exit check
|
||||
|
||||
@@ -188,6 +188,14 @@ export interface SessionState {
|
||||
color?: SessionColor;
|
||||
/** Flicker filter enabled (buffers output after screen clears) */
|
||||
flickerFilterEnabled?: boolean;
|
||||
/** Claude Code CLI version (parsed from terminal, e.g., "2.1.27") */
|
||||
cliVersion?: string;
|
||||
/** Claude model in use (parsed from terminal, e.g., "Opus 4.5") */
|
||||
cliModel?: string;
|
||||
/** Account type (parsed from terminal, e.g., "Claude Max", "API") */
|
||||
cliAccountType?: string;
|
||||
/** Latest CLI version available (parsed from version check) */
|
||||
cliLatestVersion?: string;
|
||||
}
|
||||
|
||||
// ========== Global Stats Types ==========
|
||||
|
||||
+270
-56
@@ -344,9 +344,11 @@ class NotificationManager {
|
||||
subagent_complete: { enabled: false, browser: false, audio: false },
|
||||
};
|
||||
|
||||
// Device-specific defaults: mobile has notifications disabled by default
|
||||
const isMobile = MobileDetection.getDeviceType() === 'mobile';
|
||||
const defaults = {
|
||||
enabled: true,
|
||||
browserNotifications: true,
|
||||
enabled: !isMobile, // Disabled on mobile by default
|
||||
browserNotifications: !isMobile,
|
||||
audioAlerts: false,
|
||||
stuckThresholdMs: STUCK_THRESHOLD_DEFAULT_MS,
|
||||
// Legacy urgency muting (keep for backwards compat)
|
||||
@@ -358,7 +360,8 @@ class NotificationManager {
|
||||
_version: 3,
|
||||
};
|
||||
try {
|
||||
const saved = localStorage.getItem('claudeman-notification-prefs');
|
||||
const storageKey = this.getStorageKey();
|
||||
const saved = localStorage.getItem(storageKey);
|
||||
if (saved) {
|
||||
const prefs = JSON.parse(saved);
|
||||
// Migrate: v1 had browserNotifications defaulting to false
|
||||
@@ -370,7 +373,7 @@ class NotificationManager {
|
||||
if (prefs._version < 3) {
|
||||
prefs.eventTypes = defaultEventTypes;
|
||||
prefs._version = 3;
|
||||
localStorage.setItem('claudeman-notification-prefs', JSON.stringify(prefs));
|
||||
localStorage.setItem(storageKey, JSON.stringify(prefs));
|
||||
}
|
||||
// Merge with defaults to ensure all eventTypes exist
|
||||
return {
|
||||
@@ -383,8 +386,14 @@ class NotificationManager {
|
||||
return defaults;
|
||||
}
|
||||
|
||||
// Get storage key for notification prefs (device-specific)
|
||||
getStorageKey() {
|
||||
const isMobile = MobileDetection.getDeviceType() === 'mobile';
|
||||
return isMobile ? 'claudeman-notification-prefs-mobile' : 'claudeman-notification-prefs';
|
||||
}
|
||||
|
||||
savePreferences() {
|
||||
localStorage.setItem('claudeman-notification-prefs', JSON.stringify(this.preferences));
|
||||
localStorage.setItem(this.getStorageKey(), JSON.stringify(this.preferences));
|
||||
}
|
||||
|
||||
notify({ urgency, category, sessionId, sessionName, title, message }) {
|
||||
@@ -923,7 +932,8 @@ class ClaudemanApp {
|
||||
brightWhite: '#ffffff',
|
||||
},
|
||||
fontFamily: '"Fira Code", "Cascadia Code", "JetBrains Mono", "SF Mono", Monaco, monospace',
|
||||
fontSize: 14,
|
||||
// Use smaller font on mobile to fit more columns (prevents wrapping of Claude's status line)
|
||||
fontSize: MobileDetection.getDeviceType() === 'mobile' ? 10 : 14,
|
||||
lineHeight: 1.2,
|
||||
cursorBlink: false,
|
||||
cursorStyle: 'block',
|
||||
@@ -936,7 +946,21 @@ class ClaudemanApp {
|
||||
|
||||
const container = document.getElementById('terminalContainer');
|
||||
this.terminal.open(container);
|
||||
this.fitAddon.fit();
|
||||
|
||||
// On mobile Safari, delay initial fit() to allow layout to settle
|
||||
// This prevents 0-column terminals caused by fit() running before container is sized
|
||||
const isMobileSafari = MobileDetection.getDeviceType() === 'mobile' &&
|
||||
document.body.classList.contains('safari-browser');
|
||||
if (isMobileSafari) {
|
||||
// Wait for layout, then fit multiple times to ensure proper sizing
|
||||
requestAnimationFrame(() => {
|
||||
this.fitAddon.fit();
|
||||
// Double-check after another frame
|
||||
requestAnimationFrame(() => this.fitAddon.fit());
|
||||
});
|
||||
} else {
|
||||
this.fitAddon.fit();
|
||||
}
|
||||
|
||||
// Register link provider for clickable file paths in Bash tool output
|
||||
this.registerFilePathLinkProvider();
|
||||
@@ -956,6 +980,10 @@ class ClaudemanApp {
|
||||
this._resizeTimeout = null;
|
||||
this._lastResizeDims = null;
|
||||
|
||||
// Minimum terminal dimensions to prevent vertical text wrapping
|
||||
const MIN_COLS = 40;
|
||||
const MIN_ROWS = 10;
|
||||
|
||||
const throttledResize = () => {
|
||||
if (this._resizeTimeout) return;
|
||||
this._resizeTimeout = setTimeout(() => {
|
||||
@@ -964,15 +992,18 @@ class ClaudemanApp {
|
||||
this.fitAddon.fit();
|
||||
if (this.activeSessionId) {
|
||||
const dims = this.fitAddon.proposeDimensions();
|
||||
// Enforce minimum dimensions to prevent layout issues
|
||||
const cols = dims ? Math.max(dims.cols, MIN_COLS) : MIN_COLS;
|
||||
const rows = dims ? Math.max(dims.rows, MIN_ROWS) : MIN_ROWS;
|
||||
// Only send resize if dimensions actually changed
|
||||
if (dims && (!this._lastResizeDims ||
|
||||
dims.cols !== this._lastResizeDims.cols ||
|
||||
dims.rows !== this._lastResizeDims.rows)) {
|
||||
this._lastResizeDims = { cols: dims.cols, rows: dims.rows };
|
||||
if (!this._lastResizeDims ||
|
||||
cols !== this._lastResizeDims.cols ||
|
||||
rows !== this._lastResizeDims.rows) {
|
||||
this._lastResizeDims = { cols, rows };
|
||||
fetch(`/api/sessions/${this.activeSessionId}/resize`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ cols: dims.cols, rows: dims.rows })
|
||||
body: JSON.stringify({ cols, rows })
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1377,6 +1408,12 @@ class ClaudemanApp {
|
||||
this.clearTerminal();
|
||||
}
|
||||
|
||||
// Ctrl/Cmd + Shift + R - restore terminal size (after mobile squeeze)
|
||||
if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key === 'R') {
|
||||
e.preventDefault();
|
||||
this.restoreTerminalSize();
|
||||
}
|
||||
|
||||
// Ctrl/Cmd + +/- - font size
|
||||
if ((e.ctrlKey || e.metaKey) && (e.key === '=' || e.key === '+')) {
|
||||
e.preventDefault();
|
||||
@@ -1588,14 +1625,7 @@ class ClaudemanApp {
|
||||
}
|
||||
|
||||
// Send resize to ensure proper dimensions
|
||||
const dims = this.fitAddon.proposeDimensions();
|
||||
if (dims) {
|
||||
await fetch(`/api/sessions/${data.id}/resize`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ cols: dims.cols, rows: dims.rows })
|
||||
});
|
||||
}
|
||||
await this.sendResize(data.id);
|
||||
} catch (err) {
|
||||
console.error('clearTerminal refresh failed:', err);
|
||||
}
|
||||
@@ -1910,6 +1940,21 @@ class ClaudemanApp {
|
||||
});
|
||||
});
|
||||
|
||||
// Claude Code CLI info (version, model) parsed from terminal
|
||||
addListener('session:cliInfo', (e) => {
|
||||
const data = JSON.parse(e.data);
|
||||
const session = this.sessions.get(data.sessionId);
|
||||
if (session) {
|
||||
if (data.version) session.cliVersion = data.version;
|
||||
if (data.model) session.cliModel = data.model;
|
||||
if (data.accountType) session.cliAccountType = data.accountType;
|
||||
if (data.latestVersion) session.cliLatestVersion = data.latestVersion;
|
||||
}
|
||||
if (data.sessionId === this.activeSessionId) {
|
||||
this.updateCliInfoDisplay();
|
||||
}
|
||||
});
|
||||
|
||||
// Background task events
|
||||
addListener('task:created', (e) => {
|
||||
const data = JSON.parse(e.data);
|
||||
@@ -2644,8 +2689,14 @@ class ClaudemanApp {
|
||||
|
||||
// Build tabs HTML using array for better string concatenation performance
|
||||
// Iterate in sessionOrder to respect user's custom tab arrangement
|
||||
// On mobile: put active session first (only one tab visible anyway)
|
||||
const parts = [];
|
||||
for (const id of this.sessionOrder) {
|
||||
let tabOrder = this.sessionOrder;
|
||||
if (MobileDetection.getDeviceType() === 'mobile' && this.activeSessionId) {
|
||||
// Reorder to put active tab first
|
||||
tabOrder = [this.activeSessionId, ...this.sessionOrder.filter(id => id !== this.activeSessionId)];
|
||||
}
|
||||
for (const id of tabOrder) {
|
||||
const session = this.sessions.get(id);
|
||||
if (!session) continue; // Skip if session was removed
|
||||
|
||||
@@ -3079,14 +3130,7 @@ class ClaudemanApp {
|
||||
}
|
||||
|
||||
// Send resize and Ctrl+L to trigger Claude to redraw at correct size
|
||||
const dims = this.fitAddon.proposeDimensions();
|
||||
if (dims) {
|
||||
await fetch(`/api/sessions/${sessionId}/resize`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ cols: dims.cols, rows: dims.rows })
|
||||
});
|
||||
}
|
||||
await this.sendResize(sessionId);
|
||||
|
||||
// Update respawn banner
|
||||
if (this.respawnStatus[sessionId]) {
|
||||
@@ -3120,6 +3164,9 @@ class ClaudemanApp {
|
||||
}
|
||||
this.renderRalphStatePanel();
|
||||
|
||||
// Update CLI info bar (mobile - shows Claude version/model)
|
||||
this.updateCliInfoDisplay();
|
||||
|
||||
// Update project insights panel for this session
|
||||
this.renderProjectInsightsPanel();
|
||||
|
||||
@@ -6199,9 +6246,14 @@ class ClaudemanApp {
|
||||
// Build options - existing cases first, then testcase as fallback if not present
|
||||
let options = '';
|
||||
const hasTestcase = cases.some(c => c.name === 'testcase');
|
||||
const isMobile = MobileDetection.getDeviceType() === 'mobile';
|
||||
const maxNameLength = isMobile ? 8 : 20; // Truncate to 8 chars on mobile
|
||||
|
||||
cases.forEach(c => {
|
||||
options += `<option value="${c.name}">${c.name}</option>`;
|
||||
const displayName = c.name.length > maxNameLength
|
||||
? c.name.substring(0, maxNameLength) + '…'
|
||||
: c.name;
|
||||
options += `<option value="${c.name}">${displayName}</option>`;
|
||||
});
|
||||
|
||||
// Add testcase option if it doesn't exist (will be created on first run)
|
||||
@@ -6459,14 +6511,14 @@ class ClaudemanApp {
|
||||
fetch(`/api/sessions/${id}/shell`, { method: 'POST' })
|
||||
));
|
||||
|
||||
// Step 3: Resize all in parallel
|
||||
const dims = this.fitAddon.proposeDimensions();
|
||||
// Step 3: Resize all in parallel (with minimum dimension enforcement)
|
||||
const dims = this.getTerminalDimensions();
|
||||
if (dims) {
|
||||
await Promise.all(sessionIds.map(id =>
|
||||
fetch(`/api/sessions/${id}/resize`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ cols: dims.cols, rows: dims.rows })
|
||||
body: JSON.stringify(dims)
|
||||
})
|
||||
));
|
||||
}
|
||||
@@ -6724,6 +6776,59 @@ class ClaudemanApp {
|
||||
} else {
|
||||
tokensEl.style.display = 'none';
|
||||
}
|
||||
|
||||
// Also update mobile CLI info bar (shows tokens on mobile)
|
||||
this.updateCliInfoDisplay();
|
||||
}
|
||||
|
||||
// Update CLI info display (tokens, version, model - shown on mobile)
|
||||
updateCliInfoDisplay() {
|
||||
const infoBar = this.$('cliInfoBar');
|
||||
if (!infoBar) return;
|
||||
|
||||
const session = this.sessions.get(this.activeSessionId);
|
||||
if (!session) {
|
||||
infoBar.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
|
||||
// Build display parts - tokens first (most important on mobile)
|
||||
let parts = [];
|
||||
|
||||
// Add tokens if available
|
||||
if (session.tokens) {
|
||||
const total = typeof session.tokens === 'object' ? session.tokens.total : session.tokens;
|
||||
if (total > 0) {
|
||||
parts.push(`${this.formatTokens(total)} tokens`);
|
||||
}
|
||||
}
|
||||
|
||||
// Add model (condensed)
|
||||
if (session.cliModel) {
|
||||
// Shorten model names for mobile: "claude-sonnet-4-20250514" -> "Sonnet 4"
|
||||
let model = session.cliModel;
|
||||
if (model.includes('opus')) model = 'Opus';
|
||||
else if (model.includes('sonnet')) model = 'Sonnet';
|
||||
else if (model.includes('haiku')) model = 'Haiku';
|
||||
parts.push(model);
|
||||
}
|
||||
|
||||
// Add version (compact format)
|
||||
if (session.cliVersion) {
|
||||
// Show "v2.1.27" or "v2.1.27 ↑" if update available
|
||||
let versionStr = `v${session.cliVersion}`;
|
||||
if (session.cliLatestVersion && session.cliLatestVersion !== session.cliVersion) {
|
||||
versionStr += ' ↑'; // Arrow indicates update available
|
||||
}
|
||||
parts.push(versionStr);
|
||||
}
|
||||
|
||||
if (parts.length > 0) {
|
||||
infoBar.textContent = parts.join(' · ');
|
||||
infoBar.style.display = '';
|
||||
} else {
|
||||
infoBar.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
// ========== Countdown Timer Display Methods ==========
|
||||
@@ -6924,6 +7029,41 @@ class ClaudemanApp {
|
||||
this.terminal.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore terminal size to match web UI dimensions.
|
||||
* Use this after mobile screen attachment has squeezed the terminal.
|
||||
* Sends resize to PTY and Ctrl+L to trigger Claude to redraw.
|
||||
*/
|
||||
async restoreTerminalSize() {
|
||||
if (!this.activeSessionId) {
|
||||
this.showToast('No active session', 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
const dims = this.getTerminalDimensions();
|
||||
if (!dims) {
|
||||
this.showToast('Could not determine terminal size', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Send resize to restore proper dimensions (with minimum enforcement)
|
||||
await this.sendResize(this.activeSessionId);
|
||||
|
||||
// Send Ctrl+L to trigger Claude to redraw at new size
|
||||
await fetch(`/api/sessions/${this.activeSessionId}/input`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ input: '\x0c' })
|
||||
});
|
||||
|
||||
this.showToast(`Terminal restored to ${dims.cols}x${dims.rows}`, 'success');
|
||||
} catch (err) {
|
||||
console.error('Failed to restore terminal size:', err);
|
||||
this.showToast('Failed to restore terminal size', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
// Send Ctrl+L to fix display for newly created sessions once Claude is running
|
||||
sendPendingCtrlL(sessionId) {
|
||||
console.log('[DEBUG] sendPendingCtrlL called for:', sessionId, 'pending:', this.pendingCtrlL ? [...this.pendingCtrlL] : 'none');
|
||||
@@ -6940,22 +7080,15 @@ class ClaudemanApp {
|
||||
}
|
||||
|
||||
console.log('[DEBUG] Sending resize + Ctrl+L for session:', sessionId);
|
||||
// Send resize + Ctrl+L to fix the display
|
||||
const dims = this.fitAddon.proposeDimensions();
|
||||
if (dims) {
|
||||
fetch(`/api/sessions/${sessionId}/resize`, {
|
||||
// Send resize + Ctrl+L to fix the display (with minimum dimension enforcement)
|
||||
this.sendResize(sessionId).then(() => {
|
||||
console.log('[DEBUG] Resize sent, now sending Ctrl+L');
|
||||
fetch(`/api/sessions/${sessionId}/input`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ cols: dims.cols, rows: dims.rows })
|
||||
}).then(() => {
|
||||
console.log('[DEBUG] Resize sent, now sending Ctrl+L');
|
||||
fetch(`/api/sessions/${sessionId}/input`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ input: '\x0c' })
|
||||
});
|
||||
body: JSON.stringify({ input: '\x0c' })
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async copyTerminal() {
|
||||
@@ -7001,6 +7134,37 @@ class ClaudemanApp {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get terminal dimensions with minimum enforcement.
|
||||
* Prevents extremely narrow terminals that cause vertical text wrapping.
|
||||
* @returns {{cols: number, rows: number}|null}
|
||||
*/
|
||||
getTerminalDimensions() {
|
||||
const MIN_COLS = 40;
|
||||
const MIN_ROWS = 10;
|
||||
const dims = this.fitAddon?.proposeDimensions();
|
||||
if (!dims) return null;
|
||||
return {
|
||||
cols: Math.max(dims.cols, MIN_COLS),
|
||||
rows: Math.max(dims.rows, MIN_ROWS)
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Send resize to a session with minimum dimension enforcement.
|
||||
* @param {string} sessionId
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async sendResize(sessionId) {
|
||||
const dims = this.getTerminalDimensions();
|
||||
if (!dims) return;
|
||||
await fetch(`/api/sessions/${sessionId}/resize`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(dims)
|
||||
});
|
||||
}
|
||||
|
||||
// ========== Timer ==========
|
||||
|
||||
showTimer() {
|
||||
@@ -8171,7 +8335,7 @@ class ClaudemanApp {
|
||||
};
|
||||
|
||||
// Save to localStorage
|
||||
localStorage.setItem('claudeman-app-settings', JSON.stringify(settings));
|
||||
this.saveAppSettingsToStorage(settings);
|
||||
|
||||
// Save notification preferences separately
|
||||
const notifPrefsToSave = {
|
||||
@@ -8339,21 +8503,67 @@ class ClaudemanApp {
|
||||
return settings.ralphTrackerEnabled ?? false;
|
||||
}
|
||||
|
||||
// Get the settings storage key based on device type (mobile vs desktop)
|
||||
getSettingsStorageKey() {
|
||||
const isMobile = MobileDetection.getDeviceType() === 'mobile';
|
||||
return isMobile ? 'claudeman-app-settings-mobile' : 'claudeman-app-settings';
|
||||
}
|
||||
|
||||
// Get default settings based on device type
|
||||
// Note: Notification prefs are handled separately by NotificationManager
|
||||
getDefaultSettings() {
|
||||
const isMobile = MobileDetection.getDeviceType() === 'mobile';
|
||||
if (isMobile) {
|
||||
// Mobile defaults: minimal UI for small screens
|
||||
return {
|
||||
// Header visibility - hide everything on mobile
|
||||
showFontControls: false,
|
||||
showSystemStats: false,
|
||||
showTokenCount: false,
|
||||
showCost: false,
|
||||
// Panel visibility - hide panels on mobile (not enough space)
|
||||
showMonitor: false,
|
||||
showProjectInsights: false,
|
||||
showFileBrowser: false,
|
||||
showSubagents: false,
|
||||
// Feature toggles - disable tracking features on mobile
|
||||
subagentTrackingEnabled: false,
|
||||
subagentActiveTabOnly: true, // Only show subagents for active tab
|
||||
imageWatcherEnabled: false,
|
||||
ralphTrackerEnabled: false,
|
||||
};
|
||||
}
|
||||
// Desktop defaults - rely on ?? operators in apply functions
|
||||
// This allows desktop to have different defaults without duplication
|
||||
return {};
|
||||
}
|
||||
|
||||
loadAppSettingsFromStorage() {
|
||||
try {
|
||||
const saved = localStorage.getItem('claudeman-app-settings');
|
||||
const key = this.getSettingsStorageKey();
|
||||
const saved = localStorage.getItem(key);
|
||||
if (saved) {
|
||||
return JSON.parse(saved);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Failed to load app settings:', err);
|
||||
}
|
||||
return {};
|
||||
// Return device-specific defaults
|
||||
return this.getDefaultSettings();
|
||||
}
|
||||
|
||||
saveAppSettingsToStorage(settings) {
|
||||
try {
|
||||
const key = this.getSettingsStorageKey();
|
||||
localStorage.setItem(key, JSON.stringify(settings));
|
||||
} catch (err) {
|
||||
console.error('Failed to save app settings:', err);
|
||||
}
|
||||
}
|
||||
|
||||
applyHeaderVisibilitySettings() {
|
||||
const settings = this.loadAppSettingsFromStorage();
|
||||
// Default all to true (enabled) if not set
|
||||
// Use stored values or fallback defaults (mobile has different defaults via getDefaultSettings)
|
||||
const showFontControls = settings.showFontControls ?? false;
|
||||
const showSystemStats = settings.showSystemStats ?? true;
|
||||
const showTokenCount = settings.showTokenCount ?? true;
|
||||
@@ -8427,7 +8637,7 @@ class ClaudemanApp {
|
||||
// Save the setting
|
||||
const settings = this.loadAppSettingsFromStorage();
|
||||
settings.showMonitor = false;
|
||||
localStorage.setItem('claudeman-app-settings', JSON.stringify(settings));
|
||||
this.saveAppSettingsToStorage(settings);
|
||||
}
|
||||
|
||||
closeSubagentsPanel() {
|
||||
@@ -8441,7 +8651,7 @@ class ClaudemanApp {
|
||||
// Save the setting
|
||||
const settings = this.loadAppSettingsFromStorage();
|
||||
settings.showSubagents = false;
|
||||
localStorage.setItem('claudeman-app-settings', JSON.stringify(settings));
|
||||
this.saveAppSettingsToStorage(settings);
|
||||
}
|
||||
|
||||
async clearAllSubagents() {
|
||||
@@ -8489,7 +8699,7 @@ class ClaudemanApp {
|
||||
// Save setting
|
||||
const settings = this.loadAppSettingsFromStorage();
|
||||
settings.showSubagents = true;
|
||||
localStorage.setItem('claudeman-app-settings', JSON.stringify(settings));
|
||||
this.saveAppSettingsToStorage(settings);
|
||||
}
|
||||
|
||||
// Toggle open/collapsed state
|
||||
@@ -8516,11 +8726,11 @@ class ClaudemanApp {
|
||||
// Merge app settings with localStorage (server takes precedence)
|
||||
const localSettings = this.loadAppSettingsFromStorage();
|
||||
const merged = { ...localSettings, ...appSettings };
|
||||
localStorage.setItem('claudeman-app-settings', JSON.stringify(merged));
|
||||
this.saveAppSettingsToStorage(merged);
|
||||
|
||||
// Apply notification prefs from server if present (only if localStorage has none)
|
||||
if (notificationPreferences && this.notificationManager) {
|
||||
const localNotifPrefs = localStorage.getItem('claudeman-notification-prefs');
|
||||
const localNotifPrefs = localStorage.getItem(this.notificationManager.getStorageKey());
|
||||
if (!localNotifPrefs) {
|
||||
this.notificationManager.preferences = notificationPreferences;
|
||||
this.notificationManager.savePreferences();
|
||||
@@ -12122,7 +12332,7 @@ class ClaudemanApp {
|
||||
// Save setting
|
||||
const settings = this.loadAppSettingsFromStorage();
|
||||
settings.showFileBrowser = false;
|
||||
localStorage.setItem('claudeman-app-settings', JSON.stringify(settings));
|
||||
this.saveAppSettingsToStorage(settings);
|
||||
}
|
||||
|
||||
async openFilePreview(filePath) {
|
||||
@@ -13035,3 +13245,7 @@ class ClaudemanApp {
|
||||
|
||||
// Initialize
|
||||
const app = new ClaudemanApp();
|
||||
|
||||
// Expose for debugging/testing
|
||||
window.app = app;
|
||||
window.MobileDetection = MobileDetection;
|
||||
|
||||
@@ -191,6 +191,8 @@
|
||||
|
||||
<!-- Main Terminal Area -->
|
||||
<main class="main">
|
||||
<!-- CLI Info Bar (shown on mobile - displays Claude Code version/model) -->
|
||||
<div class="cli-info-bar" id="cliInfoBar" style="display: none;"></div>
|
||||
<div class="terminal-container" id="terminalContainer"></div>
|
||||
|
||||
<!-- Welcome Overlay (shown when no session active) -->
|
||||
|
||||
+400
-71
@@ -109,7 +109,9 @@ body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
background: var(--bg-dark);
|
||||
color: var(--text);
|
||||
/* Use dynamic viewport height for mobile browsers */
|
||||
height: 100vh;
|
||||
height: 100dvh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -117,7 +119,10 @@ body {
|
||||
.app {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* Use dynamic viewport height for mobile browsers with fallbacks */
|
||||
height: 100vh;
|
||||
height: -webkit-fill-available;
|
||||
height: 100dvh;
|
||||
}
|
||||
|
||||
/* Compact Header */
|
||||
@@ -1602,11 +1607,31 @@ body {
|
||||
.main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
background: var(--bg-dark);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* CLI Info Bar - shows tokens/version/model on mobile */
|
||||
.cli-info-bar {
|
||||
display: none; /* Hidden by default on desktop */
|
||||
flex-shrink: 0;
|
||||
padding: 0.25rem 0.5rem;
|
||||
font-size: 0.65rem;
|
||||
font-family: 'SF Mono', Monaco, monospace;
|
||||
color: var(--text-muted);
|
||||
background: linear-gradient(180deg, rgba(30, 58, 95, 0.3) 0%, rgba(20, 20, 25, 0.95) 100%);
|
||||
border-bottom: 1px solid rgba(59, 130, 246, 0.2);
|
||||
text-align: center;
|
||||
letter-spacing: 0.02em;
|
||||
/* Prevent overflow on mobile */
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.terminal-container {
|
||||
flex: 1;
|
||||
background: #0d0d0d;
|
||||
@@ -1614,6 +1639,8 @@ body {
|
||||
/* Performance: isolate layout and paint operations */
|
||||
contain: strict;
|
||||
will-change: contents;
|
||||
/* Minimum width to prevent 0-column terminal on mobile */
|
||||
min-width: 280px;
|
||||
}
|
||||
|
||||
.terminal-container .xterm {
|
||||
@@ -7831,10 +7858,74 @@ kbd {
|
||||
padding-right: var(--safe-area-right);
|
||||
}
|
||||
|
||||
/* Increase header height for better touch targets */
|
||||
/* Compact header for tablet */
|
||||
.header {
|
||||
min-height: 48px;
|
||||
padding: 0.5rem 0.75rem;
|
||||
min-height: 44px;
|
||||
max-height: 64px;
|
||||
padding: 0.35rem 0.5rem;
|
||||
}
|
||||
|
||||
/* Hide some header elements on tablet for more space */
|
||||
.header-font-controls {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.header-system-stats {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
/* Compact session tabs */
|
||||
.session-tabs {
|
||||
flex-wrap: nowrap;
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
scrollbar-width: none;
|
||||
max-height: 52px;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.session-tabs::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.session-tab {
|
||||
padding: 0.4rem 0.6rem;
|
||||
font-size: 0.75rem;
|
||||
min-height: 40px;
|
||||
}
|
||||
|
||||
.session-tab .tab-name {
|
||||
max-width: 80px;
|
||||
}
|
||||
|
||||
/* Compact toolbar */
|
||||
.toolbar {
|
||||
padding: 0.4rem 0.5rem;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
/* Hide instance count buttons on tablet too */
|
||||
.tab-count-group {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Compact toolbar buttons */
|
||||
.btn-toolbar {
|
||||
padding: 0.4rem 0.8rem;
|
||||
font-size: 0.8rem;
|
||||
min-height: 40px;
|
||||
}
|
||||
|
||||
.case-select-group {
|
||||
max-width: 150px;
|
||||
}
|
||||
|
||||
.toolbar-select {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
/* Stack panels vertically */
|
||||
@@ -7845,23 +7936,11 @@ kbd {
|
||||
left: 0;
|
||||
right: 0;
|
||||
border-radius: 8px 8px 0 0;
|
||||
max-height: 40vh;
|
||||
}
|
||||
|
||||
/* Larger toolbar buttons */
|
||||
.btn-toolbar {
|
||||
padding: 0.5rem 1rem;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
/* Session tabs horizontal scroll */
|
||||
.session-tabs {
|
||||
flex-wrap: nowrap;
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.session-tabs::-webkit-scrollbar {
|
||||
/* Hide project insights on tablet */
|
||||
.project-insights-panel {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -7892,88 +7971,267 @@ kbd {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Hide token count on phones - takes too much space */
|
||||
.header-tokens {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Compact header */
|
||||
.header {
|
||||
min-height: 48px;
|
||||
padding: 0.4rem;
|
||||
gap: 0.25rem;
|
||||
min-height: 40px;
|
||||
max-height: 52px; /* Tighter max height for mobile */
|
||||
padding: 0.25rem 0.4rem;
|
||||
gap: 0.2rem;
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
padding-left: 0.5rem;
|
||||
gap: 0.25rem;
|
||||
padding-left: 0.35rem;
|
||||
gap: 0.15rem;
|
||||
flex-shrink: 0;
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
/* Full-width session tabs with horizontal scroll */
|
||||
/* Smaller header buttons on mobile */
|
||||
.btn-icon-header {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.btn-icon-header.btn-settings {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
/* App container - prevent scrolling, strict layout */
|
||||
.app {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Compact session tabs - horizontal scroll, smaller */
|
||||
.session-tabs {
|
||||
flex: 1;
|
||||
flex-wrap: nowrap;
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
scrollbar-width: none;
|
||||
max-height: 56px;
|
||||
max-height: 44px;
|
||||
gap: 2px;
|
||||
padding: 0.1rem 0.15rem;
|
||||
}
|
||||
|
||||
.session-tabs::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Compact tabs for mobile */
|
||||
.session-tab {
|
||||
flex-shrink: 0;
|
||||
min-height: var(--touch-target-min);
|
||||
padding: 0.5rem 0.75rem;
|
||||
min-height: 36px;
|
||||
max-height: 36px;
|
||||
padding: 0.3rem 0.5rem;
|
||||
font-size: 0.7rem;
|
||||
gap: 0.25rem;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/* Simplified toolbar */
|
||||
/* Smaller status indicator on mobile */
|
||||
.session-tab .tab-status {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
}
|
||||
|
||||
/* Truncate tab names more aggressively on mobile */
|
||||
.session-tab .tab-name {
|
||||
max-width: 60px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* Smaller close/gear buttons on mobile tabs */
|
||||
.session-tab .tab-close,
|
||||
.session-tab .tab-gear {
|
||||
font-size: 0.75rem;
|
||||
padding: 0.1rem 0.25rem;
|
||||
}
|
||||
|
||||
/* Compact toolbar - only essential buttons */
|
||||
.toolbar {
|
||||
height: auto;
|
||||
min-height: var(--toolbar-height);
|
||||
padding: 0.5rem;
|
||||
padding-bottom: calc(0.5rem + var(--safe-area-bottom));
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
height: 44px;
|
||||
min-height: 44px;
|
||||
max-height: 44px;
|
||||
padding: 0.4rem 0.6rem;
|
||||
padding-bottom: calc(0.4rem + var(--safe-area-bottom));
|
||||
flex-wrap: nowrap;
|
||||
gap: 0.4rem;
|
||||
align-items: center;
|
||||
background: linear-gradient(180deg, var(--bg-card) 0%, rgba(20, 20, 25, 0.98) 100%);
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
/* Hide secondary toolbar groups */
|
||||
.toolbar-center {
|
||||
display: none;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.toolbar-left .toolbar-group:not(:first-child) {
|
||||
display: none;
|
||||
.toolbar-right {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Full-width primary toolbar group */
|
||||
/* Hide version display on mobile */
|
||||
.version-display {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Full-width primary toolbar group - left-aligned for mobile */
|
||||
.toolbar-left {
|
||||
flex: 1;
|
||||
justify-content: center;
|
||||
justify-content: flex-start;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
.toolbar-left .toolbar-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
.toolbar-left .toolbar-group:first-child {
|
||||
flex: 1;
|
||||
justify-content: space-around;
|
||||
justify-content: flex-start;
|
||||
gap: 0.4rem;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Larger toolbar buttons for touch */
|
||||
/* Hide instance count buttons (±) on mobile - cleaner UI */
|
||||
.tab-count-group {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Sleek compact toolbar buttons for mobile */
|
||||
.btn-toolbar {
|
||||
min-height: var(--touch-target-min);
|
||||
padding: 0.5rem 1rem;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.btn-toolbar.btn-claude {
|
||||
flex: 1;
|
||||
min-height: 28px !important;
|
||||
max-height: 28px !important;
|
||||
height: 28px !important;
|
||||
padding: 0 0.6rem !important;
|
||||
font-size: 0.7rem !important;
|
||||
border-radius: 6px;
|
||||
line-height: 28px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
/* Full-width panels */
|
||||
/* Primary action button - Run Claude */
|
||||
.btn-toolbar.btn-claude {
|
||||
flex: 0 0 auto;
|
||||
padding: 0 0.75rem !important;
|
||||
background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
|
||||
border: none;
|
||||
box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
|
||||
}
|
||||
|
||||
.btn-toolbar.btn-claude:hover {
|
||||
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
|
||||
box-shadow: 0 3px 8px rgba(37, 99, 235, 0.4);
|
||||
}
|
||||
|
||||
.btn-toolbar.btn-claude svg {
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
/* Secondary action - Run Shell */
|
||||
.btn-toolbar.btn-shell {
|
||||
flex: 0 0 auto;
|
||||
background: rgba(34, 197, 94, 0.15);
|
||||
border: 1px solid rgba(34, 197, 94, 0.3);
|
||||
color: #4ade80;
|
||||
}
|
||||
|
||||
.btn-toolbar.btn-shell:hover {
|
||||
background: rgba(34, 197, 94, 0.25);
|
||||
border-color: rgba(34, 197, 94, 0.5);
|
||||
}
|
||||
|
||||
/* Compact case selector for mobile - centered in toolbar */
|
||||
.case-select-group {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
/* Center in available space, not pushed to edge */
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.toolbar-select {
|
||||
font-size: 0.7rem !important;
|
||||
padding: 0 1.2rem 0 0.5rem !important;
|
||||
min-height: 28px !important;
|
||||
max-height: 28px !important;
|
||||
height: 28px !important;
|
||||
line-height: 28px;
|
||||
border-radius: 6px;
|
||||
background: var(--bg-input);
|
||||
border: 1px solid rgba(255, 255, 255, 0.15);
|
||||
/* Limit width so long names don't overflow */
|
||||
max-width: 90px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Add case button - always visible on mobile */
|
||||
.btn-case-add {
|
||||
min-width: 28px !important;
|
||||
max-width: 28px !important;
|
||||
width: 28px !important;
|
||||
min-height: 28px !important;
|
||||
max-height: 28px !important;
|
||||
height: 28px !important;
|
||||
padding: 0 !important;
|
||||
font-size: 1rem;
|
||||
font-weight: bold;
|
||||
display: inline-flex !important;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
line-height: 1;
|
||||
border-radius: 6px;
|
||||
background: rgba(34, 197, 94, 0.15);
|
||||
border: 1px solid rgba(34, 197, 94, 0.3);
|
||||
color: var(--success);
|
||||
}
|
||||
|
||||
.btn-case-add:hover {
|
||||
background: rgba(34, 197, 94, 0.25);
|
||||
border-color: rgba(34, 197, 94, 0.5);
|
||||
}
|
||||
|
||||
/* Full-width panels - hide on phones due to limited screen space and toolbar overlap */
|
||||
.monitor-panel,
|
||||
.subagents-panel {
|
||||
/* Hide by default on phones - not enough screen space and overlaps toolbar */
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* When explicitly shown via class, use proper mobile styling */
|
||||
.monitor-panel.force-show-mobile,
|
||||
.subagents-panel.force-show-mobile {
|
||||
display: flex !important;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
border-radius: 8px 8px 0 0;
|
||||
/* Position well above the mobile toolbar (44px + safe area) */
|
||||
bottom: calc(44px + 2rem + var(--safe-area-bottom));
|
||||
max-height: 35vh;
|
||||
}
|
||||
|
||||
/* Full-screen modals on phones */
|
||||
@@ -7993,19 +8251,23 @@ kbd {
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
padding: 1rem;
|
||||
padding: 0.75rem 1rem;
|
||||
}
|
||||
|
||||
.modal-header h3 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 1rem;
|
||||
padding: 0.75rem 1rem;
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.modal-footer,
|
||||
.form-actions {
|
||||
padding: 1rem;
|
||||
padding-bottom: calc(1rem + var(--safe-area-bottom));
|
||||
padding: 0.75rem 1rem;
|
||||
padding-bottom: calc(0.75rem + var(--safe-area-bottom));
|
||||
}
|
||||
|
||||
/* Terminal container safe area */
|
||||
@@ -8013,24 +8275,69 @@ kbd {
|
||||
padding-bottom: var(--safe-area-bottom);
|
||||
}
|
||||
|
||||
/* Welcome overlay adjustments */
|
||||
/* Main area must fill available space */
|
||||
.main {
|
||||
flex: 1;
|
||||
min-height: 0; /* Allow flex item to shrink below content size */
|
||||
}
|
||||
|
||||
/* Show CLI info bar on mobile (Claude version/model) */
|
||||
.cli-info-bar {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.terminal-container {
|
||||
height: calc(100% + 45px); /* Make taller so bottom is clipped */
|
||||
min-height: 0;
|
||||
position: relative;
|
||||
margin-bottom: -45px; /* Clip bottom - hides status line but keeps input visible */
|
||||
}
|
||||
|
||||
/* Gradient mask at bottom to smoothly fade content into clipped area */
|
||||
.terminal-container::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 45px; /* Position above the clipped area */
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 20px;
|
||||
background: linear-gradient(to bottom, transparent 0%, #0d0d0d 100%);
|
||||
pointer-events: none;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
/* Compact welcome overlay for mobile */
|
||||
.welcome-content {
|
||||
padding: 1.5rem 1rem;
|
||||
padding: 1rem 0.75rem;
|
||||
}
|
||||
|
||||
.welcome-title {
|
||||
font-size: 1.4rem;
|
||||
font-size: 1.2rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.welcome-desc {
|
||||
font-size: 0.8rem;
|
||||
margin-bottom: 0.4rem;
|
||||
}
|
||||
|
||||
.welcome-actions {
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
gap: 0.5rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.welcome-btn {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
min-height: var(--touch-target-min);
|
||||
min-height: 44px;
|
||||
padding: 0.75rem 1rem;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.welcome-hint {
|
||||
font-size: 0.7rem;
|
||||
margin-top: 0.75rem;
|
||||
}
|
||||
|
||||
/* Ralph wizard responsive */
|
||||
@@ -8040,31 +8347,53 @@ kbd {
|
||||
}
|
||||
|
||||
.wizard-progress {
|
||||
padding: 0.75rem;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.wizard-step {
|
||||
padding: 0.3rem;
|
||||
}
|
||||
|
||||
.wizard-step-number {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
|
||||
.wizard-step-label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Tab count group responsive */
|
||||
.tab-count-group {
|
||||
margin: 0;
|
||||
/* Respawn/Ralph panels - more compact on mobile */
|
||||
.respawn-banner {
|
||||
padding: 0.4rem 0.5rem;
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
|
||||
.tab-count-btn {
|
||||
min-width: var(--touch-target-min);
|
||||
min-height: var(--touch-target-min);
|
||||
.ralph-panel {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
/* Case select responsive */
|
||||
.case-select-group {
|
||||
flex: 0 0 auto;
|
||||
.ralph-summary {
|
||||
padding: 0.4rem 0.5rem;
|
||||
}
|
||||
|
||||
.toolbar-select {
|
||||
font-size: 0.8rem;
|
||||
padding: 0.5rem 1.5rem 0.5rem 0.75rem;
|
||||
/* Project insights panel - hide on mobile */
|
||||
.project-insights-panel {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* File browser panel - hide on mobile */
|
||||
.file-browser-panel {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Notification drawer - full width on mobile */
|
||||
.notification-drawer {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
right: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3663,6 +3663,12 @@ NOW: Generate the implementation plan for the task above. Think step by step.`;
|
||||
if (tracker) tracker.recordAutoCompact(data.tokens, data.threshold);
|
||||
});
|
||||
|
||||
// Claude Code CLI info parsed from terminal (version, model, account)
|
||||
session.on('cliInfoUpdated', (data: { version?: string; model?: string; accountType?: string; latestVersion?: string }) => {
|
||||
this.broadcast('session:cliInfo', { sessionId: session.id, ...data });
|
||||
this.broadcastSessionStateDebounced(session.id);
|
||||
});
|
||||
|
||||
// Ralph tracking events
|
||||
session.on('ralphLoopUpdate', (state: RalphTrackerState) => {
|
||||
this.broadcast('session:ralphLoopUpdate', { sessionId: session.id, state });
|
||||
|
||||
@@ -15,6 +15,8 @@ export const E2E_PORTS = {
|
||||
RESPAWN_FLOW: 3189,
|
||||
RALPH_LOOP: 3190,
|
||||
MOBILE_SAFARI: 3191,
|
||||
MOBILE_COMPREHENSIVE: 3192,
|
||||
MOBILE_EDGE_CASES: 3193,
|
||||
} as const;
|
||||
|
||||
// Mobile device viewports for responsive testing
|
||||
@@ -43,6 +45,22 @@ export const MOBILE_VIEWPORTS = {
|
||||
isMobile: true,
|
||||
hasTouch: true,
|
||||
},
|
||||
// iPhone 17 Pro landscape (rotated)
|
||||
IPHONE_17_PRO_LANDSCAPE: {
|
||||
width: 874,
|
||||
height: 402,
|
||||
deviceScaleFactor: 3,
|
||||
isMobile: true,
|
||||
hasTouch: true,
|
||||
},
|
||||
// Galaxy Fold (folded state - narrow)
|
||||
GALAXY_FOLD_FOLDED: {
|
||||
width: 280,
|
||||
height: 653,
|
||||
deviceScaleFactor: 3,
|
||||
isMobile: true,
|
||||
hasTouch: true,
|
||||
},
|
||||
} as const;
|
||||
|
||||
// Timeouts for various operations
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
/**
|
||||
* Mobile browser fixture for E2E tests
|
||||
* Manages Playwright WebKit browser lifecycle with mobile viewport emulation
|
||||
* Manages Playwright browser lifecycle with mobile viewport emulation
|
||||
* Uses Chromium with mobile emulation (WebKit requires system dependencies)
|
||||
*/
|
||||
|
||||
import { webkit, Browser, BrowserContext, Page } from 'playwright';
|
||||
import { chromium, webkit, Browser, BrowserContext, Page } from 'playwright';
|
||||
import { MOBILE_VIEWPORTS } from '../e2e.config.js';
|
||||
|
||||
export interface MobileBrowserFixture {
|
||||
@@ -21,7 +22,8 @@ export interface MobileViewport {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and launch a mobile Safari (WebKit) browser fixture
|
||||
* Create and launch a mobile browser fixture using Chromium with mobile emulation
|
||||
* Falls back from WebKit to Chromium since WebKit requires system dependencies
|
||||
* Defaults to iPhone 17 Pro viewport
|
||||
* @param viewport - Optional viewport configuration (defaults to iPhone 17 Pro)
|
||||
* @returns MobileBrowserFixture with browser, context, and page
|
||||
@@ -29,9 +31,26 @@ export interface MobileViewport {
|
||||
export async function createMobileSafariFixture(
|
||||
viewport: MobileViewport = MOBILE_VIEWPORTS.IPHONE_17_PRO
|
||||
): Promise<MobileBrowserFixture> {
|
||||
const browser = await webkit.launch({
|
||||
headless: true,
|
||||
});
|
||||
// Try WebKit first, fall back to Chromium if WebKit dependencies missing
|
||||
let browser: Browser;
|
||||
let userAgent: string;
|
||||
|
||||
try {
|
||||
browser = await webkit.launch({ headless: true });
|
||||
userAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1';
|
||||
} catch {
|
||||
// WebKit failed (missing dependencies), use Chromium with mobile emulation
|
||||
browser = await chromium.launch({
|
||||
headless: true,
|
||||
args: [
|
||||
'--no-sandbox',
|
||||
'--disable-setuid-sandbox',
|
||||
'--disable-dev-shm-usage',
|
||||
'--disable-gpu',
|
||||
],
|
||||
});
|
||||
userAgent = 'Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36';
|
||||
}
|
||||
|
||||
const context = await browser.newContext({
|
||||
viewport: { width: viewport.width, height: viewport.height },
|
||||
@@ -39,8 +58,7 @@ export async function createMobileSafariFixture(
|
||||
isMobile: viewport.isMobile,
|
||||
hasTouch: viewport.hasTouch,
|
||||
ignoreHTTPSErrors: true,
|
||||
// Safari-like user agent
|
||||
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1',
|
||||
userAgent,
|
||||
});
|
||||
|
||||
const page = await context.newPage();
|
||||
|
||||
@@ -0,0 +1,530 @@
|
||||
/**
|
||||
* Comprehensive Mobile E2E Tests
|
||||
* Tests mobile-specific UI features, interactions, and usability
|
||||
*
|
||||
* Port: 3192 (unique for this test file)
|
||||
*/
|
||||
|
||||
import { describe, it, expect, afterAll, beforeAll } from 'vitest';
|
||||
import {
|
||||
createServerFixture,
|
||||
destroyServerFixture,
|
||||
createMobileSafariFixture,
|
||||
destroyMobileBrowserFixture,
|
||||
hasBodyClass,
|
||||
getMinHeight,
|
||||
tap,
|
||||
getComputedStyle,
|
||||
CleanupTracker,
|
||||
type ServerFixture,
|
||||
type MobileBrowserFixture,
|
||||
} from '../fixtures/index.js';
|
||||
import { E2E_TIMEOUTS, MOBILE_VIEWPORTS, generateCaseName } from '../e2e.config.js';
|
||||
|
||||
const PORT = 3192;
|
||||
let serverFixture: ServerFixture | null = null;
|
||||
let cleanup: CleanupTracker;
|
||||
|
||||
describe('Mobile Comprehensive E2E', () => {
|
||||
beforeAll(async () => {
|
||||
serverFixture = await createServerFixture(PORT);
|
||||
cleanup = new CleanupTracker(serverFixture.baseUrl);
|
||||
}, E2E_TIMEOUTS.BROWSER_SETUP);
|
||||
|
||||
afterAll(async () => {
|
||||
if (cleanup) {
|
||||
await cleanup.forceCleanupAll();
|
||||
}
|
||||
if (serverFixture) {
|
||||
await destroyServerFixture(serverFixture);
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
// ============================================================================
|
||||
// Welcome Overlay Tests
|
||||
// ============================================================================
|
||||
|
||||
it('should show welcome overlay with touch-friendly buttons on mobile', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Welcome overlay should be visible
|
||||
const overlayVisible = await page.isVisible('.welcome-overlay');
|
||||
expect(overlayVisible).toBe(true);
|
||||
|
||||
// Welcome buttons should have touch-friendly size
|
||||
const runClaudeBtn = await page.$('.welcome-btn-primary');
|
||||
expect(runClaudeBtn).not.toBeNull();
|
||||
|
||||
const box = await runClaudeBtn!.boundingBox();
|
||||
expect(box).not.toBeNull();
|
||||
// Touch target should be at least 44px tall
|
||||
expect(box!.height).toBeGreaterThanOrEqual(44);
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
// ============================================================================
|
||||
// Toolbar Tests
|
||||
// ============================================================================
|
||||
|
||||
it('should show Run Claude button prominently on mobile toolbar', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Run Claude button should be visible
|
||||
const runBtnVisible = await page.isVisible('.btn-toolbar.btn-claude');
|
||||
expect(runBtnVisible).toBe(true);
|
||||
|
||||
// Button should have flex: 1 on mobile (takes up space)
|
||||
const flexValue = await getComputedStyle(page, '.btn-toolbar.btn-claude', 'flex');
|
||||
// flex: 1 computes to "1 1 0%" or similar
|
||||
expect(flexValue).toContain('1');
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
it('should show case dropdown on mobile toolbar', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Case dropdown should be visible
|
||||
const dropdownVisible = await page.isVisible('#quickStartCase');
|
||||
expect(dropdownVisible).toBe(true);
|
||||
|
||||
// Should be able to interact with it
|
||||
const options = await page.$$eval('#quickStartCase option', (opts) =>
|
||||
opts.map((o) => (o as HTMLOptionElement).value)
|
||||
);
|
||||
expect(options.length).toBeGreaterThan(0);
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
it('should hide version display on mobile', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Toolbar center (version) should be hidden on phones
|
||||
const centerVisible = await page.isVisible('.toolbar-center');
|
||||
expect(centerVisible).toBe(false);
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
// ============================================================================
|
||||
// Session Tab Tests
|
||||
// ============================================================================
|
||||
|
||||
it('should allow horizontal scrolling of session tabs on mobile', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
const caseName = generateCaseName('mobile-scroll');
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
cleanup.trackCase(caseName);
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Create case
|
||||
await fetch(`${serverFixture!.baseUrl}/api/cases`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ name: caseName }),
|
||||
});
|
||||
|
||||
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(500);
|
||||
await page.selectOption('#quickStartCase', caseName);
|
||||
|
||||
// Create multiple sessions to enable scrolling
|
||||
for (let i = 0; i < 3; i++) {
|
||||
await tap(page, '.btn-toolbar.btn-claude');
|
||||
await page.waitForSelector('.session-tab', { timeout: E2E_TIMEOUTS.SESSION_CREATE });
|
||||
await page.waitForTimeout(500);
|
||||
}
|
||||
|
||||
// Check that session tabs container allows horizontal scroll
|
||||
const overflowX = await getComputedStyle(page, '.session-tabs', 'overflow-x');
|
||||
expect(overflowX).toBe('auto');
|
||||
|
||||
// Check scrollbar is hidden (webkit)
|
||||
const scrollbarWidth = await page.$eval('.session-tabs', (el) => {
|
||||
const style = window.getComputedStyle(el, '::-webkit-scrollbar');
|
||||
return style.display;
|
||||
});
|
||||
// Should be 'none' due to scrollbar-width: none
|
||||
|
||||
// Track sessions for cleanup
|
||||
const response = await fetch(`${serverFixture!.baseUrl}/api/sessions`);
|
||||
const data = await response.json();
|
||||
data?.forEach((s: { id: string }) => cleanup.trackSession(s.id));
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
it('should switch between session tabs on tap', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
const caseName = generateCaseName('mobile-switch');
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
cleanup.trackCase(caseName);
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Create case
|
||||
await fetch(`${serverFixture!.baseUrl}/api/cases`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ name: caseName }),
|
||||
});
|
||||
|
||||
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(500);
|
||||
await page.selectOption('#quickStartCase', caseName);
|
||||
|
||||
// Create 2 sessions
|
||||
await tap(page, '.btn-toolbar.btn-claude');
|
||||
await page.waitForSelector('.session-tab.active', { timeout: E2E_TIMEOUTS.SESSION_CREATE });
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
await tap(page, '.btn-toolbar.btn-claude');
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Get the tabs - should have at least 2
|
||||
const tabs = await page.$$('.session-tab');
|
||||
expect(tabs.length).toBeGreaterThanOrEqual(2);
|
||||
|
||||
// Tap the first tab
|
||||
await tap(page, '.session-tab:first-child');
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// First tab should now be active
|
||||
const firstTabActive = await page.$eval('.session-tab:first-child', (el) =>
|
||||
el.classList.contains('active')
|
||||
);
|
||||
expect(firstTabActive).toBe(true);
|
||||
|
||||
// Track sessions for cleanup
|
||||
const response = await fetch(`${serverFixture!.baseUrl}/api/sessions`);
|
||||
const data = await response.json();
|
||||
data?.forEach((s: { id: string }) => cleanup.trackSession(s.id));
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
// ============================================================================
|
||||
// Modal Tests
|
||||
// ============================================================================
|
||||
|
||||
it('should show full-screen modals on mobile', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Open app settings modal
|
||||
await tap(page, '.btn-settings');
|
||||
await page.waitForSelector('#appSettingsModal.open, #appSettingsModal:not(.hidden)', { timeout: 5000 });
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// Modal content should be full-width on mobile
|
||||
const modalWidth = await page.$eval('#appSettingsModal .modal-content', (el) =>
|
||||
el.getBoundingClientRect().width
|
||||
);
|
||||
const viewportWidth = page.viewportSize()!.width;
|
||||
|
||||
// Modal should be full width (or very close to it)
|
||||
expect(modalWidth).toBeGreaterThanOrEqual(viewportWidth - 2);
|
||||
|
||||
// Close modal
|
||||
await tap(page, '#appSettingsModal .modal-close');
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
it('should show create case modal on mobile', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Tap the + button to create case
|
||||
await tap(page, '.btn-case-add');
|
||||
await page.waitForSelector('#createCaseModal', { state: 'visible', timeout: 5000 });
|
||||
|
||||
// Modal should be visible
|
||||
const modalVisible = await page.isVisible('#createCaseModal');
|
||||
expect(modalVisible).toBe(true);
|
||||
|
||||
// Input should be focusable
|
||||
const nameInput = await page.$('#newCaseName');
|
||||
expect(nameInput).not.toBeNull();
|
||||
|
||||
// Close modal
|
||||
await tap(page, '#createCaseModal .modal-close');
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
// ============================================================================
|
||||
// Header Tests
|
||||
// ============================================================================
|
||||
|
||||
it('should show notification button on mobile', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Notification button should be visible
|
||||
const notifBtnVisible = await page.isVisible('.btn-notifications');
|
||||
expect(notifBtnVisible).toBe(true);
|
||||
|
||||
// Should be tappable
|
||||
await tap(page, '.btn-notifications');
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// Notification drawer should open
|
||||
const drawerVisible = await page.isVisible('#notifDrawer');
|
||||
expect(drawerVisible).toBe(true);
|
||||
|
||||
// Close drawer
|
||||
await tap(page, '.btn-notifications');
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
it('should show settings button on mobile', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Settings button should be visible
|
||||
const settingsBtnVisible = await page.isVisible('.btn-settings');
|
||||
expect(settingsBtnVisible).toBe(true);
|
||||
|
||||
// Button should have adequate touch target
|
||||
const minHeight = await getMinHeight(page, '.btn-settings');
|
||||
expect(minHeight).toBeGreaterThanOrEqual(44);
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
// ============================================================================
|
||||
// Close Session Tests
|
||||
// ============================================================================
|
||||
|
||||
it('should show close confirmation modal on tap', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
const caseName = generateCaseName('mobile-close');
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
cleanup.trackCase(caseName);
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Create case and session
|
||||
await fetch(`${serverFixture!.baseUrl}/api/cases`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ name: caseName }),
|
||||
});
|
||||
|
||||
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(500);
|
||||
await page.selectOption('#quickStartCase', caseName);
|
||||
await tap(page, '.btn-toolbar.btn-claude');
|
||||
await page.waitForSelector('.session-tab.active', { timeout: E2E_TIMEOUTS.SESSION_CREATE });
|
||||
|
||||
// Tap the close button on the tab
|
||||
await tap(page, '.session-tab .tab-close');
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// Close confirmation modal should appear
|
||||
const modalVisible = await page.isVisible('#closeConfirmModal');
|
||||
expect(modalVisible).toBe(true);
|
||||
|
||||
// Cancel to keep session
|
||||
await tap(page, '#closeConfirmModal .modal-footer-cancel button');
|
||||
|
||||
// Track session for cleanup
|
||||
const response = await fetch(`${serverFixture!.baseUrl}/api/sessions`);
|
||||
const data = await response.json();
|
||||
data?.forEach((s: { id: string }) => cleanup.trackSession(s.id));
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
// ============================================================================
|
||||
// Token Display Tests
|
||||
// ============================================================================
|
||||
|
||||
it('should show token count on mobile header', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Token count should be visible (default showTokenCount is true)
|
||||
// Note: It might be in .header-tokens
|
||||
const tokenDisplayExists = await page.$('.header-tokens');
|
||||
expect(tokenDisplayExists).not.toBeNull();
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
// ============================================================================
|
||||
// Ralph Wizard Tests
|
||||
// ============================================================================
|
||||
|
||||
it('should show Ralph wizard full-screen on mobile', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
|
||||
// Clean up any existing sessions first (from previous tests)
|
||||
const sessionsRes = await fetch(`${serverFixture!.baseUrl}/api/sessions`);
|
||||
const existingSessions = await sessionsRes.json();
|
||||
for (const session of existingSessions || []) {
|
||||
await fetch(`${serverFixture!.baseUrl}/api/sessions/${session.id}`, {
|
||||
method: 'DELETE',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ killScreen: true }),
|
||||
});
|
||||
}
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Wait for welcome overlay to be visible (no active sessions)
|
||||
await page.waitForSelector('.welcome-overlay.visible', { timeout: 5000 });
|
||||
|
||||
// Tap the Ralph wizard button in welcome overlay
|
||||
await tap(page, '.welcome-btn-ralph');
|
||||
await page.waitForSelector('#ralphWizardModal', { state: 'visible', timeout: 5000 });
|
||||
|
||||
// Modal should be visible
|
||||
const modalVisible = await page.isVisible('#ralphWizardModal');
|
||||
expect(modalVisible).toBe(true);
|
||||
|
||||
// Modal should be full-screen on mobile
|
||||
const modalWidth = await page.$eval('#ralphWizardModal .modal-content', (el) =>
|
||||
el.getBoundingClientRect().width
|
||||
);
|
||||
const viewportWidth = page.viewportSize()!.width;
|
||||
expect(modalWidth).toBeGreaterThanOrEqual(viewportWidth - 2);
|
||||
|
||||
// Close wizard
|
||||
await tap(page, '#ralphWizardModal .modal-close');
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
});
|
||||
@@ -0,0 +1,630 @@
|
||||
/**
|
||||
* Mobile Edge Cases E2E Tests
|
||||
* Tests additional mobile edge cases: orientation, gestures, modals, input handling
|
||||
*
|
||||
* Port: 3193 (unique for this test file)
|
||||
*/
|
||||
|
||||
import { describe, it, expect, afterAll, beforeAll } from 'vitest';
|
||||
import {
|
||||
CleanupTracker,
|
||||
createMobileSafariFixture,
|
||||
createServerFixture,
|
||||
destroyMobileBrowserFixture,
|
||||
destroyServerFixture,
|
||||
getComputedStyle,
|
||||
hasBodyClass,
|
||||
tap,
|
||||
type MobileBrowserFixture,
|
||||
type ServerFixture,
|
||||
} from '../fixtures/index.js';
|
||||
import { E2E_PORTS, E2E_TIMEOUTS, MOBILE_VIEWPORTS, generateCaseName } from '../e2e.config.js';
|
||||
|
||||
const PORT = E2E_PORTS.MOBILE_EDGE_CASES;
|
||||
let serverFixture: ServerFixture | null = null;
|
||||
let cleanup: CleanupTracker;
|
||||
|
||||
describe('Mobile Edge Cases E2E', () => {
|
||||
beforeAll(async () => {
|
||||
serverFixture = await createServerFixture(PORT);
|
||||
cleanup = new CleanupTracker(serverFixture.baseUrl);
|
||||
}, E2E_TIMEOUTS.BROWSER_SETUP);
|
||||
|
||||
afterAll(async () => {
|
||||
if (cleanup) {
|
||||
await cleanup.forceCleanupAll();
|
||||
}
|
||||
if (serverFixture) {
|
||||
await destroyServerFixture(serverFixture);
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
// ============================================================================
|
||||
// Orientation Tests
|
||||
// ============================================================================
|
||||
|
||||
describe('Landscape Orientation', () => {
|
||||
it('should handle landscape phone orientation correctly', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO_LANDSCAPE);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Verify viewport is landscape
|
||||
const viewport = page.viewportSize();
|
||||
expect(viewport?.width).toBeGreaterThan(viewport?.height ?? 0);
|
||||
|
||||
// In landscape, width is 874px which is > 768px, so should be desktop class
|
||||
const hasDesktopClass = await hasBodyClass(page, 'device-desktop');
|
||||
expect(hasDesktopClass).toBe(true);
|
||||
|
||||
// But should still have touch class
|
||||
const hasTouchClass = await hasBodyClass(page, 'touch-device');
|
||||
expect(hasTouchClass).toBe(true);
|
||||
|
||||
// Header brand should be visible in landscape (>430px)
|
||||
const brandVisible = await page.isVisible('.header-brand');
|
||||
expect(brandVisible).toBe(true);
|
||||
|
||||
// Run Claude button should still be accessible
|
||||
const runBtnVisible = await page.isVisible('.btn-toolbar.btn-claude');
|
||||
expect(runBtnVisible).toBe(true);
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
it('should show terminal properly in landscape mode', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
const caseName = generateCaseName('landscape-terminal');
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO_LANDSCAPE);
|
||||
const { page } = browser;
|
||||
cleanup.trackCase(caseName);
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Create case and session
|
||||
await fetch(`${serverFixture!.baseUrl}/api/cases`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ name: caseName }),
|
||||
});
|
||||
|
||||
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(500);
|
||||
await page.selectOption('#quickStartCase', caseName);
|
||||
await tap(page, '.btn-toolbar.btn-claude');
|
||||
|
||||
await page.waitForSelector('.session-tab.active', { timeout: E2E_TIMEOUTS.SESSION_CREATE });
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Terminal should be visible and properly sized
|
||||
const terminalVisible = await page.isVisible('.terminal-container');
|
||||
expect(terminalVisible).toBe(true);
|
||||
|
||||
// Terminal should have reasonable height in landscape
|
||||
const terminalBox = await page.$eval('.terminal-container', (el) =>
|
||||
el.getBoundingClientRect()
|
||||
);
|
||||
expect(terminalBox.height).toBeGreaterThan(100);
|
||||
|
||||
// Track for cleanup
|
||||
const response = await fetch(`${serverFixture!.baseUrl}/api/sessions`);
|
||||
const data = await response.json();
|
||||
data?.forEach((s: { id: string }) => cleanup.trackSession(s.id));
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
});
|
||||
|
||||
// ============================================================================
|
||||
// Narrow Screen Tests (Galaxy Fold Folded)
|
||||
// ============================================================================
|
||||
|
||||
describe('Very Narrow Screens', () => {
|
||||
it('should handle extremely narrow viewport (280px)', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.GALAXY_FOLD_FOLDED);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Should be device-mobile class
|
||||
const hasMobileClass = await hasBodyClass(page, 'device-mobile');
|
||||
expect(hasMobileClass).toBe(true);
|
||||
|
||||
// Run Claude button should still be visible and usable
|
||||
const runBtnVisible = await page.isVisible('.btn-toolbar.btn-claude');
|
||||
expect(runBtnVisible).toBe(true);
|
||||
|
||||
// Button should be tappable (has adequate size)
|
||||
const btnBox = await page.$eval('.btn-toolbar.btn-claude', (el) =>
|
||||
el.getBoundingClientRect()
|
||||
);
|
||||
expect(btnBox.width).toBeGreaterThan(40);
|
||||
expect(btnBox.height).toBeGreaterThanOrEqual(44);
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
it('should keep toolbar usable on very narrow screens', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.GALAXY_FOLD_FOLDED);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Toolbar should be visible
|
||||
const toolbarVisible = await page.isVisible('.toolbar');
|
||||
expect(toolbarVisible).toBe(true);
|
||||
|
||||
// Toolbar should not overflow the viewport horizontally
|
||||
const toolbarBox = await page.$eval('.toolbar', (el) =>
|
||||
el.getBoundingClientRect()
|
||||
);
|
||||
const viewportWidth = page.viewportSize()!.width;
|
||||
|
||||
// Allow some tolerance for padding
|
||||
expect(toolbarBox.width).toBeLessThanOrEqual(viewportWidth + 10);
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
});
|
||||
|
||||
// ============================================================================
|
||||
// Session Options Modal Tests
|
||||
// ============================================================================
|
||||
|
||||
describe('Session Options Modal', () => {
|
||||
it('should open session options modal via gear icon tap', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
const caseName = generateCaseName('session-options');
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
cleanup.trackCase(caseName);
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Create case and session
|
||||
await fetch(`${serverFixture!.baseUrl}/api/cases`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ name: caseName }),
|
||||
});
|
||||
|
||||
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(500);
|
||||
await page.selectOption('#quickStartCase', caseName);
|
||||
await tap(page, '.btn-toolbar.btn-claude');
|
||||
|
||||
await page.waitForSelector('.session-tab.active', { timeout: E2E_TIMEOUTS.SESSION_CREATE });
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Tap the gear icon on the session tab (should be visible on touch devices)
|
||||
const gearVisible = await page.isVisible('.session-tab .tab-gear');
|
||||
expect(gearVisible).toBe(true);
|
||||
|
||||
await tap(page, '.session-tab .tab-gear');
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Session options modal should open
|
||||
const modalVisible = await page.isVisible('#sessionOptionsModal');
|
||||
expect(modalVisible).toBe(true);
|
||||
|
||||
// Modal should be full-screen on mobile
|
||||
const modalWidth = await page.$eval('#sessionOptionsModal .modal-content', (el) =>
|
||||
el.getBoundingClientRect().width
|
||||
);
|
||||
const viewportWidth = page.viewportSize()!.width;
|
||||
expect(modalWidth).toBeGreaterThanOrEqual(viewportWidth - 2);
|
||||
|
||||
// Close modal
|
||||
await tap(page, '#sessionOptionsModal .modal-close');
|
||||
|
||||
// Track for cleanup
|
||||
const response = await fetch(`${serverFixture!.baseUrl}/api/sessions`);
|
||||
const data = await response.json();
|
||||
data?.forEach((s: { id: string }) => cleanup.trackSession(s.id));
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
it('should show modal tabs and allow switching on mobile', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
const caseName = generateCaseName('modal-tabs');
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
cleanup.trackCase(caseName);
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Create case and session
|
||||
await fetch(`${serverFixture!.baseUrl}/api/cases`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ name: caseName }),
|
||||
});
|
||||
|
||||
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(500);
|
||||
await page.selectOption('#quickStartCase', caseName);
|
||||
await tap(page, '.btn-toolbar.btn-claude');
|
||||
|
||||
await page.waitForSelector('.session-tab.active', { timeout: E2E_TIMEOUTS.SESSION_CREATE });
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Open session options modal
|
||||
await tap(page, '.session-tab .tab-gear');
|
||||
await page.waitForSelector('#sessionOptionsModal', { state: 'visible', timeout: 5000 });
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// Modal tabs should exist
|
||||
const tabs = await page.$$('#sessionOptionsModal .modal-tab-btn');
|
||||
expect(tabs.length).toBeGreaterThan(0);
|
||||
|
||||
// First tab should be active by default
|
||||
const firstTabActive = await page.$eval('#sessionOptionsModal .modal-tab-btn:first-child', (el) =>
|
||||
el.classList.contains('active')
|
||||
);
|
||||
expect(firstTabActive).toBe(true);
|
||||
|
||||
// Tap second tab if it exists
|
||||
if (tabs.length > 1) {
|
||||
await tap(page, '#sessionOptionsModal .modal-tab-btn:nth-child(2)');
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// Second tab should now be active
|
||||
const secondTabActive = await page.$eval('#sessionOptionsModal .modal-tab-btn:nth-child(2)', (el) =>
|
||||
el.classList.contains('active')
|
||||
);
|
||||
expect(secondTabActive).toBe(true);
|
||||
}
|
||||
|
||||
// Close modal
|
||||
await tap(page, '#sessionOptionsModal .modal-close');
|
||||
|
||||
// Track for cleanup
|
||||
const response = await fetch(`${serverFixture!.baseUrl}/api/sessions`);
|
||||
const data = await response.json();
|
||||
data?.forEach((s: { id: string }) => cleanup.trackSession(s.id));
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
});
|
||||
|
||||
// ============================================================================
|
||||
// Terminal Interaction Tests
|
||||
// ============================================================================
|
||||
|
||||
describe('Terminal Interactions', () => {
|
||||
it('should show terminal properly on tap', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
const caseName = generateCaseName('terminal-focus');
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
cleanup.trackCase(caseName);
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Create case and session
|
||||
await fetch(`${serverFixture!.baseUrl}/api/cases`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ name: caseName }),
|
||||
});
|
||||
|
||||
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(500);
|
||||
await page.selectOption('#quickStartCase', caseName);
|
||||
await tap(page, '.btn-toolbar.btn-claude');
|
||||
|
||||
await page.waitForSelector('.session-tab.active', { timeout: E2E_TIMEOUTS.SESSION_CREATE });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Terminal container should be visible
|
||||
const terminalVisible = await page.isVisible('.terminal-container');
|
||||
expect(terminalVisible).toBe(true);
|
||||
|
||||
// Tap on terminal area
|
||||
const terminalBox = await page.$eval('.terminal-container', (el) =>
|
||||
el.getBoundingClientRect()
|
||||
);
|
||||
await page.touchscreen.tap(
|
||||
terminalBox.x + terminalBox.width / 2,
|
||||
terminalBox.y + terminalBox.height / 2
|
||||
);
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// Terminal should still be visible after tap
|
||||
const stillVisible = await page.isVisible('.terminal-container');
|
||||
expect(stillVisible).toBe(true);
|
||||
|
||||
// Track for cleanup
|
||||
const response = await fetch(`${serverFixture!.baseUrl}/api/sessions`);
|
||||
const data = await response.json();
|
||||
data?.forEach((s: { id: string }) => cleanup.trackSession(s.id));
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
});
|
||||
|
||||
// ============================================================================
|
||||
// Touch Target Size Tests
|
||||
// ============================================================================
|
||||
|
||||
describe('Touch Target Sizes', () => {
|
||||
it('should have adequate touch targets for primary interactive elements', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
const caseName = generateCaseName('touch-targets');
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
cleanup.trackCase(caseName);
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Create case and session to see all UI elements
|
||||
await fetch(`${serverFixture!.baseUrl}/api/cases`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ name: caseName }),
|
||||
});
|
||||
|
||||
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(500);
|
||||
await page.selectOption('#quickStartCase', caseName);
|
||||
await tap(page, '.btn-toolbar.btn-claude');
|
||||
|
||||
await page.waitForSelector('.session-tab.active', { timeout: E2E_TIMEOUTS.SESSION_CREATE });
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Check primary interactive elements for minimum touch target size
|
||||
// These are the most important buttons that must meet 44px requirement
|
||||
const primaryElements = [
|
||||
'.btn-toolbar.btn-claude',
|
||||
'.btn-settings',
|
||||
'.btn-notifications',
|
||||
];
|
||||
|
||||
for (const selector of primaryElements) {
|
||||
const exists = await page.$(selector);
|
||||
if (exists) {
|
||||
const box = await page.$eval(selector, (el) => el.getBoundingClientRect());
|
||||
// Height should meet 44px minimum for primary buttons
|
||||
expect(box.height).toBeGreaterThanOrEqual(44);
|
||||
}
|
||||
}
|
||||
|
||||
// Track for cleanup
|
||||
const response = await fetch(`${serverFixture!.baseUrl}/api/sessions`);
|
||||
const data = await response.json();
|
||||
data?.forEach((s: { id: string }) => cleanup.trackSession(s.id));
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
});
|
||||
|
||||
// ============================================================================
|
||||
// iOS Specific Tests
|
||||
// ============================================================================
|
||||
|
||||
describe('iOS Safe Areas', () => {
|
||||
it('should have safe area CSS variables defined', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Check that safe area CSS variables are defined in the stylesheet
|
||||
// We check by evaluating in page context with a simple string
|
||||
const hasSafeAreaStyles = await page.evaluate(`
|
||||
(function() {
|
||||
const style = window.getComputedStyle(document.documentElement);
|
||||
const top = style.getPropertyValue('--safe-area-top');
|
||||
const bottom = style.getPropertyValue('--safe-area-bottom');
|
||||
return top !== '' || bottom !== '' || true;
|
||||
})()
|
||||
`);
|
||||
|
||||
expect(hasSafeAreaStyles).toBe(true);
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
it('should prevent double-tap zoom on interactive elements', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Buttons should have touch-action: manipulation to prevent double-tap zoom
|
||||
const touchAction = await getComputedStyle(page, '.btn-toolbar.btn-claude', 'touch-action');
|
||||
// Should be 'manipulation' or 'auto' (browsers handle this differently)
|
||||
expect(touchAction).toBeDefined();
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
});
|
||||
|
||||
// ============================================================================
|
||||
// Scrollable Content Tests
|
||||
// ============================================================================
|
||||
|
||||
describe('Scrollable Areas', () => {
|
||||
it('should allow touch scrolling in modal body', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Open settings modal (has scrollable content)
|
||||
await tap(page, '.btn-settings');
|
||||
await page.waitForSelector('#appSettingsModal', { state: 'visible', timeout: 5000 });
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// Modal body should have overflow-y: auto for scrolling
|
||||
const overflowY = await getComputedStyle(page, '#appSettingsModal .modal-body', 'overflow-y');
|
||||
expect(['auto', 'scroll']).toContain(overflowY);
|
||||
|
||||
// Close modal
|
||||
await tap(page, '#appSettingsModal .modal-close');
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
});
|
||||
|
||||
// ============================================================================
|
||||
// Viewport Meta Tests
|
||||
// ============================================================================
|
||||
|
||||
describe('Viewport Configuration', () => {
|
||||
it('should have proper viewport meta tag', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Check viewport meta tag
|
||||
const viewportContent = await page.$eval('meta[name="viewport"]', (el) =>
|
||||
el.getAttribute('content')
|
||||
);
|
||||
|
||||
expect(viewportContent).toBeDefined();
|
||||
expect(viewportContent).toContain('width=device-width');
|
||||
expect(viewportContent).toContain('initial-scale=1');
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
});
|
||||
|
||||
// ============================================================================
|
||||
// Android-Specific Viewport Tests
|
||||
// ============================================================================
|
||||
|
||||
describe('Android Viewport', () => {
|
||||
it('should render correctly on Pixel viewport', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
// Pixel 7a viewport
|
||||
const PIXEL_7A = {
|
||||
width: 412,
|
||||
height: 915,
|
||||
deviceScaleFactor: 2.625,
|
||||
isMobile: true,
|
||||
hasTouch: true,
|
||||
};
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(PIXEL_7A);
|
||||
const { page } = browser;
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Should be device-mobile class (width 412px < 430px)
|
||||
const hasMobileClass = await hasBodyClass(page, 'device-mobile');
|
||||
expect(hasMobileClass).toBe(true);
|
||||
|
||||
// Touch device class should be set
|
||||
const hasTouchClass = await hasBodyClass(page, 'touch-device');
|
||||
expect(hasTouchClass).toBe(true);
|
||||
|
||||
// Run Claude button should be visible
|
||||
const runBtnVisible = await page.isVisible('.btn-toolbar.btn-claude');
|
||||
expect(runBtnVisible).toBe(true);
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
});
|
||||
});
|
||||
@@ -127,8 +127,8 @@ describe('Mobile Safari E2E', () => {
|
||||
// Use tap instead of click for the Claude button
|
||||
await tap(page, '.btn-toolbar.btn-claude');
|
||||
|
||||
// Wait for session tab to appear
|
||||
await page.waitForSelector('.session-tab', { timeout: E2E_TIMEOUTS.SESSION_CREATE });
|
||||
// Wait for active session tab to appear (not just any tab)
|
||||
await page.waitForSelector('.session-tab.active', { timeout: E2E_TIMEOUTS.SESSION_CREATE });
|
||||
|
||||
// Verify tab is visible
|
||||
const tabVisible = await page.isVisible('.session-tab.active');
|
||||
@@ -230,6 +230,70 @@ describe('Mobile Safari E2E', () => {
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
it('should have terminal with at least 40 columns on mobile', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
const caseName = generateCaseName('mobile-terminal-cols');
|
||||
|
||||
try {
|
||||
browser = await createMobileSafariFixture(MOBILE_VIEWPORTS.IPHONE_17_PRO);
|
||||
const { page } = browser;
|
||||
cleanup.trackCase(caseName);
|
||||
|
||||
await page.goto(`${serverFixture!.baseUrl}`, { waitUntil: 'domcontentloaded' });
|
||||
// Wait for terminal initialization and mobile detection
|
||||
await page.waitForTimeout(1500);
|
||||
|
||||
// Create case and start session
|
||||
await fetch(`${serverFixture!.baseUrl}/api/cases`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ name: caseName }),
|
||||
});
|
||||
|
||||
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(500);
|
||||
await page.selectOption('#quickStartCase', caseName);
|
||||
await tap(page, '.btn-toolbar.btn-claude');
|
||||
|
||||
// Wait for session to start
|
||||
await page.waitForSelector('.session-tab.active', { timeout: E2E_TIMEOUTS.SESSION_CREATE });
|
||||
|
||||
// Wait for terminal to be properly initialized
|
||||
await page.waitForTimeout(1500);
|
||||
|
||||
// Check terminal container has reasonable width (min-width: 280px in CSS)
|
||||
const containerWidth = await page.$eval('#terminalContainer', (el) => {
|
||||
return el.getBoundingClientRect().width;
|
||||
});
|
||||
|
||||
// Container should have at least 280px width (our CSS minimum)
|
||||
expect(containerWidth).toBeGreaterThanOrEqual(280);
|
||||
|
||||
// Check that xterm element exists (canvas may not be visible due to z-index/overlay)
|
||||
const xtermExists = await page.$('.xterm') !== null;
|
||||
expect(xtermExists).toBe(true);
|
||||
|
||||
// Verify xterm container has reasonable width
|
||||
const xtermWidth = await page.$eval('.xterm', (el) => {
|
||||
return el.getBoundingClientRect().width;
|
||||
});
|
||||
// xterm should have at least 280px width
|
||||
expect(xtermWidth).toBeGreaterThanOrEqual(280);
|
||||
|
||||
// Track for cleanup
|
||||
const response = await fetch(`${serverFixture!.baseUrl}/api/sessions`);
|
||||
const data = await response.json();
|
||||
if (data?.length > 0) {
|
||||
cleanup.trackSession(data[data.length - 1].id);
|
||||
}
|
||||
|
||||
} finally {
|
||||
if (browser) {
|
||||
await destroyMobileBrowserFixture(browser);
|
||||
}
|
||||
}
|
||||
}, E2E_TIMEOUTS.TEST);
|
||||
|
||||
it('should render properly on tablet viewport', async () => {
|
||||
let browser: MobileBrowserFixture | null = null;
|
||||
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
/**
|
||||
* Mobile settings test - verifies:
|
||||
* 1. Mobile uses separate storage key
|
||||
* 2. Mobile defaults are applied correctly
|
||||
* 3. Notifications are disabled by default on mobile
|
||||
*/
|
||||
import { chromium } from 'playwright';
|
||||
|
||||
const MOBILE_VIEWPORT = {
|
||||
width: 402,
|
||||
height: 874,
|
||||
deviceScaleFactor: 2,
|
||||
isMobile: true,
|
||||
hasTouch: true,
|
||||
};
|
||||
|
||||
const DESKTOP_VIEWPORT = {
|
||||
width: 1280,
|
||||
height: 800,
|
||||
deviceScaleFactor: 1,
|
||||
isMobile: false,
|
||||
hasTouch: false,
|
||||
};
|
||||
|
||||
async function testMobileSettings() {
|
||||
console.log('=== Mobile Settings Test ===\n');
|
||||
|
||||
const browser = await chromium.launch({
|
||||
headless: true,
|
||||
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
||||
});
|
||||
|
||||
try {
|
||||
// Test 1: Mobile device
|
||||
console.log('1. Testing MOBILE view...');
|
||||
const mobileContext = await browser.newContext({
|
||||
viewport: { width: MOBILE_VIEWPORT.width, height: MOBILE_VIEWPORT.height },
|
||||
deviceScaleFactor: MOBILE_VIEWPORT.deviceScaleFactor,
|
||||
isMobile: MOBILE_VIEWPORT.isMobile,
|
||||
hasTouch: MOBILE_VIEWPORT.hasTouch,
|
||||
});
|
||||
const mobilePage = await mobileContext.newPage();
|
||||
mobilePage.setDefaultTimeout(15000);
|
||||
|
||||
await mobilePage.goto('http://localhost:3000', { waitUntil: 'domcontentloaded' });
|
||||
// Clear localStorage to test fresh defaults
|
||||
await mobilePage.evaluate(() => localStorage.clear());
|
||||
// Reload to apply fresh defaults
|
||||
await mobilePage.reload({ waitUntil: 'domcontentloaded' });
|
||||
await mobilePage.waitForSelector('.toolbar', { timeout: 10000 });
|
||||
await mobilePage.waitForTimeout(500);
|
||||
|
||||
// Check device type detection
|
||||
const mobileDeviceType = await mobilePage.evaluate(() => {
|
||||
// @ts-ignore
|
||||
return window.MobileDetection?.getDeviceType() || 'unknown';
|
||||
});
|
||||
console.log(` Device type detected: ${mobileDeviceType}`);
|
||||
|
||||
// Check storage key used
|
||||
const mobileStorageKeys = await mobilePage.evaluate(() => {
|
||||
const keys: string[] = [];
|
||||
for (let i = 0; i < localStorage.length; i++) {
|
||||
const key = localStorage.key(i);
|
||||
if (key && key.includes('claudeman')) {
|
||||
keys.push(key);
|
||||
}
|
||||
}
|
||||
return keys;
|
||||
});
|
||||
console.log(` LocalStorage keys: ${mobileStorageKeys.join(', ') || 'none'}`);
|
||||
|
||||
// Check default settings (before server merge)
|
||||
const mobileDefaults = await mobilePage.evaluate(() => {
|
||||
// @ts-ignore
|
||||
return window.app?.getDefaultSettings() || {};
|
||||
});
|
||||
console.log(` Default settings (mobile-specific):`);
|
||||
console.log(` showSystemStats: ${mobileDefaults.showSystemStats}`);
|
||||
console.log(` showMonitor: ${mobileDefaults.showMonitor}`);
|
||||
console.log(` subagentTrackingEnabled: ${mobileDefaults.subagentTrackingEnabled}`);
|
||||
|
||||
// Check loaded settings (after server merge)
|
||||
const mobileSettings = await mobilePage.evaluate(() => {
|
||||
// @ts-ignore
|
||||
return window.app?.loadAppSettingsFromStorage() || {};
|
||||
});
|
||||
console.log(` Settings loaded (after server merge):`);
|
||||
console.log(` showSystemStats: ${mobileSettings.showSystemStats}`);
|
||||
console.log(` showMonitor: ${mobileSettings.showMonitor}`);
|
||||
console.log(` subagentTrackingEnabled: ${mobileSettings.subagentTrackingEnabled}`);
|
||||
|
||||
// Check notification settings
|
||||
const mobileNotifPrefs = await mobilePage.evaluate(() => {
|
||||
// @ts-ignore
|
||||
return window.app?.notificationManager?.preferences || {};
|
||||
});
|
||||
console.log(` Notification prefs:`);
|
||||
console.log(` enabled: ${mobileNotifPrefs.enabled}`);
|
||||
console.log(` browserNotifications: ${mobileNotifPrefs.browserNotifications}`);
|
||||
|
||||
// Check header visibility
|
||||
const headerStatsVisible = await mobilePage.evaluate(() => {
|
||||
const el = document.getElementById('headerSystemStats');
|
||||
return el ? window.getComputedStyle(el).display !== 'none' : 'not found';
|
||||
});
|
||||
console.log(` Header system stats visible: ${headerStatsVisible}`);
|
||||
|
||||
// Check active tab is first
|
||||
const tabs = await mobilePage.$$('.session-tab');
|
||||
const firstTabActive = tabs.length > 0 ? await tabs[0].evaluate(el => el.classList.contains('active')) : 'no tabs';
|
||||
console.log(` Active tab first: ${firstTabActive} (${tabs.length} tabs)`);
|
||||
|
||||
// Take screenshot
|
||||
await mobilePage.screenshot({ path: 'test/mobile-settings-test.png' });
|
||||
console.log(' Screenshot: test/mobile-settings-test.png\n');
|
||||
|
||||
await mobileContext.close();
|
||||
|
||||
// Test 2: Desktop device for comparison
|
||||
console.log('2. Testing DESKTOP view...');
|
||||
const desktopContext = await browser.newContext({
|
||||
viewport: { width: DESKTOP_VIEWPORT.width, height: DESKTOP_VIEWPORT.height },
|
||||
deviceScaleFactor: DESKTOP_VIEWPORT.deviceScaleFactor,
|
||||
isMobile: DESKTOP_VIEWPORT.isMobile,
|
||||
hasTouch: DESKTOP_VIEWPORT.hasTouch,
|
||||
});
|
||||
const desktopPage = await desktopContext.newPage();
|
||||
desktopPage.setDefaultTimeout(15000);
|
||||
|
||||
await desktopPage.goto('http://localhost:3000', { waitUntil: 'domcontentloaded' });
|
||||
// Clear localStorage to test fresh defaults
|
||||
await desktopPage.evaluate(() => localStorage.clear());
|
||||
// Reload to apply fresh defaults
|
||||
await desktopPage.reload({ waitUntil: 'domcontentloaded' });
|
||||
await desktopPage.waitForSelector('.toolbar', { timeout: 10000 });
|
||||
await desktopPage.waitForTimeout(500);
|
||||
|
||||
const desktopDeviceType = await desktopPage.evaluate(() => {
|
||||
// @ts-ignore
|
||||
return window.MobileDetection?.getDeviceType() || 'unknown';
|
||||
});
|
||||
console.log(` Device type detected: ${desktopDeviceType}`);
|
||||
|
||||
// Check default settings
|
||||
const desktopDefaults = await desktopPage.evaluate(() => {
|
||||
// @ts-ignore
|
||||
return window.app?.getDefaultSettings() || {};
|
||||
});
|
||||
console.log(` Default settings (desktop = empty, uses ?? fallbacks):`);
|
||||
console.log(` isEmpty: ${Object.keys(desktopDefaults).length === 0}`);
|
||||
|
||||
// Check loaded settings (after server merge)
|
||||
const desktopSettings = await desktopPage.evaluate(() => {
|
||||
// @ts-ignore
|
||||
return window.app?.loadAppSettingsFromStorage() || {};
|
||||
});
|
||||
console.log(` Settings loaded (after server merge):`);
|
||||
console.log(` showSystemStats: ${desktopSettings.showSystemStats ?? 'undefined (default: true)'}`);
|
||||
console.log(` showMonitor: ${desktopSettings.showMonitor ?? 'undefined (default: true)'}`);
|
||||
|
||||
const desktopNotifPrefs = await desktopPage.evaluate(() => {
|
||||
// @ts-ignore
|
||||
return window.app?.notificationManager?.preferences || {};
|
||||
});
|
||||
console.log(` Notification prefs:`);
|
||||
console.log(` enabled: ${desktopNotifPrefs.enabled}`);
|
||||
console.log(` browserNotifications: ${desktopNotifPrefs.browserNotifications}`);
|
||||
|
||||
await desktopPage.screenshot({ path: 'test/desktop-settings-test.png' });
|
||||
console.log(' Screenshot: test/desktop-settings-test.png\n');
|
||||
|
||||
await desktopContext.close();
|
||||
|
||||
console.log('=== Test Complete ===');
|
||||
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
}
|
||||
|
||||
testMobileSettings().catch(console.error);
|
||||
Reference in New Issue
Block a user