Skip to content

Commit 9a1f8ce

Browse files
committed
chore: add e2e workspace and update dependencies
- Add e2e to workspace in root package.json - Update bun.lock with e2e dependencies - Minor fixes to CLI e2e test utilities
1 parent 77ecc53 commit 9a1f8ce

File tree

5 files changed

+58
-3
lines changed

5 files changed

+58
-3
lines changed

bun.lock

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/src/__tests__/e2e/test-db-utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { execSync } from 'child_process'
22
import path from 'path'
33
import fs from 'fs'
4+
import { fileURLToPath } from 'url'
5+
6+
// ESM-compatible __dirname
7+
const __filename = fileURLToPath(import.meta.url)
8+
const __dirname = path.dirname(__filename)
49

510
const INTERNAL_PKG_DIR = path.join(__dirname, '../../../../packages/internal')
611
const DOCKER_COMPOSE_E2E = path.join(INTERNAL_PKG_DIR, 'src/db/docker-compose.e2e.yml')

cli/src/__tests__/e2e/test-server-utils.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ import { spawn, execSync } from 'child_process'
22
import { createServer } from 'net'
33
import path from 'path'
44
import http from 'http'
5+
import { fileURLToPath } from 'url'
56

67
import type { ChildProcess } from 'child_process'
78
import type { AddressInfo } from 'net'
89

10+
// ESM-compatible __dirname
11+
const __filename = fileURLToPath(import.meta.url)
12+
const __dirname = path.dirname(__filename)
13+
914
const WEB_DIR = path.join(__dirname, '../../../../web')
1015

1116
export interface E2EServer {
@@ -64,11 +69,19 @@ export async function findAvailableServerPort(basePort: number = 3100): Promise<
6469
return await reservePort(0)
6570
}
6671

72+
export interface StartE2EServerOptions {
73+
/** Specific port to use. If not provided, finds an available port starting from 3100 */
74+
port?: number
75+
}
76+
6777
/**
6878
* Start the web server for e2e tests
6979
*/
70-
export async function startE2EServer(databaseUrl: string): Promise<E2EServer> {
71-
const port = await findAvailableServerPort(3100)
80+
export async function startE2EServer(
81+
databaseUrl: string,
82+
options: StartE2EServerOptions = {},
83+
): Promise<E2EServer> {
84+
const port = options.port ?? await findAvailableServerPort(3100)
7285
const url = `http://localhost:${port}`
7386
const backendUrl = url
7487

cli/src/app.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,20 @@ export const App = ({
168168

169169
// Render login modal when not authenticated AND auth service is reachable
170170
// Don't show login modal during network outages OR while retrying
171+
// Also show login modal when requireAuth is explicitly true (no credentials at all)
172+
if (
173+
requireAuth === true &&
174+
(isAuthenticated === false || isAuthenticated === null)
175+
) {
176+
return (
177+
<LoginModal
178+
onLoginSuccess={handleLoginSuccess}
179+
hasInvalidCredentials={hasInvalidCredentials}
180+
/>
181+
)
182+
}
183+
184+
// Also show login for the case where we have credentials but they're invalid
171185
if (
172186
requireAuth !== null &&
173187
isAuthenticated === false &&

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"evals",
1313
"sdk",
1414
".agents",
15-
"cli"
15+
"cli",
16+
"e2e"
1617
],
1718
"scripts": {
1819
"dev": "bash scripts/dev.sh",

0 commit comments

Comments
 (0)