Skip to content

[ENHANCEMENT] [MER-5988] Automate key Simple Author features - #6906

Draft
nicocirio wants to merge 12 commits into
masterfrom
MER-5988-automate-key-simple-author-features
Draft

nicocirio wants to merge 12 commits into
masterfrom
MER-5988-automate-key-simple-author-features

Conversation

@nicocirio

@nicocirio nicocirio commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Adds a Playwright suite for the highest-value Simple Author (adaptive flowchart) workflows, tagged @pr so it runs in the PR Playwright Suite.

npm run test-simple-author (set PLAYWRIGHT_BASE_URL and PLAYWRIGHT_SCENARIO_TOKEN; with PLAYWRIGHT_AUTOMATION_API_KEY set, seeded data is torn down afterwards)

Verifies:

  • Static text, image, video, multiple choice, multi-select, and hub and spoke components: each is configured on its own screen and the configuration persists after save and refresh (one parameterized case per component).
  • Copy/paste and undo/redo, including the known paste regressions: the clipboard is single-use, a screen keeps a single question component, and static components can still be pasted next to a question.
  • Screen settings (check button label, max attempts, max score) and the Scoring Overview.
  • Flowchart validation errors and how they clear once paths are wired.
  • Slider advanced feedback keeps decimal values (known regression), both in authoring and in delivery.
  • Student delivery of a published lesson: responsive layout side by side at desktop width and stacked at phone width, video loading, check-button feedback on a wrong answer, and navigation along the correct path.

Supporting changes:

  • Shared Playwright fixtures now live in tests/resources/media_files with generic names, and /test/support can serve video-test-01.mp4, so browser specs can use a real video without the media library or object storage.
  • Fixes a student page-title check that was accidentally broken by [BUG FIX] [MER-5944] Update lesson title screen reader announcement #6874 (MER-5944): the adaptive lesson header title changed from a heading to plain text, which broke the student tests in adaptive-authoring.spec.ts. StudentCoursePO now accepts either form.
  • Completes the PR Playwright job's environment (.github/workflows/pr-playwright.yml), which this suite is the first @pr test to need: the job only built the webpack JS bundles, so pages were served without the Tailwind CSS (built by Mix into priv/static/css/app.css) and every adaptive "Check" failed with a 500 because the server-side rule bundles (priv/node/rules.js and eval.js, built by yarn run deploy-node as in the Dockerfile) were missing. The job now builds both upfront, adding about 40s, and runs @pr spec files on two workers, which cut the test step from about 8 to under 6 minutes (three workers were slower and made the credential login test flaky).

Suite details, CI placement, and the editor behaviors the page object handles are documented in assets/automation/tests/torus/course_authoring/simple_author.md.
MER-5988-simple-author-report

See: https://eliterate.atlassian.net/browse/MER-5988

Move the image coding fixtures into the shared automation media folder
(tests/resources/media_files) under generic names (image-test-01.png,
table-test-01.csv), so other specs can reuse them, and point the
Playwright support asset controller at that folder.

Allow video-test-01.mp4 through /test/support so browser specs can use a
real video without depending on the media library or object storage.
Add a @pr-tagged suite covering Phase 1 Simple Author workflows:

- Parameterized component cases (static text, image, video, multiple
  choice, multi-select, hub and spoke) that author each component on its
  own screen and verify the configuration survives a save and refresh.
- Copy/paste and undo/redo, with targeted checks for the MER-3420,
  MER-4109 and MER-4572 paste regressions.
- An authored and published lesson covering screen settings, scoring
  overview, flowchart validation and path wiring, and the MER-3919 slider
  decimal feedback regression.
- Student delivery of that lesson: responsive layout at desktop and
  phone widths, video loading, check-button feedback, and navigation.

Add SimpleAuthorPO and SimpleAuthorTask (exposed through the fixture).
The page object waits for the editor's debounced writes before moving
on, since quick successive edits can otherwise persist stale state.

