Skip to content

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

chore(e2e): remove cron jobs flow spec

Steven Enamakel2df4e6415960
diff --git a/app/scripts/e2e-merge-affected.sh b/app/scripts/e2e-merge-affected.sh
index 37079d9d8e..105aecde9e 100755
--- a/app/scripts/e2e-merge-affected.sh
+++ b/app/scripts/e2e-merge-affected.sh
@@ -18,7 +18,6 @@ run() {
run "test/e2e/specs/card-payment-flow.spec.ts" "card-payment"
run "test/e2e/specs/crypto-payment-flow.spec.ts" "crypto-payment"
run "test/e2e/specs/skill-execution-flow.spec.ts" "skill-execution"
-run "test/e2e/specs/cron-jobs-flow.spec.ts" "cron-jobs"
run "test/e2e/specs/notifications.spec.ts" "notifications"
run "test/e2e/specs/settings-channels-permissions.spec.ts" "settings-channels"
run "test/e2e/specs/settings-data-management.spec.ts" "settings-data"
diff --git a/app/scripts/e2e-run-all-flows.sh b/app/scripts/e2e-run-all-flows.sh
index f27b22c7ba..5e45462228 100755
--- a/app/scripts/e2e-run-all-flows.sh
+++ b/app/scripts/e2e-run-all-flows.sh
@@ -299,7 +299,6 @@ if should_run_suite "notifications"; then
echo ""
echo "## Running suite: notifications"
run "test/e2e/specs/notifications.spec.ts" "notifications" "notifications"
- run "test/e2e/specs/cron-jobs-flow.spec.ts" "cron-jobs" "notifications"
_mini_summary "notifications"
fi
diff --git a/app/test/e2e/specs/cron-jobs-flow.spec.ts b/app/test/e2e/specs/cron-jobs-flow.spec.ts
deleted file mode 100644
index 4eb3a09a02..0000000000
--- a/app/test/e2e/specs/cron-jobs-flow.spec.ts
+++ /dev/null
@@ -1,257 +0,0 @@
-// @ts-nocheck
-/**
- * Reference E2E spec — Settings → Cron Jobs through real UI clicks.
- *
- * This file is the template every other E2E spec should follow:
- *
- * 1. ONE Appium session for the whole run (see wdio.conf.ts). We never
- * restart the app between specs.
- * 2. Each spec starts with `await resetApp(<unique userId>)` which calls
- * the in-place `openhuman.test_reset` RPC, reloads the renderer, and
- * walks the real onboarding UI. After that the app is in the same
- * state a brand-new install would be in.
- * 3. The rest of the spec drives the product through real UI: clicks on
- * buttons, assertions on rendered text, navigation via the same
- * affordances a user would tap. Direct RPC calls are reserved for
- * *oracle* checks (verifying that a click actually persisted), not
- * for setting up or driving state.
- *
- * What this validates end-to-end (UI → coreRpcClient → Tauri relay → sidecar):
- * - `morning_briefing` is auto-seeded after onboarding completes.
- * - The Cron Jobs settings panel renders the seeded job with its
- * Pause / Run Now / View Runs / Remove affordances.
- * - Clicking "Pause" flips the row to "Resume" AND the change persists
- * across "Refresh Cron Jobs" — i.e. it went through the sidecar.
- * - Clicking "Remove" makes the row disappear and the list shows the
- * empty state. A final oracle `cron_list` RPC confirms the sidecar
- * agrees, but the *test* drove everything via the buttons.
- */
-import { waitForApp } from '../helpers/app-helpers';
-import { callOpenhumanRpc } from '../helpers/core-rpc';
-import {
- clickNativeButton,
- clickTestId,
- textExists,
- waitForTestId,
- waitForText,
-} from '../helpers/element-helpers';
-import { resetApp } from '../helpers/reset-app';
-import { navigateToSettings, navigateViaHash, waitForHomePage } from '../helpers/shared-flows';
-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();
- if (context === undefined) {
- console.log(`[CronJobsE2E][${stamp}] ${message}`);
- return;
- }
- console.log(`[CronJobsE2E][${stamp}] ${message}`, JSON.stringify(context, null, 2));
-}
-
-async function waitForCronPanel(timeoutMs = 5_000): Promise<void> {
- try {
- await waitForTestId('cron-jobs-panel', timeoutMs);
- } catch (error) {
- stepLog('cron panel test id unavailable, falling back to visible panel text', error);
- await waitForText('Scheduled Jobs', timeoutMs);
- }
-}
-
-async function clickCronRefresh(): Promise<void> {
- try {
- await clickTestId('cron-refresh');
- } catch (error) {
- stepLog('cron refresh test id unavailable, falling back to button text', error);
- await clickNativeButton('Refresh Cron Jobs');
- }
-}
-
-async function waitForCronToggleLabel(
- jobId: string,
- expectedLabel: 'Pause' | 'Resume',
- timeoutMs = 10_000
-): Promise<void> {
- const testId = `cron-job-toggle-${jobId}`;
- stepLog('waiting for cron toggle label', { jobId, expectedLabel, timeoutMs });
- await browser.waitUntil(
- async () => {
- // Reacquire on every poll because the toggle RPC replaces the job row
- // in React state and WebDriver element references can become stale.
- const toggle = await waitForTestId(testId, Math.min(timeoutMs, 2_000));
- // CoreJobList's icon-only button exposes this label through aria-label
- // and title rather than visible button text.
- return (await toggle.getAttribute('aria-label'))?.trim() === expectedLabel;
- },
- {
- timeout: timeoutMs,
- interval: 500,
- timeoutMsg: `${MORNING_BRIEFING} toggle never showed ${expectedLabel}`,
- }
- );
- stepLog('cron toggle label reached expected state', { jobId, expectedLabel });
-}
-
-/** Open the Cron Jobs settings panel via the same Settings entry-point a user clicks. */
-async function openCronJobsPanel(): Promise<void> {
- await navigateToSettings();
- await browser.pause(800);
- // The Cron Jobs panel is nested under Developer Options. Hash-nav is still
- // a click-equivalent under the hood (the router handles the route change
- // identically) — what matters for "real UI" is that the rendered panel is
- // the one the user lands on, not how we got there.
- await navigateViaHash('/settings/cron-jobs');
- await waitForText('Cron Jobs', 10_000);
- await waitForText('Scheduled Jobs', 5_000);
- await waitForCronPanel(5_000);
-}
-
-describe('Cron jobs settings panel (real UI flow)', () => {
- let morningBriefingId: string;
-
- before(async function () {
- // waitForApp() + resetApp() can exceed the default 30s Mocha hook budget.
- this.timeout(90_000);
- await startMockServer();
- await waitForApp();
- await resetApp(USER_ID);
- });
-
- after(async () => {
- await stopMockServer();
- });
-
- it('completing onboarding lands the user on the home screen', async () => {
- // `/home` redirects to `/chat` (AppRoutes.tsx), so the landed surface can render
- // either the CTA `home.askAssistant` ('Ask your assistant anything...') OR the
- // `home.statusOk` hero ('Your assistant is ready when you are. Type something below
- // to get started.'). Use the canonical waitForHomePage() helper — the same one
- // resetApp() and every other spec use — which accepts the full marker set, instead
- // of a stale subset that only matched the CTA and flaked on the slower macOS runner
- // whenever the statusOk hero rendered first.
- const home = await waitForHomePage(20_000);
- expect(home).toBeTruthy();
- });
-
- it('the seeded morning_briefing job appears in the Cron Jobs panel', async function () {
- this.timeout(60_000);
-
- // The morning_briefing cron is auto-seeded after onboarding completes.
- // If the async seed hasn't fired yet, seed it explicitly via RPC.
- const preCheck = await callOpenhumanRpc('openhuman.cron_list', {});
- expect(preCheck.ok).toBe(true);
- const preJobs = Array.isArray(preCheck.result?.result) ? preCheck.result.result : [];
- const existing = preJobs.find(
- (job: { id?: string; name?: string; enabled?: boolean }) => job?.name === MORNING_BRIEFING
- ) as { id?: string; enabled?: boolean } | undefined;
- morningBriefingId = existing?.id ?? '';
- if (!existing) {
- stepLog('morning_briefing not auto-seeded — seeding via cron_create');
- const seed = await callOpenhumanRpc('openhuman.cron_create', {
- name: MORNING_BRIEFING,
- schedule: '0 8 * * *',
- enabled: true,
- });
- expect(seed.ok).toBe(true);
- const seedResult = (seed.result as { result?: { id?: string } } | undefined)?.result;
- morningBriefingId = seedResult?.id ?? '';
- await browser.pause(1_000);
- } else if (!existing.enabled) {
- stepLog('morning_briefing is paused — enabling it for toggle assertions');
- const enable = await callOpenhumanRpc('openhuman.cron_update', {
- job_id: morningBriefingId,
- patch: { enabled: true },
- });
- expect(enable.ok).toBe(true);
- }
- expect(morningBriefingId).toBeTruthy();
-
- await openCronJobsPanel();
- // resetApp reloads the renderer without clearing the current hash. When a
- // previous spec left the app on this panel, its mount-time cron_list can
- // race ahead of the setup cron_update above and leave a stale paused row
- // in React state. Refresh explicitly so the UI reads the state we just
- // established before asserting or driving the toggle.
- await clickCronRefresh();
- await browser.pause(1_000);
- // The seed runs in a detached spawn_blocking task — poll for the row.
- try {
- await waitForTestId(`cron-job-row-${morningBriefingId}`, 20_000);
- } catch {
- stepLog('morning_briefing row never rendered — clicking Refresh and retrying');
- await clickCronRefresh();
- await browser.pause(1_500);
- await waitForTestId(`cron-job-row-${morningBriefingId}`, 10_000);
- }
- expect(await textExists(MORNING_BRIEFING)).toBe(true);
- // Assert the user-facing action for the enabled state. Appium's getText()
- // does not consistently aggregate descendant badge text from a row div,
- // while the dedicated toggle button is stable across all three drivers.
- await waitForCronToggleLabel(morningBriefingId, 'Pause');
- });
-
- it('clicking Pause flips the row to Resume and persists across Refresh', async function () {
- this.timeout(90_000);
-
- // The cron job.id is a generated UUID, not the job name. Target its stable
- // per-job test id so unrelated core jobs cannot receive the action.
- await clickTestId(`cron-job-toggle-${morningBriefingId}`, 15_000);
-
- await waitForCronToggleLabel(morningBriefingId, 'Resume');
-
- // Real UI persistence proof: refresh re-reads from the sidecar.
- await clickCronRefresh();
- await browser.pause(1_500);
- await waitForCronToggleLabel(morningBriefingId, 'Resume');
-
- // Restore so the next test starts from the enabled state.
- await clickTestId(`cron-job-toggle-${morningBriefingId}`, 8_000);
- await waitForCronToggleLabel(morningBriefingId, 'Pause');
- });
-
- it('clicking Remove deletes a user job from both the UI and the sidecar', async function () {
- this.timeout(60_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();
-
- 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(
- async () => !(await browser.$(`[data-testid="cron-job-row-${removableJobId}"]`).isExisting()),
- { timeout: 20_000, interval: 500, timeoutMsg: 'user-created cron row never disappeared' }
- );
- expect(gone).toBe(true);
-
- // Single oracle RPC: confirm the sidecar agrees with the UI.
- const list = await callOpenhumanRpc('openhuman.cron_list', {});
- 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 === REMOVABLE_JOB)).toBeUndefined();
- });
-});
diff --git a/docs/TEST-COVERAGE-MATRIX.md b/docs/TEST-COVERAGE-MATRIX.md
index b81c5320a4..68c0a00aa8 100644
--- a/docs/TEST-COVERAGE-MATRIX.md
+++ b/docs/TEST-COVERAGE-MATRIX.md
@@ -398,16 +398,16 @@ The thread JSONL store moved to `tinyagents_session::threads` (`vendor/tinyagent
| ID | Feature | Layer | Test path(s) | Status | Notes |
| ----- | ------------- | ----- | ------------------------ | ------ | ----- |
-| 9.1.1 | Task Creation | WD | `cron-jobs-flow.spec.ts` | ✅ | |
-| 9.1.2 | Task Update | WD | `cron-jobs-flow.spec.ts` | ✅ | |
-| 9.1.3 | Task Deletion | WD | `cron-jobs-flow.spec.ts` | ✅ | |
+| 9.1.1 | Task Creation | PW | `app/test/playwright/specs/cron-jobs-flow.spec.ts` | ✅ | Verifies an actual cron row and persisted state. |
+| 9.1.2 | Task Update | PW | `app/test/playwright/specs/cron-jobs-flow.spec.ts` | ✅ | Pause and resume persist across refresh. |
+| 9.1.3 | Task Deletion | PW | `app/test/playwright/specs/cron-jobs-flow.spec.ts` | ✅ | Remove action clears the row and RPC state. |
### 9.2 Cron Jobs
| ID | Feature | Layer | Test path(s) | Status | Notes |
| ----- | -------------------------- | ----- | ------------------------ | ------ | ----- |
| 9.2.1 | Cron Expression Validation | RU | `crates/openhuman-core/src/cron/` | ✅ | Incl. the 5-minute agent-job floor (`validate_agent_schedule`, #6158) |
-| 9.2.2 | Recurring Execution | WD+RI | `cron-jobs-flow.spec.ts` | ✅ | |
+| 9.2.2 | Recurring Execution | PW+RI | `app/test/playwright/specs/cron-jobs-flow.spec.ts` | ✅ | Covers cron state and runner wiring, not wall-clock scheduler execution. |
| 9.2.3 | Agent Job Transcript Isolation | RU | `crates/openhuman-core/src/cron/scheduler_transcript_isolation_tests.rs`, `agent/session_host/runtime_adapter_tests.rs` | ✅ | Cron orchestration suppresses transcript autoload; the session host consumes that override as `ResumeMode::Never` before dispatch. |
### 9.3 Remote Execution
@@ -415,7 +415,7 @@ The thread JSONL store moved to `tinyagents_session::threads` (`vendor/tinyagent
| ID | Feature | Layer | Test path(s) | Status | Notes |
| ----- | ----------------------- | ----- | ------------------------ | ------ | ------------------------ |
| 9.3.1 | Remote Agent Scheduling | RI | `tests/in_process/domain_modules_e2e.rs::cron_update_applies_a_partial_patch_without_clobbering_unset_fields` (CRUD); manual execution + history (`cron_run`/`cron_runs`) in `tests/raw_coverage/automation_scheduling_e2e.rs::cron_run_records_history_and_remove_is_not_idempotent` (live again: restored from the #6382 quarantine) | 🟡 | **Evidence corrected 2026-09-24; updated when the file was restored.** This row cited `tests/json_rpc_e2e.rs`, which contains **zero** occurrences of `cron` (verified with a positive control: 425 `openhuman.` matches in the same file). So "Coverage thin" was assessed against a file with no scheduling coverage at all. What is live is CRUD plus a manual `cron_run` with its history; nothing live asserts a scheduled agent job actually RUNS on its schedule (the scheduler tick), which is why this stays 🟡. |
-| 9.3.2 | Execution Trigger | WD | `cron-jobs-flow.spec.ts` | ✅ | |
+| 9.3.2 | Execution Trigger | PW | `app/test/playwright/specs/cron-jobs-flow.spec.ts` | ✅ | |
| 9.3.3 | Retry Handling | RU | `crates/openhuman-core/src/cron/` | 🟡 | Backoff branches partial |
### 9.4 Workflow Run History