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>
71 lines
2.6 KiB
JavaScript
71 lines
2.6 KiB
JavaScript
describe('Body - Health Check-in (身体-健康打卡)', () => {
|
|
beforeEach(() => {
|
|
cy.visit('/body', {
|
|
onBeforeLoad(win) {
|
|
win.localStorage.setItem('sp_login_expires', String(Date.now() + 86400000))
|
|
}
|
|
})
|
|
cy.get('header').should('be.visible')
|
|
})
|
|
|
|
it('shows 4 sub tabs', () => {
|
|
cy.get('.sub-tab').should('have.length', 4)
|
|
cy.get('.sub-tab').eq(0).should('contain', '健康打卡')
|
|
cy.get('.sub-tab').eq(1).should('contain', '睡眠')
|
|
cy.get('.sub-tab').eq(2).should('contain', '健身')
|
|
cy.get('.sub-tab').eq(3).should('contain', '经期')
|
|
})
|
|
|
|
it('defaults to health check-in tab', () => {
|
|
cy.get('.sub-tab').contains('健康打卡').should('have.class', 'active')
|
|
})
|
|
|
|
it('shows today date and check-in section', () => {
|
|
cy.get('.section-header').should('contain', '今日打卡')
|
|
cy.get('.date-label').should('not.be.empty')
|
|
})
|
|
|
|
it('adds a health item to pool', () => {
|
|
cy.get('.add-row input').type('维生素D')
|
|
cy.get('.add-row .btn-accent').click()
|
|
cy.get('.pool-item').should('contain', '维生素D')
|
|
})
|
|
|
|
it('toggles item into/out of monthly plan', () => {
|
|
cy.get('.add-row input').type('益生菌')
|
|
cy.get('.add-row .btn-accent').click()
|
|
cy.get('.pool-item').contains('益生菌').click()
|
|
// Item should now appear in today checkin grid
|
|
cy.get('.checkin-item').should('contain', '益生菌')
|
|
})
|
|
|
|
it('checks in a health item', () => {
|
|
cy.get('.add-row input').type('打卡测试项')
|
|
cy.get('.add-row .btn-accent').click()
|
|
cy.get('.pool-item').contains('打卡测试项').click()
|
|
cy.get('.checkin-item').contains('打卡测试项').click()
|
|
cy.get('.checkin-item').contains('打卡测试项').should('have.class', 'checked')
|
|
})
|
|
|
|
it('unchecks a health item', () => {
|
|
cy.get('.add-row input').type('取消打卡项')
|
|
cy.get('.add-row .btn-accent').click()
|
|
cy.get('.pool-item').contains('取消打卡项').click()
|
|
cy.get('.checkin-item').contains('取消打卡项').click()
|
|
cy.get('.checkin-item').contains('取消打卡项').should('have.class', 'checked')
|
|
cy.get('.checkin-item').contains('取消打卡项').click()
|
|
cy.get('.checkin-item').contains('取消打卡项').should('not.have.class', 'checked')
|
|
})
|
|
|
|
it('deletes a health item from pool', () => {
|
|
cy.get('.add-row input').type('删除测试项')
|
|
cy.get('.add-row .btn-accent').click()
|
|
cy.get('.pool-item').contains('删除测试项').parent().find('.remove-btn').click()
|
|
cy.get('.pool-item').should('not.contain', '删除测试项')
|
|
})
|
|
|
|
it('shows empty hint when no plan items', () => {
|
|
cy.get('.body-layout').should('be.visible')
|
|
})
|
|
})
|