import { logInDepiClient, } from '../../src/depiUtils'; import { closeSession } from './session'; const DEFAULT_MAX_ATTEMPTS = 60; const DEFAULT_DELAY_MS = 500; export async function waitForDepiServer( url: string, userName: string = 'demo', password: string = '123456', maxAttempts: number = DEFAULT_MAX_ATTEMPTS, delayMs: number = DEFAULT_DELAY_MS, ): Promise { for (let attempt = 0; attempt < maxAttempts; attempt += 1) { try { const session = await logInDepiClient(url, userName, password); await closeSession(session); return; } catch { await new Promise((resolve) => setTimeout(resolve, delayMs)); } } throw new Error(`depi-server at ${url} did not become ready in time`); }