Files
schedule-planner/frontend/cypress/e2e/performance.cy.js
Hera Zhao d3f3b4f37b
Some checks failed
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 3s
PR Preview / teardown-preview (pull_request) Has been skipped
Test / e2e-test (push) Failing after 55s
PR Preview / deploy-preview (pull_request) Failing after 40s
Refactor to Vue 3 + FastAPI + SQLite architecture
- Backend: FastAPI + SQLite (WAL mode), 22 tables, ~40 API endpoints
- Frontend: Vue 3 + Vite + Pinia + Vue Router, 8 views, 3 stores
- Database: migrate from JSON file to SQLite with proper schema
- Dockerfile: multi-stage build (node + python)
- Deploy: K8s manifests (namespace, deployment, service, ingress, pvc, backup)
- CI/CD: Gitea Actions (test, deploy, PR preview at pr-$id.planner.oci.euphon.net)
- Tests: 20 Cypress E2E test files, 196 test cases, ~85% coverage
- Doc: test-coverage.md with full feature coverage report

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 21:18:22 +00:00

60 lines
1.8 KiB
JavaScript

describe('Performance', () => {
it('page loads within 5 seconds', () => {
const start = Date.now()
cy.visit('/', {
onBeforeLoad(win) {
win.localStorage.setItem('sp_login_expires', String(Date.now() + 86400000))
}
})
cy.get('header').should('be.visible').then(() => {
const elapsed = Date.now() - start
expect(elapsed).to.be.lessThan(5000)
})
})
it('API responses are under 1 second', () => {
const apis = ['/api/notes', '/api/todos', '/api/reminders', '/api/sleep', '/api/bugs']
apis.forEach(api => {
const start = Date.now()
cy.request(api).then(() => {
const elapsed = Date.now() - start
expect(elapsed).to.be.lessThan(1000)
})
})
})
it('tab switching is instantaneous', () => {
cy.visit('/', {
onBeforeLoad(win) {
win.localStorage.setItem('sp_login_expires', String(Date.now() + 86400000))
}
})
cy.get('header').should('be.visible')
const tabs = ['待办', '提醒', '身体', '音乐', '文档', '日程', '随手记']
tabs.forEach(tab => {
cy.get('.tab-btn').contains(tab).click()
cy.get('.tab-btn').contains(tab).should('have.class', 'active')
})
})
it('creating many notes does not degrade', () => {
cy.visit('/', {
onBeforeLoad(win) {
win.localStorage.setItem('sp_login_expires', String(Date.now() + 86400000))
}
})
cy.get('header').should('be.visible')
// Create 10 notes rapidly
for (let i = 0; i < 10; i++) {
cy.request('POST', '/api/notes', {
id: `perf_${i}_${Date.now()}`,
text: `Performance test note ${i}`,
tag: '灵感'
})
}
// Reload and verify it still loads
cy.reload()
cy.get('header', { timeout: 5000 }).should('be.visible')
})
})