Merge branch 'MDL-76169-master' of https://github.com/andrewnicols/moodle

This commit is contained in:
Sara Arjona 2022-11-03 17:06:05 +01:00 committed by Ilya Tregubov
commit add46e3112
42 changed files with 462 additions and 395 deletions

View file

@ -1,27 +1,27 @@
@mod @mod_data
Feature: Users can view and manage data presets
In order to use presets
As a user
I need to view, manage and use presets
In order to use presets
As a user
I need to view, manage and use presets
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| data | Mountain landscapes | n | C1 | data1 |
And the following "mod_data > presets" exist:
| database | name | description | user |
| data1 | Saved preset 1 | The preset1 has description | admin |
| data1 | Saved preset 2 | | admin |
| data1 | Saved preset by teacher1 | This preset has also a description | teacher1 |
| database | name | description | user |
| data1 | Saved preset 1 | The preset1 has description | admin |
| data1 | Saved preset 2 | | admin |
| data1 | Saved preset by teacher1 | This preset has also a description | teacher1 |
@javascript
Scenario: Admins can delete saved presets
@ -71,11 +71,11 @@ Feature: Users can view and manage data presets
@javascript
Scenario: Only users with the viewalluserpresets capability can see presets created by other users
Given the following "permission override" exists:
| role | editingteacher |
| capability | mod/data:viewalluserpresets |
| permission | Prohibit |
| contextlevel | System |
| reference | |
| role | editingteacher |
| capability | mod/data:viewalluserpresets |
| permission | Prohibit |
| contextlevel | System |
| reference | |
When I am on the "Mountain landscapes" "data activity" page logged in as teacher1
And I follow "Presets"
Then I should see "Image gallery"
@ -86,8 +86,8 @@ Feature: Users can view and manage data presets
@javascript
Scenario: Teachers can save presets
Given the following "mod_data > fields" exist:
| database | type | name | description |
| data1 | text | Test field name | Test field description |
| database | type | name | description |
| data1 | text | Test field name | Test field description |
And I am on the "Mountain landscapes" "data activity" page logged in as teacher1
And I follow "Templates"
When I click on "Actions" "button"
@ -176,10 +176,10 @@ Feature: Users can view and manage data presets
@javascript
Scenario: Teachers can edit presets and overwrite them if they are the authors
Given the following "mod_data > preset" exists:
| database | data1 |
| name | Another preset created by teacher1 |
| description | This description will be overwritten |
| user | teacher1 |
| database | data1 |
| name | Another preset created by teacher1 |
| description | This description will be overwritten |
| user | teacher1 |
And I am on the "Mountain landscapes" "data activity" page logged in as teacher1
When I follow "Presets"
And I open the action menu in "Saved preset by teacher1" "table_row"
@ -243,11 +243,11 @@ Feature: Users can view and manage data presets
@javascript
Scenario: Teachers can delete their own presets
Given the following "mod_data > fields" exist:
| database | type | name | description |
| data1 | text | Test field name | Test field description |
| database | type | name | description |
| data1 | text | Test field name | Test field description |
And the following "mod_data > presets" exist:
| database | name | description | user |
| data1 | Saved preset by teacher1 | My funny description goes here. | teacher1 |
| database | name | description | user |
| data1 | Saved preset by teacher1 | My funny description goes here. | teacher1 |
And I am on the "Mountain landscapes" "data activity" page logged in as teacher1
When I follow "Presets"
And I should see "Image gallery"

View file

