forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-57449 block_myoverview: add behat tests for UI
Part of MDL-55611 epic.
- Loading branch information
1 parent
71d1430
commit 1dc764a
Showing
2 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
blocks/myoverview/tests/behat/block_myoverview_dashboard.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
@block @block_myoverview @javascript | ||
Feature: The my overview block allows users to easily access their courses and see upcoming activities | ||
In order to enable the my overview block in a course | ||
As a student | ||
I can add the my overview block to my dashboard | ||
|
||
Background: | ||
Given the following "users" exist: | ||
| username | firstname | lastname | email | idnumber | | ||
| student1 | Student | 1 | student1@example.com | S1 | | ||
| student2 | Student | 2 | student2@example.com | S2 | | ||
And the following "courses" exist: | ||
| fullname | shortname | category | startdate | enddate | | ||
| Course 1 | C1 | 0 | ##1 month ago## | ##15 days ago## | | ||
| Course 2 | C2 | 0 | ##yesterday## | ##tomorrow## | | ||
| Course 3 | C3 | 0 | ##first day of next month## | ##last day of next month## | | ||
And the following "activities" exist: | ||
| activity | course | idnumber | name | intro | timeopen | timeclose | | ||
| choice | C2 | choice1 | Test choice 1 | Test choice description | ##yesterday## | ##tomorrow## | | ||
| choice | C1 | choice2 | Test choice 2 | Test choice description | ##1 month ago## | ##15 days ago## | | ||
| choice | C3 | choice3 | Test choice 3 | Test choice description | ##first day of next month## | ##last day of next month## | | ||
| feedback | C2 | feedback1 | Test feedback 1 | Test feedback description | ##yesterday## | ##tomorrow## | | ||
| feedback | C3 | feedback3 | Test feedback 3 | Test feedback description | ##first day of next month## | ##last day of next month## | | ||
And the following "course enrolments" exist: | ||
| user | course | role | | ||
| student1 | C1 | student | | ||
| student1 | C2 | student | | ||
| student1 | C3 | student | | ||
|
||
Scenario: View courses and upcoming activities on timeline view | ||
Given I log in as "student1" | ||
And I click on "Timeline" "link" in the "My overview" "block" | ||
When I click on "Sort by dates" "link" in the "My overview" "block" | ||
Then I should see "Next 7 days" in the "My overview" "block" | ||
And I should see "Choice Test choice 1 closes" in the "My overview" "block" | ||
And I should see "View choices" in the "My overview" "block" | ||
And I should see "Feedback Test feedback 1 closes" in the "My overview" "block" | ||
And I should see "Answer the questions" in the "My overview" "block" | ||
And I should see "##tomorrow##d M, H:i##" in the "My overview" "block" | ||
And I should see "Future" in the "My overview" "block" | ||
And I should see "Choice Test choice 3 closes" in the "My overview" "block" | ||
And I should see "Feedback Test feedback 3 closes" in the "My overview" "block" | ||
And I should see "##last day of next month##j M, H:i##" in the "My overview" "block" | ||
And I log out | ||
|
||
Scenario: Past activities should not be displayed on the timeline view | ||
Given I log in as "student1" | ||
And I click on "Timeline" "link" in the "My overview" "block" | ||
When I click on "Sort by dates" "link" in the "My overview" "block" | ||
And I should not see "Choice Test choice 2 closes" in the "My overview" "block" | ||
And I should not see "##1 month ago##j M, H:i##" in the "My overview" "block" | ||
And I log out | ||
|
||
Scenario: See the courses I am enrolled by their status on courses view | ||
Given I log in as "student1" | ||
And I click on "Courses" "link" in the "My overview" "block" | ||
And I click on "In progress" "link" in the "My overview" "block" | ||
And I should see "Course 2" in the "My overview" "block" | ||
And I should see "##yesterday##j F Y##" in the "My overview" "block" | ||
And I should see "##tomorrow##j F Y##" in the "My overview" "block" | ||
And I should not see "Course 1" in the "My overview" "block" | ||
And I click on "Future" "link" in the "My overview" "block" | ||
And I should see "Course 3" in the "My overview" "block" | ||
And I should see "##first day of next month##j F Y##" in the "My overview" "block" | ||
And I should see "##last day of next month##j F Y##" in the "My overview" "block" | ||
And I should not see "Course 1" in the "My overview" "block" | ||
When I click on "Past" "link" in the "My overview" "block" | ||
Then I should see "Course 1" in the "My overview" "block" | ||
And I should not see "Course 2" in the "My overview" "block" | ||
And I should not see "Course 3" in the "My overview" "block" | ||
And I should see "##1 month ago##j F Y##" in the "My overview" "block" | ||
And I should see "##15 days ago##j F Y##" in the "My overview" "block" | ||
And I log out | ||
|
||
Scenario: No activities should be displayed if the user is not enrolled | ||
Given I log in as "student2" | ||
And I click on "Timeline" "link" in the "My overview" "block" | ||
And I should see "No upcoming activities" in the "My overview" "block" | ||
When I click on "Courses" "link" in the "My overview" "block" | ||
Then I should see "No courses" in the "My overview" "block" | ||
And I log out |
62 changes: 62 additions & 0 deletions
62
blocks/myoverview/tests/behat/block_myoverview_progress.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
@block @block_myoverview @javascript | ||
Feature: My overview block show users their progress on courses | ||
In order to enable the my overview block in a course | ||
As a student | ||
I can see the progress percentage of the courses I am enrolled in | ||
|
||
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 | startdate | enddate | | ||
| Course 1 | C1 | 0 | 1 | ##yesterday## | ##tomorrow## | | ||
And the following "activities" exist: | ||
| activity | course | idnumber | name | intro | timeopen | timeclose | | ||
| choice | C1 | choice1 | Test choice 1 | Test choice description | ##yesterday## | ##tomorrow## | | ||
And the following "course enrolments" exist: | ||
| user | course | role | | ||
| teacher1 | C1 | editingteacher | | ||
| student1 | C1 | student | | ||
|
||
Scenario: Course progress percentage should not be displayed if completion is not enabled | ||
Given I log in as "student1" | ||
And I click on "Timeline" "link" in the "My overview" "block" | ||
When I click on "Sort by courses" "link" in the "My overview" "block" | ||
Then I should see "Choice Test choice 1 closes" in the "My overview" "block" | ||
And I should not see "0%" in the "My overview" "block" | ||
And I click on "Courses" "link" in the "My overview" "block" | ||
And I click on "In progress" "link" in the "My overview" "block" | ||
And I should see "Course 1" in the "My overview" "block" | ||
And I should not see "0%" in the "My overview" "block" | ||
And I log out | ||
|
||
Scenario: User complete activity and verify his progress | ||
Given I log in as "teacher1" | ||
And I am on "Course 1" course homepage with editing mode on | ||
And I follow "Test choice 1" | ||
And I navigate to "Edit settings" in current page administration | ||
And I set the following fields to these values: | ||
| Completion tracking | Show activity as complete when conditions are met | | ||
| id_completionview | 1 | | ||
And I press "Save and return to course" | ||
And I log out | ||
And I log in as "student1" | ||
And I click on "Sort by courses" "link" in the "My overview" "block" | ||
And I should see "Choice Test choice 1 closes" in the "My overview" "block" | ||
And I should see "0%" in the "My overview" "block" | ||
And I click on "Courses" "link" in the "My overview" "block" | ||
When I click on "In progress" "link" in the "My overview" "block" | ||
Then I should see "Course 1" in the "My overview" "block" | ||
And I should see "0%" in the "My overview" "block" | ||
And I am on "Course 1" course homepage | ||
And I follow "Test choice 1" | ||
And I follow "Dashboard" in the user menu | ||
And I click on "Sort by courses" "link" in the "My overview" "block" | ||
And I should see "100%" in the "My overview" "block" | ||
And I click on "Courses" "link" in the "My overview" "block" | ||
And I click on "In progress" "link" in the "My overview" "block" | ||
And I should see "Course 1" in the "My overview" "block" | ||
And I should see "100%" in the "My overview" "block" | ||
And I log out |