- Replace single-file 8441-line HTML with Vue 3 SPA - Pinia stores: auth, oils, recipes, diary, ui - Composables: useApi, useDialog, useSmartPaste, useOilTranslation - 6 shared components: RecipeCard, RecipeDetailOverlay, TagPicker, etc. - 9 page views: RecipeSearch, RecipeManager, Inventory, OilReference, etc. - 14 Cypress E2E test specs (113 tests), all passing - Multi-stage Dockerfile (Node build + Python runtime) - Demo video generation scripts (TTS + subtitles + screen recording) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
68 lines
2.1 KiB
JavaScript
68 lines
2.1 KiB
JavaScript
describe('Advanced Search Features', () => {
|
|
beforeEach(() => {
|
|
cy.visit('/')
|
|
cy.get('.recipe-card', { timeout: 10000 }).should('have.length.gte', 1)
|
|
})
|
|
|
|
it('search input accepts text and app stays stable', () => {
|
|
cy.get('input[placeholder*="搜索"]').type('酸痛')
|
|
cy.wait(500)
|
|
// App should remain functional
|
|
cy.get('.main').should('be.visible')
|
|
cy.get('input[placeholder*="搜索"]').should('have.value', '酸痛')
|
|
})
|
|
|
|
it('searches by partial recipe name', () => {
|
|
cy.get('input[placeholder*="搜索"]').type('安睡')
|
|
cy.wait(500)
|
|
cy.get('.recipe-card').should('have.length.gte', 0)
|
|
})
|
|
|
|
it('returns fewer results for nonsense query', () => {
|
|
cy.get('.recipe-card').then($all => {
|
|
const total = $all.length
|
|
cy.get('input[placeholder*="搜索"]').type('xyzabcnonexistent')
|
|
cy.wait(500)
|
|
// Should show empty state or fewer results
|
|
cy.get('.recipe-card').should('have.length.lte', total)
|
|
})
|
|
})
|
|
|
|
it('search is case-insensitive for latin chars', () => {
|
|
cy.get('input[placeholder*="搜索"]').type('doterra')
|
|
cy.wait(500)
|
|
// Just verify no crash
|
|
cy.get('.main').should('be.visible')
|
|
})
|
|
|
|
it('handles special characters in search', () => {
|
|
cy.get('input[placeholder*="搜索"]').type('()【】')
|
|
cy.wait(300)
|
|
cy.get('.main').should('be.visible')
|
|
})
|
|
|
|
it('rapid typing updates results without crash', () => {
|
|
const input = cy.get('input[placeholder*="搜索"]')
|
|
input.type('薰')
|
|
cy.wait(100)
|
|
input.type('衣')
|
|
cy.wait(100)
|
|
input.type('草')
|
|
cy.wait(300)
|
|
cy.get('.recipe-card').should('have.length.gte', 0)
|
|
cy.get('.main').should('be.visible')
|
|
})
|
|
|
|
it('clearing search with button restores all recipes', () => {
|
|
cy.get('.recipe-card').then($initial => {
|
|
const count = $initial.length
|
|
cy.get('input[placeholder*="搜索"]').type('薰衣草')
|
|
cy.wait(300)
|
|
// Clear
|
|
cy.get('input[placeholder*="搜索"]').clear()
|
|
cy.wait(300)
|
|
cy.get('.recipe-card').should('have.length', count)
|
|
})
|
|
})
|
|
})
|