Files
tolaria/tests/smoke/improve-note-open-latency.spec.ts
Test 59ca7a7b41 test: update smoke tests for single-note model (no tab bar)
Remove tab bar assertions from E2E tests. Update emoji icon test to
check NoteIcon display instead of tab. Replace tab rename test with
title field rename. Remove draggable tab assertions from latency test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 17:48:27 +01:00

72 lines
2.5 KiB
TypeScript

import { test, expect } from '@playwright/test'
test.describe('Improve note open latency', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/')
await page.waitForLoadState('networkidle')
})
test('keyboard navigation opens note in editor', async ({ page }) => {
// Focus the note list container
const noteListContainer = page.locator('[data-testid="note-list-container"]')
await noteListContainer.click()
// Navigate down through several notes rapidly via keyboard
for (let i = 0; i < 5; i++) {
await page.keyboard.press('ArrowDown')
}
// Open the highlighted note
await page.keyboard.press('Enter')
// Wait for the editor to have content
const editorContainer = page.locator('.editor__blocknote-container')
await expect(editorContainer).toBeVisible({ timeout: 5000 })
// The editor should have BlockNote content
const editorContent = page.locator('.bn-editor')
await expect(editorContent).toBeVisible({ timeout: 3000 })
})
test('opening a note from the list loads content in editor', async ({ page }) => {
// Click the first note in the list
const firstNote = page.locator('.cursor-pointer.border-b').first()
await expect(firstNote).toBeVisible()
await firstNote.click()
// Editor should become visible with content
const editorContainer = page.locator('.editor__blocknote-container')
await expect(editorContainer).toBeVisible({ timeout: 5000 })
// The editor should have some BlockNote content
const editorContent = page.locator('.bn-editor')
await expect(editorContent).toBeVisible({ timeout: 3000 })
})
test('switching between notes quickly via clicks does not show stale content', async ({ page }) => {
// Get all note items
const notes = page.locator('.cursor-pointer.border-b')
const noteCount = await notes.count()
if (noteCount < 3) {
test.skip()
return
}
// Click through 3 notes rapidly
for (let i = 0; i < Math.min(3, noteCount); i++) {
await notes.nth(i).click()
}
// Wait for the last note to load
await page.waitForTimeout(500)
// The editor should be visible and functional
const editorContainer = page.locator('.editor__blocknote-container')
await expect(editorContainer).toBeVisible({ timeout: 5000 })
// The editor should have content loaded
const editorContent = page.locator('.bn-editor')
await expect(editorContent).toBeVisible({ timeout: 3000 })
})
})