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
fix: stabilize channel and tool group e2e checks
Steven Enamakeldbe1e5a3fb06
diff --git a/app/test/e2e/helpers/element-helpers.ts b/app/test/e2e/helpers/element-helpers.tsindex e176f19393..b32a0e03f2 100644--- a/app/test/e2e/helpers/element-helpers.ts+++ b/app/test/e2e/helpers/element-helpers.ts@@ -398,9 +398,13 @@ export async function waitForElementAbsence(selector: string,timeout: number = 15_000): Promise<void> {- await browser.waitUntil(async () => !(await browser.$(selector).isExisting()), {+ const activeSelector =+ !isTauriDriver() && selector.startsWith('[data-testid="')+ ? `//*[@data-testid=${xpathStringLiteral(selector.slice('[data-testid="'.length, -2))}]`+ : selector;+ await browser.waitUntil(async () => !(await browser.$(activeSelector).isExisting()), {timeout,- timeoutMsg: `Element ${selector} remained present after ${timeout}ms`,+ timeoutMsg: `Element ${activeSelector} remained present after ${timeout}ms`,});}@@ -533,12 +537,19 @@ export async function clickToolGroupTrigger(timeout: number = 15_000): Promise<void> {const literal = xpathStringLiteral(label);- const selector = isTauriDriver()- ? '[data-slot="tool-group-root"] [data-slot="tool-group-trigger"]'- : `//XCUIElementTypeButton[contains(@label, ${literal}) or contains(@value, ${literal}) or contains(@title, ${literal})]`;- const triggers = await browser.$$(selector);- const trigger = triggers[index];- if (!trigger) throw new Error(`Tool group trigger ${index + 1} (${label}) was not found`);+ const matches =+ `//XCUIElementTypeButton[contains(@label, ${literal}) or contains(@value, ${literal}) or contains(@title, ${literal})]`;+ let trigger: ChainablePromiseElement;+ if (isTauriDriver()) {+ const selector = '[data-slot="tool-group-root"] [data-slot="tool-group-trigger"]';+ await browser.waitUntil(async () => (await browser.$$(selector)).length > index, {+ timeout,+ timeoutMsg: `Tool group trigger ${index + 1} (${label}) was not found`,+ });+ trigger = (await browser.$$(selector))[index]!;+ } else {+ trigger = await browser.$(`(${matches})[${index + 1}]`);+ }await trigger.waitForExist({ timeout, timeoutMsg: `Tool group trigger "${label}" not found` });await clickAtElement(trigger);}diff --git a/app/test/e2e/specs/credential-channels-flow.spec.ts b/app/test/e2e/specs/credential-channels-flow.spec.tsindex 2afca135fb..afaff03fba 100644--- a/app/test/e2e/specs/credential-channels-flow.spec.ts+++ b/app/test/e2e/specs/credential-channels-flow.spec.ts@@ -30,9 +30,11 @@* which is the house pattern for a channel lifecycle.** No external network: Yuanbao credential verification is directed to the- * local mock backend. Email's required IMAP login is tested against a refused- * loopback port because the suite has no TLS IMAP fixture.+ * local mock backend. Email's required IMAP login is tested against a+ * test-owned loopback socket that drops the TLS handshake before credentials+ * can be sent.*/+import { createServer } from 'node:net';import { waitForApp } from '../helpers/app-helpers';import { callOpenhumanRpc } from '../helpers/core-rpc';import { resetApp } from '../helpers/reset-app';@@ -40,6 +42,24 @@ import { getMockServerPort, startMockServer, stopMockServer } from '../mock-servconst LOG_PREFIX = '[CredentialChannels]';+/** Accept one local connection and drop the TLS handshake before IMAP credentials can be sent. */+async function startImapHandshakeRejector(): Promise<{ port: number; close: () => Promise<void> }> {+ const server = createServer(socket => socket.destroy());+ await new Promise<void>((resolve, reject) => {+ server.once('error', reject);+ server.listen(0, '127.0.0.1', resolve);+ });+ const address = server.address();+ if (!address || typeof address === 'string') throw new Error('IMAP fixture did not bind');+ return {+ port: address.port,+ close: () =>+ new Promise<void>((resolve, reject) =>+ server.close(error => (error ? reject(error) : resolve()))+ ),+ };+}+interface AuthModeSpec {mode?: string;fields?: { key?: string; required?: boolean }[];@@ -212,15 +232,20 @@ describe('Credential channels — Yuanbao and Email (IMAP/SMTP)', () => {);}- const credentials =- channel === 'email'- ? { ...validCredentials, imap_host: '127.0.0.1', imap_port: '0' }+ const imapFixture = channel === 'email' ? await startImapHandshakeRejector() : undefined;+ let out: Awaited<ReturnType<typeof callOpenhumanRpc>>;+ try {+ const credentials = imapFixture+ ? { ...validCredentials, imap_host: '127.0.0.1', imap_port: String(imapFixture.port) }: { ...validCredentials, api_domain: `http://127.0.0.1:${getMockServerPort()}` };- const out = await callOpenhumanRpc('openhuman.channels_connect', {- channel,- authMode: 'api_key',- credentials,- });+ out = await callOpenhumanRpc('openhuman.channels_connect', {+ channel,+ authMode: 'api_key',+ credentials,+ });+ } finally {+ await imapFixture?.close();+ }if (channel === 'email') {expect(out.ok).toBe(false);expect(out.error).toContain('IMAP connection failed');@@ -272,7 +297,12 @@ describe('Credential channels — Yuanbao and Email (IMAP/SMTP)', () => {it(`D.5 ${channel} disconnect clears the stored connection`, async function () {this.timeout(60_000);if (channel === 'email') {- this.skip();+ await callOpenhumanRpc('openhuman.channels_disconnect', { channel, authMode: 'api_key' });+ const status = await statusFor(channel);+ expect(isConnected(status)).toBe(false);+ expect(status?.hasCredentials ?? status?.has_credentials).toBe(false);+ console.log(`${LOG_PREFIX} D.5 email: disconnected state verified`);+ return;}await callOpenhumanRpc('openhuman.channels_connect', {channel,