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') }) })