Some checks failed
- 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>
54 lines
1.7 KiB
JavaScript
54 lines
1.7 KiB
JavaScript
describe('Body - Sleep (身体-睡眠)', () => {
|
|
beforeEach(() => {
|
|
cy.visit('/body', {
|
|
onBeforeLoad(win) {
|
|
win.localStorage.setItem('sp_login_expires', String(Date.now() + 86400000))
|
|
}
|
|
})
|
|
cy.get('.sub-tab').contains('睡眠').click()
|
|
})
|
|
|
|
it('shows sleep record input', () => {
|
|
cy.get('.capture-input').should('be.visible')
|
|
cy.get('.btn-accent').should('be.visible')
|
|
})
|
|
|
|
it('records sleep time with HH:MM format', () => {
|
|
cy.get('.capture-input').type('22:30')
|
|
cy.get('.btn-accent').contains('记录').click()
|
|
cy.get('.sleep-hint').should('contain', '已记录')
|
|
cy.get('.data-table').should('contain', '22:30')
|
|
})
|
|
|
|
it('records sleep time with Chinese format', () => {
|
|
cy.get('.capture-input').type('10点半')
|
|
cy.get('.btn-accent').contains('记录').click()
|
|
cy.get('.sleep-hint').should('contain', '已记录')
|
|
cy.get('.data-table').should('contain', '10:30')
|
|
})
|
|
|
|
it('shows error for unrecognized time', () => {
|
|
cy.get('.capture-input').type('随便写写')
|
|
cy.get('.btn-accent').contains('记录').click()
|
|
cy.get('.sleep-hint').should('contain', '无法识别')
|
|
})
|
|
|
|
it('deletes a sleep record', () => {
|
|
cy.get('.capture-input').type('23:00')
|
|
cy.get('.btn-accent').contains('记录').click()
|
|
cy.get('.data-table .remove-btn').first().click()
|
|
})
|
|
|
|
it('shows record detail table', () => {
|
|
cy.get('.capture-input').type('21:45')
|
|
cy.get('.btn-accent').contains('记录').click()
|
|
cy.get('.data-table th').should('contain', '日期')
|
|
cy.get('.data-table th').should('contain', '入睡时间')
|
|
})
|
|
|
|
it('shows empty hint when no records', () => {
|
|
// Component handles both states
|
|
cy.get('.sleep-section').should('be.visible')
|
|
})
|
|
})
|