MDL-73097 calendar: add behat coverage for manageentries capability

This commit is contained in:
Simey Lameze 2022-09-05 15:45:41 +08:00
parent 73bc430e17
commit 2b07a23709

View file

@ -230,23 +230,37 @@ Feature: Perform basic calendar functionality
And "Course 3" "autocomplete_suggestions" should exist
@javascript
Scenario: Students can not see event type by default.
Scenario: Students can not see event type field by default.
Given I log in as "student1"
And I am viewing site calendar
When I click on "New event" "button"
# Only "user" event type is available, so "Type of event" field should not be displayed.
Then "Type of event" "select" should not exist
And I click on "Close" "button" in the "New event" "dialogue"
And I log out
# Login as admin to set the adminseesall = 1.
And I log in as "admin"
And I navigate to "Appearance > Calendar" in site administration
And I set the field "Admins see all" to "1"
And I log out
# Login back as student.
@javascript
Scenario: "Student 2" has "manageentries" capability assigned but it's not enrolled in any course.
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/calendar:manageentries | Allow | student | System | |
And I log in as "student2"
And I am viewing site calendar
When I click on "New event" "button"
# Only "user" event type is available, so "Type of event" field should not be displayed.
Then "Type of event" "select" should not exist
@javascript
Scenario: "Student 1" has "manageentries" capability assigned and it's enrolled in a course.
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/calendar:manageentries | Allow | student | System | |
And I log in as "student1"
And I am viewing site calendar
And I click on "New event" "button"
And "Type of event" "select" should not exist
When I click on "New event" "button"
# Student 1 is enrolled in a course and have the capability assigned.
# Then, the "Type of event" select box should be visible.
Then "Type of event" "select" should exist
And I should see "User" in the "Type of event" "select"
And I should see "Course" in the "Type of event" "select"
@javascript @accessibility
Scenario: The calendar page must be accessible