5fa4a0bb5022b53fb0c213fb1856095752af26e9
[moodle.git] / blocks / participants / tests / behat / block_participants_course.feature
1 @block @block_participants
2 Feature: People Block used in a course
3   In order to view participants in a course
4   As a teacher
5   I can add the people block to a course
7   Background:
8     Given the following "courses" exist:
9       | fullname | shortname | category |
10       | Course 1 | C101      | 0        |
11     And the following "users" exist:
12       | username    | firstname | lastname | email            |
13       | student1    | Sam       | Student  | student1@example.com |
14     And the following "course enrolments" exist:
15       | user        | course | role           |
16       | student1    | C101   | student        |
17     And I log in as "admin"
18     And I am on "Course 1" course homepage with editing mode on
19     And I add the "People" block
20     And I log out
22   Scenario: Student can view participants link
23     When I log in as "student1"
24     And I am on "Course 1" course homepage
25     Then "People" "block" should exist
26     And I should see "Participants" in the "People" "block"
28   Scenario: Student can follow participants link and be directed to the correct page
29     When I log in as "student1"
30     And I am on "Course 1" course homepage
31     And I click on "Participants" "link" in the "People" "block"
32     Then I should see "Participants" in the "#page-content" "css_element"
34   Scenario: Student without permission can not view participants link
35     Given the following "permission overrides" exist:
36          | capability | permission | role | contextlevel | reference |
37          | moodle/course:viewparticipants | Prevent | student | Course | C101 |
38     When I log in as "student1"
39     And I am on "Course 1" course homepage
40     Then "People" "block" should not exist