Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(e2e): settings data management

Steven Enamakel1229faf54b9c
diff --git a/app/test/e2e/specs/settings-data-management.spec.ts b/app/test/e2e/specs/settings-data-management.spec.ts
index 3dc0f27d57..1757532229 100644
--- a/app/test/e2e/specs/settings-data-management.spec.ts
+++ b/app/test/e2e/specs/settings-data-management.spec.ts
@@ -11,7 +11,11 @@
* - 13.5.1 Clear App Data confirmation dialog + Cancel
* - 13.5.3 Full State Reset → back to Welcome screen
*/
+import fs from 'node:fs';
+import path from 'node:path';
+
import { waitForApp } from '../helpers/app-helpers';
+import { callOpenhumanRpc } from '../helpers/core-rpc';
import { clickTestId, clickText, textExists, waitForText } from '../helpers/element-helpers';
import { resetApp } from '../helpers/reset-app';
import { navigateViaHash } from '../helpers/shared-flows';
@@ -46,43 +50,37 @@ describe('Settings - Data Management', function () {
});
it('performs Full State Reset (13.5.3)', async function () {
- this.timeout(60_000);
+ this.timeout(90_000);
+ const workspace = await callOpenhumanRpc('openhuman.test_support_workspace_root', {});
+ expect(workspace.ok).toBe(true);
+ const workspacePath = workspace.result?.result?.path;
+ expect(typeof workspacePath).toBe('string');
+ expect(workspace.result?.result?.exists).toBe(true);
+ expect(workspacePath).toContain(`${path.sep}users${path.sep}${USER_ID}${path.sep}workspace`);
+ const sentinelPath = path.join(workspacePath, 'settings-data-management-sentinel.txt');
+ fs.writeFileSync(sentinelPath, 'user-scoped clear-data sentinel', { flag: 'wx' });
+ expect(fs.readFileSync(sentinelPath, 'utf8')).toBe('user-scoped clear-data sentinel');
+
await navigateViaHash('/settings/account');
await clickTestId('settings-nav-logout-and-clear', 15_000);
await waitForText('This will sign you out', 5_000);
- // The confirm button in the modal has the same label as the trigger.
- // Use browser.execute to click the amber-colored confirm button which
- // is the last "Clear App Data" button in the DOM (inside the modal).
- await browser.execute(() => {
- const buttons = Array.from(document.querySelectorAll('button'));
- const confirmBtn = buttons
- .filter(b => b.textContent?.trim().toLowerCase() === 'clear app data')
- .pop(); // last match = the modal confirm button
- confirmBtn?.click();
+ const confirmations = await browser.$$('button*=Clear App Data');
+ expect(confirmations.length).toBeGreaterThan(1);
+ await confirmations[confirmations.length - 1].click();
+ await browser.waitUntil(async () => await textExists('Welcome to OpenHuman'), {
+ timeout: 30_000,
+ interval: 250,
+ timeoutMsg: 'clear-data reset did not reload the signed-out Welcome screen',
});
+ expect(await browser.$('[data-testid="welcome-cta-tinyhumans"]').isExisting()).toBe(true);
+ expect(fs.existsSync(sentinelPath)).toBe(false);
- // clearAllAppData calls restartApp() which restarts the entire Tauri
- // process. On desktop, this kills the CEF runtime and the WDIO session
- // becomes stale. We verify the clear happened by checking that the
- // confirmation modal is no longer visible (it was just clicked) and
- // wait a moment to confirm the app begins its restart sequence.
- // Post-restart UI verification is not possible through the same WDIO
- // session on desktop.
- await browser.pause(3_000);
- // If the session is still alive, the modal should be gone and the app
- // is in the process of restarting. Either the session throws (restart
- // happened) or we're still on the settings page (restart pending).
- let restarted = false;
- try {
- await textExists('Settings');
- // If we can still read the DOM and the modal is gone, the clear
- // was triggered successfully (restartApp may be async).
- restarted = !(await textExists('This will sign you out'));
- } catch {
- // Session broke — the app restarted as expected.
- restarted = true;
- }
- expect(restarted).toBe(true);
+ const auth = await callOpenhumanRpc('openhuman.auth_get_state', {});
+ expect(auth.ok).toBe(true);
+ expect(auth.result?.result?.isAuthenticated).toBe(false);
+ expect(auth.result?.result?.credential).toBeUndefined();
+ const ping = await callOpenhumanRpc('core.ping', {});
+ expect(ping.ok).toBe(true);
});
});