Skip to content

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

fix(e2e): dismiss late tour and isolate cron removal

Steven Enamakelf0483f1dfd93
diff --git a/app/test/e2e/helpers/reset-app.ts b/app/test/e2e/helpers/reset-app.ts
index 366b401b1d..96850dbc93 100644
--- a/app/test/e2e/helpers/reset-app.ts
+++ b/app/test/e2e/helpers/reset-app.ts
@@ -20,7 +20,7 @@
*/
import { waitForApp, waitForAppReady } from './app-helpers';
import { callOpenhumanRpc } from './core-rpc';
-import { waitForWebView, waitForWindowVisible } from './element-helpers';
+import { clickText, textExists, waitForWebView, waitForWindowVisible } from './element-helpers';
import { triggerAuthLoopbackBypass } from './loopback-auth-helpers';
import { supportsExecuteScript } from './platform';
import { dismissBootCheckGateIfVisible, waitForHomePage, walkOnboarding } from './shared-flows';
@@ -51,30 +51,21 @@ function stepLog(message: string): void {
/** Dismiss the Joyride tour if it starts after the home route becomes ready. */
async function dismissLateWalkthrough(): Promise<void> {
const appeared = await browser
- .waitUntil(
- async () =>
- Boolean(
- await browser
- .execute(() => document.querySelector('[role="tooltip"]') !== null)
- .catch(() => false)
- ),
- { timeout: 4_000, interval: 250, timeoutMsg: 'waiting for a walkthrough tooltip' }
- )
+ .waitUntil(async () => textExists('Skip tour'), {
+ timeout: 4_000,
+ interval: 250,
+ timeoutMsg: 'waiting for the walkthrough Skip tour action',
+ })
.then(() => true)
.catch(() => false);
if (!appeared) return;
- const dismissed = await dismissWalkthroughIfVisible(5_000);
- const stillVisible = await browser
- .execute(() => document.querySelector('[role="tooltip"]') !== null)
- .catch(() => false);
- if (stillVisible) {
- throw new Error(
- dismissed
- ? 'walkthrough tooltip remained visible after Skip tour'
- : 'walkthrough tooltip appeared without a dismissible Skip tour button'
- );
- }
+ await clickText('Skip tour', 2_000);
+ await browser.waitUntil(async () => !(await textExists('Skip tour')), {
+ timeout: 5_000,
+ interval: 250,
+ timeoutMsg: 'walkthrough Skip tour action remained visible after dismissal',
+ });
stepLog('Dismissed walkthrough after home route became ready');
}
diff --git a/app/test/e2e/specs/cron-jobs-flow.spec.ts b/app/test/e2e/specs/cron-jobs-flow.spec.ts
index fd3e298ebe..badceb8b1b 100644
--- a/app/test/e2e/specs/cron-jobs-flow.spec.ts
+++ b/app/test/e2e/specs/cron-jobs-flow.spec.ts
@@ -41,6 +41,7 @@ import { startMockServer, stopMockServer } from '../mock-server';
const USER_ID = 'e2e-cron-jobs';
const MORNING_BRIEFING = 'morning_briefing';
+const REMOVABLE_JOB = 'e2e_remove_me';
function stepLog(message: string, context?: unknown): void {
const stamp = new Date().toISOString();
@@ -211,11 +212,33 @@ describe('Cron jobs settings panel (real UI flow)', () => {
await waitForCronToggleLabel(morningBriefingId, 'Pause');
});
- it('clicking Remove deletes the job from both the UI and the sidecar', async function () {
+ it('clicking Remove deletes a user job from both the UI and the sidecar', async function () {
this.timeout(60_000);
- await clickTestId(`cron-job-remove-${morningBriefingId}`, 8_000);
+ // The morning_briefing is seeded asynchronously when onboarding completes.
+ // Removing that built-in job can race the seed task and recreate it, so
+ // exercise deletion against a user-created job instead.
+ const created = await callOpenhumanRpc('openhuman.cron_add', {
+ name: REMOVABLE_JOB,
+ schedule: { kind: 'cron', expr: '0 8 * * *' },
+ job_type: 'agent',
+ prompt: 'E2E disposable cron job',
+ });
+ expect(created.ok).toBe(true);
+ const createdJob = (created.result as { result?: { id?: string } } | undefined)?.result;
+ const removableJobId = createdJob?.id ?? '';
+ expect(removableJobId).toBeTruthy();
- // UI assertion first — the row should disappear and the empty state appear.
+ const disabled = await callOpenhumanRpc('openhuman.cron_update', {
+ job_id: removableJobId,
+ patch: { enabled: false },
+ });
+ expect(disabled.ok).toBe(true);
+
+ await clickCronRefresh();
+ await waitForTestId(`cron-job-row-${removableJobId}`, 20_000);
+ await clickTestId(`cron-job-remove-${removableJobId}`, 8_000);
+
+ // UI assertion first — the user-created row should disappear.
// The removal RPC + optimistic re-render can take longer on the slower macOS
// runner, so poll for up to 20s rather than 10s before declaring the row stuck.
const gone = await browser.waitUntil(
@@ -230,6 +253,6 @@ describe('Cron jobs settings panel (real UI flow)', () => {
expect(list.ok).toBe(true);
const inner = (list.result as { result?: unknown } | undefined)?.result ?? list.result;
const jobs = Array.isArray(inner) ? inner : [];
- expect(jobs.find((j: { name?: string }) => j?.name === MORNING_BRIEFING)).toBeUndefined();
+ expect(jobs.find((j: { name?: string }) => j?.name === REMOVABLE_JOB)).toBeUndefined();
});
});