MDL-45268 behat: tests for participants block
[moodle.git] / blocks / participants / tests / behat / block_participants_course.feature
CommitLineData
16a87642
DP
1@block @block_participants
2Feature: 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
6
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@asd.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 follow "Course 1"
19 And I turn editing mode on
20 And I add the "People" block
21 And I log out
22
23 Scenario: Student can view participants link
24 When I log in as "student1"
25 And I follow "Course 1"
26 Then "People" "block" should exist
27 And I should see "Participants" in the "People" "block"
28
29 Scenario: Student can follow participants link and be directed to the correct page
30 When I log in as "student1"
31 And I follow "Course 1"
32 And I click on "Participants" "link" in the "People" "block"
33 Then I should see "All participants" in the "h3" "css_element"
34 And the "My courses" select box should contain "C101"
35
36 Scenario: Student without permission can not view participants link
37 Given the following "permission overrides" exist:
38 | capability | permission | role | contextlevel | reference |
39 | moodle/course:viewparticipants | Prevent | student | Course | C101 |
40 When I log in as "student1"
41 And I follow "Course 1"
42 Then "People" "block" should not exist