Files
schedule-planner/frontend/cypress/e2e/navigation.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

72 lines
2.2 KiB
JavaScript

describe('Navigation & Routing', () => {
beforeEach(() => {
cy.visit('/', {
onBeforeLoad(win) {
win.localStorage.setItem('sp_login_expires', String(Date.now() + 86400000))
}
})
cy.get('header').should('be.visible')
})
it('default tab is 随手记', () => {
cy.get('.tab-btn').contains('随手记').should('have.class', 'active')
cy.url().should('eq', Cypress.config('baseUrl') + '/')
})
it('clicking tab navigates to correct route', () => {
const tabs = [
{ label: '待办', path: '/tasks' },
{ label: '提醒', path: '/reminders' },
{ label: '身体', path: '/body' },
{ label: '音乐', path: '/music' },
{ label: '文档', path: '/docs' },
{ label: '日程', path: '/planning' },
{ label: '随手记', path: '/' },
]
tabs.forEach(({ label, path }) => {
cy.get('.tab-btn').contains(label).click()
cy.url().should('include', path === '/' ? Cypress.config('baseUrl') : path)
cy.get('.tab-btn').contains(label).should('have.class', 'active')
})
})
it('direct URL access works for each route', () => {
const routes = ['/tasks', '/reminders', '/body', '/music', '/docs', '/planning']
routes.forEach(route => {
cy.visit(route, {
onBeforeLoad(win) {
win.localStorage.setItem('sp_login_expires', String(Date.now() + 86400000))
}
})
cy.get('header').should('be.visible')
})
})
it('back button works between tabs', () => {
cy.get('.tab-btn').contains('待办').click()
cy.url().should('include', '/tasks')
cy.get('.tab-btn').contains('提醒').click()
cy.url().should('include', '/reminders')
cy.go('back')
cy.url().should('include', '/tasks')
})
it('unknown route still renders the app (SPA fallback)', () => {
cy.visit('/nonexistent', {
onBeforeLoad(win) {
win.localStorage.setItem('sp_login_expires', String(Date.now() + 86400000))
}
})
cy.get('header').should('be.visible')
})
it('sleep buddy route works', () => {
cy.visit('/sleep-buddy', {
onBeforeLoad(win) {
win.localStorage.setItem('sp_login_expires', String(Date.now() + 86400000))
}
})
cy.contains('睡眠打卡').should('be.visible')
})
})