LifeMate — Personal, Family & Learning Companion

feat/weekly-planner-android
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 50 lines 6.77 KB
Raw
1 const {chromium}=require('playwright');
2 const assert=require('node:assert/strict');
3 const fs=require('node:fs');
4 const path=require('node:path');
5 const base=process.env.DESIGN_BASE_URL || 'http://127.0.0.1:8769/';
6 const receipt=process.env.DESIGN_RECEIPT || path.resolve(__dirname,'../exports/verification.json');
7 (async()=>{
8 const b=await chromium.launch({executablePath:process.env.CHROMIUM_PATH || '/usr/bin/chromium',headless:true,args:['--no-sandbox']});
9 const p=await b.newPage({viewport:{width:390,height:844}}),errors=[],external=[],checks=[];
10 p.on('pageerror',e=>errors.push(e.message));p.on('request',r=>{if(/^https?:/.test(r.url())&&new URL(r.url()).origin!==new URL(base).origin)external.push(r.url())});
11 const load=async(query='')=>{await p.goto(base+query);await p.locator('.phone').first().waitFor();await p.evaluate(()=>document.fonts.ready)};
12 const at=async(name)=>assert.equal(await p.locator('.phone').getAttribute('data-screen'),name);
13 for(const [width,height]of[[390,844],[320,740]]){
14 await p.setViewportSize({width,height});await load();assert.equal(await p.locator('.screen-content').evaluate(e=>e.scrollHeight-e.clientHeight),0,'Home menus should fit without scrolling');
15 for(const [i,r]of['plan','courses','focus','family','report','reminders'].entries()){
16 await p.locator('.menu-card').nth(i).click();await at(r);await p.getByRole('button',{name:'برگشت',exact:true}).click();await at('home');
17 }
18 assert.ok(await p.evaluate(()=>document.documentElement.scrollWidth<=innerWidth));
19 assert.ok(await p.locator('.bottom-nav').evaluate(e=>e.getBoundingClientRect().bottom<=innerHeight));
20 checks.push({check:'six menu destinations, back, fixed navigation, no horizontal overflow',width,height,result:'PASS'});
21 }
22 await p.setViewportSize({width:390,height:844});await load('?screen=plan');
23 await p.locator('.task-main').nth(1).click();await at('task');assert.match(await p.locator('.task-detail-head h2').textContent(),/خواندن یک متن کوتاه/);
24 checks.push({check:'Persian task opens its own details rather than the mathematics task',result:'PASS'});
25 await load('?screen=plan');await p.getByRole('button',{name:'یک کار تازه',exact:true}).click();await p.getByLabel('عنوان کار').fill('کار ساختگی آزمایشی');await p.getByLabel('زمان برنامه').fill('19:00');await p.getByRole('button',{name:'اعمال در پیش‌نمایش',exact:true}).click();
26 assert.equal(await p.locator('.task-main').count(),4);await p.locator('.task-main').last().click();assert.equal(await p.locator('.task-detail-head h2').textContent(),'کار ساختگی آزمایشی');
27 await p.getByRole('button',{name:'ویرایش زمان',exact:true}).click();await p.getByLabel('عنوان کار').fill('کار ساختگی ویرایش‌شده');await p.getByRole('button',{name:'اعمال در پیش‌نمایش',exact:true}).click();assert.equal(await p.locator('.task-detail-head h2').textContent(),'کار ساختگی ویرایش‌شده');
28 checks.push({check:'add and edit a temporary design task with visible result',result:'PASS'});
29 await load('?screen=lesson');await p.getByRole('button',{name:'تمام‌صفحه',exact:true}).click();assert.equal(await p.locator('.full-video').count(),1);await p.getByRole('button',{name:'بستن تمام‌صفحه',exact:true}).click();assert.equal(await p.locator('.full-video').count(),0);await at('lesson');
30 checks.push({check:'player frame expands and closes inside same design; no external media loaded',result:'PASS'});
31 await p.getByRole('button',{name:'شروع آزمونک · ۱۰ پرسش',exact:true}).click();
32 for(const index of[0,1,2,3,1,0,2,3,1,0]){
33 await p.locator('.answers button').nth(index).click();await p.getByRole('button',{name:'بررسی پاسخ',exact:true}).click();assert.equal(await p.locator('.answer-feedback').count(),1);await p.getByRole('button',{name:/^(پرسش بعدی|دیدن نتیجه)$/}).click();
34 }
35 assert.equal((await p.locator('.result-score').textContent()).trim(),'۱۰ از ۱۰ پاسخ درست');
36 checks.push({check:'ten-question draft quiz with explanatory feedback and result',result:'PASS'});
37 await load('?screen=focus');await p.getByRole('button',{name:'شروع نوبت',exact:true}).click();await p.waitForTimeout(1200);await p.getByRole('button',{name:'توقف موقت',exact:true}).click();const paused=await p.locator('.timer-ring strong').textContent();assert.notEqual(paused,'۲۵:۰۰');await p.waitForTimeout(1100);assert.equal(await p.locator('.timer-ring strong').textContent(),paused);await p.getByRole('button',{name:'استراحت ۵ دقیقه‌ای',exact:true}).click();assert.equal(await p.locator('.timer-ring strong').textContent(),'۰۵:۰۰');
38 checks.push({check:'foreground timer starts, pauses and switches to five-minute break',result:'PASS'});
39 await load('?screen=reminders');const sw=p.getByRole('switch').first();assert.equal(await sw.getAttribute('aria-checked'),'true');await sw.click();assert.equal(await sw.getAttribute('aria-checked'),'false');
40 checks.push({check:'reminder switch toggles its explicit state; no device alarm',result:'PASS'});
41 await p.getByRole('button',{name:'والد',exact:true}).click();assert.equal(await p.locator('.phone').getAttribute('data-role'),'parent');await p.locator('.child-card').click();await at('report');assert.match(await p.locator('.freshness').textContent(),/دادهٔ زنده نیست/);
42 checks.push({check:'separate parent home and explicitly non-live sample report',result:'PASS'});
43 await p.setViewportSize({width:2700,height:2600});await load('?board=1');assert.equal(await p.locator('.board-panel').count(),12);const overflow=await p.locator('.board-panel main').evaluateAll(es=>es.map(e=>e.scrollHeight-e.clientHeight));assert.ok(overflow.every(n=>n===0));
44 checks.push({check:'all twelve board panels show their full initial content',overflow,result:'PASS'});
45 assert.equal(errors.length,0);assert.equal(external.length,0);
46 await p.context().setOffline(true);await p.getByRole('button',{name:'بازگشت به پیش‌نمایش',exact:true}).click();await p.locator('.menu-card').first().click();await at('plan');await p.context().setOffline(false);
47 checks.push({check:'loaded self-contained design remains navigable while browser network is offline',result:'PASS'});
48 const result={status:'VERIFIED_PROTOTYPE_ONLY',browser:await b.version(),checks,passed:checks.length,javascriptErrors:errors,externalRequests:external,localFileOpen:'UNVERIFIED: file:// opening blocked by execution environment policy',unverified:['Safari/iPhone device','actual backend data and permissions','real video playback','system alarms and widgets','production deployment']};
49 fs.writeFileSync(receipt,JSON.stringify(result,null,2));console.log(JSON.stringify(result,null,2));await b.close();
50 })().catch(e=>{console.error(e.message);process.exit(1)});