diff --git a/mod/data/tests/behat/completion_condition_entries.feature b/mod/data/tests/behat/completion_condition_entries.feature deleted file mode 100644 index 4f74d2cb65d..00000000000 --- a/mod/data/tests/behat/completion_condition_entries.feature +++ /dev/null @@ -1,62 +0,0 @@ -@mod @mod_data -Feature: Set entries required as a completion condition for a data item - In order to ensure students make a minimum number of entries - As a teacher - I need to set entries required to mark the database activity as completed - - Scenario: Two entries required to complete the activity - Given the following "users" exist: - | username | firstname | lastname | email | - | student1 | Student | 1 | student1@example.com | - | teacher1 | Teacher | 1 | teacher1@example.com | - And the following "courses" exist: - | fullname | shortname | enablecompletion | - | Course 1 | C1 | 1 | - And the following "course enrolments" exist: - | user | course | role | - | teacher1 | C1 | editingteacher | - | student1 | C1 | student | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Database" to section "1" and I fill the form with: - | Name | Test database name | - | Description | Test database description | - | Completion tracking | Show activity as complete when conditions are met | - | completionview | 0 | - | completionentriesenabled | checked | - | completionentries | 2 | - And I am on "Course 1" course homepage - And I add a "Text input" field to "Test database name" database and I fill the form with: - | Field name | Test field name | - And I am on "Course 1" course homepage - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I add an entry to "Test database name" database with: - | Test field name | Student original entry | - And I press "Save and view" - And I am on "Course 1" course homepage - And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - #One entry is not enough to mark as complete - And "Student 1" user has not completed "Test database name" activity - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I add an entry to "Test database name" database with: - | Test field name | Student second entry | - And I press "Save and view" - And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - Then "Student 1" user has completed "Test database name" activity - And I am on "Course 1" course homepage - And I follow "Test database name" - And I navigate to "Edit settings" in current page administration - And I press "Unlock completion" - And I set the field "completionentries" to "1" - And I press "Save and display" - And I am on "Course 1" course homepage - Then "Student 1" user has completed "Test database name" activity - And I log out diff --git a/mod/data/tests/behat/data_activity_completion.feature b/mod/data/tests/behat/data_activity_completion.feature new file mode 100644 index 00000000000..709f739c511 --- /dev/null +++ b/mod/data/tests/behat/data_activity_completion.feature @@ -0,0 +1,141 @@ +@mod @mod_data @core_completion +Feature: View activity completion in the database activity + In order to have visibility of database completion requirements + As a student + I need to be able to view my database completion progress + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | student1 | Vinnie | Student1 | student1@example.com | + | teacher1 | Darrell | Teacher1 | teacher1@example.com | + And the following "courses" exist: + | fullname | shortname | category | + | Course 1 | C1 | 0 | + And the following "course enrolments" exist: + | user | course | role | + | student1 | C1 | student | + | teacher1 | C1 | editingteacher | + And I log in as "teacher1" + And I am on "Course 1" course homepage + And I navigate to "Edit settings" in current page administration + And I expand all fieldsets + And I set the following fields to these values: + | Enable completion tracking | Yes | + | Show completion conditions | Yes | + And I press "Save and display" + And the following "activity" exists: + | activity | data | + | course | C1 | + | idnumber | mh1 | + | name | Music history | + | section | 1 | + And I am on "Course 1" course homepage + And I follow "Music history" + And I navigate to "Edit settings" in current page administration + And I expand all fieldsets + And I set the following fields to these values: + | Aggregate type | Average of ratings | + | scale[modgrade_type] | Point | + | scale[modgrade_point] | 100 | + | Completion tracking | Show activity as complete when conditions are met | + | Require view | 1 | + | Require grade | 1 | + | completionentriesenabled | 1 | + | completionentries | 2 | + And I press "Save and display" + And I add a "Text input" field to "Music history" database and I fill the form with: + | Field name | Instrument types | + And I follow "Templates" + And I press "Save template" + And I log out + + Scenario: View automatic completion items as a teacher and confirm all tabs display conditions + Given I log in as "teacher1" + And I am on "Course 1" course homepage + When I follow "Music history" + Then "Music history" should have the "View" completion condition + And "Music history" should have the "Make entries: 2" completion condition + And "Music history" should have the "Receive a grade" completion condition + And I follow "View single" + And "Music history" should have the "View" completion condition + And "Music history" should have the "Make entries: 2" completion condition + And "Music history" should have the "Receive a grade" completion condition + And I follow "Search" + And "Music history" should have the "View" completion condition + And "Music history" should have the "Make entries: 2" completion condition + And "Music history" should have the "Receive a grade" completion condition + And I follow "Add entry" + And "Music history" should have the "View" completion condition + And "Music history" should have the "Make entries: 2" completion condition + And "Music history" should have the "Receive a grade" completion condition + And I follow "Export" + And "Music history" should have the "View" completion condition + And "Music history" should have the "Make entries: 2" completion condition + And "Music history" should have the "Receive a grade" completion condition + And I follow "Templates" + And "Music history" should have the "View" completion condition + And "Music history" should have the "Make entries: 2" completion condition + And "Music history" should have the "Receive a grade" completion condition + And I follow "Fields" + And "Music history" should have the "View" completion condition + And "Music history" should have the "Make entries: 2" completion condition + And "Music history" should have the "Receive a grade" completion condition + And I follow "Presets" + And "Music history" should have the "View" completion condition + And "Music history" should have the "Make entries: 2" completion condition + And "Music history" should have the "Receive a grade" completion condition + + Scenario: View automatic completion items as a student + Given I log in as "student1" + And I am on "Course 1" course homepage + And I follow "Music history" + And the "View" completion condition of "Music history" is displayed as "done" + And the "Make entries: 2" completion condition of "Music history" is displayed as "todo" + And the "Receive a grade" completion condition of "Music history" is displayed as "todo" + And I am on "Course 1" course homepage + And I add an entry to "Music history" database with: + | Instrument types | Drums | + And I press "Save and view" + # One entry is not enough to mark as complete. + And the "Make entries: 2" completion condition of "Music history" is displayed as "todo" + And I log out + And I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Music history" + And I follow "View single" + And I set the field "rating" to "3" + And I press "Rate" + And I log out + When I log in as "student1" + And I am on "Course 1" course homepage + And I add an entry to "Music history" database with: + | Instrument types | Hurdygurdy | + And I press "Save and view" + Then the "View" completion condition of "Music history" is displayed as "done" + And the "Make entries: 2" completion condition of "Music history" is displayed as "done" + And the "Receive a grade" completion condition of "Music history" is displayed as "done" + And I log out + And I log in as "teacher1" + And I am on "Course 1" course homepage + And "Vinnie Student1" user has completed "Music history" activity + + @javascript + Scenario: Use manual completion + Given I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Music history" + And I navigate to "Edit settings" in current page administration + And I expand all fieldsets + And I set the field "Completion tracking" to "Students can manually mark the activity as completed" + And I press "Save and display" + # Teacher view. + And the manual completion button for "Music history" should be disabled + And I log out + # Student view. + When I log in as "student1" + And I am on "Course 1" course homepage + And I follow "Music history" + Then the manual completion button of "Music history" is displayed as "Mark as done" + And I toggle the manual completion state of "Music history" + And the manual completion button of "Music history" is displayed as "Done"