Skip to content

Commit

Permalink
MDL-73097 calendar: add behat coverage for manageentries capability
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze committed Sep 6, 2022
1 parent 73bc430 commit 2b07a23
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions calendar/tests/behat/calendar.feature
Expand Up @@ -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
Expand Down

0 comments on commit 2b07a23

Please sign in to comment.