diff --git a/course/tests/behat/course_activity_dates.feature b/course/tests/behat/course_activity_dates.feature new file mode 100644 index 00000000000..9b17854b108 --- /dev/null +++ b/course/tests/behat/course_activity_dates.feature @@ -0,0 +1,64 @@ +@core @core_course +Feature: Allow teachers to edit the visibility of activity dates in a course + In order to show students the activity dates in a course + As a teacher + I need to be able to edit activity dates settings + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | teacher1 | Teacher | 1 | teacher1@example.com | + And the following "courses" exist: + | fullname | shortname | category | + | Course 1 | C1 | 0 | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + And the following "activities" exist: + | activity | course | idnumber | name | intro | timeopen | timeclose | + | choice | C1 | choice1 | Test choice 1 | Test choice description | ##yesterday## | ##tomorrow## | + + Scenario: Activity dates setting can be enabled to display activity dates in a course + Given I log in as "teacher1" + And I am on "Course 1" course homepage with editing mode on + And I navigate to "Edit settings" in current page administration + When I set the following fields to these values: + | Show activity dates | Yes | + And I click on "Save and display" "button" + And I follow "Test choice" + Then I should see "Opened:" in the "[data-region=activity-information]" "css_element" + And I should see "Closes:" in the "[data-region=activity-information]" "css_element" + # TODO MDL-70821: Check activity dates display on course homepage. + + Scenario: Activity dates setting can be disabled to hidden activity dates in a course + Given I log in as "teacher1" + And I am on "Course 1" course homepage with editing mode on + And I navigate to "Edit settings" in current page administration + When I set the following fields to these values: + | Show activity dates | No | + And I click on "Save and display" "button" + And I follow "Test choice" + # Activity dates are always shown in the module's view page. + Then I should see "Opened:" + And I should see "Closes:" + And I am on "Course 1" course homepage + And I should not see "Opened:" + And I should not see "Closes:" + + Scenario: Default activity dates setting default value can changed to No + Given I log in as "admin" + And I navigate to "Courses > Course default settings" in site administration + When I set the following fields to these values: + | Show activity dates | No | + And I click on "Save changes" "button" + And I navigate to "Courses > Add a new course" in site administration + Then the field "showactivitydates" matches value "No" + + Scenario: Default activity dates setting default value can changed to Yes + Given I log in as "admin" + And I navigate to "Courses > Course default settings" in site administration + When I set the following fields to these values: + | Show activity dates | Yes | + And I click on "Save changes" "button" + And I navigate to "Courses > Add a new course" in site administration + Then the field "showactivitydates" matches value "Yes"