- oils store: change Map to plain object for Vue reactivity - recipes store: map `oil_name` from API (was only mapping `oil`/`name`) - OilReference: fix .get() calls to bracket access - Add price-display.cy.js regression test (3 tests) - Add visual-check.cy.js for screenshot verification Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
40 lines
1.5 KiB
JavaScript
40 lines
1.5 KiB
JavaScript
describe('Price Display Regression', () => {
|
|
it('recipe cards show non-zero prices', () => {
|
|
cy.visit('/')
|
|
cy.get('.recipe-card', { timeout: 10000 }).should('have.length.gte', 1)
|
|
cy.wait(2000) // wait for oils store to load and re-render
|
|
|
|
// Check via .card-price elements which hold the formatted cost
|
|
cy.get('.card-price').first().invoke('text').then(text => {
|
|
const match = text.match(/¥\s*(\d+\.?\d*)/)
|
|
expect(match, 'Card price should contain ¥').to.not.be.null
|
|
expect(parseFloat(match[1]), 'Price should be > 0').to.be.gt(0)
|
|
})
|
|
})
|
|
|
|
it('oil reference page shows non-zero prices', () => {
|
|
cy.visit('/oils')
|
|
cy.get('.oil-card', { timeout: 10000 }).should('have.length.gte', 1)
|
|
cy.wait(500)
|
|
|
|
cy.get('.oil-card').first().invoke('text').then(text => {
|
|
const match = text.match(/¥\s*(\d+\.?\d*)/)
|
|
expect(match, 'Oil card should contain a price').to.not.be.null
|
|
expect(parseFloat(match[1])).to.be.gt(0)
|
|
})
|
|
})
|
|
|
|
it('recipe detail shows non-zero total cost', () => {
|
|
cy.visit('/')
|
|
cy.get('.recipe-card', { timeout: 10000 }).first().click()
|
|
cy.wait(1000)
|
|
|
|
// Look for any ¥ amount > 0 in the detail overlay
|
|
cy.get('[class*="overlay"], [class*="detail"]').invoke('text').then(text => {
|
|
const prices = [...text.matchAll(/¥\s*(\d+\.?\d*)/g)].map(m => parseFloat(m[1]))
|
|
const nonZero = prices.filter(p => p > 0)
|
|
expect(nonZero.length, 'Detail should show at least one non-zero price').to.be.gte(1)
|
|
})
|
|
})
|
|
})
|