Files
oil-formula-calculator/frontend/cypress/e2e/oil-reference.cy.js
Hera Zhao 27418695a5
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 6s
PR Preview / test (pull_request) Successful in 6s
PR Preview / deploy-preview (pull_request) Successful in 16s
Test / e2e-test (push) Failing after 6m2s
test: 智能识别与英文名搜索的单测 + e2e
- 将粘贴解析抽到 useOilProductPaste composable
- 8 条 vitest 覆盖价格/规格/中英文名/类型判断
- 2 条 cypress 覆盖 UI 填充(产品 100ml、精油 15ml)
- 补英文名搜索 e2e;旧 search 用例 placeholder 选择器宽松化

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

43 lines
1.3 KiB
JavaScript

describe('Oil Reference Page', () => {
beforeEach(() => {
cy.visit('/oils')
cy.get('.oil-chip, .oils-grid', { timeout: 10000 }).should('exist')
})
it('displays oil grid with items', () => {
cy.contains('精油价目').should('be.visible')
cy.get('.oil-chip').should('have.length.gte', 10)
})
it('shows oil name and price on each chip', () => {
cy.get('.oil-chip').first().should('contain', '¥')
})
it('filters oils by search', () => {
cy.get('.oil-chip').then($chips => {
const initial = $chips.length
cy.get('input[placeholder*="搜索"]').type('薰衣草')
cy.wait(300)
cy.get('.oil-chip').should('have.length.lt', initial)
})
})
it('filters oils by english name', () => {
cy.get('.oil-chip').then($chips => {
const initial = $chips.length
cy.get('input[placeholder*="搜索"]').type('Lavender')
cy.wait(300)
cy.get('.oil-chip').should('have.length.lt', initial)
cy.get('.oil-chip').should('exist')
})
})
it('toggles between bottle and drop price view', () => {
cy.get('.oil-chip').first().invoke('text').then(textBefore => {
cy.contains('滴价').click()
cy.wait(300)
cy.get('.oil-chip').first().invoke('text').should('not.eq', textBefore)
})
})
})