Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

2.4 KB
Raw Blame
import { _electron as electron, expect, test, type ElectronApplication, type Page } from '@playwright/test'
import { mkdtempSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'

const main = join(import.meta.dirname, '../out/main/index.js')
const zoom = { bundleId: 'us.zoom.xos', name: 'zoom.us' }
const fake = (app: ElectronApplication, fn: string, arg?: unknown) =>
  app.evaluate((_e, [fn, arg]) => (globalThis as unknown as Record<string, Record<string, (a?: unknown) => unknown>>).__fake__[fn as string](arg), [fn, arg] as const)
const windowOf = async (app: ElectronApplication, hash: string): Promise<Page> => {
  for (let i = 0; i < 100; i++) {
    const w = app.windows().find((p) => p.url().includes(hash))
    if (w) return w
    await new Promise((r) => setTimeout(r, 50))
  }
  throw new Error(`no ${hash} window`)
}

// #30: a meeting recorded before the speech model was in is transcribed from its saved recording once the model is
test('a meeting with audio and no transcript is transcribed from its recording', async () => {
  const userData = mkdtempSync(join(tmpdir(), 'yogurt-e2e-'))
  const app = await electron.launch({ args: [main], env: { ...process.env, YOGURT_FAKE: '1', YOGURT_USER_DATA: userData } })
  try {
    const page = await app.firstWindow()
    await expect(page.getByTestId('home')).toBeVisible()
    await fake(app, 'signals', { micApps: [zoom], events: [] })
    await (await windowOf(app, '#prompt')).getByTestId('prompt-take-notes').click()
    await expect(page.getByTestId('note-state')).toHaveAttribute('data-state', 'recording')
    // the fixture says its four lines in about 15 s
    await page.waitForTimeout(16_000)
    await page.getByTestId('note-stop').click()
    await expect(page.getByTestId('note-state')).not.toHaveAttribute('data-state', 'recording')
    await fake(app, 'untranscribe')
    await page.getByTestId('note-transcript-toggle').click()
    await page.reload()
    await expect(page.getByTestId('transcript-bubble')).toHaveCount(0)
    await fake(app, 'transcribeWaiting')
    await page.reload()
    await page.getByTestId('note-transcript-toggle').click().catch(() => {})
    await expect(page.getByTestId('transcript-text').first()).toBeVisible({ timeout: 20_000 })
    await expect(page.getByTestId('transcript-text').filter({ hasText: 'launch plan' })).toHaveCount(1)
  } finally { await app.close() }
})