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

46 lines
1.6 KiB
JavaScript

describe('Body - Gym (身体-健身)', () => {
beforeEach(() => {
cy.visit('/body', {
onBeforeLoad(win) {
win.localStorage.setItem('sp_login_expires', String(Date.now() + 86400000))
}
})
cy.get('.sub-tab').contains('健身').click()
})
it('shows gym section with add button', () => {
cy.contains('健身记录').should('be.visible')
cy.get('.btn-accent').should('contain', '记录')
})
it('opens add gym form', () => {
cy.get('.btn-accent').contains('记录').click()
cy.get('.edit-form').should('be.visible')
cy.get('.edit-form input[type="date"]').should('exist')
})
it('creates a gym record', () => {
cy.get('.btn-accent').contains('记录').click()
cy.get('.edit-form input').eq(1).type('跑步')
cy.get('.edit-form input').eq(2).type('30分钟')
cy.get('.edit-form input').eq(3).type('5公里')
cy.get('.btn-accent').contains('保存').click()
cy.get('.record-card').should('contain', '跑步')
cy.get('.record-card').should('contain', '30分钟')
})
it('deletes a gym record', () => {
cy.get('.btn-accent').contains('记录').click()
cy.get('.edit-form input').eq(1).type('待删除运动')
cy.get('.btn-accent').contains('保存').click()
cy.get('.record-card').contains('待删除运动').parent().find('.remove-btn').click()
cy.get('.record-card').should('not.contain', '待删除运动')
})
it('cancel button closes form', () => {
cy.get('.btn-accent').contains('记录').click()
cy.get('.btn-close').contains('取消').click()
cy.get('.edit-form').should('not.exist')
})
})