guanghu/tests/smoke/improve-note-open-latency.spec.ts
Guanghu Domestic Migration 9b41d51231
Some checks are pending
Auto-update PR branches / Update open PR branches (push) Waiting to run
CI / Frontend Static Quality Checks (push) Waiting to run
CI / Frontend Tests & Coverage (push) Waiting to run
CI / Rust Tests & Quality Checks (push) Waiting to run
CI / Linux build verification (push) Waiting to run
Deploy docs / Build VitePress site (push) Waiting to run
Deploy docs / Deploy to GitHub Pages (push) Blocked by required conditions
Release (Alpha) / Compute alpha version (push) Waiting to run
Release (Alpha) / Build release artifacts (push) Blocked by required conditions
Release (Alpha) / GitHub Release (alpha) (push) Blocked by required conditions
Release (Alpha) / Update docs and release pages (push) Blocked by required conditions
chore: import sanitized domestic snapshot for REPO-004
Source snapshot: 514ab1975951d94342ea38e64101d5a0f1c51c77
2026-07-17 15:55:28 +08: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: 8000 })
// 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: 8000 })
// 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: 8000 })
// The editor should have content loaded
const editorContent = page.locator('.bn-editor')
await expect(editorContent).toBeVisible({ timeout: 3000 })
})
})