LMS QA Playwright Runbook¶
This runbook sets up a repeatable QA workflow for LMS E2E using Playwright (FE repo) against Odoo + local Postgres.
All steps are idempotent and operate only on scola_test.
One-time setup¶
1) Create an E2E env file:
cd /home/scola/odoo/scola-fe-v2
cp .env.e2e.example .env.e2e
2) Ensure Postgres CLI tools are available (psql, pg_dump, pg_restore).
3) Ensure scola_test exists and modules are installed (baseline). If not, create it once using your standard Odoo setup.
4) Install Playwright browsers (one-time):
cd /home/scola/odoo/scola-fe-v2
npx playwright install --with-deps
Create baseline backup snapshot¶
Backup always targets scola_test and writes under .qa_backups/.
cd /home/scola/odoo/scola-fe-v2
make qa-backup
Optional overrides:
- QA_BACKUP_FILE=/path/to/file.dump
- PGHOST, PGPORT, PGUSER, PGPASSWORD
Restore/reset scola_test¶
The restore step: - terminates active connections - drops and recreates the DB - restores from the latest baseline dump
cd /home/scola/odoo/scola-fe-v2
make qa-reset
To restore a specific dump:
QA_BACKUP_FILE=/home/scola/odoo/scola-fe-v2/.qa_backups/scola_test_baseline_YYYYMMDD_HHMMSS.dump \
make qa-reset
Seed LMS scenario (preferred: Odoo shell)¶
The seed script is idempotent and prints IDs for debugging:
cd /home/scola/odoo/scola-fe-v2
make qa-seed
Direct invocation (if needed):
cd /home/scola/odoo/scola-fe-v2
E2E_DB_NAME=scola_test \
E2E_ODOO_CONF=/home/scola/odoo/config/scola-dev.conf \
/home/scola/odoo/odoo-bin shell -c /home/scola/odoo/config/scola-dev.conf -d scola_test \
< scripts/qa/seed/seed_lms.py
Seeded objects include: - Users: teacher1/teacher2, student1/student2, parent1/parent2, admin - Academic year + term - Course + subject + batch (rombel) - Teaching assignment (AcademicSection) - LMS course items (material + assignment) - LMS submission (one graded sample)
Daily reset + run tests¶
Fast reset with baseline restore + seed + Playwright:
cd /home/scola/odoo/scola-fe-v2
make qa-all
P0 (Critical Flow) Fast Path¶
Use this when validating the LMS critical path (student submit → teacher grade/publish → student sees grade).
cd /home/scola/odoo/scola-fe-v2
make qa-reset
make qa-seed
npx playwright test tests/e2e/flow --grep "@p0" --project=chromium --reporter=line
Repeat 3x to confirm stability:
npx playwright test tests/e2e/flow --grep "@p0" --project=chromium --reporter=line
npx playwright test tests/e2e/flow --grep "@p0" --project=chromium --reporter=line
npx playwright test tests/e2e/flow --grep "@p0" --project=chromium --reporter=line
Run Playwright (headed + CI)¶
Local debug:
cd /home/scola/odoo/scola-fe-v2
npx playwright test --ui
Headed run for a specific spec (when present):
cd /home/scola/odoo/scola-fe-v2
npx playwright test tests/e2e/specs/lms-smoke.spec.ts --headed
CI/headless:
cd /home/scola/odoo/scola-fe-v2
make qa-run
Reports:
- HTML report: scola-fe-v2/playwright-report
- Artifacts: scola-fe-v2/test-results
Storage state per role¶
Recommended storageState locations:
- tests/e2e/.auth/admin.json
- tests/e2e/.auth/teacher.json
- tests/e2e/.auth/student.json
- tests/e2e/.auth/parent.json
Create storageState by logging in once per role and saving state in a Playwright helper or global setup.
Use the .env.e2e credentials and set storageState in tests per role.
Auth Strategy (Stabilized)¶
Use Odoo session auth to create cookies, then fetch user payload for FE storage:
POST /web/session/authenticateto getsession_idcookie.GET /api/auth/sessionto populateuserInfo.- Seed local/session storage with
userInfo,isAuthenticated, andauthpayloads.
This avoids UI login flakiness and CORS issues.
Same-origin API rule (important)¶
- Production must use same-origin
/api. - Do not set
VITE_API_URLin production. - For local QA runs, the Vite dev server proxies to
E2E_ODOO_URLwhenVITE_API_URLis not set.
Troubleshooting¶
FATAL: database "scola_test" does not exist:-
Create the DB once and install modules, then re-run
make qa-backup. -
permission denied to drop database: -
Use a Postgres user with drop/create privileges (
PGUSER). -
psql: connection failed: -
Set
PGHOST,PGPORT,PGUSER,PGPASSWORDin.env.e2e. -
FE API calls go to the wrong backend:
- Ensure
E2E_ODOO_URLpoints to your local Odoo in.env.e2e. -
Do not set
VITE_API_URLin production. -
LMS course list empty:
- Verify
op.teaching.assignment,op.student.course, andop.batch.student_ids. -
Ensure assignment state is
publishand students are inallocation_ids. -
Gradebook empty:
-
Ensure
lms.course.itemexists for the assignment andlms.submissionhasscore. -
Notifications not visible:
- Check that users have
user_idand are linked toop.student. -
Confirm
scola_portalmodule is installed. -
P0 student flow stuck on submission:
- Ensure assignment detail view shows submission form (edit mode) when prior submission exists.
- Allow
.txtin upload accept list for fixture submissions. -
For resubmission, allow submit without new file.
-
Publish API never called:
- Ensure gradebook publish uses computed assignment averages.
- Ensure
idempotency_keyaligns with UI checks:lms-publish:<courseOfferingId>:<studentId>:TUGAS.
Evidence & Reporting¶
Always capture:
- playwright-report/ HTML report
- test-results/**/trace.zip
- test-results/**/error-context.md
Include: - Command run - Failing spec + step name - Screenshot/trace path - Root cause + fix summary
Selector proposal list (PR recommendation only)¶
Add minimal data-testid attributes in these files:
- scola-fe-v2/src/components/LMS/CourseCard.vue -> data-testid="lms-course-card"
- scola-fe-v2/src/views/LearningManagement/Faculty/CourseDetail.vue -> data-testid="lms-create-assignment" on "Buat Tugas" button
- scola-fe-v2/src/components/Assignment/AssignmentDetailModal.vue -> data-testid="lms-submit-assignment" on submit/update button
- scola-fe-v2/src/views/AssignmentManagement/Faculty/components/AssignmentGradingPage.vue -> data-testid="lms-grade-input" on the marks input
- scola-fe-v2/src/views/LearningManagement/Faculty/Gradebook.vue -> data-testid="lms-publish-grade" on "Publish ke Akademik"
- scola-fe-v2/src/components/portal/NotificationCenter.vue (or src/components/TopbarMobile.vue) -> data-testid="notif-bell"
Update baseline when schema changes¶
cd /home/scola/odoo/scola-fe-v2
make qa-reset
make qa-seed
make qa-backup