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

describe('Body - Period (身体-经期)', () => {
beforeEach(() => {
cy.visit('/body', {
onBeforeLoad(win) {
win.localStorage.setItem('sp_login_expires', String(Date.now() + 86400000))
}
})
cy.get('.sub-tab').contains('经期').click()
})
it('shows period section with add button', () => {
cy.contains('经期记录').should('be.visible')
cy.get('.btn-accent').should('contain', '记录')
})
it('opens add period form', () => {
cy.get('.btn-accent').contains('记录').click()
cy.get('.edit-form').should('be.visible')
cy.get('.edit-form input[type="date"]').should('have.length', 2)
})
it('creates a period record', () => {
cy.get('.btn-accent').contains('记录').click()
cy.get('.edit-form input[type="date"]').first().type('2026-04-01')
cy.get('.edit-form input[type="date"]').eq(1).type('2026-04-05')
cy.get('.btn-accent').contains('保存').click()
cy.get('.record-card').should('contain', '2026-04-01')
cy.get('.record-card').should('contain', '2026-04-05')
})
it('creates period record without end date', () => {
cy.get('.btn-accent').contains('记录').click()
cy.get('.edit-form input[type="date"]').first().type('2026-04-07')
cy.get('.btn-accent').contains('保存').click()
cy.get('.record-card').should('contain', '进行中')
})
it('deletes a period record', () => {
cy.get('.btn-accent').contains('记录').click()
cy.get('.edit-form input[type="date"]').first().type('2026-03-01')
cy.get('.btn-accent').contains('保存').click()
cy.get('.record-card').contains('2026-03-01').parent().find('.remove-btn').click()
cy.get('.record-card').should('not.contain', '2026-03-01')
})
})