diff --git a/blocks/completionstatus/tests/behat/block_completionstatus.feature b/blocks/completionstatus/tests/behat/block_completionstatus.feature new file mode 100644 index 00000000000..58b7cc74a90 --- /dev/null +++ b/blocks/completionstatus/tests/behat/block_completionstatus.feature @@ -0,0 +1,57 @@ +@block @block_completionstatus +Feature: Enable Block Completion in a course + In order to view the completion block in a course + As a teacher + I can add completion block to a course + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | idnumber | + | teacher1 | Teacher | 1 | teacher1@example.com | T1 | + | student1 | Student | 1 | student1@example.com | S1 | + And the following "courses" exist: + | fullname | shortname | category | enablecompletion | + | Course 1 | C1 | 0 | 1 | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + + Scenario: Add the block to a the course where completion is disabled + Given I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + And I navigate to "Edit settings" node in "Course administration" + And I set the following fields to these values: + | Enable completion tracking | No | + And I press "Save and display" + When I add the "Course completion status" block + Then I should see "Completion is not enabled for this course" in the "Course completion status" "block" + + Scenario: Add the block to a the course where completion is not set + Given I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + When I add the "Course completion status" block + Then I should see "No completion criteria set for this course" in the "Course completion status" "block" + + Scenario: Add the block to a course with criteria and view as an untracked role. + Given the following "activities" exist: + | activity | course | idnumber | name | intro | + | page | C1 | page1 | Test page name | Test page description | + And I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + And I follow "Test page name" + And I navigate to "Edit settings" node in "Page module administration" + And I set the following fields to these values: + | Completion tracking | Show activity as complete when conditions are met | + | Require view | 1 | + And I press "Save and return to course" + When I add the "Course completion status" block + And I navigate to "Course completion" node in "Course administration" + And I expand all fieldsets + And I set the following fields to these values: + | Test page name | 1 | + And I press "Save changes" + Then I should see "You are currently not being tracked by completion in this course" in the "Course completion status" "block" diff --git a/blocks/completionstatus/tests/behat/block_completionstatus_activity_completion.feature b/blocks/completionstatus/tests/behat/block_completionstatus_activity_completion.feature new file mode 100644 index 00000000000..7d3285f761a --- /dev/null +++ b/blocks/completionstatus/tests/behat/block_completionstatus_activity_completion.feature @@ -0,0 +1,73 @@ +@block @block_completionstatus +Feature: Enable Block Completion in a course using activity completion + In order to view the completion block in a course + As a teacher + I can add completion block to a course and set up activity completion + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | idnumber | + | teacher1 | Teacher | 1 | teacher1@example.com | T1 | + | student1 | Student | 1 | student1@example.com | S1 | + And the following "courses" exist: + | fullname | shortname | category | enablecompletion | + | Course 1 | C1 | 0 | 1 | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + And the following "activities" exist: + | activity | course | idnumber | name | intro | + | page | C1 | page1 | Test page name | Test page description | + + Scenario: Add the block to a the course and add course completion items + Given I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + And I follow "Test page name" + And I navigate to "Edit settings" node in "Page module administration" + And I set the following fields to these values: + | Completion tracking | Show activity as complete when conditions are met | + | Require view | 1 | + And I press "Save and return to course" + And I add the "Course completion status" block + And I navigate to "Course completion" node in "Course administration" + And I expand all fieldsets + And I set the following fields to these values: + | Test page name | 1 | + And I press "Save changes" + And I log out + When I log in as "student1" + And I follow "Course 1" + Then I should see "Status: Not yet started" in the "Course completion status" "block" + And I should see "0 of 1" in the "Activity completion" "table_row" + + Scenario: Add the block to a the course and add course completion items + Given I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + And I follow "Test page name" + And I navigate to "Edit settings" node in "Page module administration" + And I set the following fields to these values: + | Completion tracking | Show activity as complete when conditions are met | + | Require view | 1 | + And I press "Save and return to course" + And I add the "Course completion status" block + And I navigate to "Course completion" node in "Course administration" + And I expand all fieldsets + And I set the following fields to these values: + | Test page name | 1 | + And I press "Save changes" + And I log out + When I log in as "student1" + And I follow "Course 1" + And I follow "Test page name" + And I follow "C1" + Then I should see "Status: Pending" in the "Course completion status" "block" + And I should see "0 of 1" in the "Activity completion" "table_row" + And I trigger cron + And I am on site homepage + And I follow "Course 1" + And I should see "1 of 1" in the "Activity completion" "table_row" + And I follow "More details" + And I should see "Yes" in the "Activity completion" "table_row" diff --git a/blocks/completionstatus/tests/behat/block_completionstatus_manual_other.feature b/blocks/completionstatus/tests/behat/block_completionstatus_manual_other.feature new file mode 100644 index 00000000000..1aaed0a3989 --- /dev/null +++ b/blocks/completionstatus/tests/behat/block_completionstatus_manual_other.feature @@ -0,0 +1,100 @@ +@block @block_completionstatus +Feature: Enable Block Completion in a course using manual completion by others + In order to view the completion block in a course + As a teacher + I can add completion block to a course and set up manual completion by others + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | idnumber | + | teacher1 | Teacher | 1 | teacher1@example.com | T1 | + | teacher2 | Teacher | 2 | teacher1@example.com | T2 | + | student1 | Student | 1 | student1@example.com | S1 | + And the following "courses" exist: + | fullname | shortname | category | enablecompletion | + | Course 1 | C1 | 0 | 1 | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + | teacher2 | C1 | teacher | + | student1 | C1 | student | + + Scenario: Add the block to a the course and mark a student complete. + Given I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + And I add the "Course completion status" block + And I navigate to "Course completion" node in "Course administration" + And I expand all fieldsets + And I set the following fields to these values: + | Teacher | 1 | + And I press "Save changes" + And I log out + When I log in as "student1" + And I follow "Course 1" + And I should see "Status: Not yet started" in the "Course completion status" "block" + And I should see "No" in the "Teacher" "table_row" + And I log out + And I log in as "teacher1" + And I follow "Course 1" + And I navigate to "Course completion" node in "Reports" + And I follow "Click to mark user complete" + And I trigger cron + And I am on site homepage + And I log out + And I log in as "student1" + And I follow "Course 1" + Then I should see "Status: Complete" in the "Course completion status" "block" + And I should see "Yes" in the "Teacher" "table_row" + And I follow "More details" + And I should see "Yes" in the "Marked complete by Teacher" "table_row" + + + Scenario: Add the block to a the course and require multiple roles to mark a student complete. + Given I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + And I add the "Course completion status" block + And I navigate to "Course completion" node in "Course administration" + And I expand all fieldsets + And I set the following fields to these values: + | Teacher | 1 | + | Non-editing teacher | 1 | + | id_role_aggregation | ALL selected roles to mark when the condition is met | + And I press "Save changes" + And I log out + When I log in as "student1" + And I follow "Course 1" + And I should see "Status: Not yet started" in the "Course completion status" "block" + And I should see "No" in the "Teacher" "table_row" + And I should see "No" in the "Non-editing teacher" "table_row" + And I log out + And I log in as "teacher1" + And I follow "Course 1" + And I navigate to "Course completion" node in "Reports" + And I follow "Click to mark user complete" + And I log out + And I log in as "student1" + And I follow "Course 1" + And I should see "Status: In progress" in the "Course completion status" "block" + And I should see "Yes" in the "Teacher" "table_row" + And I should see "No" in the "Non-editing teacher" "table_row" + And I follow "More details" + And I should see "Yes" in the "Marked complete by Teacher" "table_row" + And I should see "No" in the "Marked complete by Non-editing teacher" "table_row" + And I log out + And I log in as "teacher2" + And I follow "Course 1" + And I navigate to "Course completion" node in "Reports" + And I follow "Click to mark user complete" + And I trigger cron + And I am on site homepage + And I log out + And I log in as "student1" + And I follow "Course 1" + Then I should see "Status: Complete" in the "Course completion status" "block" + And I should see "Yes" in the "Teacher" "table_row" + And I should see "Yes" in the "Non-editing teacher" "table_row" + And I follow "More details" + And I should see "Yes" in the "Marked complete by Teacher" "table_row" + And I should see "Yes" in the "Marked complete by Non-editing teacher" "table_row" diff --git a/blocks/completionstatus/tests/behat/block_completionstatus_manual_self.feature b/blocks/completionstatus/tests/behat/block_completionstatus_manual_self.feature new file mode 100644 index 00000000000..8441d375321 --- /dev/null +++ b/blocks/completionstatus/tests/behat/block_completionstatus_manual_self.feature @@ -0,0 +1,44 @@ +@block @block_completionstatus @block_selfcompletion +Feature: Enable Block Completion in a course using manual self completion + In order to view the completion block in a course + As a teacher + I can add completion block to a course and set up manual self completion + + Scenario: Add the block to a the course and manually complete the course + Given the following "users" exist: + | username | firstname | lastname | email | idnumber | + | teacher1 | Teacher | 1 | teacher1@example.com | T1 | + | student1 | Student | 1 | student1@example.com | S1 | + And the following "courses" exist: + | fullname | shortname | category | enablecompletion | + | Course 1 | C1 | 0 | 1 | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + And I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + And I add the "Course completion status" block + And I add the "Self completion" block + And I navigate to "Course completion" node in "Course administration" + And I expand all fieldsets + And I set the following fields to these values: + | id_criteria_self | 1 | + And I press "Save changes" + And I log out + When I log in as "student1" + And I follow "Course 1" + And I should see "Status: Not yet started" in the "Course completion status" "block" + And I should see "No" in the "Self completion" "table_row" + And I follow "Complete course" + And I should see "Confirm self completion" + And I press "Yes" + And I should see "Status: In progress" in the "Course completion status" "block" + And I trigger cron + And I am on site homepage + And I follow "Course 1" + Then I should see "Status: Complete" in the "Course completion status" "block" + And I should see "Yes" in the "Self completion" "table_row" + And I follow "More details" + And I should see "Yes" in the "Self completion" "table_row"