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

76 lines
2.6 KiB
JavaScript

describe('Planning - Schedule (日程)', () => {
beforeEach(() => {
cy.visit('/planning', {
onBeforeLoad(win) {
win.localStorage.setItem('sp_login_expires', String(Date.now() + 86400000))
}
})
cy.get('header').should('be.visible')
})
it('shows 3 sub tabs', () => {
cy.get('.sub-tab').should('have.length', 3)
cy.get('.sub-tab').eq(0).should('contain', '日程')
cy.get('.sub-tab').eq(1).should('contain', '模板')
cy.get('.sub-tab').eq(2).should('contain', '回顾')
})
it('defaults to schedule sub tab', () => {
cy.get('.sub-tab').contains('日程').should('have.class', 'active')
})
it('shows module pool and timeline', () => {
cy.get('.module-pool').should('be.visible')
cy.get('.timeline').should('be.visible')
})
it('shows time slots from 6:00 to 23:00', () => {
cy.get('.time-slot').should('have.length', 18)
cy.get('.time-label').first().should('contain', '06:00')
cy.get('.time-label').last().should('contain', '23:00')
})
it('shows date navigation', () => {
cy.get('.date-nav').should('be.visible')
cy.get('.date-label-main').should('not.be.empty')
})
it('navigates to next/previous day', () => {
cy.get('.date-label-main').invoke('text').then(today => {
cy.get('.date-nav button').first().click()
cy.get('.date-label-main').invoke('text').should('not.eq', today)
})
})
it('adds a schedule module', () => {
cy.get('.module-pool .add-row input').type('深度工作')
cy.get('.module-pool .add-row button').click()
cy.get('.module-item').should('contain', '深度工作')
})
it('color picker works', () => {
cy.get('.color-dot').should('have.length.gte', 10)
cy.get('.color-dot').eq(3).click()
cy.get('.color-dot').eq(3).should('have.class', 'active')
})
it('deletes a schedule module', () => {
cy.get('.module-pool .add-row input').type('待删除模块')
cy.get('.module-pool .add-row button').click()
cy.get('.module-item').contains('待删除模块').parent().find('.remove-btn').click({ force: true })
cy.get('.module-item').should('not.contain', '待删除模块')
})
it('clears all slots for the day', () => {
cy.get('.btn-light').contains('清空').click()
// Just verify it doesn't crash
cy.get('.timeline').should('be.visible')
})
it('module items are draggable', () => {
cy.get('.module-pool .add-row input').type('拖拽测试')
cy.get('.module-pool .add-row button').click()
cy.get('.module-item').contains('拖拽测试').should('have.attr', 'draggable', 'true')
})
})