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

74 lines
2.9 KiB
JavaScript

describe('Reminders (提醒)', () => {
beforeEach(() => {
cy.visit('/reminders', {
onBeforeLoad(win) {
win.localStorage.setItem('sp_login_expires', String(Date.now() + 86400000))
}
})
cy.get('header').should('be.visible')
})
it('shows reminders page with add button', () => {
cy.get('.section-header').should('contain', '提醒')
cy.get('.btn-accent').should('contain', '新提醒')
})
it('opens add reminder form', () => {
cy.get('.btn-accent').contains('新提醒').click()
cy.get('.edit-form').should('be.visible')
cy.get('.edit-form input').should('have.length.gte', 2)
cy.get('.edit-form select').should('exist')
})
it('creates a reminder', () => {
cy.get('.btn-accent').contains('新提醒').click()
cy.get('.edit-form input').first().type('喝水提醒')
cy.get('.edit-form input[type="time"]').type('14:00')
cy.get('.edit-form select').select('daily')
cy.get('.btn-accent').contains('保存').click()
cy.get('.reminder-card').should('contain', '喝水提醒')
cy.get('.reminder-meta').should('contain', '14:00')
cy.get('.reminder-meta').should('contain', '每天')
})
it('creates reminder with different repeat options', () => {
cy.get('.btn-accent').contains('新提醒').click()
cy.get('.edit-form input').first().type('周报提醒')
cy.get('.edit-form select').select('weekly')
cy.get('.btn-accent').contains('保存').click()
cy.get('.reminder-card').should('contain', '周报提醒')
cy.get('.reminder-meta').should('contain', '每周')
})
it('toggles reminder enabled/disabled', () => {
cy.get('.btn-accent').contains('新提醒').click()
cy.get('.edit-form input').first().type('开关测试')
cy.get('.btn-accent').contains('保存').click()
cy.get('.reminder-toggle').first().click()
cy.get('.reminder-toggle').first().should('contain', '🔕')
cy.get('.reminder-toggle').first().click()
cy.get('.reminder-toggle').first().should('contain', '🔔')
})
it('deletes a reminder', () => {
cy.get('.btn-accent').contains('新提醒').click()
cy.get('.edit-form input').first().type('待删除提醒')
cy.get('.btn-accent').contains('保存').click()
cy.get('.reminder-card').contains('待删除提醒').parent().find('.remove-btn').click()
cy.get('.reminder-card').should('not.contain', '待删除提醒')
})
it('cancel button closes form without saving', () => {
cy.get('.btn-accent').contains('新提醒').click()
cy.get('.edit-form input').first().type('取消测试')
cy.get('.btn-close').contains('取消').click()
cy.get('.edit-form').should('not.exist')
cy.get('.reminder-card').should('not.contain', '取消测试')
})
it('shows empty hint when no reminders', () => {
// Just verify component handles both states gracefully
cy.get('.reminders-layout').should('be.visible')
})
})