@ -1,8 +1,8 @@
@mod @mod_quiz @quiz @quiz_overview @javascript
Feature: Regrading quiz attempts using the Grades report
In order to be able to correct mistakes I made setting up my quiz
As a teacher
I need to be able to re-grade attempts after editing questions
In order to be able to correct mistakes I made setting up my quiz
As a teacher
I need to be able to re-grade attempts after editing questions
Background:
Given the following "users" exist:
@ -24,24 +24,24 @@ Feature: Regrading quiz attempts using the Grades report
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "activities" exist:
| activity | name | course | idnumber |
| quiz | Quiz for testing regrading | C1 | quiz1 |
| activity | name | course | idnumber |
| quiz | Quiz for testing regrading | C1 | quiz1 |
And the following "questions" exist:
| questioncategory | qtype | name |
| Test questions | truefalse | TF |
| Test questions | shortanswer | SA |
| questioncategory | qtype | name |
| Test questions | truefalse | TF |
| Test questions | shortanswer | SA |
And quiz "Quiz for testing regrading" contains the following questions:
| question | page | maxmark |
| TF | 1 | 5.0 |
| SA | 1 | 5.0 |
And user "student1" has attempted "Quiz for testing regrading" with responses:
| slot | response |
| 1 | True |
| 2 | frog |
| 1 | True |
| 2 | frog |
And user "student2" has attempted "Quiz for testing regrading" with responses:
| slot | response |
| 1 | True |
| 2 | toad |
| 1 | True |
| 2 | toad |
Scenario: Regrade all attempts
Given I am on the "Quiz for testing regrading" "quiz activity" page logged in as teacher
@ -76,8 +76,7 @@ Feature: Regrading quiz attempts using the Grades report
And I should see "Overall number of students achieving grade ranges"
Scenario: Dry-run a full regrade, then regrade the attempts that will need it.
Given I am on the "Quiz for testing regrading" "quiz activity" page logged in as teacher
When I navigate to "Questions" in current page administration
Given I am on the "Quiz for testing regrading" "mod_quiz > edit" page logged in as teacher
And I follow "Edit question SA"
And I set the field "id_fraction_1" to "50%"
And I press "id_submitbutton"
@ -123,11 +122,11 @@ Feature: Regrading quiz attempts using the Grades report
And I should see "Quiz for testing regrading"
And I should see "Overall number of students achieving grade ranges"
And "Student One" row "Regrade" column of "attempts" table should not contain "Needed"
And I navigate to "Question bank" in current page administration
And I am on the "Quiz for testing regrading" "mod_quiz > question bank" page
And I choose "Edit question" action for "TF" in the question bank
And I set the field "Correct answer" to "False"
And I press "id_submitbutton"
And I navigate to "Questions" in current page administration
And I am on the "Quiz for testing regrading" "mod_quiz > edit" page
And I set the field "version" in the "TF" "list_item" to "v2 (latest)"
And I navigate to "Results" in current page administration
And I press "Dry run a full regrade"
@ -148,10 +147,10 @@ Feature: Regrading quiz attempts using the Grades report
And I click on "mod-quiz-report-overview-report-selectall-attempts" "checkbox"
And I click on "Delete selected attempts" "button"
And I click on "Yes" "button"
And I navigate to "Questions" in current page administration
And I am on the "Quiz for testing regrading" "mod_quiz > edit" page
And I should see "(latest)" in the "TF" "list_item"
# Create multiple question versions.
And I navigate to "Question bank" in current page administration
And I am on the "Quiz for testing regrading" "mod_quiz > question bank" page
And I choose "Edit question" action for "TF" in the question bank
And I set the field "Correct answer" to "True"
And I press "id_submitbutton"
@ -159,7 +158,7 @@ Feature: Regrading quiz attempts using the Grades report
And I set the field "Question name" to "New version of TF"
And I set the field "Correct answer" to "False"
And I press "id_submitbutton"
And I navigate to "Questions" in current page administration
And I am on the "Quiz for testing regrading" "mod_quiz > edit" page
And I should see "(latest)" in the "TF" "list_item"
And I click on "version" "select" in the "TF" "list_item"
And I should see "v1"
@ -169,9 +168,9 @@ Feature: Regrading quiz attempts using the Grades report
And I set the field "version" in the "TF" "list_item" to "v1"
And user "student3" has attempted "Quiz for testing regrading" with responses:
| slot | response |
| 1 | True |
| 2 | toad |
And I navigate to "Questions" in current page administration
| 1 | True |
| 2 | toad |
And I am on the "Quiz for testing regrading" "mod_quiz > edit" page
And I set the field "version" in the "TF" "list_item" to "Always latest"
And I navigate to "Results" in current page administration
And I press "Regrade all"
@ -188,10 +187,10 @@ Feature: Regrading quiz attempts using the Grades report
And I click on "Delete selected attempts" "button"
And I click on "Yes" "button"
# Create multiple question versions.
And I navigate to "Question bank" in current page administration
And I am on the "Quiz for testing regrading" "mod_quiz > question bank" page
And I choose "Delete" action for "SA" in the question bank
And I press "Delete"
And I navigate to "Questions" in current page administration
And I am on the "Quiz for testing regrading" "mod_quiz > edit" page
And I click on "Delete" "link" in the "TF" "list_item"
And I click on "Yes" "button" in the "Confirm" "dialogue"
And I click on "Delete" "link" in the "SA" "list_item"
@ -207,8 +206,7 @@ Feature: Regrading quiz attempts using the Grades report
And I click on "Finish attempt ..." "button"
And I press "Submit all and finish"
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
And I am on the "Quiz for testing regrading" "quiz activity" page logged in as teacher
And I navigate to "Question bank" in current page administration
And I am on the "Quiz for testing regrading" "mod_quiz > question bank" page logged in as teacher
And I choose "Edit question" action for "TF" in the question bank
And I set the field "Correct answer" to "False"
And I press "id_submitbutton"

View file

@ -71,6 +71,7 @@ class behat_mod_quiz extends behat_question_base {
* | Manual grading report | Quiz name | The manual grading report for a quiz |
* | Statistics report | Quiz name | The statistics report for a quiz |
* | Attempt review | Quiz name > username > [Attempt] attempt no | Review page for a given attempt (review.php) |
* | Question bank | Quiz name | The question bank page for a quiz |
*
* @param string $type identifies which type of page this is, e.g. 'Attempt review'.
* @param string $identifier identifies the particular page, e.g. 'Test quiz > student > Attempt 1'.
@ -141,6 +142,12 @@ class behat_mod_quiz extends behat_question_base {
['quiz' => $quiz->id, 'userid' => $user->id, 'attempt' => $attemptno], '*', MUST_EXIST);
return new moodle_url('/mod/quiz/review.php', ['attempt' => $attempt->id]);
case 'question bank':
return new moodle_url('/question/edit.php', [
'cmid' => $this->get_cm_by_quiz_name($identifier)->id,
]);
default:
throw new Exception('Unrecognised quiz page type "' . $type . '."');
}