MDL-58855 glossary: Remove behat logout line
[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 |
21 And I log in as "teacher1"
fdeeaff9 22 And I am on "Course 1" course homepage with editing mode on
222e0a00
AG
23 Given I add a "Glossary" to section "1" and I fill the form with:
24 | Name | Test glossary name |
25 | Description | Test glossary entries require approval |
26 | Approved by default | No |
27 And I log out
c8b67bee
P
28
29 Scenario: Approve and undo approve glossary entries
30 Given I log in as "student1"
fdeeaff9 31 And I am on "Course 1" course homepage
222e0a00
AG
32 And I follow "Test glossary name"
33 When I add a glossary entry with the following data:
34 | Concept | Just a test concept |
35 | Definition | Concept definition |
36 | Keyword(s) | Black |
37 And I log out
38 # Test that students can not see the unapproved entry.
39 And I log in as "student2"
fdeeaff9 40 And I am on "Course 1" course homepage
222e0a00
AG
41 And I follow "Test glossary name"
42 Then I should see "No entries found in this section"
43 And I log out
44 # Approve the entry.
45 And I log in as "teacher1"
fdeeaff9 46 And I am on "Course 1" course homepage
222e0a00
AG
47 And I follow "Test glossary name"
48 And I follow "Waiting approval"
49 Then I should see "(this entry is currently hidden)"
50 And I follow "Approve"
51 And I follow "Test glossary name"
52 Then I should see "Concept definition"
53 And I log out
54 # Check that the entry can now be viewed by students.
55 And I log in as "student2"
fdeeaff9 56 And I am on "Course 1" course homepage
222e0a00
AG
57 And I follow "Test glossary name"
58 Then I should see "Concept definition"
59 And I log out
12efa527 60 # Undo the approval of the previous entry.
222e0a00 61 And I log in as "teacher1"
fdeeaff9 62 And I am on "Course 1" course homepage
222e0a00 63 And I follow "Test glossary name"
12efa527 64 And I follow "Undo approval"
222e0a00
AG
65 And I log out
66 # Check that the entry is no longer visible by students.
67 And I log in as "student2"
fdeeaff9 68 And I am on "Course 1" course homepage
222e0a00 69 And I follow "Test glossary name"
12efa527 70 Then I should see "No entries found in this section"
c8b67bee
P
71
72 @javascript
73 Scenario: View pending approval glossary items
74 Given I log in as "student1"
75 And I am on "Course 1" course homepage
76 And I follow "Test glossary name"
77 When I add a glossary entry with the following data:
78 | Concept | Just a test concept |
79 | Definition | Concept definition |
80 | Keyword(s) | Black |
81 | Tags | Test |
82 And I log out
83 And I log in as "teacher1"
84 And I press "Customise this page"
85 And I add the "Navigation" block if not present
86 And I expand "Site pages" node
87 And I click on "Tags" "link" in the "Navigation" "block"
88 And I follow "Test"
89 Then I should see "Glossary entries"
90 And I should see "Just a test concept"
91 And I should see "Entry not approved"