MDL-58855 glossary: Remove behat logout line
[moodle.git] / mod / glossary / tests / behat / entries_require_approval.feature
... / ...
CommitLineData
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
7 Background:
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 | category |
15 | Course 1 | C1 | 0 |
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 am on "Course 1" course homepage with editing mode on
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
28
29 Scenario: Approve and undo approve glossary entries
30 Given I log in as "student1"
31 And I am on "Course 1" course homepage
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"
40 And I am on "Course 1" course homepage
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"
46 And I am on "Course 1" course homepage
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"
56 And I am on "Course 1" course homepage
57 And I follow "Test glossary name"
58 Then I should see "Concept definition"
59 And I log out
60 # Undo the approval of the previous entry.
61 And I log in as "teacher1"
62 And I am on "Course 1" course homepage
63 And I follow "Test glossary name"
64 And I follow "Undo approval"
65 And I log out
66 # Check that the entry is no longer visible by students.
67 And I log in as "student2"
68 And I am on "Course 1" course homepage
69 And I follow "Test glossary name"
70 Then I should see "No entries found in this section"
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"