@@ -348,3 +348,81 @@ Feature: Create, preview, test, tidy and edit STACK questions
348348 And I should see "Number of new variants successfully created, tested and deployed: 1."
349349 And I should see "Too many repeated existing question notes were generated."
350350 And I should see "A variant matching this Question note is already deployed."
351+
352+ @javascript
353+ Scenario : Saving broken questions
354+ When I am on the "Course 1" "core_question > course question bank" page logged in as "teacher"
355+ # Create a new question.
356+ And I add a "STACK" question filling the form with:
357+ | Question name | Test STACK question |
358+ | Question variables | p : (x -1 )^3 ; |
359+ | Question text | Differentiate {@p @} with respect to \(x \). [[input :ans1 ]] [[validation :ans1 ]] |
360+ | Question description | This is a very simple test question . |
361+ | Model answer | diff (p ,x ) |
362+ | SAns | ans1 |
363+ | TAns | diff (p ,x ) |
364+ Then I should see "Test STACK question"
365+
366+ # Save a broken question.
367+ When I am on the "Test STACK question" "core_question > edit" page
368+ And I set the following fields to these values:
369+ | Question name | Broken question |
370+ | Model answer | |
371+ And I press "id_submitbutton"
372+ Then I should not see "Broken question"
373+ And I set the following fields to these values:
374+ | Save as broken | 1 |
375+ And I press "id_submitbutton"
376+ Then I should see "Broken question"
377+
378+ # Update a broken question
379+ When I am on the "Broken question" "core_question > edit" page
380+ And I set the following fields to these values:
381+ | Question name | Broken question updated |
382+ | Question text | [[input :ans1 ]] [[validation :ans1 ]] [[input :ans2 ]] [[validation :ans2 ]] |
383+ | Specific feedback | [[feedback :prt1 ]] [[feedback :prt2 ]] |
384+ And I press "id_submitbutton"
385+ Then I should see "Broken question updated"
386+
387+ # Remove an input from a broken question
388+ When I am on the "Broken question updated" "core_question > edit" page
389+ Then I should see "Potential response tree: prt2"
390+ And I should see "Input: ans2"
391+ And I set the following fields to these values:
392+ | Question name | Broken question update2 |
393+ | Question text | [[input :ans1 ]] [[validation :ans1 ]] |
394+ | Specific feedback | [[feedback :prt1 ]] [[feedback :prt2 ]] |
395+ And I press "id_submitbutton"
396+ Then I should see "QUESTION WAS NOT SAVED"
397+ And I click on "[id='id_ans2deleteconfirm']" "css_element"
398+ And I press "id_submitbutton"
399+ Then I should see "Broken question update2"
400+
401+ # Remove a PRT from a broken question
402+ When I am on the "Broken question update2" "core_question > edit" page
403+ Then I should see "Potential response tree: prt1"
404+ And I should see "Potential response tree: prt2"
405+ And I should see "Input: ans1"
406+ And I should not see "Input: ans2"
407+ And I set the following fields to these values:
408+ | Question name | Broken question update3 |
409+ | Question text | [[input :ans1 ]] [[validation :ans1 ]] |
410+ | Specific feedback | [[feedback :prt1 ]] |
411+ And I press "id_submitbutton"
412+ Then I should see "QUESTION WAS NOT SAVED"
413+ And I click on "[id='id_prt2prtdeleteconfirm']" "css_element"
414+ And I press "id_submitbutton"
415+ Then I should see "Broken question update3"
416+
417+ # Fix the question, then save normally
418+ When I am on the "Broken question update3" "core_question > edit" page
419+ Then I should see "Potential response tree: prt1"
420+ And I should not see "Potential response tree: prt2"
421+ And I should see "Input: ans1"
422+ And I should not see "Input: ans2"
423+ And I set the following fields to these values:
424+ | Question name | Fixed question |
425+ | Model answer | diff (p ,x ) |
426+ | Save as broken | 0 |
427+ And I press "id_submitbutton"
428+ Then I should see "Fixed question"
0 commit comments