Skip to content

Commit 70e4fa0

Browse files
author
Brock Cooper
committed
Make course checklist status accurate
Fixes CNVS-22241 Test Plan: 1) Create new course 2) Navigate to Course Setup Checklist on the Home view 3) Follow each item in the checklist and ensure each item is checked off correctly as you complete them Change-Id: Ia65ab7817dcd330107701e6e6641941343d72d24 Reviewed-on: https://gerrit.instructure.com/59999 Tested-by: Jenkins Reviewed-by: Dan Minkevitch <dan@instructure.com> QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com> Product-Review: Brock Cooper <bcooper@instructure.com>
1 parent 6f462bb commit 70e4fa0

3 files changed

Lines changed: 163 additions & 67 deletions

File tree

app/controllers/courses_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,7 @@ def show
15141514
:add_students => course_users_path(course_id: @context),
15151515
:add_files => context_url(@context, :context_files_url, :wizard => 1),
15161516
:select_navigation => context_url(@context, :context_details_url),
1517-
:course_calendar => calendar_path(:wizard => 1),
1517+
:course_calendar => calendar_path(course_id: @context),
15181518
:add_tas => course_users_path(:course_id => @context),
15191519
:publish_course => course_path(@context)
15201520
},

app/jsx/course_wizard/ListItems.jsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,45 @@ define([
33
], function (I18n) {
44
/**
55
* Returns an array containing all the possible items for the checklist
6+
* For many ListItems, the ! is added for the complete property
7+
* because the ENV is checking if the step is nil? or empty?
68
*/
79
return [
810
{
911
key:'content_import',
10-
complete: ENV.COURSE_WIZARD.checklist_states.import_step,
12+
complete: !ENV.COURSE_WIZARD.checklist_states.import_step,
1113
title: I18n.t("Import Content"),
1214
text: I18n.t("If you've been using another course management system, you probably have stuff in there that you're going to want moved over to Canvas. We can walk you through the process of easily migrating your content into Canvas."),
1315
url: ENV.COURSE_WIZARD.urls.content_import,
1416
iconClass: 'icon-upload'
1517
},
1618
{
1719
key:'add_assignments',
18-
complete: ENV.COURSE_WIZARD.checklist_states.assignment_step,
20+
complete: !ENV.COURSE_WIZARD.checklist_states.assignment_step,
1921
title: I18n.t("Add Course Assignments"),
2022
text: I18n.t("Add your assignments. You can just make a long list, or break them up into groups - and even specify weights for each assignment group."),
2123
url: ENV.COURSE_WIZARD.urls.add_assignments,
2224
iconClass: 'icon-assignment'
2325
},
2426
{
2527
key:'add_students',
26-
complete: ENV.COURSE_WIZARD.checklist_states.add_student_step,
28+
complete: !ENV.COURSE_WIZARD.checklist_states.add_student_step,
2729
title: I18n.t("Add Students to the Course"),
2830
text: I18n.t("You'll definitely want some of these. What's the fun of teaching a course if nobody's even listening?"),
2931
url: ENV.COURSE_WIZARD.urls.add_students,
3032
iconClass: 'icon-group-new'
3133
},
3234
{
3335
key:'add_files',
34-
complete: ENV.COURSE_WIZARD.checklist_states.import_step, /* Super odd in the existing wizard this is set to display: none */
36+
complete: !ENV.COURSE_WIZARD.checklist_states.import_step, /* Super odd in the existing wizard this is set to display: none */
3537
title: I18n.t("Add Files to the Course"),
3638
text: I18n.t("The Files tab is the place to share lecture slides, example documents, study helps -- anything your students will want to download. Uploading and organizing your files is easy with Canvas. We'll show you how."),
3739
url: ENV.COURSE_WIZARD.urls.add_files,
3840
iconClass: 'icon-note-light'
3941
},
4042
{
4143
key:'select_navigation',
42-
complete: ENV.COURSE_WIZARD.checklist_states.navigation_step,
44+
complete: !ENV.COURSE_WIZARD.checklist_states.navigation_step,
4345
title: I18n.t("Select Navigation Links"),
4446
text: I18n.t("By default all links are enabled for a course. Students won't see links to sections that don't have content. For example, if you haven't created any quizzes, they won't see the quizzes link. You can sort and explicitly disable these links if there are areas of the course you don't want your students accessing."),
4547
url: ENV.COURSE_WIZARD.urls.select_navigation,
@@ -54,15 +56,15 @@ define([
5456
},
5557
{
5658
key:'course_calendar',
57-
complete: ENV.COURSE_WIZARD.checklist_states.calendar_event_step,
59+
complete: !ENV.COURSE_WIZARD.checklist_states.calendar_event_step,
5860
title: I18n.t("Add Course Calendar Events"),
5961
text: I18n.t("Here's a great chance to get to know the calendar and add any non-assignment events you might have to the course. Don't worry, we'll help you through it."),
6062
url: ENV.COURSE_WIZARD.urls.course_calendar,
6163
iconClass: 'icon-calendar-month'
6264
},
6365
{
6466
key:'add_tas',
65-
complete: ENV.COURSE_WIZARD.checklist_states.add_ta_step,
67+
complete: !ENV.COURSE_WIZARD.checklist_states.add_ta_step,
6668
title: I18n.t("Add TAs to the Course"),
6769
text: I18n.t("You may want to assign some TAs to help you with the course. TAs can grade student submissions, help moderate the discussions and even update due dates and assignment details for you."),
6870
url: ENV.COURSE_WIZARD.urls.add_tas,

spec/selenium/courses_spec.rb

Lines changed: 153 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -89,78 +89,172 @@ def validate_action_button(postion, validation_text)
8989

9090
end
9191

92-
it "should properly hide the wizard and remember its hidden state" do
93-
# For now we are not allowing the wizard to popup automatically
94-
# so this spec doesn't apply, it may in the future though.
95-
pending
96-
course_with_teacher_logged_in
97-
98-
create_new_course
92+
describe 'course wizard' do
93+
def go_to_checklist
94+
get "/courses/#{@course.id}"
95+
f(".wizard_popup_link").click()
96+
wizard_box = f(".ic-wizard-box")
97+
keep_trying_until { expect(wizard_box).to be_displayed }
98+
end
9999

100-
wizard_box = f(".ic-wizard-box")
101-
keep_trying_until { expect(wizard_box).to be_displayed }
102-
f(".ic-wizard-box__close a").click
100+
def check_if_item_complete(item)
101+
elem = "#wizard_#{item}.ic-wizard-box__content-trigger--checked"
102+
expect(f(elem)).to be_displayed
103+
end
103104

104-
refresh_page
105-
wait_for_ajaximations # we need to give the wizard a chance to pop up
106-
wizard_box = f(".ic-wizard-box")
107-
expect(wizard_box).to eq nil
105+
def check_if_item_not_complete(item)
106+
expect(f("#wizard_#{item}.ic-wizard-box__content-trigger")).to be_displayed
107+
expect(f("#wizard_#{item}.ic-wizard-box__content-trigger--checked")).to be_nil
108+
end
108109

109-
# un-remember the setting
110-
driver.execute_script "localStorage.clear()"
111-
end
110+
it "should properly hide the wizard and remember its hidden state" do
111+
# For now we are not allowing the wizard to popup automatically
112+
# so this spec doesn't apply, it may in the future though.
113+
pending
114+
course_with_teacher_logged_in
115+
create_new_course
116+
wizard_box = f(".ic-wizard-box")
117+
keep_trying_until { expect(wizard_box).to be_displayed }
118+
f(".ic-wizard-box__close a").click
119+
refresh_page
120+
wait_for_ajaximations # we need to give the wizard a chance to pop up
121+
wizard_box = f(".ic-wizard-box")
122+
expect(wizard_box).to eq nil
123+
# un-remember the setting
124+
driver.execute_script "localStorage.clear()"
125+
end
112126

113-
it "should open and close wizard after initial close" do
114-
# For now we are not allowing the wizard to popup automatically
115-
# so this spec doesn't apply, it may in the future though.
116-
pending
117-
def find_wizard_box
118-
wizard_box = keep_trying_until do
119-
wizard_box = f(".ic-wizard-box")
120-
expect(wizard_box).to be_displayed
127+
it "should open and close wizard after initial close" do
128+
# For now we are not allowing the wizard to popup automatically
129+
# so this spec doesn't apply, it may in the future though.
130+
pending
131+
def find_wizard_box
132+
wizard_box = keep_trying_until do
133+
wizard_box = f(".ic-wizard-box")
134+
expect(wizard_box).to be_displayed
135+
wizard_box
136+
end
121137
wizard_box
122138
end
123-
wizard_box
139+
140+
course_with_teacher_logged_in
141+
create_new_course
142+
143+
wait_for_ajaximations
144+
wizard_box = find_wizard_box
145+
f(".ic-wizard-box__close a").click
146+
wait_for_ajaximations
147+
wizard_box = f(".ic-wizard-box")
148+
expect(wizard_box).to eq nil
149+
checklist_button = f('.wizard_popup_link')
150+
expect(checklist_button).to be_displayed
151+
checklist_button.click
152+
wait_for_ajaximations
153+
wizard_box = find_wizard_box
154+
f(".ic-wizard-box__close a").click
155+
wait_for_ajaximations
156+
wizard_box = f(".ic-wizard-box")
157+
expect(wizard_box).to eq nil
158+
expect(checklist_button).to be_displayed
124159
end
125160

126-
course_with_teacher_logged_in
127-
create_new_course
161+
it "should open up the choose home page dialog from the wizard" do
162+
course_with_teacher_logged_in
163+
create_new_course
164+
165+
# Because of the specs about automatically opening are currently
166+
# pending, we need to cause the wizard to open by way of click. When
167+
# those specs are no longer pendings, the click line should be removed.
168+
go_to_checklist
169+
170+
f("#wizard_home_page").click
171+
f(".ic-wizard-box__message-button a").click
172+
wait_for_ajaximations
173+
modal = f("#edit_course_home_content_form")
174+
expect(modal).to be_displayed
175+
end
128176

129-
wait_for_ajaximations
130-
wizard_box = find_wizard_box
131-
f(".ic-wizard-box__close a").click
132-
wait_for_ajaximations
133-
wizard_box = f(".ic-wizard-box")
134-
expect(wizard_box).to eq nil
135-
checklist_button = f('.wizard_popup_link')
136-
expect(checklist_button).to be_displayed
137-
checklist_button.click
138-
wait_for_ajaximations
139-
wizard_box = find_wizard_box
140-
f(".ic-wizard-box__close a").click
141-
wait_for_ajaximations
142-
wizard_box = f(".ic-wizard-box")
143-
expect(wizard_box).to eq nil
144-
expect(checklist_button).to be_displayed
145-
end
177+
it "should have the correct initial state" do
178+
course_with_teacher_logged_in
179+
go_to_checklist
180+
181+
check_if_item_not_complete('content_import')
182+
check_if_item_not_complete('add_assignments')
183+
check_if_item_not_complete('add_students')
184+
check_if_item_not_complete('add_files')
185+
check_if_item_not_complete('content_import')
186+
check_if_item_not_complete('select_navigation')
187+
check_if_item_complete('home_page')
188+
check_if_item_not_complete('course_calendar')
189+
check_if_item_not_complete('add_tas')
190+
end
146191

147-
it "should open up the choose home page dialog from the wizard" do
148-
course_with_teacher_logged_in
149-
create_new_course
192+
it "should complete 'Add Course Assignments' checklist item" do
193+
course_with_teacher_logged_in
194+
@course.assignments.create({name: "Test Assignment"})
195+
go_to_checklist
196+
check_if_item_complete('add_assignments')
197+
end
150198

151-
# Because of the specs about automatically opening are currently
152-
# pending, we need to cause the wizard to open by way of click. When
153-
# those specs are no longer pendings, the click line should be removed.
154-
f(".wizard_popup_link").click()
155-
wizard_box = f(".ic-wizard-box")
156-
keep_trying_until { expect(wizard_box).to be_displayed }
199+
it "should complete 'Add Students to the Course' checklist item" do
200+
course_with_teacher_logged_in
201+
student = user_with_pseudonym(:username => 'student@example.com', :active_all => 1)
202+
student_in_course(:user => student, :active_all => 1)
203+
go_to_checklist
204+
check_if_item_complete('add_students')
205+
end
157206

207+
it "should complete 'Select Navigation Links' checklist item" do
208+
course_with_teacher_logged_in
209+
get "/courses/#{@course.id}"
158210

159-
f("#wizard_home_page").click
160-
f(".ic-wizard-box__message-button a").click
161-
wait_for_ajaximations
162-
modal = f("#edit_course_home_content_form")
163-
expect(modal).to be_displayed
211+
# Navigate to Navigation tab
212+
go_to_checklist
213+
f('#wizard_select_navigation').click()
214+
f('.ic-wizard-box__message-button a').click()
215+
216+
# Modify Naviagtion
217+
f('#navigation_tab').click()
218+
f('.navitem.enabled.modules .al-trigger.al-trigger-gray').click()
219+
f('.navitem.enabled.modules .admin-links .disable_nav_item_link').click()
220+
f('#tab-navigation .btn').click()
221+
222+
go_to_checklist
223+
check_if_item_complete('select_navigation')
224+
end
225+
226+
it "should complete 'Add Course Calendar Events' checklist item" do
227+
course_with_teacher_logged_in
228+
get "/courses/#{@course.id}"
229+
230+
# Navigate to Calendar tab
231+
go_to_checklist
232+
f('#wizard_course_calendar').click()
233+
f('.ic-wizard-box__message-button a').click()
234+
235+
# Add Event
236+
f("#create_new_event_link").click()
237+
wait_for_ajaximations
238+
replace_content(f('#edit_calendar_event_form #calendar_event_title'), "Event")
239+
f("#edit_calendar_event_form button.event_button").click()
240+
wait_for_ajaximations
241+
242+
go_to_checklist
243+
check_if_item_complete('course_calendar')
244+
end
245+
246+
it "should complete 'Publish the Course' checklist item" do
247+
course_with_teacher_logged_in
248+
get "/courses/#{@course.id}"
249+
250+
# Publish from Checklist
251+
go_to_checklist
252+
f('#wizard_publish_course').click()
253+
f('.ic-wizard-box__message-button button').click()
254+
255+
go_to_checklist
256+
check_if_item_complete('publish_course')
257+
end
164258
end
165259

166260
it "should correctly update the course quota" do

0 commit comments

Comments
 (0)