Skip to content

seeding tools: write ui-test-only curriculum content files to custom location#70203

Merged
davidsbailey merged 13 commits into
stagingfrom
write-custom-ui-test-file-locations
Jan 14, 2026
Merged

seeding tools: write ui-test-only curriculum content files to custom location#70203
davidsbailey merged 13 commits into
stagingfrom
write-custom-ui-test-file-locations

Conversation

@davidsbailey

@davidsbailey davidsbailey commented Jan 6, 2026

Copy link
Copy Markdown
Member

In the process of creating some new ui test scripts which are not needed in production, I noticed that we have logic to seed from the custom config location dashboard/test/ui/config/, but not to write to that location. This PR updates the write logic for levelbuilder + cloning pathways to start writing to the following directories when appropriate:

  • dashboard/test/ui/config/course_offerings
  • dashboard/test/ui/config/courses
  • dashboard/test/ui/config/scripts_json

Testing story

  • new unit tests verify we write each object to the custom location when name starts with ui-test-
  • manually verified I could create a new course and unit. together these steps verify each relevant levelbuilder edit path as well as the clone_migrated_unit path are all writing files to the new location:
    • created ui-test-artist course via http://localhost-studio.code.org:3000/courses/new`
    • immediately saved via http://localhost-studio.code.org:3000/courses/ui-test-artist/edit` to create the course offering
    • created new unit from rails console via Unit.find_by_name('artist').clone_migrated_unit('ui-test-artist', destination_unit_group_name: 'ui-test-artist')
    • set some required fields on the course offering via http://localhost-studio.code.org:3000/course_offerings/ui-test-artist/edit
    • committed the resulting files to the repo as part of this PR (everything in this PR under dashboard/test/ui/config
  • verified the new ui-test-only course and unit are working properly by updating an existing UI test to depend on them. this helps verify the contents of the files in the new location are valid

Follow-up work

  • Because all content in dashboard/test/ui/config already have names starting with the ui-test- prefix, I'm using this name prefix as a heuristic for when to write to this custom location. In the future, if we find that we want to move scripts like allthethings here without changing its name, we could consider using a custom ui_test_only field on each object. TBD whether we want to allow this, or if we prefer to require that ui-test-only objects have the ui-test- prefix, so I'm erring on the side of being more restrictive for now.
  • remove artist from UI_TEST_SCRIPTS, since this PR removes the last UI test that depended on it. the verification steps for this are a little too involved for me to want to tack them onto this PR. see Prefer test units in UI tests #66876 for an explanation.

@davidsbailey davidsbailey changed the title Write custom UI test file locations seeding tools: write ui-test-only curriculum content files to custom location Jan 12, 2026
@davidsbailey davidsbailey marked this pull request as ready for review January 12, 2026 21:07

@etaderhold etaderhold 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.

Thanks for including tests for the non-default root directory. This helps maintain confidence that moving this test content won't break the seeding-from-staging procedure (not that the UI test files have a strong need to be seeded to production anyway).

I see a bunch of ui-test content already exists and isn't being moved to the new directory as part of this PR. Is that going to cause any problems seeding or modifying that content? Maybe if one of these is edited on levelbuilder it would save a copy to the new folder or while keeping the old copy in the old place too? I'm not sure.

@davidsbailey

Copy link
Copy Markdown
Member Author

I see a bunch of ui-test content already exists and isn't being moved to the new directory as part of this PR. Is that going to cause any problems seeding or modifying that content? Maybe if one of these is edited on levelbuilder it would save a copy to the new folder or while keeping the old copy in the old place too? I'm not sure.

Good catch! The only one I see of these is

. that one is depended on by allthemigratedthings.course, which is seeded in non-ui-test environments, so I've renamed that one to allthemigratedthings.json and kept it in dashboard/config. we stopped using this course in ui tests in #66462, so this is just to keep seeding working, without creating ourselves a land mine by removing the files from the repo without removing the objects from prod and other environments.

The other files starting with ui-test- all appear to be in dashboard/test/ui/config already, with the exception of levels like config/levels/custom/applab/ui-test-level-v2.level which won't be affected by this change. Please let me know if you think I missed anything else here.

 Conflicts:
	dashboard/config/locales/courses/en.yml
@davidsbailey davidsbailey merged commit db7c559 into staging Jan 14, 2026
6 checks passed
@davidsbailey davidsbailey deleted the write-custom-ui-test-file-locations branch January 14, 2026 16:22
moshebaricdo pushed a commit that referenced this pull request Jan 14, 2026
…location (#70203)

* customize write location of script_json directory for ui test scripts

* also customize write location for ui test course files

* customize course offering ui test file location

* use levelbuilder controls to create new ui-test-artist course

* make assessment_feedback_download.feature depend on ui-test-artist

* actually seed new content in ui tests

* fix display names

* fix course offering content settings

* publish ui-test-artist course

* save misc updates to ui-test-artist script json

* rename ui-test-versioned-script course offering to allthemigratedthings
davidsbailey added a commit that referenced this pull request Jan 29, 2026
…0502)

* Re Restore "seeding tools: write ui-test-only curriculum content … (#70203)"

This reverts commit 36ac2f4.

* temporarily generate cached staging build to temp location

* Revert "temporarily generate cached staging build to temp location"

This reverts commit 8a71330.

* run drone against temp cached build files

* temporarily skip removing records when seeding course offerings

* Revert "temporarily skip removing records when seeding course offerings"

This reverts commit 329bc4c.

* improve error message when preventing course version change

* preserve ui-test- prefixed offerings during CourseOffering.seed_all

UI test course offerings are now stored in a separate directory
(test/ui/config/course_offerings/) and seeded separately. This change
prevents seed_all from destroying them when it runs against the
regular config/course_offerings/ directory.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Revert "run drone against temp cached build files"

This reverts commit efb732d.

* rerun drone

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
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.

2 participants