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
chore: files changed app/test/e2e/helpers/element-helpers.ts,app/test/e2e/specs/file-drop-guard.spec
Steven Enamakel3d2cacf88afc
diff --git a/app/test/e2e/helpers/element-helpers.ts b/app/test/e2e/helpers/element-helpers.tsindex d8ebb801b4..374fffac9c 100644--- a/app/test/e2e/helpers/element-helpers.ts+++ b/app/test/e2e/helpers/element-helpers.ts@@ -381,6 +381,41 @@ export async function waitForTestId(return el;}+/**+ * Dispatch a browser file drag sequence against an element.+ *+ * WebDriver cannot hand the desktop webview an operating-system drag source,+ * but constructing a `DataTransfer` in the renderer gives the application the+ * same `FileList` and `DataTransferItemList` shape its HTML drag handlers+ * consume. Keep this here so specs do not reach around the cross-platform+ * element helper boundary with raw DOM queries.+ */+export async function dispatchFileDrop(+ target: ChainablePromiseElement,+ file: { name: string; type: string; contents: string }+): Promise<{ dragOverPrevented: boolean; dropPrevented: boolean; fileCount: number }> {+ return browser.execute(+ (element: HTMLElement, droppedFile: { name: string; type: string; contents: string }) => {+ const dataTransfer = new DataTransfer();+ dataTransfer.items.add(new File([droppedFile.contents], droppedFile.name, { type: droppedFile.type }));++ const dispatch = (type: 'dragover' | 'drop') => {+ const event = new DragEvent(type, { bubbles: true, cancelable: true, dataTransfer });+ element.dispatchEvent(event);+ return event.defaultPrevented;+ };++ return {+ dragOverPrevented: dispatch('dragover'),+ dropPrevented: dispatch('drop'),+ fileCount: dataTransfer.files.length,+ };+ },+ target as unknown as HTMLElement,+ file+ );+}+/*** Wait for an element by stable `data-testid`, then click it.*/diff --git a/app/test/e2e/specs/file-drop-guard.spec.ts b/app/test/e2e/specs/file-drop-guard.spec.tsindex e8a9decd9d..ca01965dda 100644--- a/app/test/e2e/specs/file-drop-guard.spec.ts+++ b/app/test/e2e/specs/file-drop-guard.spec.ts@@ -1,7 +1,7 @@-// @ts-nocheckimport { browser, expect } from '@wdio/globals';import { waitForApp } from '../helpers/app-helpers';+import { dispatchFileDrop, waitForTestId } from '../helpers/element-helpers';import { resetApp } from '../helpers/reset-app';import { startMockServer, stopMockServer } from '../mock-server';@@ -20,26 +20,14 @@ describe('File drop guard', () => {it('refuses an unclaimed file drop on the sidebar without navigating the app', async () => {const urlBeforeDrop = await browser.getUrl();- const result = await browser.execute(() => {- const target = document.querySelector('[data-testid="root-shell-sidebar"]');- if (!target) return null;-- const dispatchFileEvent = (type: 'dragover' | 'drop') => {- const event = new Event(type, { bubbles: true, cancelable: true }) as DragEvent;- Object.defineProperty(event, 'dataTransfer', {- value: { types: ['Files'], dropEffect: 'copy' },- });- target.dispatchEvent(event);- return event.defaultPrevented;- };-- return {- dragOverPrevented: dispatchFileEvent('dragover'),- dropPrevented: dispatchFileEvent('drop'),- };+ const sidebar = await waitForTestId('root-shell-sidebar');+ const result = await dispatchFileDrop(sidebar, {+ name: 'unclaimed.txt',+ type: 'text/plain',+ contents: 'dropped from e2e',});- expect(result).toEqual({ dragOverPrevented: true, dropPrevented: true });+ expect(result).toEqual({ dragOverPrevented: true, dropPrevented: true, fileCount: 1 });expect(await browser.getUrl()).toBe(urlBeforeDrop);});});