Skip to content

Commit

Permalink
MDL-71162 mod_wiki: Improve behat testing for completion conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
mickhawkins committed Apr 28, 2021
1 parent 194a38b commit 36d5523
Showing 1 changed file with 40 additions and 23 deletions.
63 changes: 40 additions & 23 deletions mod/wiki/tests/behat/wiki_activity_completion.feature
@@ -1,8 +1,8 @@
@mod @mod_url @core_completion
@mod @mod_wiki @core_completion
Feature: View activity completion information in the Wiki activity
In order to have visibility of URL completion requirements
In order to have visibility of wiki completion requirements
As a student
I need to be able to view my URL completion progress
I need to be able to view my wiki completion progress

Background:
Given the following "users" exist:
Expand All @@ -24,35 +24,52 @@ Feature: View activity completion information in the Wiki activity
| Enable completion tracking | Yes |
| Show completion conditions | Yes |
And I press "Save and display"

Scenario: View automatic completion items
Given I am on "Course 1" course homepage with editing mode on
And I add a "Wiki" to section "1" and I fill the form with:
| Wiki name | Music history |
| First page name | Respect |
| Completion tracking | Show activity as complete when conditions are met |
| Require view | 1 |
# Teacher view.
And the following "activity" exists:
| activity | wiki |
| course | C1 |
| idnumber | mh1 |
| name | Music history |
| section | 1 |
| completion | 2 |
| completionview | 1 |
And I am on "Course 1" course homepage
And I follow "Music history"
And I click on "Create page" "button"
And "Music history" should have the "View" completion condition
And I log out
# Student view.
When I log in as "student1"

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 I click on "Edit" "link" in the "region-main" "region"
And "Music history" should have the "View" completion condition
And I follow "Comments"
And "Music history" should have the "View" completion condition
And I follow "Map"
And "Music history" should have the "View" completion condition
And I follow "Files"
And "Music history" should have the "View" completion condition
And I follow "Administration"
And "Music history" should have the "View" completion condition

Scenario: View automatic completion items as a student
Given I log in as "student1"
When I am on "Course 1" course homepage
And I follow "Music history"
And the "View" completion condition of "Music history" is displayed as "done"
Then the "View" completion condition of "Music history" is displayed as "done"

@javascript
Scenario: Use manual completion
Given I am on "Course 1" course homepage with editing mode on
And I add a "Wiki" to section "1" and I fill the form with:
| Wiki name | Music history |
| First page name | Respect |
| Completion tracking | Students can manually mark the activity as completed |
# Teacher view.
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Music history"
And I click on "Create page" "button"
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
And I press "Unlock completion options"
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.
Expand Down

0 comments on commit 36d5523

Please sign in to comment.