fix(camera): make lighting checks advisory only

This commit is contained in:
xsl
2026-10-16 15:51:07 +08:00
parent 9ff7a582af
commit 6a628f837b
5 changed files with 28 additions and 17 deletions
+5 -5
View File
@@ -117,10 +117,8 @@ try {
assert((await page.locator('#cam-step').textContent()).includes('1/3'), 'invalid frontal angle never advances');
assert.equal(await page.evaluate(() => window.__voice.some(row => /^hint-turn-|^step[23]-|^shot-done$/.test(row.id))), false, 'no turn/next-step/completion audio before a successful front photo');
await page.evaluate(() => { window.__cameraFixture.light(.6); return window.__cameraFixture.set('C3_180.jpg'); });
await page.waitForFunction(()=>window.__evaluations.some(row=>row.target==='front'&&!row.ok&&row.hint==='请到光线充足处'));
assert((await page.locator('#cam-step').textContent()).includes('1/3'),'dim sample cannot advance');
// Simulate improving room lighting, not bypassing the actual quality gate.
await page.evaluate(()=>window.__cameraFixture.light(1.3));
await page.waitForFunction(()=>document.querySelector('#cam-hint').textContent.includes('建议到光线明亮处拍摄'));
// Keep the dim sample through countdown AND final JPEG validation.
try { await page.waitForFunction(() => document.querySelector('#cam-step').textContent.includes('2/3')); }
catch (error) {
console.log(await page.evaluate(async () => {
@@ -132,6 +130,7 @@ try {
}).then(value => JSON.stringify(value, null, 2)), errors); throw error;
}
await page.waitForFunction(() => window.__voice.some(row => row.id === 'step2-rightface'));
await page.evaluate(()=>window.__cameraFixture.light(1.3));
const firstVoice = await page.evaluate(() => window.__voice);
const completion = firstVoice.find(row => row.id === 'shot-done'), turn = firstVoice.find(row => row.id === 'step2-rightface');
assert(completion && turn && completion.step.includes('1/3') && turn.step.includes('2/3'));
@@ -152,7 +151,8 @@ try {
for (const key of ['front', 'left', 'right']) {
const row = body.capture_diagnostics.views[key];
assert.equal(row.mode, 'live'); assert.equal(row.direction_checked, true);
assert(row.score >= (key==='front'?.3:.4) && row.luma >= 110 && row.luma <= 220);
assert(row.score >= (key==='front'?.25:.3));
if(key==='front') assert(row.luma < 110, 'dim JPEG still passes final validation');
assert(Math.abs(row.roll) <= 22);
}
assert(Math.abs(body.capture_diagnostics.views.front.yaw) <= 18);