MDL-72179 behat: Add page resolvers for activity roles/perms
[moodle.git] / mod / glossary / tests / behat / entries_require_approval.feature
CommitLineData
222e0a00
AG
1@mod @mod_glossary
2Feature: A teacher can choose whether glossary entries require approval
3 In order to check entries before they are displayed
4 As a user
5 I need to enable entries requiring approval
6
c8b67bee 7 Background:
759b323e 8 Given the following "users" exist:
222e0a00 9 | username | firstname | lastname | email |
0fe86bbd
RT
10 | teacher1 | Teacher | 1 | teacher1@example.com |
11 | student1 | Student | 1 | student1@example.com |
12 | student2 | Student | 2 | student2@example.com |
759b323e 13 And the following "courses" exist:
222e0a00
AG
14 | fullname | shortname | category |
15 | Course 1 | C1 | 0 |
759b323e 16 And the following "course enrolments" exist:
222e0a00
AG
17 | user | course | role |
18 | teacher1 | C1 | editingteacher |
19 | student1 | C1 | student |
20 | student2 | C1 | student |
cf1cf222
IT
21 And the following "activity" exists:
22 | activity | glossary |
23 | course | C1 |
24 | idnumber | 0001 |
25 | name | Test glossary name |
26 | intro | Test glossary entries require approval |
27 | section | 1 |
28 | defaultapproval | 0 |
c8b67bee
P
29
30 Scenario: Approve and undo approve glossary entries
31 Given I log in as "student1"
fdeeaff9 32 And I am on "Course 1" course homepage
222e0a00
AG
33 And I follow "Test glossary name"
34 When I add a glossary entry with the following data:
35 | Concept | Just a test concept |
36 | Definition | Concept definition |
37 | Keyword(s) | Black |
38 And I log out
39 # Test that students can not see the unapproved entry.
40 And I log in as "student2"
fdeeaff9 41 And I am on "Course 1" course homepage
222e0a00
AG
42 And I follow "Test glossary name"
43 Then I should see "No entries found in this section"
44 And I log out
45 # Approve the entry.
46 And I log in as "teacher1"
fdeeaff9 47 And I am on "Course 1" course homepage
222e0a00
AG
48 And I follow "Test glossary name"
49 And I follow "Waiting approval"
50 Then I should see "(this entry is currently hidden)"
51 And I follow "Approve"
52 And I follow "Test glossary name"
53 Then I should see "Concept definition"
54 And I log out
55 # Check that the entry can now be viewed by students.
56 And I log in as "student2"
fdeeaff9 57 And I am on "Course 1" course homepage
222e0a00
AG
58 And I follow "Test glossary name"
59 Then I should see "Concept definition"
60 And I log out
12efa527 61 # Undo the approval of the previous entry.
222e0a00 62 And I log in as "teacher1"
fdeeaff9 63 And I am on "Course 1" course homepage
222e0a00 64 And I follow "Test glossary name"
12efa527 65 And I follow "Undo approval"
222e0a00
AG
66 And I log out
67 # Check that the entry is no longer visible by students.
68 And I log in as "student2"
fdeeaff9 69 And I am on "Course 1" course homepage
222e0a00 70 And I follow "Test glossary name"
12efa527 71 Then I should see "No entries found in this section"
c8b67bee
P
72
73 @javascript
74 Scenario: View pending approval glossary items
75 Given I log in as "student1"
76 And I am on "Course 1" course homepage
77 And I follow "Test glossary name"
78 When I add a glossary entry with the following data:
79 | Concept | Just a test concept |
80 | Definition | Concept definition |
81 | Keyword(s) | Black |
82 | Tags | Test |
83 And I log out
84 And I log in as "teacher1"
85 And I press "Customise this page"
86 And I add the "Navigation" block if not present
87 And I expand "Site pages" node
88 And I click on "Tags" "link" in the "Navigation" "block"
89 And I follow "Test"
90 Then I should see "Glossary entries"
91 And I should see "Just a test concept"
92 And I should see "Entry not approved"