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.

Tests: end-to-end tests open the app's database with a busy timeout, so a write while the app is writing waits instead of failing with "database is locked"

christianmatd96049c046cb
diff --git a/app/e2e/autosave.spec.ts b/app/e2e/autosave.spec.ts
index dd044333..a05c6e58 100644
--- a/app/e2e/autosave.spec.ts
+++ b/app/e2e/autosave.spec.ts
@@ -16,7 +16,7 @@ async function launch(env: Record<string, string> = {}) {
await page.getByTestId('past-note').click()
await expect(page.getByTestId('note-enhanced')).toBeVisible()
const id = (await page.evaluate(() => window.yogurt.nav.current())).slice('/note/'.length)
- const db = new DatabaseSync(join(userData, 'yogurt.db'))
+ const db = new DatabaseSync(join(userData, 'yogurt.db'), { timeout: 5000 })
return { app, page, db, id }
}
const failWrites = (db: DatabaseSync) => db.exec("CREATE TRIGGER test_note_write_failure BEFORE INSERT ON notes BEGIN SELECT RAISE(FAIL, 'test note write failure'); END")
diff --git a/app/e2e/home.spec.ts b/app/e2e/home.spec.ts
index 1b038317..6f7fb558 100644
--- a/app/e2e/home.spec.ts
+++ b/app/e2e/home.spec.ts
@@ -36,7 +36,7 @@ async function prepareCalendarNote(page: Page, title: string) {
test('meeting rows show captured duration, excluding gaps, only after recording finishes', async () => {
const { app, page, userData } = await launch()
- const db = new DatabaseSync(join(userData, 'yogurt.db'))
+ const db = new DatabaseSync(join(userData, 'yogurt.db'), { timeout: 5000 })
try {
await fake(app, 'manyMeetings', 6)
db.prepare("UPDATE meetings SET duration_ms = ?, ended_at = started_at + ? WHERE title = 'Budget review'").run(32 * 60_000, 2 * 24 * 60 * 60_000)
diff --git a/app/e2e/note.spec.ts b/app/e2e/note.spec.ts
index bad502f4..8a624742 100644
--- a/app/e2e/note.spec.ts
+++ b/app/e2e/note.spec.ts
@@ -42,7 +42,7 @@ const heard = (page: Page, id: string) => expect.poll(async () => (await page.ev
test('Stop ends recording when its metadata cannot save, and Retry saves without stopping twice', async () => {
const { app, page, userData } = await launch()
- const db = new DatabaseSync(join(userData, 'yogurt.db'))
+ const db = new DatabaseSync(join(userData, 'yogurt.db'), { timeout: 5000 })
try {
const id = await record(app, page)
await page.getByTestId('note-mine').fill('Remember to send the launch plan.')
diff --git a/app/e2e/rewriteRecovery.spec.ts b/app/e2e/rewriteRecovery.spec.ts
index d66fac52..18f1d8ea 100644
--- a/app/e2e/rewriteRecovery.spec.ts
+++ b/app/e2e/rewriteRecovery.spec.ts
@@ -23,7 +23,7 @@ async function launch() {
await page.getByTestId('past-note').click()
await expect(page.getByTestId('note-enhanced')).toBeVisible()
const id = (await page.evaluate(() => window.yogurt.nav.current())).slice('/note/'.length)
- const db = new DatabaseSync(join(userData, 'yogurt.db'))
+ const db = new DatabaseSync(join(userData, 'yogurt.db'), { timeout: 5000 })
return { app, page, id, db, out }
}
const fail = (db: DatabaseSync) => db.exec("CREATE TRIGGER test_rewrite_failure BEFORE INSERT ON notes BEGIN SELECT RAISE(FAIL, 'rewrite save failed'); END")
diff --git a/app/e2e/speakerColors.spec.ts b/app/e2e/speakerColors.spec.ts
index 1f2dae08..6c69a86f 100644
--- a/app/e2e/speakerColors.spec.ts
+++ b/app/e2e/speakerColors.spec.ts
@@ -20,7 +20,7 @@ for (const theme of ['light', 'dark'] as const) test(`speaker colours agree acro
await page.getByRole('button', { name: 'Start recording', exact: true }).click()
await expect(page.getByTestId('note-state')).toHaveAttribute('data-state', 'recording')
const id = await page.evaluate(async () => (await window.yogurt.nav.current()).slice('/note/'.length))
- db = new DatabaseSync(join(userData, 'yogurt.db'))
+ db = new DatabaseSync(join(userData, 'yogurt.db'), { timeout: 5000 })
const insert = db.prepare('INSERT INTO segments(meeting_id,track,start_ms,end_ms,text,speaker) VALUES(?,?,?,?,?,?)')
// These first appearances are outside the preview's initial 80-line slice.
for (let i = 0; i < names.length; i++) insert.run(id, 'them', 100000 + i * 3000, 101000 + i * 3000, 'Earlier discussion.', names[i])
diff --git a/app/e2e/transcriptEcho.spec.ts b/app/e2e/transcriptEcho.spec.ts
index ac478f1f..63441096 100644
--- a/app/e2e/transcriptEcho.spec.ts
+++ b/app/e2e/transcriptEcho.spec.ts
@@ -12,7 +12,7 @@ test('the mic copy of the call (an echo) is simply left out of the transcript, w
const page = await app.firstWindow()
await expect(page.getByTestId('home')).toBeVisible()
const id = await app.evaluate(() => (globalThis as any).__fake__.bigMeeting(1)) as string
- db = new DatabaseSync(join(userData, 'yogurt.db'))
+ db = new DatabaseSync(join(userData, 'yogurt.db'), { timeout: 5000 })
db.prepare('DELETE FROM segments WHERE meeting_id=?').run(id)
const add = db.prepare('INSERT INTO segments(meeting_id,track,start_ms,end_ms,text,speaker,hidden) VALUES(?,?,?,?,?,?,?)')
for (const [i, hidden] of [false, true, true, false, true].entries()) add.run(id, hidden ? 'me' : 'them', i * 3000, i * 3000 + 1000, `Speech ${i}`, null, Number(hidden))
diff --git a/app/test/e2eDatabase.test.ts b/app/test/e2eDatabase.test.ts
new file mode 100644
index 00000000..ef19d08c
--- /dev/null
+++ b/app/test/e2eDatabase.test.ts
@@ -0,0 +1,16 @@
+import { describe, expect, it } from 'vitest'
+import { readdirSync, readFileSync } from 'node:fs'
+import { join } from 'node:path'
+
+// End-to-end tests open the app's own database next to the running app. Without a busy timeout a test's write fails
+// at once with "database is locked" whenever the app happens to be writing, which flaked CI (autosave.spec.ts).
+describe('end-to-end tests open the app database patiently', () => {
+ it('every connection to a running app\'s yogurt.db has a busy timeout', () => {
+ const dir = join(__dirname, '../e2e')
+ const bare = readdirSync(dir).filter((f) => f.endsWith('.ts'))
+ .flatMap((f) => readFileSync(join(dir, f), 'utf8').split('\n').map((l, i) => ({ f, i, l })))
+ .filter(({ l }) => /new DatabaseSync\(join\(userData, 'yogurt\.db'\)\)/.test(l))
+ .map(({ f, i }) => `${f}:${i + 1}`)
+ expect(bare).toEqual([])
+ })
+})