Files
oil-formula-calculator/frontend/cypress/e2e/recipe-search.cy.js
Hera Zhao 21026b0a07
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Failing after 7m5s
fix: 修复剩余6个e2e失败 — 选择器/路由/超时/默认tab
- manage-recipes: 展开公共配方库section后再查找recipe-row
- pr27-features: /#/manage改为/manage(HTML5 history模式)
- performance: 搜索后接受empty-hint作为有效结果
- recipe-search: .empty-state改为.empty-hint
- demo-walkthrough: 超时从15s加到20s
- diary-flow: 默认tab是brand不是diary,改为验证brand内容

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 21:26:22 +00:00

45 lines
1.5 KiB
JavaScript

describe('Recipe Search', () => {
beforeEach(() => {
cy.visit('/')
// Wait for recipes to load
cy.get('.recipe-card, .empty-hint', { timeout: 10000 }).should('exist')
})
it('displays recipe cards in the grid', () => {
cy.get('.recipe-card').should('have.length.gte', 1)
})
it('each recipe card shows name and oils', () => {
cy.get('.recipe-card').first().within(() => {
cy.get('.recipe-card-name').should('not.be.empty')
cy.get('.recipe-card-oils').should('not.be.empty')
})
})
it('filters recipes by search input', () => {
cy.get('.recipe-card').then($cards => {
const initialCount = $cards.length
cy.get('input[placeholder*="搜索"]').type('薰衣草')
// Should filter, possibly fewer results
cy.wait(500)
cy.get('.recipe-card').should('have.length.lte', initialCount)
})
})
it('clears search and restores all recipes', () => {
cy.get('.recipe-card', { timeout: 10000 }).should('have.length.gte', 1)
cy.get('input[placeholder*="搜索"]').type('薰衣草')
cy.wait(500)
cy.get('.recipe-card, .empty-hint', { timeout: 10000 }).should('exist')
cy.get('input[placeholder*="搜索"]').clear()
cy.wait(500)
cy.get('.recipe-card', { timeout: 10000 }).should('have.length.gte', 1)
})
it('opens recipe detail when clicking a card', () => {
cy.get('.recipe-card').first().click()
// Should show detail overlay or panel
cy.get('[class*="overlay"], [class*="detail"]', { timeout: 5000 }).should('be.visible')
})
})