Skip to content

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

test(cron): update cron job panel tests

Steven Enamakelc5d30d6a1cc6
diff --git a/app/test/playwright/specs/cron-jobs-flow.spec.ts b/app/test/playwright/specs/cron-jobs-flow.spec.ts
index 3f95215d3f..1cf48db2b5 100644
--- a/app/test/playwright/specs/cron-jobs-flow.spec.ts
+++ b/app/test/playwright/specs/cron-jobs-flow.spec.ts
@@ -2,8 +2,6 @@ import { expect, test } from '@playwright/test';
import { bootAuthenticatedPage, callCoreRpc, waitForAppReady } from '../helpers/core-rpc';
-const MORNING_BRIEFING = 'morning_briefing';
-
async function openCronJobsPanel(page: import('@playwright/test').Page): Promise<void> {
await page.goto('/#/settings/cron-jobs');
await waitForAppReady(page);
@@ -24,20 +22,40 @@ test.describe('Cron jobs settings panel', () => {
await expect(page.getByTestId('chat-message-input')).toBeVisible();
});
- test('cron jobs panel renders in the browser lane and surfaces the current fallback state', async ({
- page,
- }) => {
+ test('a cron row toggles, persists after refresh, and can be removed', async ({ page }) => {
+ const name = 'e2e_runner_consolidation';
+ const created = (await callCoreRpc<unknown>('openhuman.cron_add', {
+ name,
+ schedule: { kind: 'cron', expr: '0 8 * * *' },
+ job_type: 'agent',
+ prompt: 'Disposable runner ownership fixture',
+ })) as { result?: { id?: string } };
+ const jobId = created.result?.id;
+ expect(jobId, 'cron_add returns the created row id').toBeTruthy();
await openCronJobsPanel(page);
- await expect
- .poll(async () => {
- const text = await page.locator('#root').innerText();
- return [
- 'Failed to load core cron jobs: Not running in Tauri',
- 'No core cron jobs found.',
- MORNING_BRIEFING,
- ].some(marker => text.includes(marker));
- })
- .toBe(true);
+ const row = page.getByTestId(`cron-job-row-${jobId}`);
+ const toggle = page.getByTestId(`cron-job-toggle-${jobId}`);
+ const remove = page.getByTestId(`cron-job-remove-${jobId}`);
+
+ await expect(row).toBeVisible();
+ await expect(toggle).toHaveAttribute('aria-label', 'Pause');
+ await toggle.click();
+ await expect(toggle).toHaveAttribute('aria-label', 'Resume');
+ await page.getByTestId('cron-refresh').click();
+ await expect(toggle).toHaveAttribute('aria-label', 'Resume');
+ await toggle.click();
+ await expect(toggle).toHaveAttribute('aria-label', 'Pause');
+
+ await remove.click();
+ await expect(row).toHaveCount(0);
+ const listed = (await callCoreRpc<unknown>('openhuman.cron_list', {})) as unknown;
+ const jobs = Array.isArray(listed)
+ ? listed
+ : listed && typeof listed === 'object' && 'result' in listed
+ ? (listed as { result: unknown }).result
+ : listed;
+ expect(Array.isArray(jobs), 'cron_list returns rows after removal').toBe(true);
+ expect((jobs as Array<{ id?: string }>).some(job => job.id === jobId)).toBe(false);
});
test('refresh action is visible in the cron jobs panel', async ({ page }) => {