weekly release 4.0dev
[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
776f4bd8 31 Given I am on the "Test glossary name" "glossary activity" page logged in as student1
222e0a00
AG
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.
776f4bd8 38 And I am on the "Test glossary name" "glossary activity" page logged in as student2
222e0a00
AG
39 Then I should see "No entries found in this section"
40 And I log out
41 # Approve the entry.
776f4bd8 42 And I am on the "Test glossary name" "glossary activity" page logged in as teacher1
222e0a00
AG
43 And I follow "Waiting approval"
44 Then I should see "(this entry is currently hidden)"
45 And I follow "Approve"
776f4bd8 46 And I click on "Test glossary name" "link" in the "page-header" "region"
222e0a00
AG
47 Then I should see "Concept definition"
48 And I log out
49 # Check that the entry can now be viewed by students.
776f4bd8 50 And I am on the "Test glossary name" "glossary activity" page logged in as student2
222e0a00
AG
51 Then I should see "Concept definition"
52 And I log out
12efa527 53 # Undo the approval of the previous entry.
776f4bd8 54 And I am on the "Test glossary name" "glossary activity" page logged in as teacher1
12efa527 55 And I follow "Undo approval"
222e0a00
AG
56 And I log out
57 # Check that the entry is no longer visible by students.
776f4bd8 58 And I am on the "Test glossary name" "glossary activity" page logged in as student2
12efa527 59 Then I should see "No entries found in this section"
c8b67bee
P
60
61 @javascript
62 Scenario: View pending approval glossary items
776f4bd8 63 Given I am on the "Test glossary name" "glossary activity" page logged in as student1
c8b67bee
P
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"