weekly release 4.0dev
[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 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 |
29
30 Scenario: Approve and undo approve glossary entries
31 Given I am on the "Test glossary name" "glossary activity" page logged in as student1
32 When I add a glossary entry with the following data:
33 | Concept | Just a test concept |
34 | Definition | Concept definition |
35 | Keyword(s) | Black |
36 And I log out
37 # Test that students can not see the unapproved entry.
38 And I am on the "Test glossary name" "glossary activity" page logged in as student2
39 Then I should see "No entries found in this section"
40 And I log out
41 # Approve the entry.
42 And I am on the "Test glossary name" "glossary activity" page logged in as teacher1
43 And I follow "Waiting approval"
44 Then I should see "(this entry is currently hidden)"
45 And I follow "Approve"
46 And I am on the "Test glossary name" "glossary activity" page
47 Then I should see "Concept definition"
48 And I log out
49 # Check that the entry can now be viewed by students.
50 And I am on the "Test glossary name" "glossary activity" page logged in as student2
51 Then I should see "Concept definition"
52 And I log out
53 # Undo the approval of the previous entry.
54 And I am on the "Test glossary name" "glossary activity" page logged in as teacher1
55 And I follow "Undo approval"
56 And I log out
57 # Check that the entry is no longer visible by students.
58 And I am on the "Test glossary name" "glossary activity" page logged in as student2
59 Then I should see "No entries found in this section"
60
61 @javascript
62 Scenario: View pending approval glossary items
63 Given I am on the "Test glossary name" "glossary activity" page logged in as student1
64 When I add a glossary entry with the following data:
65 | Concept | Just a test concept |
66 | Definition | Concept definition |
67 | Keyword(s) | Black |
68 | Tags | Test |
69 And I log out
70 And I log in as "teacher1"
71 And I press "Customise this page"
72 And I add the "Navigation" block if not present
73 And I expand "Site pages" node
74 And I click on "Tags" "link" in the "Navigation" "block"
75 And I follow "Test"
76 Then I should see "Glossary entries"
77 And I should see "Just a test concept"
78 And I should see "Entry not approved"