LifeMate — Personal, Family & Learning Companion

design/mobile-accessibility-v2
chore/phase1-repository-cleanup deploy/stable-web-apk deployment-static design/mobile-accessibility-v2 design/mobile-navigation-review docs/child-education-access-decision docs/offline-data-rescue-options docs/owner-guide-and-delivery-plan docs/phase1-policy-options docs/public-review-live-2026-10-15 feat/aparat-learning-library feat/child-device-safety feat/child-identity-schema feat/flutter-mobile-navigation feat/learning-content-operations feat/local-signing-preflight feat/online-family-stage0 feat/personal-encrypted-recovery feat/private-planner-series-api feat/public-review-page feat/standalone-weekly-planner feat/weekly-planner-android final-feature-1/iran-family-school fix/auth-abuse-expiry-safety fix/auth-expiry-after-lock fix/backend-request-safety fix/lifeguide-bootstrap-naming-ci fix/lifeguide-pages-qa-base-preflight fix/lifeguide-qa-pages-env-deployment fix/local-task-persistence fix/managed-child-session-boundary fix/personal-jalali-dates fix/personal-notification-controls fix/personal-upgrade-delivery-guard fix/sms-approval-gates fix/study-duration-display infra/cloudflare-neon-migration infra/lifeguide-cloudflare-qa infra/lifeguide-github-pages-qa infra/lifeguide-supabase-qa main phase-1/foundation-completion phase-2/product-foundation-identity phase-3/planner-school-family-core phase-4/ai-learning-wellbeing phase-5/hardening-observability-release test/android-reminder-acceptance test/personal-notification-settings test/personal-recovery-acceptance test/role-entry-apk
cjs 29 lines 2.21 KB
Raw
1 #!/usr/bin/env node
2 'use strict';
3 // Negative controls exercise the real DOM audit, not hand-written thresholds.
4 const {chromium}=require('playwright');
5 const assert=require('node:assert/strict');
6 const {auditLayout}=require('./check.cjs');
7 (async()=>{
8 const browser=await chromium.launch({executablePath:process.env.CHROMIUM_PATH||'/usr/bin/chromium',args:['--no-sandbox']});
9 try{
10 const page=await browser.newPage({viewport:{width:320,height:740}});
11 const fixtures=[
12 ['valid','',null],
13 ['font-small','.copy{font-size:11px}','font'],
14 ['contrast-low','.copy{color:#aaa}','contrast'],
15 ['touch-small','button{width:30px;height:30px;min-width:0;min-height:0;padding:0}','target'],
16 ['overflow-horizontal','.copy{width:700px}','overflow'],
17 ['clipped-text','.copy{height:8px;overflow:hidden}','clip']
18 ];
19 const results=[];
20 for(const [name,change,expected] of fixtures){
21 await page.setContent(`<html lang="fa" dir="rtl"><style>html{font-size:16px}body{margin:0;color:#203a32;background:#fff}.phone{width:300px}.prototype-label{font-size:12px}button{font-size:16px;width:80px;height:48px;color:#203a32;background:#fff}.copy{font-size:16px} ${change}</style><section class="phone" data-screen="fixture" data-state="normal" data-theme="calm"><div class="prototype-label">طرح تعاملی با داده ساختگی</div><main class="screen-content"><p class="copy">متن ساختگی برای بررسی واقعی.</p><button>نمونه</button></main></section></html>`);
22 const result=await page.evaluate(auditLayout,{expectedScreen:'fixture',expectedState:'normal',expectedTheme:'calm',fontScale:1,requiredLabel:'طرح تعاملی با داده ساختگی'});
23 if(expected){assert.ok(result.problems.some(p=>p.type.includes(expected)),`${name} did not fail for ${expected}`);}
24 else assert.equal(result.problems.length,0,JSON.stringify(result.problems));
25 results.push({name,expected:expected?'REJECT':'PASS',observedProblems:result.problems.map(p=>p.type),result:'PASS'});
26 }
27 console.log(JSON.stringify({status:'VERIFIED_CHECKER_NEGATIVE_CONTROLS',results},null,2));
28 }finally{await browser.close();}
29 })().catch(error=>{console.error(error.message);process.exitCode=1;});