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.

fix load tests

Elton C. Rego4915e9856f8e
diff --git a/app/e2e/askFocus.spec.ts b/app/e2e/askFocus.spec.ts
index 51f87e9d..12fae52e 100644
--- a/app/e2e/askFocus.spec.ts
+++ b/app/e2e/askFocus.spec.ts
@@ -32,9 +32,10 @@ async function keepsFocus(page: Page, prefix: string) {
await expect(page.getByTestId('chat-copy-answer').last()).toBeFocused()
}
+// pieces slow enough that a slow machine still sees an answer while it is being written
async function launch(name: string) {
const app = await electron.launch({ args: [main], env: {
- ...process.env, YOGURT_FAKE: '1', YOGURT_FAKE_LLM_MS: '60', YOGURT_USER_DATA: mkdtempSync(join(tmpdir(), `yogurt-${name}-`)),
+ ...process.env, YOGURT_FAKE: '1', YOGURT_FAKE_LLM_MS: '300', YOGURT_USER_DATA: mkdtempSync(join(tmpdir(), `yogurt-${name}-`)),
} })
const page = await app.firstWindow()
await expect(page.getByTestId('home')).toBeVisible()
diff --git a/app/e2e/chat.spec.ts b/app/e2e/chat.spec.ts
index ce5f7207..1db3cc1a 100644
--- a/app/e2e/chat.spec.ts
+++ b/app/e2e/chat.spec.ts
@@ -159,8 +159,8 @@ test('asking about a finished meeting streams the answer in, word by word, and i
})
test('opening Ask on a meeting reads it in ahead, and a question says what it is doing until the answer starts', async () => {
- // a slow first word, so each step can be seen
- const { app, page } = await launch({ YOGURT_FAKE_LLM_MS: '4500' })
+ // a first word well after the 4s step tick, so a slow machine still sees each step
+ const { app, page } = await launch({ YOGURT_FAKE_LLM_MS: '8000' })
try {
const id = await fake<string>(app, 'bigMeeting', 12)
await fake(app, 'go', `/note/${id}`)
diff --git a/app/e2e/commands.spec.ts b/app/e2e/commands.spec.ts
index d2197ed4..faafc270 100644
--- a/app/e2e/commands.spec.ts
+++ b/app/e2e/commands.spec.ts
@@ -48,8 +48,10 @@ test('the sidebar shortcut, native View menu, command palette and shortcut refer
await expect(toggle).toHaveAttribute('aria-expanded', 'false')
await page.keyboard.press('Escape')
await expect(page.getByTestId('shortcuts-dialog')).toHaveCount(0)
+ // innerWidth changes before the resize event lands, so wait for the event or it can close the sidebar opened below
+ await page.evaluate(() => { (window as unknown as { narrowed: Promise<void> }).narrowed = new Promise(done => addEventListener('resize', function on() { if (innerWidth === 720) { removeEventListener('resize', on); done() } })) })
await app.evaluate(({ BrowserWindow }) => BrowserWindow.getAllWindows().find(w => !w.webContents.getURL().includes('#'))!.setSize(720, 520))
- await expect.poll(() => page.evaluate(() => innerWidth)).toBe(720)
+ await page.evaluate(() => (window as unknown as { narrowed: Promise<void> }).narrowed)
await expect(toggle).toHaveAttribute('aria-expanded', 'false')
await page.keyboard.press('Control+Meta+s')
await expect(toggle).toHaveAttribute('aria-expanded', 'true')
diff --git a/app/e2e/summaryRim.spec.ts b/app/e2e/summaryRim.spec.ts
index 31866cba..846dba9f 100644
--- a/app/e2e/summaryRim.spec.ts
+++ b/app/e2e/summaryRim.spec.ts
@@ -40,6 +40,7 @@ for (const theme of ['light', 'dark'] as const) for (const width of [420, 860])
await expect(page.locator('.note-reading-frame')).toBeHidden()
expect(await rim.evaluate(el => getComputedStyle(el, '::before').animationPlayState)).toBe('paused')
await page.getByTestId('note-summary-tab').click()
+ await expect(page.locator('.note-reading-frame')).toHaveAttribute('data-active', 'true')
await pane.evaluate(el => { el.dispatchEvent(new WheelEvent('wheel', { deltaY: -400 })); el.scrollTop = 100 })
await expect(latest).toBeVisible()
await push('writing', text(22))
diff --git a/app/e2e/windowChrome.spec.ts b/app/e2e/windowChrome.spec.ts
index 21da426d..690dd05a 100644
--- a/app/e2e/windowChrome.spec.ts
+++ b/app/e2e/windowChrome.spec.ts
@@ -21,7 +21,7 @@ test('glass is limited to chrome, with solid reading surfaces and a reduced-tran
{ name: 'prefers-contrast', value: 'no-preference' },
] })
const chrome = await page.locator('.workspace').evaluate(el => ({ background: getComputedStyle(el).backgroundColor, opacity: getComputedStyle(el).opacity }))
- expect(chrome.background).toContain('0.6')
+ expect(chrome.background).toContain('0.85')
expect(chrome.opacity).toBe('1')
for (const selector of ['html', 'body', '#root', '[data-testid=app-shell]']) {
expect(await page.locator(selector).evaluate(el => getComputedStyle(el).backgroundColor)).toBe('rgba(0, 0, 0, 0)')
diff --git a/app/src/renderer/src/followLatest.ts b/app/src/renderer/src/followLatest.ts
index 13c2737d..27591552 100644
--- a/app/src/renderer/src/followLatest.ts
+++ b/app/src/renderer/src/followLatest.ts
@@ -2,20 +2,25 @@ import { followGlide } from './motion'
/** Shared by growing answers and summaries; an idle or hidden pane schedules no work. */
export function attachFollowLatest(el: HTMLElement, body: HTMLElement, stuck: { current: boolean }, behind: (value: boolean) => void) {
- let glide: ReturnType<typeof followGlide> | undefined
+ let glide: ReturnType<typeof followGlide> | undefined, last = el.scrollTop
const stop = () => { glide?.stop(); glide = undefined }
const report = () => behind(el.scrollHeight - el.scrollTop - el.clientHeight >= 24)
const follow = () => {
if (document.hidden || !el.clientHeight) return
if (stuck.current) {
if (glide?.active) glide.to(Math.max(0, el.scrollHeight - el.clientHeight))
- else el.scrollTop = el.scrollHeight
+ else { el.scrollTop = el.scrollHeight; last = el.scrollTop }
}
report()
}
+ // The scroll event lands a frame after we set scrollTop, by which time the body may have grown again,
+ // so only a move up can stop following and only reaching the bottom can resume it.
const scroll = () => {
+ const up = el.scrollTop < last
+ last = el.scrollTop
if (glide?.active) return
- stuck.current = el.scrollHeight - el.scrollTop - el.clientHeight < 24
+ const near = el.scrollHeight - el.scrollTop - el.clientHeight < 24
+ if (up || near) stuck.current = near
report()
}
const touch = () => { stop() }
diff --git a/app/test/followLatest.test.ts b/app/test/followLatest.test.ts
index fae136c3..7b444c2e 100644
--- a/app/test/followLatest.test.ts
+++ b/app/test/followLatest.test.ts
@@ -83,3 +83,10 @@ it('does not move a collapsed pane', () => {
expect(pane.scrollTop).toBe(800)
follow.dispose()
})
+it('keeps following when the body grows again before the scroll from the last follow lands', () => {
+ const { pane, state, follow } = setup()
+ pane.scrollHeight = 1400; Resize.current.change(); pane.scrollHeight = 2000
+ pane.dispatchEvent(new Event('scroll')); expect(state.current).toBe(true)
+ Resize.current.change(); expect(pane.scrollTop).toBe(1600)
+ follow.dispose()
+})