LifeMate — Personal, Family & Learning Companion
design/mobile-navigation-review
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
| 1 | // Compiled-browser regression helper. Call only with a dedicated NEW synthetic |
| 2 | // actor in the local HTTPS acceptance harness; pass its independent API result. |
| 3 | // Reads real Chromium semantics. Does not change UI state, APIs or TLS settings. |
| 4 | const assert = require('node:assert/strict'); |
| 5 | |
| 6 | const statuses = { |
| 7 | not_started: 'شروع نشده', |
| 8 | in_progress: 'در حال یادگیری', |
| 9 | completed: 'تکمیل طبق گزارش من', |
| 10 | }; |
| 11 | |
| 12 | async function assertLearningProgressSemantics(page, progress) { |
| 13 | const origin = new URL(page.url()); |
| 14 | assert.equal(origin.origin, 'https://127.0.0.1:8445', |
| 15 | 'Use only the isolated synthetic local HTTPS stack.'); |
| 16 | assert(progress && Object.hasOwn(statuses, progress.status), |
| 17 | 'Provide the independent API progress snapshot, not a guessed UI label.'); |
| 18 | assert.equal(progress.source, 'self_reported'); |
| 19 | assert.equal(progress.pending_sync === true, false, |
| 20 | 'This compiled-browser check requires an acknowledged server snapshot.'); |
| 21 | assert(Number.isInteger(progress.version) && progress.version > 0); |
| 22 | assert(typeof progress.updatedAt === 'string' && |
| 23 | /(?:Z|[+-]\d{2}:\d{2})$/.test(progress.updatedAt) && |
| 24 | Number.isFinite(Date.parse(progress.updatedAt))); |
| 25 | |
| 26 | const label = `پیشرفت شخصی: ${statuses[progress.status]}\nآخرین ثبت سرور: ${progress.updatedAt}`; |
| 27 | const status = page.getByRole('status', {name: label, exact: true}); |
| 28 | await status.waitFor({state: 'attached', timeout: 20000}); |
| 29 | assert.equal(await status.count(), 1, |
| 30 | 'Progress and server timestamp must share one accessible status node.'); |
| 31 | assert.equal(await status.getAttribute('aria-label'), label); |
| 32 | |
| 33 | const session = await page.context().newCDPSession(page); |
| 34 | try { |
| 35 | const {nodes} = await session.send('Accessibility.getFullAXTree'); |
| 36 | // Chromium flattens whitespace in computed accessible names. The DOM |
| 37 | // attribute above must remain exact; AX content is compared under the |
| 38 | // browser's name normalization without dropping status or timestamp. |
| 39 | const normalizedName = value => String(value).replace(/\s+/gu,' ').trim(); |
| 40 | const matches = nodes.filter(node => !node.ignored && |
| 41 | node.role?.value === 'status' && normalizedName(node.name?.value) === normalizedName(label)); |
| 42 | assert.equal(matches.length, 1, |
| 43 | `The updated label must appear in Chromium accessibility, not only DOM attributes; status names: ${JSON.stringify(nodes.filter(n=>!n.ignored&&n.role?.value==='status').map(n=>n.name?.value))}`); |
| 44 | assert.equal(nodes.filter(node => !node.ignored && |
| 45 | node.role?.value === 'StaticText' && node.name?.value?.startsWith('پیشرفت شخصی:')).length, 0, |
| 46 | 'Do not duplicate progress announcements through excluded child Text widgets.'); |
| 47 | return {status: 'PASS', role: 'status', serverVersion: progress.version, |
| 48 | includesSelfReportedStatus: true, includesServerTimestamp: true, |
| 49 | accessibleStatusNodeCount: matches.length}; |
| 50 | } finally { |
| 51 | await session.detach(); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | module.exports = {assertLearningProgressSemantics}; |