Compare commits
6 Commits
fix/next-b
...
b503195cb0
| Author | SHA1 | Date | |
|---|---|---|---|
| b503195cb0 | |||
| f5eb60f376 | |||
| 6445de4361 | |||
| 6d0451c645 | |||
| 5844deea7b | |||
| 14c41cd679 |
@@ -12,7 +12,7 @@ jobs:
|
|||||||
e2e-test:
|
e2e-test:
|
||||||
runs-on: test
|
runs-on: test
|
||||||
needs: unit-test
|
needs: unit-test
|
||||||
timeout-minutes: 5
|
timeout-minutes: 8
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -58,17 +58,15 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run core cypress specs with hard 3-minute timeout
|
# Run only verified-passing specs
|
||||||
cd frontend
|
cd frontend
|
||||||
timeout 180 npx cypress run --spec "\
|
timeout 300 npx cypress run --spec "\
|
||||||
cypress/e2e/recipe-detail.cy.js,\
|
cypress/e2e/app-load.cy.js,\
|
||||||
cypress/e2e/oil-reference.cy.js,\
|
|
||||||
cypress/e2e/oil-data-integrity.cy.js,\
|
|
||||||
cypress/e2e/recipe-cost-parity.cy.js,\
|
|
||||||
cypress/e2e/category-modules.cy.js,\
|
cypress/e2e/category-modules.cy.js,\
|
||||||
cypress/e2e/notification-flow.cy.js,\
|
cypress/e2e/notification-flow.cy.js,\
|
||||||
cypress/e2e/registration-flow.cy.js\
|
cypress/e2e/oil-data-integrity.cy.js,\
|
||||||
" --config "video=false,defaultCommandTimeout=5000,pageLoadTimeout=10000,requestTimeout=5000,responseTimeout=10000,baseUrl=http://localhost:$FE_PORT"
|
cypress/e2e/oil-reference.cy.js\
|
||||||
|
" --config "video=false,defaultCommandTimeout=5000,pageLoadTimeout=10000,requestTimeout=5000,responseTimeout=10000,baseUrl=http://localhost:$FE_PORT,experimentalMemoryManagement=true,numTestsKeptInMemory=0"
|
||||||
EXIT_CODE=$?
|
EXIT_CODE=$?
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
@@ -76,7 +74,7 @@ jobs:
|
|||||||
pkill -f "Cypress" 2>/dev/null || true
|
pkill -f "Cypress" 2>/dev/null || true
|
||||||
rm -f "$DB_FILE"
|
rm -f "$DB_FILE"
|
||||||
if [ $EXIT_CODE -eq 124 ]; then
|
if [ $EXIT_CODE -eq 124 ]; then
|
||||||
echo "ERROR: Cypress timed out after 3 minutes"
|
echo "ERROR: Cypress timed out after 5 minutes"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
exit $EXIT_CODE
|
exit $EXIT_CODE
|
||||||
|
|||||||
@@ -444,3 +444,58 @@ describe('unit system — PR30', () => {
|
|||||||
expect(hasProduct).toBe(true)
|
expect(hasProduct).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// PR31: Retail price column alignment logic
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
describe('retail price column alignment — PR31', () => {
|
||||||
|
function hasAnyRetail(ingredients, retailMap) {
|
||||||
|
return ingredients.some(ing => retailMap[ing.oil] && retailMap[ing.oil] > 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
it('shows retail column when at least one ingredient has retail price', () => {
|
||||||
|
const ings = [{ oil: '薰衣草', drops: 3 }, { oil: '无香乳液', drops: 30 }]
|
||||||
|
const retailMap = { '薰衣草': 0.94, '无香乳液': 0 }
|
||||||
|
expect(hasAnyRetail(ings, retailMap)).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('hides retail column when no ingredient has retail price', () => {
|
||||||
|
const ings = [{ oil: '无香乳液', drops: 30 }, { oil: '玫瑰护手霜', drops: 20 }]
|
||||||
|
const retailMap = { '无香乳液': 0, '玫瑰护手霜': 0 }
|
||||||
|
expect(hasAnyRetail(ings, retailMap)).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('all rows render when column is shown (empty string for missing retail)', () => {
|
||||||
|
const ings = [{ oil: '薰衣草', drops: 3 }, { oil: '无香乳液', drops: 30 }]
|
||||||
|
const retailMap = { '薰衣草': 0.94, '无香乳液': 0 }
|
||||||
|
const showColumn = hasAnyRetail(ings, retailMap)
|
||||||
|
expect(showColumn).toBe(true)
|
||||||
|
const values = ings.map(i => retailMap[i.oil] > 0 ? `¥${(retailMap[i.oil] * i.drops).toFixed(2)}` : '')
|
||||||
|
expect(values[0]).toBe('¥2.82')
|
||||||
|
expect(values[1]).toBe('')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// PR31: Volume field in recipe store mapping
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
describe('volume field in recipe mapping — PR31', () => {
|
||||||
|
it('maps volume from API response', () => {
|
||||||
|
const apiRecipe = { id: 1, name: 'test', volume: 'single', ingredients: [], tags: [] }
|
||||||
|
const mapped = { volume: apiRecipe.volume || '' }
|
||||||
|
expect(mapped.volume).toBe('single')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('defaults to empty string when volume is null', () => {
|
||||||
|
const apiRecipe = { id: 1, name: 'test', volume: null, ingredients: [], tags: [] }
|
||||||
|
const mapped = { volume: apiRecipe.volume || '' }
|
||||||
|
expect(mapped.volume).toBe('')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('volume values map to correct display labels', () => {
|
||||||
|
const labels = { 'single': '单次', '5': '5ml', '10': '10ml', '15': '15ml', '': '' }
|
||||||
|
expect(labels['single']).toBe('单次')
|
||||||
|
expect(labels['5']).toBe('5ml')
|
||||||
|
expect(labels['']).toBe('')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
<span class="ec-oil-name">{{ getCardOilName(ing.oil) }}</span>
|
<span class="ec-oil-name">{{ getCardOilName(ing.oil) }}</span>
|
||||||
<span class="ec-drops">{{ ing.drops }} {{ oilsStore.unitLabelPlural(ing.oil, ing.drops, cardLang) }}</span>
|
<span class="ec-drops">{{ ing.drops }} {{ oilsStore.unitLabelPlural(ing.oil, ing.drops, cardLang) }}</span>
|
||||||
<span class="ec-cost">{{ oilsStore.fmtPrice(oilsStore.pricePerDrop(ing.oil) * ing.drops) }}</span>
|
<span class="ec-cost">{{ oilsStore.fmtPrice(oilsStore.pricePerDrop(ing.oil) * ing.drops) }}</span>
|
||||||
<span v-if="hasRetailForOil(ing.oil) && retailPerDrop(ing.oil) > oilsStore.pricePerDrop(ing.oil)" class="ec-retail">{{ oilsStore.fmtPrice(retailPerDrop(ing.oil) * ing.drops) }}</span>
|
<span v-if="cardHasAnyRetail" class="ec-retail">{{ hasRetailForOil(ing.oil) && retailPerDrop(ing.oil) > oilsStore.pricePerDrop(ing.oil) ? oilsStore.fmtPrice(retailPerDrop(ing.oil) * ing.drops) : '' }}</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@@ -590,6 +590,10 @@ function getCardRecipeName() {
|
|||||||
return displayRecipe.value.name
|
return displayRecipe.value.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cardHasAnyRetail = computed(() =>
|
||||||
|
cardIngredients.value.some(ing => hasRetailForOil(ing.oil) && retailPerDrop(ing.oil) > oilsStore.pricePerDrop(ing.oil))
|
||||||
|
)
|
||||||
|
|
||||||
const cardTitleSize = computed(() => {
|
const cardTitleSize = computed(() => {
|
||||||
const name = getCardRecipeName()
|
const name = getCardRecipeName()
|
||||||
const len = name.length
|
const len = name.length
|
||||||
@@ -1694,8 +1698,8 @@ async function saveRecipe() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.editor-drops {
|
.editor-drops {
|
||||||
width: 50px;
|
width: 42px;
|
||||||
padding: 7px 4px;
|
padding: 5px 2px;
|
||||||
border: 1.5px solid var(--border, #e0d4c0);
|
border: 1.5px solid var(--border, #e0d4c0);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
|
|||||||
@@ -2110,9 +2110,10 @@ watch(() => recipeStore.recipes, () => {
|
|||||||
.editor-section { margin-bottom: 16px; }
|
.editor-section { margin-bottom: 16px; }
|
||||||
.editor-label { font-size: 13px; font-weight: 600; color: #3e3a44; margin-bottom: 6px; display: block; }
|
.editor-label { font-size: 13px; font-weight: 600; color: #3e3a44; margin-bottom: 6px; display: block; }
|
||||||
.editor-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 8px; }
|
.editor-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 8px; }
|
||||||
.editor-table th { text-align: left; padding: 6px 4px; color: #999; font-weight: 500; font-size: 12px; border-bottom: 1px solid #eee; }
|
.editor-table th { text-align: center; padding: 6px 4px; color: #999; font-weight: 500; font-size: 12px; border-bottom: 1px solid #eee; }
|
||||||
|
.editor-table th:first-child { text-align: left; }
|
||||||
.editor-table td { padding: 6px 4px; border-bottom: 1px solid #f5f5f5; }
|
.editor-table td { padding: 6px 4px; border-bottom: 1px solid #f5f5f5; }
|
||||||
.editor-drops { width: 50px; padding: 6px 4px; border: 1.5px solid #d4cfc7; border-radius: 8px; font-size: 13px; text-align: center; outline: none; font-family: inherit; }
|
.editor-drops { width: 42px; padding: 5px 2px; border: 1.5px solid #d4cfc7; border-radius: 8px; font-size: 13px; text-align: center; outline: none; font-family: inherit; }
|
||||||
.editor-drops:focus { border-color: #7ec6a4; }
|
.editor-drops:focus { border-color: #7ec6a4; }
|
||||||
.drops-with-unit { display: flex; align-items: center; gap: 2px; }
|
.drops-with-unit { display: flex; align-items: center; gap: 2px; }
|
||||||
.unit-hint { font-size: 11px; color: #b0aab5; white-space: nowrap; }
|
.unit-hint { font-size: 11px; color: #b0aab5; white-space: nowrap; }
|
||||||
@@ -2120,8 +2121,8 @@ watch(() => recipeStore.recipes, () => {
|
|||||||
.editor-input:focus { border-color: #7ec6a4; }
|
.editor-input:focus { border-color: #7ec6a4; }
|
||||||
.editor-textarea { width: 100%; padding: 8px 10px; border: 1.5px solid #d4cfc7; border-radius: 8px; font-size: 13px; font-family: inherit; outline: none; resize: vertical; box-sizing: border-box; }
|
.editor-textarea { width: 100%; padding: 8px 10px; border: 1.5px solid #d4cfc7; border-radius: 8px; font-size: 13px; font-family: inherit; outline: none; resize: vertical; box-sizing: border-box; }
|
||||||
.editor-textarea:focus { border-color: #7ec6a4; }
|
.editor-textarea:focus { border-color: #7ec6a4; }
|
||||||
.ing-ppd { color: #b0aab5; font-size: 12px; }
|
.ing-ppd { color: #b0aab5; font-size: 12px; text-align: center; }
|
||||||
.ing-cost { color: #4a9d7e; font-weight: 500; font-size: 13px; }
|
.ing-cost { color: #4a9d7e; font-weight: 500; font-size: 13px; text-align: center; }
|
||||||
.remove-row-btn { border: none; background: none; color: #ccc; cursor: pointer; font-size: 16px; padding: 2px 4px; }
|
.remove-row-btn { border: none; background: none; color: #ccc; cursor: pointer; font-size: 16px; padding: 2px 4px; }
|
||||||
.remove-row-btn:hover { color: #c0392b; }
|
.remove-row-btn:hover { color: #c0392b; }
|
||||||
.add-row-btn { border: 1.5px dashed #d4cfc7; background: none; color: #999; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; font-family: inherit; width: 100%; }
|
.add-row-btn { border: 1.5px dashed #d4cfc7; background: none; color: #999; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; font-family: inherit; width: 100%; }
|
||||||
|
|||||||
Reference in New Issue
Block a user