Skip to content

[ENHANCEMENT] [MER-5443] Add Playwright delivery coverage for file upload, likert, and directed discussion#6720

Open
Francisco-Castro wants to merge 12 commits into
masterfrom
MER-5443-automated-file-upload-likert-and-discussion-style-activity-delivery-coverage-including-any-directive-expansion-needed-for-scenario-driven-learner-interaction-and-assertion-support-playwright
Open

[ENHANCEMENT] [MER-5443] Add Playwright delivery coverage for file upload, likert, and directed discussion#6720
Francisco-Castro wants to merge 12 commits into
masterfrom
MER-5443-automated-file-upload-likert-and-discussion-style-activity-delivery-coverage-including-any-directive-expansion-needed-for-scenario-driven-learner-interaction-and-assertion-support-playwright

Conversation

@Francisco-Castro

@Francisco-Castro Francisco-Castro commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Ticket: MER-5443

Summary

Adds Playwright learner-delivery coverage for three activity types that had weak or no browser automation — file upload, likert, and directed discussion — following the Lane 4 pattern established by MER-5438/MER-5440 and the sibling MER-5446 (PR #6712).

Also included:

  • Restructures the shared student_delivery support.ts into a support/ folder (matches the [ENHANCEMENT] [MER-5446] Add delivery automation coverage for activities #6712 convention), with a per-activity helper module each.
  • Small automation tsconfig.json tooling fix (adds node types, drops deprecated baseUrl in favour of relative paths).
  • Fixes the reference scenario fixture so its likert example actually renders in delivery.

What's covered

Each activity is seeded server-side via Oli.Scenarios YAML (structure only), then the learner interaction is driven in the browser — no authoring/section UI is exercised (that's covered by other lanes).

Activity Cases Notes
oli_likert select → submit → evaluated result; submit-gating; restore on reload scoreable seed → server-evaluated
oli_file_upload oversize rejection; submit disabled with no file; (storage-gated) upload → received notice; restore manual-graded
oli_directed_discussion post appears + participation met; Post-button length gating; word-limit warning; restore on reload own post via REST (no channel needed)

The full case matrix and rationale live in docs/exec-plans/current/epics/automated_testing/mer-5443-delivery-plan.md.

Implementation notes

  • Seeds as source of truth — activities created with create_activity (JSON model), placed via edit_page, published, one section per attempt-isolated variant.
  • test.step grouping — related assertions grouped per test to pay the login/nav cost once.
  • File-upload storage gating — the upload-success and restore tests (F1/F4) require an object-storage backend, so they are gated behind STORAGE_TESTS. The storage-free negatives (oversize, submit-gating) always run. See follow-ups.
  • Likert items requirement — likert delivery renders from model.items; the seed includes items with the part id aligned to the item id (per the likert default model). The shared reference fixture was missing this and is fixed here.
  • Navigation-readiness race fixStudentCoursePO.openPage and the shared openStudentDeliveryPracticeForLoggedInStudent helper previously branched on an instant isVisible({ timeout }) snapshot (Playwright ignores that timeout), which could misroute under slow rendering. They now wait for whichever target appears via a new courseContentReady() accessor (galleryTitle.or(outlineTitle)) before branching. Addresses the two CI navigation-race findings flagged on this PR.

Coordination with #6712

The support/ scaffolding and StudentCoursePO changes overlap with the sibling PR #6712 (draft). Two StudentCoursePO items:

Validation

  • prettier --check and eslint clean across all added specs/helpers, StudentCoursePO.ts, and tsconfig.json.
  • Delivery specs run locally against a dev Torus: likert 2/2, directed discussion 3/3, file upload 1 passed + 1 storage-gated skip. (10/12 cases verified live; F1/F4 run where storage is available.)
  • mix test test/scenarios/activities/activities_test.exs → 11 tests, 0 failures (reference-fixture change).
  • Navigation-readiness fix verified both ways: normal run passes (6/1); a deliberately unreachable page fails cleanly at the readiness expect(...).toBeVisible() (10s) rather than misrouting silently.
  • Cross-reviewed (Codex): all findings resolved; verdict ship. The navigation-race fix was implemented by Codex (writer inversion) and reviewed by Claude.

Follow-ups

  • TRIAGE-2409 — CI pipeline to run the student_delivery specs (boots Torus + storage). Today no workflow runs these specs; this also enables the STORAGE_TESTS-gated file-upload tests.
  • TRIAGE-2410 — investigate the directed-discussion realtime channel connecting with token=undefined; does not affect single-user posting (REST-backed).
  • TRIAGE-2411 — refactor StudentCoursePO.findVisibleCourseHome off manual polling to native auto-wait (shared nav helper; trace-noise/robustness).
  • openPage matcher cleanup — handled in [ENHANCEMENT] [MER-5446] Add delivery automation coverage for activities #6712.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
Warnings
⚠️ PR is large (1268 LOC changed). Consider splitting.

Risk score: 5 → risk/medium

Generated by 🚫 dangerJS against da3e7d4

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

AI Review —

Readiness locator can match unrelated course content

file: assets/automation/src/systems/torus/pom/course/StudentCoursePO.ts
line: 39
Description: Falling back to the first expand toggle does not establish that the requested page is loaded. Any expandable group can satisfy the wait, allowing navigation to continue before pageName is available and causing intermittent failures or interaction with the wrong content.
Suggestion: Restrict the fallback locator to an expandable item containing the exact pageName, or wait only for galleryTitle(pageName).or(outlineTitle(pageName)).

Storage coverage is disabled by a test-only environment flag

file: assets/automation/tests/torus/student_delivery/file-upload-delivery.spec.ts
line: 27
Description: The positive upload and persistence test is skipped unless STORAGE_TESTS is explicitly set, even when the configured Torus server has working S3 or MinIO storage. This can silently remove the ticket’s primary happy-path coverage from CI/nightly runs.
Suggestion: Configure STORAGE_TESTS=1 in the committed automation environment, or detect storage capability through the test/server configuration and fail clearly when storage-required coverage is expected.

…file-upload-likert-and-discussion-style-activity-delivery-coverage-including-any-directive-expansion-needed-for-scenario-driven-learner-interaction-and-assertion-support-playwright
…file-upload-likert-and-discussion-style-activity-delivery-coverage-including-any-directive-expansion-needed-for-scenario-driven-learner-interaction-and-assertion-support-playwright

# Conflicts:
#	assets/automation/src/systems/torus/pom/course/StudentCoursePO.ts
#	assets/automation/tests/torus/student_delivery/support/common.ts
#	assets/automation/tests/torus/student_delivery/support/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant