MDL-47065 behat: improve verificaton of lack of note
[moodle.git] / notes / tests / behat / participants_notes.feature
CommitLineData
142099e2
DP
1@core @core_note
2Feature: Add notes to course participants
3 In order to share information with other staff
4 As a teacher
5 I need to add notes from the course particpants list
6
7 Scenario: An teacher can add multiple notes
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher1 | Teacher | 1 | teacher1@example.com |
11 | student1 | Student | 1 | student1@example.com |
12 | student2 | Student | 2 | student2@example.com |
13 And the following "courses" exist:
14 | fullname | shortname | format |
15 | Course 1 | C1 | topics |
16 And the following "course enrolments" exist:
17 | user | course | role |
18 | teacher1 | C1 | editingteacher |
19 | student1 | C1 | student |
20 | student2 | C1 | student |
21 And I log in as "teacher1"
22 And I follow "Course 1"
23 And I follow "Participants"
24 And I set the field with xpath "//tr[contains(normalize-space(.), 'Student 1')]//input[@type='checkbox']" to "1"
25 And I set the field with xpath "//tr[contains(normalize-space(.), 'Student 2')]//input[@type='checkbox']" to "1"
26 And I set the field "With selected users..." to "Add a new note"
27 And I press "OK"
28 # Add a note to student 1, but leave student 2 empty.
29 When I set the field with xpath "//tr[contains(normalize-space(.), 'Student 1')]//textarea" to "Student 1 needs to pick up his game"
30 And I set the field with xpath "//tr[contains(normalize-space(.), 'Student 2')]//textarea" to ""
31 And I press "Save changes"
32 And I follow "Student 1"
33 And I follow "Notes"
34 # Student 1 has note from Teacher
35 Then I should see "Teacher" in the "region-main" "region"
36 And I should see "Student 1 needs to pick up his game"
37 And I follow "Participants"
38 And I follow "Student 2"
39 And I follow "Notes"
2a4c2367
JP
40 And I follow "Course 1"
41 And I follow "Participants"
42 And I follow "Notes"
43 Then I should see "Student 1"
44 And I should see "Student 1 needs to pick up his game"
45 # Verify Student 2 does not have a note added.
46 And I should not see "Student 2"