test(deploy): verify fourth feedback capture and public release

This commit is contained in:
xsl
2026-10-12 20:27:45 +08:00
parent 92a3965b7d
commit 3f165bf9e5
10 changed files with 707 additions and 648 deletions
+13 -5
View File
@@ -10,7 +10,9 @@ const browser = await chromium.launch({ headless: true });
try {
const page = await browser.newPage({ viewport: { width: 375, height: 726 } });
page.setDefaultTimeout(60000);
const errors = []; page.on('pageerror', e => errors.push(e.message));
const errors = [], failedRequests = [];
page.on('pageerror', e => errors.push(e.message));
page.on('requestfailed', request => failedRequests.push({ path: new URL(request.url()).pathname, error: request.failure().errorText }));
await page.route('**/api/auth/session', route => route.fulfill({ json: { ok: true, user: { id: 'local-camera-fixture', kind: 'browser' } } }));
for (const name of ['C3_180.jpg', 'C3_135.jpg', 'C3_-135.jpg']) {
const body = fs.readFileSync(fileURLToPath(new URL('../../reference/facepp-skinanalyze/examples/images/' + name, import.meta.url)));
@@ -54,12 +56,18 @@ try {
try {
await page.waitForFunction(() => window.faceapi && faceapi.nets.faceLandmark68Net.isLoaded && document.querySelector('#s-cam').classList.contains('cam-live'));
} catch (error) {
console.log(await page.evaluate(() => ({ status: document.querySelector('#cam-status').textContent, hint: document.querySelector('#cam-hint').textContent, toast: document.querySelector('#toast').textContent, width: document.querySelector('#cam-video').videoWidth, classes: document.querySelector('#s-cam').className, engine: !!window.faceapi })), errors);
console.log(await page.evaluate(() => ({ status: document.querySelector('#cam-status').textContent, hint: document.querySelector('#cam-hint').textContent, toast: document.querySelector('#toast').textContent, width: document.querySelector('#cam-video').videoWidth, classes: document.querySelector('#s-cam').className, engine: !!window.faceapi })), errors, failedRequests);
throw error;
}
assert.equal(await page.locator('#s-cam.cam-manual').count(), 0, 'real automatic pipeline, not manual bypass');
await page.evaluate(() => {
window.__holdSamples = []; window.__hints = [];
window.__holdSamples = []; window.__hints = []; window.__evaluations = [];
const evaluate = CaptureQuality.evaluate;
CaptureQuality.evaluate = function(d, options) {
const result = evaluate(d, options);
window.__evaluations.push({ target: options.target, ok: result.ok, hint: result.hint });
return result;
};
const hold = CaptureQuality.hold;
CaptureQuality.hold = function(state, obs, now) {
const result = hold(state, obs, now);
@@ -79,11 +87,11 @@ try {
ratio: window.__dbgRatio, faces: faces.map(d => ({ score: d.detection.score, pose: HeadPose.estimate(d.landmarks.positions, false), box: d.detection.box })), holds: window.__holdSamples, hints: window.__hints };
}).then(value => JSON.stringify(value, null, 2)), errors); throw error;
}
await page.waitForTimeout(1000);
await page.waitForFunction(() => window.__evaluations.some(row => row.target === 'right' && !row.ok));
assert((await page.locator('#cam-step').textContent()).includes('2/3'), 'front photo cannot pass the side gate');
await page.evaluate(() => window.__cameraFixture.set('C3_135.jpg'));
await page.waitForFunction(() => document.querySelector('#cam-step').textContent.includes('3/3'));
await page.waitForTimeout(800);
await page.waitForFunction(() => window.__evaluations.some(row => row.target === 'left' && !row.ok));
assert((await page.locator('#cam-step').textContent()).includes('3/3'), 'wrong-direction side cannot pass');
const sent = page.waitForRequest(r => r.url().endsWith('/api/skin-analyze'));
await page.evaluate(() => window.__cameraFixture.set('C3_-135.jpg'));
+1
View File
@@ -10,6 +10,7 @@ const artifacts = process.env.H5_ARTIFACT_DIR;
const browser = await chromium.launch({ headless: true });
try {
const page = await browser.newPage({ viewport: { width: 375, height: 726 }, isMobile: true, hasTouch: true });
page.setDefaultTimeout(60000); // Match the production-facing third-round suite.
const errors = [], requests = [];
page.on('pageerror', e => errors.push(e.message));
page.on('request', r => requests.push(new URL(r.url()).pathname));
+1
View File
@@ -9,6 +9,7 @@ const base = process.env.H5_BASE_URL || 'http://127.0.0.1:8080/';
const browser = await chromium.launch({ headless: true });
try {
const page = await browser.newPage({ viewport: { width: 375, height: 726 }, isMobile: true, hasTouch: true });
page.setDefaultTimeout(60000); // Cold public-site font downloads can exceed 30s.
const errors = [];
page.on('pageerror', e => errors.push(e.message));
await page.goto(base + '?mock=1&screen=report');