Compare commits
1 Commits
dce1c189fb
...
fix/next-b
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a8698c187 |
@@ -12,8 +12,7 @@ jobs:
|
||||
e2e-test:
|
||||
runs-on: test
|
||||
needs: unit-test
|
||||
timeout-minutes: 8
|
||||
continue-on-error: true
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -59,10 +58,17 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run all specs with memory optimization
|
||||
# Run core cypress specs with hard 3-minute timeout
|
||||
cd frontend
|
||||
timeout 300 npx cypress run \
|
||||
--config "video=false,defaultCommandTimeout=5000,pageLoadTimeout=10000,requestTimeout=5000,responseTimeout=10000,baseUrl=http://localhost:$FE_PORT,experimentalMemoryManagement=true,numTestsKeptInMemory=0"
|
||||
timeout 180 npx cypress run --spec "\
|
||||
cypress/e2e/recipe-detail.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/notification-flow.cy.js,\
|
||||
cypress/e2e/registration-flow.cy.js\
|
||||
" --config "video=false,defaultCommandTimeout=5000,pageLoadTimeout=10000,requestTimeout=5000,responseTimeout=10000,baseUrl=http://localhost:$FE_PORT"
|
||||
EXIT_CODE=$?
|
||||
|
||||
# Cleanup
|
||||
@@ -70,7 +76,7 @@ jobs:
|
||||
pkill -f "Cypress" 2>/dev/null || true
|
||||
rm -f "$DB_FILE"
|
||||
if [ $EXIT_CODE -eq 124 ]; then
|
||||
echo "ERROR: Cypress timed out after 5 minutes"
|
||||
echo "ERROR: Cypress timed out after 3 minutes"
|
||||
exit 1
|
||||
fi
|
||||
exit $EXIT_CODE
|
||||
|
||||
@@ -444,58 +444,3 @@ describe('unit system — PR30', () => {
|
||||
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-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 v-if="cardHasAnyRetail" class="ec-retail">{{ hasRetailForOil(ing.oil) && retailPerDrop(ing.oil) > oilsStore.pricePerDrop(ing.oil) ? oilsStore.fmtPrice(retailPerDrop(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>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -590,10 +590,6 @@ function getCardRecipeName() {
|
||||
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 name = getCardRecipeName()
|
||||
const len = name.length
|
||||
|
||||
@@ -2110,8 +2110,7 @@ watch(() => recipeStore.recipes, () => {
|
||||
.editor-section { margin-bottom: 16px; }
|
||||
.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 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 th { text-align: left; padding: 6px 4px; color: #999; font-weight: 500; font-size: 12px; border-bottom: 1px solid #eee; }
|
||||
.editor-table td { padding: 6px 4px; border-bottom: 1px solid #f5f5f5; }
|
||||
.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; }
|
||||
@@ -2121,8 +2120,8 @@ watch(() => recipeStore.recipes, () => {
|
||||
.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:focus { border-color: #7ec6a4; }
|
||||
.ing-ppd { color: #b0aab5; font-size: 12px; text-align: center; }
|
||||
.ing-cost { color: #4a9d7e; font-weight: 500; font-size: 13px; text-align: center; }
|
||||
.ing-ppd { color: #b0aab5; font-size: 12px; }
|
||||
.ing-cost { color: #4a9d7e; font-weight: 500; font-size: 13px; }
|
||||
.remove-row-btn { border: none; background: none; color: #ccc; cursor: pointer; font-size: 16px; padding: 2px 4px; }
|
||||
.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%; }
|
||||
|
||||
Reference in New Issue
Block a user