All checks were successful
Queue Release Build / prepare (push) Successful in 22s
Deploy Web Apps / deploy (push) Successful in 7m32s
Queue Release Build / build-windows (push) Successful in 27m41s
Queue Release Build / build-linux (push) Successful in 44m56s
Queue Release Build / build-android (push) Successful in 18m52s
Queue Release Build / finalize (push) Successful in 21s
Ignore stale P2P self-disconnect voice-state echoes while this client actively owns voice, refresh noise-reduction input on re-join, and repair dual-signal E2E harness expectations. Co-authored-by: Cursor <cursoragent@cursor.com>
73 lines
2.2 KiB
TypeScript
73 lines
2.2 KiB
TypeScript
import { expect, type Page } from '@playwright/test';
|
|
|
|
/** Read how many signaling managers are currently connected for this page. */
|
|
export async function getConnectedSignalManagerCount(page: Page): Promise<number> {
|
|
return page.evaluate(() => {
|
|
interface AngularDebugApi {
|
|
getComponent: (element: Element) => Record<string, unknown>;
|
|
}
|
|
|
|
const host = document.querySelector('app-rooms-side-panel');
|
|
const debugApi = (window as { ng?: AngularDebugApi }).ng;
|
|
|
|
if (!host || !debugApi?.getComponent) {
|
|
return 0;
|
|
}
|
|
|
|
const component = debugApi.getComponent(host);
|
|
const realtime = component['realtime'] as {
|
|
signalingTransportHandler?: {
|
|
getConnectedSignalingManagers?: () => unknown[];
|
|
};
|
|
} | undefined;
|
|
|
|
return realtime?.signalingTransportHandler?.getConnectedSignalingManagers?.().length ?? 0;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Dual-signal setups create one RTCPeerConnection per remote peer per active
|
|
* signaling manager, so the harness tracks `remotePeerCount * signalCount`
|
|
* connected peer connections.
|
|
*/
|
|
export async function waitForConnectedRemotePeerMesh(
|
|
page: Page,
|
|
remotePeerCount: number,
|
|
timeout = 45_000
|
|
): Promise<void> {
|
|
const signalCount = Math.max(await getConnectedSignalManagerCount(page), 1);
|
|
const expectedCount = remotePeerCount * signalCount;
|
|
const minimumCount = Math.max(remotePeerCount, expectedCount - signalCount);
|
|
|
|
await page.waitForFunction(
|
|
(min) => ((window as unknown as {
|
|
__rtcConnections?: RTCPeerConnection[];
|
|
}).__rtcConnections ?? []).filter(
|
|
(pc) => pc.connectionState === 'connected'
|
|
).length >= min,
|
|
minimumCount,
|
|
{ timeout }
|
|
);
|
|
}
|
|
|
|
export async function getMinimumConnectedPeerMeshCount(
|
|
page: Page,
|
|
remotePeerCount: number
|
|
): Promise<number> {
|
|
const signalCount = Math.max(await getConnectedSignalManagerCount(page), 1);
|
|
const expectedCount = remotePeerCount * signalCount;
|
|
|
|
return Math.max(remotePeerCount, expectedCount - signalCount);
|
|
}
|
|
|
|
export async function waitForConnectedSignalManagerCount(
|
|
page: Page,
|
|
expectedCount: number,
|
|
timeout = 30_000
|
|
): Promise<void> {
|
|
await expect.poll(async () => await getConnectedSignalManagerCount(page), {
|
|
timeout,
|
|
intervals: [500, 1_000]
|
|
}).toBe(expectedCount);
|
|
}
|