-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ceara/aitt 602 levelbuilder instructions test #58329
Ceara/aitt 602 levelbuilder instructions test #58329
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great, thanks for picking this up!
@unit = create :script, name: 'csp2-2020' | ||
lesson_group = create :lesson_group, script: @unit | ||
@lesson = create( | ||
:lesson, | ||
script_id: @unit.id, | ||
lesson_group: lesson_group, | ||
name: 'first lesson', | ||
relative_position: 1, | ||
absolute_position: 1, | ||
has_lesson_plan: true, | ||
properties: { | ||
overview: 'lesson overview', | ||
student_overview: 'student overview' | ||
} | ||
) | ||
@lesson2 = create( | ||
:lesson, | ||
script_id: @unit.id, | ||
lesson_group: lesson_group, | ||
name: 'second lesson', | ||
relative_position: 2, | ||
absolute_position: 2, | ||
has_lesson_plan: true | ||
) | ||
@level = create :maze | ||
@level2 = create(:level, long_instructions: 'foo', short_instructions: 'bar') | ||
@level3 = create :multi | ||
@script_level1 = create( | ||
:script_level, | ||
activity_section: @activity_section, | ||
activity_section_position: 1, | ||
chapter: 1, | ||
position: 1, | ||
lesson: @lesson, | ||
script: @lesson.script, | ||
levels: [@level], | ||
challenge: true | ||
) | ||
@script_level2 = create( | ||
:script_level, | ||
activity_section: @activity_section, | ||
activity_section_position: 1, | ||
chapter: 1, | ||
position: 2, | ||
lesson: @lesson, | ||
script: @lesson.script, | ||
levels: [@level2], | ||
challenge: true | ||
) | ||
@script_level3 = create( | ||
:script_level, | ||
activity_section: @activity_section, | ||
activity_section_position: 1, | ||
chapter: 1, | ||
position: 1, | ||
lesson: @lesson2, | ||
script: @lesson2.script, | ||
levels: [@level3], | ||
challenge: true | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you may be able to replace all of this with something like:
@unit = create(:script, name: ..., :with_levels, lessons_count: 2, levels_count: 2)
@unit.lessons.first.script_levels.first.update!(challenge: true)
...
assert_select '.instructions_summary h1', "Lesson 1: #{@script.lessons.first.name}"
this invokes:
code-dot-org/dashboard/test/factories/factories.rb
Lines 940 to 952 in 9a47018
trait :with_levels do | |
transient do | |
lessons_count {1} | |
levels_count {2} | |
end | |
after(:create) do |script, evaluator| | |
lesson_group = create :lesson_group, script: script | |
evaluator.lessons_count.times do | |
lesson = create :lesson, :with_activity_section, lesson_group: lesson_group | |
evaluator.levels_count.times do | |
level = create(:level) | |
create :script_level, levels: [level], activity_section: lesson.activity_sections.first |
fine to keep what you have this time, but worth looking in the factories for shortcuts next time.
Warning!!
The AP CSP Create Performance Task is in progress. The most critical dates are from April 3 - April 30, 2024. Please consider any risk introduced by this PR that could affect our students taking AP CSP. Code.org students taking AP CSP primarily use App Lab for their Create Task, however a small percent use Game Lab. Carefully consider whether your change has any risk of alterering, changing, or breaking anything in these two labs. Even small changes, such as a different button color, are considered significant during this time period. Reach out to the Student Learning team or Curriculum team for more details.
Description
Adds a ruby integration test that verifies that the levelbuilder
/instructions
view is successfully created. There is one test that creates a simple/instructions
page, and another test that creates a page with a variety of level types to display, including ones that previously broke the page.Links
Jira ticket: https://codedotorg.atlassian.net/browse/AITT-602
Follow up to this commit: #54547
Testing story
When I undo the fix to the instructions page from this commit, the new test fails, with the fix from that commit, the test passes
PR Checklist: