mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
Fix CI issues (#476)
This commit is contained in:
parent
acdc4f22a8
commit
9d7fe36699
12 changed files with 111 additions and 41 deletions
2
.github/workflows/mac.yml
vendored
2
.github/workflows/mac.yml
vendored
|
|
@ -121,7 +121,7 @@ jobs:
|
|||
run: |
|
||||
echo "Resolving Swift package dependencies..."
|
||||
# Workspace is at root level
|
||||
xcodebuild -resolvePackageDependencies -workspace VibeTunnel.xcworkspace || echo "Dependency resolution completed"
|
||||
xcodebuild -resolvePackageDependencies -workspace VibeTunnel.xcworkspace -scheme VibeTunnel-Mac || echo "Dependency resolution completed"
|
||||
|
||||
# Debug: List available schemes
|
||||
echo "=== Available schemes ==="
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<!-- Generated: 2025-07-26 18:45:00 UTC -->
|
||||
<!-- Generated: 2025-07-28 12:35:00 UTC -->
|
||||
<p align="center">
|
||||
<img src="assets/banner.png" alt="VibeTunnel Banner" />
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ class ServerManager {
|
|||
// Log for debugging
|
||||
// logger
|
||||
// .debug(
|
||||
// "bindAddress getter: rawValue='\(rawValue)', mode=\(mode.rawValue), bindAddress=\(mode.bindAddress)"
|
||||
// "bindAddress getter: rawValue='\(rawValue)', mode=\(mode.rawValue),
|
||||
// bindAddress=\(mode.bindAddress)"
|
||||
// )
|
||||
|
||||
return mode.bindAddress
|
||||
|
|
|
|||
|
|
@ -266,10 +266,10 @@ struct AutocompleteTextField: View {
|
|||
)
|
||||
)
|
||||
)
|
||||
.onAppear {
|
||||
// Initialize autocompleteService with GitRepositoryMonitor
|
||||
autocompleteService = AutocompleteService(gitMonitor: gitMonitor)
|
||||
}
|
||||
.onAppear {
|
||||
// Initialize autocompleteService with GitRepositoryMonitor
|
||||
autocompleteService = AutocompleteService(gitMonitor: gitMonitor)
|
||||
}
|
||||
}
|
||||
|
||||
private func handleKeyPress(_ keyPress: KeyPress) -> KeyPress.Result {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import SwiftUI
|
||||
import AppKit
|
||||
import SwiftUI
|
||||
|
||||
/// Simple NSWindow-based dropdown for autocomplete
|
||||
struct AutocompleteWindowView: NSViewRepresentable {
|
||||
|
|
@ -41,7 +41,7 @@ struct AutocompleteWindowView: NSViewRepresentable {
|
|||
private let onSelect: (String) -> Void
|
||||
@Binding var isShowing: Bool
|
||||
@Binding var selectedIndex: Int
|
||||
nonisolated(unsafe) private var clickMonitor: Any?
|
||||
private nonisolated(unsafe) var clickMonitor: Any?
|
||||
|
||||
init(onSelect: @escaping (String) -> Void, isShowing: Binding<Bool>, selectedIndex: Binding<Int>) {
|
||||
self.onSelect = onSelect
|
||||
|
|
@ -99,7 +99,7 @@ struct AutocompleteWindowView: NSViewRepresentable {
|
|||
}
|
||||
|
||||
guard let window = dropdownWindow,
|
||||
let hostingView = hostingView else { return }
|
||||
let hostingView else { return }
|
||||
|
||||
// Update content with proper binding
|
||||
let content = VStack(spacing: 0) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import UserNotifications
|
|||
/// across all windows and handles deep linking for terminal session URLs.
|
||||
///
|
||||
/// This application runs on macOS 14.0+ and requires Swift 6.
|
||||
/// The app provides terminal access through web browsers.
|
||||
@main
|
||||
struct VibeTunnelApp: App {
|
||||
@NSApplicationDelegateAdaptor(AppDelegate.self)
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ child.on('error', (error) => {
|
|||
// Log when process starts
|
||||
child.on('spawn', () => {
|
||||
console.log('Server process spawned successfully');
|
||||
console.log(`Server PID: ${child.pid}`);
|
||||
});
|
||||
|
||||
// Handle early exit
|
||||
|
|
@ -204,6 +205,25 @@ if (process.env.CI || process.env.WAIT_FOR_SERVER) {
|
|||
process.exit(1);
|
||||
} else {
|
||||
console.log('Server is ready, tests can proceed');
|
||||
|
||||
// In CI, add periodic health checks
|
||||
if (process.env.CI) {
|
||||
const healthCheckInterval = setInterval(() => {
|
||||
if (hasExited) {
|
||||
clearInterval(healthCheckInterval);
|
||||
return;
|
||||
}
|
||||
|
||||
const http = require('http');
|
||||
http.get(`http://localhost:${port}/api/health`, (res) => {
|
||||
if (res.statusCode !== 200) {
|
||||
console.error(`Health check failed with status ${res.statusCode}`);
|
||||
}
|
||||
}).on('error', (err) => {
|
||||
console.error(`Health check error: ${err.message}`);
|
||||
});
|
||||
}, 10000); // Check every 10 seconds
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 3000); // Wait 3 seconds before checking
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// VibeTunnel server entry point
|
||||
import chalk from 'chalk';
|
||||
import compression from 'compression';
|
||||
import type { Response as ExpressResponse } from 'express';
|
||||
|
|
|
|||
|
|
@ -40,7 +40,34 @@ export class TestSessionManager {
|
|||
let sessionId = '';
|
||||
if (!spawnWindow) {
|
||||
console.log(`Web session created, waiting for navigation to session view...`);
|
||||
await this.page.waitForURL(/\/session\//, { timeout: 10000 });
|
||||
// Increase timeout for CI and add retry logic
|
||||
const timeout = process.env.CI ? 30000 : 15000;
|
||||
|
||||
// Add a small delay to ensure navigation starts
|
||||
await this.page.waitForTimeout(500);
|
||||
|
||||
try {
|
||||
await this.page.waitForURL(/\/session\//, { timeout });
|
||||
} catch (error) {
|
||||
// If waitForURL times out, check if we're already on a session page
|
||||
const currentUrl = this.page.url();
|
||||
if (!currentUrl.includes('/session/')) {
|
||||
// Try to wait for any navigation
|
||||
try {
|
||||
await this.page.waitForLoadState('domcontentloaded', { timeout: 5000 });
|
||||
} catch (_loadError) {
|
||||
// Ignore load state error
|
||||
}
|
||||
const finalUrl = this.page.url();
|
||||
if (!finalUrl.includes('/session/')) {
|
||||
console.error(
|
||||
`Navigation failed. Initial URL: ${currentUrl}, Final URL: ${finalUrl}`
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
console.log(`Already on session page: ${currentUrl}`);
|
||||
}
|
||||
const url = this.page.url();
|
||||
|
||||
if (!url.includes('/session/')) {
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ export class SessionListPage extends BasePage {
|
|||
if (sessionId) {
|
||||
await this.page.goto(`/session/${sessionId}`, {
|
||||
waitUntil: 'domcontentloaded',
|
||||
timeout: 15000, // Increase timeout for CI
|
||||
timeout: process.env.CI ? 30000 : 15000, // Increase timeout for CI
|
||||
});
|
||||
} else {
|
||||
// Wait for automatic navigation
|
||||
|
|
|
|||
|
|
@ -23,14 +23,22 @@ test.describe('Terminal Interaction', () => {
|
|||
// Use unique prefix for this test file to prevent session conflicts
|
||||
sessionManager = new TestSessionManager(page, 'termint');
|
||||
|
||||
// Add network error logging for debugging
|
||||
page.on('requestfailed', (request) => {
|
||||
console.error(`Request failed: ${request.url()} - ${request.failure()?.errorText}`);
|
||||
});
|
||||
|
||||
// Create a session for all tests using the session manager to ensure proper tracking
|
||||
const sessionData = await sessionManager.createTrackedSession('terminal-test');
|
||||
|
||||
// Navigate to the created session
|
||||
await page.goto(`/session/${sessionData.sessionId}`, { waitUntil: 'domcontentloaded' });
|
||||
// Navigate to the created session with increased timeout for CI
|
||||
await page.goto(`/session/${sessionData.sessionId}`, {
|
||||
waitUntil: 'domcontentloaded',
|
||||
timeout: process.env.CI ? 30000 : 15000,
|
||||
});
|
||||
|
||||
// Wait for terminal with proper WebSocket handling
|
||||
await waitForTerminalReady(page, 10000);
|
||||
await waitForTerminalReady(page, process.env.CI ? 20000 : 10000);
|
||||
});
|
||||
|
||||
test.afterEach(async () => {
|
||||
|
|
|
|||
|
|
@ -28,8 +28,20 @@ describe('AsciinemaWriter byte position tracking', () => {
|
|||
it('should track byte position correctly for header', async () => {
|
||||
writer = AsciinemaWriter.create(testFile, 80, 24, 'test command', 'Test Title');
|
||||
|
||||
// Give the header time to be written
|
||||
await new Promise((resolve) => setTimeout(resolve, 10));
|
||||
// Wait for the header to be written with a polling mechanism
|
||||
let attempts = 0;
|
||||
const maxAttempts = 50; // 50 * 10ms = 500ms max wait
|
||||
|
||||
while (attempts < maxAttempts) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 10));
|
||||
|
||||
const position = writer.getPosition();
|
||||
if (position.written > 0 && position.pending === 0) {
|
||||
// Header has been written
|
||||
break;
|
||||
}
|
||||
attempts++;
|
||||
}
|
||||
|
||||
const position = writer.getPosition();
|
||||
expect(position.written).toBeGreaterThan(0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue