Skip to content

Seed different project types - #987

Merged
zetter-rpf merged 3 commits into
mainfrom
seed-other-project-types
Aug 27, 2026
Merged

Seed different project types#987
zetter-rpf merged 3 commits into
mainfrom
seed-other-project-types

Conversation

@zetter-rpf

@zetter-rpf zetter-rpf commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Status

What's changed?

Previously we only created Python projects in our seed data which made integration testing harder.
This PR also creates Scratch and HTML projects and gives them clearer names.

I've also turned the Scratch feature flag on for the School to make the setup for the Scratch tests simpler.

I've also changed the local dev seeds to use the same method, so it will be easier to test different projects in dev too.

Steps to perform after deploying to production

After this is deployed, https://github.com/RaspberryPiFoundation/learner-experience-integration-tests/pull/72
should be merged immediately after

Made with help from Claude

@cla-bot cla-bot Bot added the cla-signed label Aug 26, 2026
@raspberrypiherokubot
raspberrypiherokubot temporarily deployed to editor-api-p-seed-other-ctb9ft August 26, 2026 15:27 Inactive
@zetter-rpf
zetter-rpf marked this pull request as ready for review August 26, 2026 15:37
Copilot AI lite review requested due to automatic review settings August 26, 2026 15:37
@zetter-rpf zetter-rpf changed the title Seed a Python, HTML/CSS and Scratch lesson for each class Seed different project types Aug 26, 2026
@zetter-rpf zetter-rpf closed this Aug 26, 2026
@zetter-rpf zetter-rpf reopened this Aug 26, 2026
@zetter-rpf
zetter-rpf force-pushed the seed-other-project-types branch from be11b86 to 77502f7 Compare August 26, 2026 15:57
@raspberrypiherokubot
raspberrypiherokubot temporarily deployed to editor-api-p-seed-other-eccnnx August 26, 2026 15:58 Inactive
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown

Test coverage

93.47% line coverage reported by SimpleCov.
Run: https://github.com/RaspberryPiFoundation/editor-api/actions/runs/33076210391

@DNR500 DNR500 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, nice to have this to better support those test in LXIT

Comment thread spec/lib/test_seeds_spec.rb
Comment thread lib/tasks/seed_data/lesson_scratch_starter.json

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Previously the education seed tasks only ever created Python
lessons/projects, with lesson names drawn from a random Faker
programming language that had no relation to the actual project
content. This made it harder to manually test school class
flows, or run E2E tests, against Scratch or HTML/CSS lessons using
the seed data.

This change makes create_lessons build one lesson per entry in
LESSON_PROJECT_TYPES (python, html/css, scratch) for a school class,
naming each lesson after its project type (e.g. "Lesson 3 scratch")
and generating a project with matching starter content via
create_project: a .py component for Python, an .html/.css pair for
HTML/CSS, and a Scratch component (seeded from
lib/tasks/seed_data/lesson_scratch_starter.json) for Scratch.
"Project type" is used instead of "language" throughout, since
Scratch and HTML/CSS aren't languages. Both for_education.rake and
test_seeds.rake share this behaviour, and the seeded school gets
scratch_enabled set in both, matching the real constraint enforced
when a teacher creates a Scratch lesson via
LessonCreation#verify_lesson_scratch!.

Existing specs for for_education and test_seeds are updated for the
new lesson counts and assert on the specific lesson names/project
types for the Scratch and HTML/CSS lessons.
These are both the same and are just used to represent the Scratch Starter project
This was added in as a stub before we saved projects to the db
@zetter-rpf
zetter-rpf force-pushed the seed-other-project-types branch from 77502f7 to d474ec1 Compare August 27, 2026 13:19
@zetter-rpf
zetter-rpf temporarily deployed to editor-api-p-seed-other-eccnnx August 27, 2026 13:19 Inactive
@zetter-rpf
zetter-rpf merged commit 9f18973 into main Aug 27, 2026
8 checks passed
@zetter-rpf
zetter-rpf deleted the seed-other-project-types branch August 27, 2026 13:24
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.

4 participants