Skip to content

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

2.2 KB
Raw Blame
// @ts-nocheck
/**
 * Smoke spec — proves the unified Appium/CEF harness can:
 *
 *   1. Attach to the running app and produce a live WebDriver session.
 *   2. Drive the app from a clean slate through `resetApp(...)`:
 *      sidecar wipe → renderer reload → auth deep-link → onboarding walk.
 *   3. Land on `/home` with rendered React content (NOT a blank shell, NOT
 *      stuck behind BootCheckGate / onboarding / the login screen).
 *
 * Every other spec assumes this works — so when CI is red, look here first.
 */
import { waitForApp } from '../helpers/app-helpers';
import { callOpenhumanRpc } from '../helpers/core-rpc';
import { hasAppChrome } from '../helpers/element-helpers';
import { resetApp } from '../helpers/reset-app';
import { startMockServer, stopMockServer } from '../mock-server';

const USER_ID = 'e2e-smoke';

describe('Smoke', function () {
  this.timeout(120_000);

  before(async () => {
    await startMockServer();
    await waitForApp();
    await resetApp(USER_ID);
  });

  after(async () => {
    await stopMockServer();
  });

  it('has a live WebDriver session', async () => {
    const sessionId = browser.sessionId;
    expect(sessionId).toBeDefined();
    expect(typeof sessionId).toBe('string');
    expect(sessionId.length).toBeGreaterThan(0);
  });

  it('shows app chrome (window is mapped & visible)', async () => {
    expect(await hasAppChrome()).toBe(true);
  });

  it('renders a non-empty DOM in the main webview', async () => {
    const elements = await browser.$$('//*');
    expect(elements.length).toBeGreaterThan(0);
  });

  it('starts the embedded core normally and answers core.ping', async () => {
    const ping = await callOpenhumanRpc('core.ping', {});
    expect(ping.ok).toBe(true);
  });

  // NOTE: a permanently-`it.skip`ped "reaches a logged-in route after auth +
  // onboarding" test was removed here (plan.md §2.1) — it was skipped for a
  // documented but untracked/ownerless auth-deep-link→router flake and thus
  // read as coverage while never running. The three `it`s above (harness
  // attaches + window mapped + DOM rendered) are what smoke is for; the
  // logged-in-route journey is covered by the fuller flow specs.
});