Files
oil-formula-calculator/frontend/cypress/e2e/recipe-detail.cy.js
Hera Zhao 5a34b11720
All checks were successful
PR Preview / test (pull_request) Has been skipped
Deploy Production / test (push) Successful in 5s
Test / unit-test (push) Successful in 4s
PR Preview / teardown-preview (pull_request) Successful in 13s
PR Preview / deploy-preview (pull_request) Has been skipped
Test / build-check (push) Successful in 4s
Deploy Production / deploy (push) Successful in 5s
Test / e2e-test (push) Successful in 53s
fix: 更新e2e测试适配新UI
- recipe-detail: 移除编辑按钮测试(已从卡片移除)
- 新增卡片视图测试(doTERRA品牌、语言切换)
- 所有CI spec通过(27 e2e + 168 unit)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 20:27:45 +00:00

81 lines
2.1 KiB
JavaScript

function dismissModals() {
cy.get('body').then($body => {
if ($body.find('.login-overlay').length) {
cy.get('.login-overlay').click('topLeft')
}
if ($body.find('.dialog-overlay').length) {
cy.get('.dialog-btn-primary').click()
}
})
}
describe('Recipe Detail', () => {
beforeEach(() => {
cy.visit('/')
cy.get('.recipe-card', { timeout: 10000 }).should('have.length.gte', 1)
dismissModals()
})
it('opens detail panel when clicking a recipe card', () => {
cy.get('.recipe-card').first().click()
dismissModals()
cy.get('.detail-overlay').should('exist')
})
it('shows recipe name in detail view', () => {
cy.get('.recipe-card').first().click()
dismissModals()
cy.get('.detail-overlay').should('exist')
})
it('shows ingredient info with drops', () => {
cy.get('.recipe-card').first().click()
dismissModals()
cy.contains('滴').should('exist')
})
it('shows cost with ¥ symbol', () => {
cy.get('.recipe-card').first().click()
dismissModals()
cy.contains('¥').should('exist')
})
it('closes detail panel when clicking close button', () => {
cy.get('.recipe-card').first().click()
dismissModals()
cy.get('.detail-overlay').should('exist')
cy.get('.detail-close-btn').first().click({ force: true })
cy.get('.recipe-card').should('be.visible')
})
it('shows action buttons in detail', () => {
cy.get('.recipe-card').first().click()
dismissModals()
cy.get('.detail-overlay button').should('have.length.gte', 1)
})
it('shows favorite star on recipe cards', () => {
cy.get('.fav-btn').first().should('exist')
})
})
describe('Recipe Detail - Card View', () => {
beforeEach(() => {
cy.visit('/')
cy.get('.recipe-card', { timeout: 10000 }).should('have.length.gte', 1)
dismissModals()
cy.get('.recipe-card').first().click()
dismissModals()
})
it('shows export card with doTERRA branding', () => {
cy.get('.export-card').should('exist')
cy.contains('doTERRA').should('exist')
})
it('shows language toggle', () => {
cy.contains('中文').should('exist')
cy.contains('English').should('exist')
})
})