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.

Ask: focus moves into Ask once it is ready, and tests follow the hidden sidebar

Eric Brownrout119b23e10666
diff --git a/app/e2e/chat.spec.ts b/app/e2e/chat.spec.ts
index d383bc64..5464364f 100644
--- a/app/e2e/chat.spec.ts
+++ b/app/e2e/chat.spec.ts
@@ -2,6 +2,7 @@ import { _electron as electron, expect, test, type ElectronApplication, type Pag
import { mkdtempSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
+import { revealSidebar } from './cornerNavigation'
const main = join(import.meta.dirname, '../out/main/index.js')
const zoom = { bundleId: 'us.zoom.xos', name: 'zoom.us' }
@@ -453,6 +454,7 @@ for (const width of [1100, 720]) test(`Command-J toggles Ask from any focus at $
await expect(page.getByTestId('chat-page-input')).toBeEditable()
await expect.poll(() => page.evaluate(() => window.yogurt.nav.current())).toMatch(/^\/chat\/.+/)
+ await revealSidebar(page)
await page.getByTestId('nav-chat').click()
await expect(page.getByTestId('chat-empty')).toBeVisible()
const field = page.locator('textarea#library-question')
diff --git a/app/e2e/commands.spec.ts b/app/e2e/commands.spec.ts
index eafcd850..1ae962af 100644
--- a/app/e2e/commands.spec.ts
+++ b/app/e2e/commands.spec.ts
@@ -115,7 +115,8 @@ test('the sidebar shortcut, native View menu, command palette and shortcut refer
})
await expect(toggle).toHaveAttribute('aria-expanded', 'true')
await expect(toggle).toHaveAttribute('aria-keyshortcuts', 'Control+Meta+S')
- await expect(toggle).toHaveAttribute('title', /⌃⌘S/)
+ await toggle.hover()
+ await expect(page.getByRole('tooltip', { name: 'Hide sidebar (⌃⌘S)', exact: true })).toBeVisible()
await expect.poll(menu).toEqual({ label: 'Hide Sidebar', accelerator: 'Control+Command+S', enabled: true })
await page.keyboard.press('Control+Meta+s')
await expect(toggle).toHaveAttribute('aria-expanded', 'false')
diff --git a/app/e2e/cornerNavigation.ts b/app/e2e/cornerNavigation.ts
index 418b3e62..efd0c860 100644
--- a/app/e2e/cornerNavigation.ts
+++ b/app/e2e/cornerNavigation.ts
@@ -1,7 +1,13 @@
import { expect, type Page } from '@playwright/test'
+export async function revealSidebar(page: Page) {
+ const panel = page.locator('#workspace-sidebar')
+ if (await panel.getAttribute('inert') !== null) await page.getByTestId('sidebar-expand').press('ArrowDown')
+ await expect(panel).toBeInViewport()
+}
+
export async function openFromCorner(page: Page, item: 'settings-open' | 'nav-trash') {
- if (await page.locator('#workspace-sidebar[inert]').count()) await page.getByTestId('sidebar-expand').press('ArrowDown')
+ await revealSidebar(page)
await page.getByTestId('corner-menu-button').click()
await page.getByTestId(item).click()
await expect(page.getByTestId('corner-menu')).toHaveCount(0)
diff --git a/app/e2e/emptyStates.spec.ts b/app/e2e/emptyStates.spec.ts
index 07672df0..ac1de0de 100644
--- a/app/e2e/emptyStates.spec.ts
+++ b/app/e2e/emptyStates.spec.ts
@@ -1,4 +1,4 @@
-import { openFromCorner } from './cornerNavigation'
+import { openFromCorner, revealSidebar } from './cornerNavigation'
import { _electron as electron, expect, test } from '@playwright/test'
import { mkdtempSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
@@ -45,10 +45,12 @@ for (const theme of ['light', 'dark'] as const) for (const width of [1200, 720])
await check('past-empty', 'meetings')
await openFromCorner(page, 'nav-trash')
await check('trash-none', 'trash')
+ await revealSidebar(page)
await page.getByTestId('folder-create').click()
await page.getByTestId('folder-name-input').fill('Projects')
await page.keyboard.press('Enter')
await check('folder-empty', 'folder')
+ await revealSidebar(page)
await page.getByTestId('nav-chat').click()
await expect(page.getByTestId('chat-page-box')).toBeVisible()
await page.emulateMedia({ colorScheme: theme, reducedMotion: 'no-preference' })
diff --git a/app/e2e/home.spec.ts b/app/e2e/home.spec.ts
index af203e54..97515fa9 100644
--- a/app/e2e/home.spec.ts
+++ b/app/e2e/home.spec.ts
@@ -306,10 +306,11 @@ test('meeting rows fill a laptop pane and stay centred in their own column throu
measure()
for (const open of [false, true]) {
toggle.dispatchEvent(new MouseEvent('click', { bubbles: true, detail: 1 }))
+ // The 200 ms UI timer and the grid transition can finish on different frames.
do {
await new Promise<void>(resolve => requestAnimationFrame(() => resolve()))
measure()
- } while (home.dataset.agendaMotion === 'true')
+ } while (home.dataset.agendaMotion === 'true' || home.getAnimations().length > 0)
if (toggle.getAttribute('aria-expanded') !== String(open)) throw new Error('Agenda did not toggle')
listWidths.push(list.getBoundingClientRect().width)
}
diff --git a/app/e2e/noteFooter.spec.ts b/app/e2e/noteFooter.spec.ts
index 30ba2c22..65cc5cd8 100644
--- a/app/e2e/noteFooter.spec.ts
+++ b/app/e2e/noteFooter.spec.ts
@@ -12,6 +12,14 @@ test('recording controls stay in the header and Ask lives in the footer with sta
const page = await app.firstWindow()
await expect(page.getByTestId('home')).toBeVisible()
await page.locator('#workspace-actions').getByRole('button', { name: 'Start recording', exact: true }).click()
+ const reminder = page.getByTestId('recording-reminder')
+ await reminder.hover()
+ await expect.poll(() => reminder.evaluate(el => {
+ const footer = document.querySelector('.note-footer-bar')
+ return !!footer && footer.getBoundingClientRect().bottom + 8 <= el.getBoundingClientRect().top
+ })).toBe(true)
+ await reminder.getByRole('button', { name: 'Close', exact: true }).click()
+ await expect(page.locator('.note-footer')).toHaveCSS('margin-block-end', '0px')
await expect(page.getByTestId('note-notes-tab')).toHaveAttribute('aria-selected', 'true')
await page.getByTestId('note-transcript-toggle').click()
const header = page.locator('.note-header'), controls = header.getByTestId('note-state')
diff --git a/app/src/renderer/src/screens/Note.tsx b/app/src/renderer/src/screens/Note.tsx
index c0f35b95..0e35de31 100644
--- a/app/src/renderer/src/screens/Note.tsx
+++ b/app/src/renderer/src/screens/Note.tsx
@@ -140,6 +140,7 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource, onResu
const [namingFolder, setNamingFolder] = useState(false)
/** the bounded reading area holds the chat beside the current view */
const [transcriptToolbar, setTranscriptToolbar] = useState<HTMLDivElement | null>(null)
+ const readingArea = useRef<HTMLDivElement>(null)
const [chatAnchor, setChatAnchor] = useState<HTMLDivElement | null>(null)
/** the notes as shown, for merging a new view from the app outside a state update */
const current = useRef<NoteView | undefined>(undefined)
@@ -357,7 +358,11 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource, onResu
}
return (
- <LoadingContent onReady={()=>document.dispatchEvent(new CustomEvent('audio-upload-note-ready',{detail:id}))} pending={false} skeleton={<Loading layout="note" />} className="loading-note-frame"><div data-testid="note" className="document-main relative flex h-full bg-bg">
+ <LoadingContent onReady={() => {
+ // A keyboard request can open Ask while the loading frame still hides the note.
+ setChatAnchor(readingArea.current)
+ document.dispatchEvent(new CustomEvent('audio-upload-note-ready', { detail: id }))
+ }} pending={false} skeleton={<Loading layout="note" />} className="loading-note-frame"><div data-testid="note" className="document-main relative flex h-full bg-bg">
{resumeConfirm && <Modal testId="resume-confirm" role="alertdialog" title={t('Record more in this note?')}
description={t('Your notes, transcript, and previous audio are kept. Your edited summary will be replaced when you stop recording.')}
onCancel={() => setResumeConfirm(false)}>
@@ -443,7 +448,7 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource, onResu
</div>
</header>
{readFailed && <InlineError testId="note-read-error" retry={retryRead} />}
- <div ref={setChatAnchor} className="note-reading-area">
+ <div ref={readingArea} className="note-reading-area">
<div ref={panels} className="note-panels">
<NoteReadingPane active={primary === 'notes'} summary={shown === 'enhanced'} generating={shown === 'enhanced' && ['waiting', 'rewriting', 'handoff', 'reset', 'streaming'].includes(summaryState)} resetting={shown === 'enhanced' && summaryState === 'reset'} writing={shown === 'enhanced' && summaryState === 'streaming'} scroll={readingScroll}>
{shown === 'mine' ? <Editor
diff --git a/app/test/resumeRequest.test.ts b/app/test/resumeRequest.test.ts
index 06fb2306..f1b45845 100644
--- a/app/test/resumeRequest.test.ts
+++ b/app/test/resumeRequest.test.ts
@@ -1,6 +1,7 @@
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
import { isValidElement, type ReactElement, type ReactNode } from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
+import { Ask } from '../src/renderer/src/components/Chat'
import { NoteMenu } from '../src/renderer/src/components/NoteMenu'
import { Note } from '../src/renderer/src/screens/Note'
import type { MeetingView, NoteView, SetupState } from '../src/shared/types'
@@ -43,10 +44,10 @@ async function render() {
}
for (let i = 0; i < 6; i++) await Promise.resolve()
}
-function find(node: ReactNode, id: string | typeof NoteMenu): ReactElement<Record<string, unknown>> | undefined {
+function find(node: ReactNode, id: string | typeof NoteMenu | typeof Ask): ReactElement<Record<string, unknown>> | undefined {
if (Array.isArray(node)) return node.map(child => find(child, id)).find(Boolean)
if (!isValidElement<Record<string, unknown>>(node)) return
- return node.type === id || node.props.id === id || node.props['data-testid'] === id || node.props.testId === id ? node : find(node.props.children as ReactNode, id)
+ return node.type === id || node.props.className === id || node.props.id === id || node.props['data-testid'] === id || node.props.testId === id ? node : find(node.props.children as ReactNode, id)
}
beforeEach(() => {
vi.clearAllMocks();meetingListeners.clear();meetingChanged=()=>meetingListeners.forEach(cb=>cb())
@@ -67,6 +68,21 @@ beforeEach(() => {
})
afterEach(() => { unmount(); vi.unstubAllGlobals() })
+it('waits for the recording note to be visible before mounting the Ask dialog into it', async () => {
+ meeting.state = 'recording'; requested = undefined
+ vi.stubGlobal('document', { dispatchEvent: vi.fn() })
+ await render(); await render()
+ const area = {} as HTMLDivElement
+ const ref = find(tree, 'note-reading-area')!.props.ref as { current: HTMLDivElement } | ((node: HTMLDivElement) => void)
+ if (typeof ref === 'function') ref(area)
+ else ref.current = area
+ await render()
+ expect(find(tree, Ask)!.props.anchor).toBeNull()
+ ;(find(tree, 'loading-note-frame')!.props.onReady as () => void)()
+ await render()
+ expect(find(tree, Ask)!.props.anchor).toBe(area)
+})
+
it('tints the note wave purple while recording, grey on pause, and purple again on resume', async () => {
meeting.state = 'recording'; requested = undefined
await render(); await render()