Data is seeded through a scenario and torn down with the guarded
automation teardown when an API key is available. Shared helpers now
wait for the read-only toggle to be enabled before reading it and accept
an optional lesson title when creating a Simple Author page.
StudentCoursePO.openPage and openFirstPage confirmed the opened page by a
heading with the page title. MER-5944 (#6874) changed the adaptive lesson
header title from an h1 to plain text with a screen-reader "Title:"
prefix, so the check failed for every adaptive lesson and broke the
student tests in adaptive-authoring.spec.ts.

Accept either the heading (basic pages) or the adaptive header title.
- Open the student lesson through StudentCoursePO.openPage from Learn
  instead of a direct adaptive_lesson URL, dropping the lesson slug
  shared between the delivery tests.
- Add AdaptiveDeckPO.footerButton() and use it instead of a spec-local
  footer locator.
- Make SimpleAuthorPO internals private and drop unused type values.
- Describe regression checks by behavior in spec comments.
- Document in the fixtures readme how media_files are served through
  /test/support and how to allow a new fixture.
Cut the suite from about 585s to about 375s locally, measured over two
consecutive runs each:

- Share one signed-in page with the editor open across the component
  cases (serial describe), so each case skips a login and an editor load.
  Every case still reloads the editor to verify persistence.
- Stop waiting for the onboarding wizard on every editor load. Extract
  BasicPracticePagePO.disableAdaptiveReadOnly() and use it once the
  editor header has rendered.
- Shorten the waitForSaves quiet window from 1.5s to 800ms, still longer
  than the editor's 500ms save debounce.
- Retry the "Add new screen" dialog only when no screen-creation request
  went out, instead of waiting 20s for a screen that will never appear.
- Drop the now-unused openLesson/openEditor helpers.
Replace the non-null assertions on the added and pasted part ids with
explicit guards, so TypeScript narrows them and a missing part fails
with a clear message.
@github-actions

github-actions Bot commented Oct 6, 2026 •

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

Risk score: 5 → risk/medium

Generated by 🚫 dangerJS against 485ebde

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

AI Review — performance

No issues found

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

AI Review — security

No issues found

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

AI Review — elixir

No issues found

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

AI Review — typescript

Retry can add the component twice

file: assets/automation/src/systems/torus/pom/page/SimpleAuthorPO.ts
line: 250
Description: If the first add takes longer than five seconds, the count assertion times out and the loop clicks again. The original click can still complete afterward, creating two components and making this workflow flaky.
Suggestion: After each click, wait for either the add request or the new component without retrying once a request is observed. Only retry when there is positive evidence the click was dropped.

The job built only the webpack JS bundles. Tailwind CSS is built by Mix
(priv/static/css/app.css), and with watchers disabled for ci_e2e nothing
generated it, so every page in the job rendered unstyled. Tests that rely
on real layout, such as hidden responsive markup or side-by-side
positioning, could not pass there.

Build the CSS once, upfront, alongside the JS bundles.
Adaptive lesson rules are evaluated server-side by Node.js from
priv/node/rules.js and eval.js, which the production Dockerfile builds
with deploy-node. The PR job never built them, so every adaptive check
failed with "Cannot find module 'rules'" and a 500 response.
Confirm the corrected option is selected before the footer control is
used again, and explain that with the feedback still open that control
re-checks the current answer, so acknowledging the feedback first would
submit the wrong answer once more.
Spec files are distributed across two workers while tests within a file
stay serial, since playwright.config.ts keeps fullyParallel off. Specs
already isolate their data per process and run, so they can share the
ephemeral Torus instance.
Spec files are distributed across three workers while tests within a
file stay serial, since playwright.config.ts keeps fullyParallel off.
Specs already isolate their data per process and run, so they can share
the ephemeral Torus instance. The total time is bounded by the longest
spec file instead of the sum of all of them.
Three workers were slower than two on the 4-vCPU runner and made the
credential login test flaky in two of three runs, since three browsers,
Torus, and Postgres competed for CPU. Two workers cut the test step from
about 8 minutes to under 6.

This branch was successfully deployed

1 active deployment
preview-6906 — 485ebde3 Deployed Oct 6, 2026 by github-actions[bot]
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