describe('Body - Sleep (身体-睡眠)', () => { beforeEach(() => { cy.visit('/body', { onBeforeLoad(win) { win.localStorage.setItem('sp_login_expires', String(Date.now() + 86400000)) } }) cy.get('.sub-tab').contains('睡眠').click() }) it('shows sleep record input', () => { cy.get('.capture-input').should('be.visible') cy.get('.btn-accent').should('be.visible') }) it('records sleep time with HH:MM format', () => { cy.get('.capture-input').type('22:30') cy.get('.btn-accent').contains('记录').click() cy.get('.sleep-hint').should('contain', '已记录') cy.get('.data-table').should('contain', '22:30') }) it('records sleep time with Chinese format', () => { cy.get('.capture-input').type('10点半') cy.get('.btn-accent').contains('记录').click() cy.get('.sleep-hint').should('contain', '已记录') cy.get('.data-table').should('contain', '10:30') }) it('shows error for unrecognized time', () => { cy.get('.capture-input').type('随便写写') cy.get('.btn-accent').contains('记录').click() cy.get('.sleep-hint').should('contain', '无法识别') }) it('deletes a sleep record', () => { cy.get('.capture-input').type('23:00') cy.get('.btn-accent').contains('记录').click() cy.get('.data-table .remove-btn').first().click() }) it('shows record detail table', () => { cy.get('.capture-input').type('21:45') cy.get('.btn-accent').contains('记录').click() cy.get('.data-table th').should('contain', '日期') cy.get('.data-table th').should('contain', '入睡时间') }) it('shows empty hint when no records', () => { // Component handles both states cy.get('.sleep-section').should('be.visible') }) })