The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(e2e): add voice note chat spec and element helpers
Steven Enamakel936606704308
diff --git a/app/test/e2e/helpers/element-helpers.ts b/app/test/e2e/helpers/element-helpers.tsindex c898d10240..38fe970ac3 100644--- a/app/test/e2e/helpers/element-helpers.ts+++ b/app/test/e2e/helpers/element-helpers.ts@@ -422,6 +422,22 @@ export async function countTestId(testId: string): Promise<number> {).length;}+/** Wait until an audio element captured by an E2E Audio constructor has decoded data. */+export async function waitForDecodedAudioAtIndex(+ index: number,+ timeout: number = 5_000+): Promise<void> {+ await browser.waitUntil(+ async () =>+ await browser.execute((audioIndex: number) => {+ const audio = (window as Window & { __E2E_AUDIO_ELEMENTS?: HTMLAudioElement[] })+ .__E2E_AUDIO_ELEMENTS?.[audioIndex];+ return Boolean(audio && audio.readyState >= 2 && Number.isFinite(audio.duration) && audio.duration > 0);+ }, index),+ { timeout, timeoutMsg: `Audio ${index} did not decode before ${timeout}ms` }+ );+}+/** Click an indexed repeated test-id control through the shared click path. */export async function clickTestIdAtIndex(testId: string,diff --git a/app/test/e2e/specs/chat-voice-note.spec.ts b/app/test/e2e/specs/chat-voice-note.spec.tsindex 44a3a28dfb..c8c403d20c 100644--- a/app/test/e2e/specs/chat-voice-note.spec.ts+++ b/app/test/e2e/specs/chat-voice-note.spec.ts@@ -12,6 +12,7 @@ import {clickTestIdAtIndex,countTestId,textExists,+ waitForDecodedAudioAtIndex,waitForTestId,waitForTestIdAtIndex,} from '../helpers/element-helpers';@@ -160,7 +161,18 @@ describe('Chat voice notes', () => {await browser.waitUntil(async () => (await countTestId('voice-note-toggle')) === 2, {timeout: 5_000,});+ await browser.execute(() => {+ const NativeAudio = window.Audio;+ window.__E2E_AUDIO_ELEMENTS = [];+ window.Audio = class extends NativeAudio {+ constructor(source) {+ super(source);+ window.__E2E_AUDIO_ELEMENTS.push(this);+ }+ };+ });await clickTestIdAtIndex('voice-note-toggle', 0);+ await waitForDecodedAudioAtIndex(0);await browser.waitUntil(async () =>(await (await waitForTestId('voice-note-toggle')).getAttribute('aria-label'))@@ -170,6 +182,7 @@ describe('Chat voice notes', () => {);await clickTestIdAtIndex('voice-note-toggle', 0);await clickTestIdAtIndex('voice-note-toggle', 1);+ await waitForDecodedAudioAtIndex(1);await browser.waitUntil(async () =>(await (await waitForTestIdAtIndex('voice-note-toggle', 1)).getAttribute('aria-label'))