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 And "Course 3" "autocomplete_suggestions" should exist
@javascript @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" Given I log in as "student1"
And I am viewing site calendar And I am viewing site calendar
When I click on "New event" "button" 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 Then "Type of event" "select" should not exist
And I click on "Close" "button" in the "New event" "dialogue"
And I log out @javascript
# Login as admin to set the adminseesall = 1. Scenario: "Student 2" has "manageentries" capability assigned but it's not enrolled in any course.
And I log in as "admin" Given the following "permission overrides" exist:
And I navigate to "Appearance > Calendar" in site administration | capability | permission | role | contextlevel | reference |
And I set the field "Admins see all" to "1" | moodle/calendar:manageentries | Allow | student | System | |
And I log out And I log in as "student2"
# Login back as student. 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 log in as "student1"
And I am viewing site calendar And I am viewing site calendar
And I click on "New event" "button" When I click on "New event" "button"
And "Type of event" "select" should not exist # 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 @javascript @accessibility
Scenario: The calendar page must be accessible Scenario: The calendar page must be accessible