MDL-42379 behat: Automated test for approving and disapproving glossary entries.
[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
7 Scenario: Approve and disapprove glossary entries
8 Given the following "users" exists:
9 | username | firstname | lastname | email |
10 | teacher1 | Teacher | 1 | teacher1@asd.com |
11 | student1 | Student | 1 | student1@asd.com |
12 | student2 | Student | 2 | student2@asd.com |
13 And the following "courses" exists:
14 | fullname | shortname | category |
15 | Course 1 | C1 | 0 |
16 And the following "course enrolments" exists:
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 follow "Course 1"
23 And I turn editing mode on
24 Given I add a "Glossary" to section "1" and I fill the form with:
25 | Name | Test glossary name |
26 | Description | Test glossary entries require approval |
27 | Approved by default | No |
28 And I log out
29 And I log in as "student1"
30 And I follow "Course 1"
31 And I follow "Test glossary name"
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 log in as "student2"
39 And I follow "Course 1"
40 And I follow "Test glossary name"
41 Then I should see "No entries found in this section"
42 And I log out
43 # Approve the entry.
44 And I log in as "teacher1"
45 And I follow "Course 1"
46 And I follow "Test glossary name"
47 And I follow "Waiting approval"
48 Then I should see "(this entry is currently hidden)"
49 And I follow "Approve"
50 And I follow "Test glossary name"
51 Then I should see "Concept definition"
52 And I log out
53 # Check that the entry can now be viewed by students.
54 And I log in as "student2"
55 And I follow "Course 1"
56 And I follow "Test glossary name"
57 Then I should see "Concept definition"
58 And I log out
59 # Disapprove the previous entry.
60 And I log in as "teacher1"
61 And I follow "Course 1"
62 And I follow "Test glossary name"
63 And I follow "Disapprove"
64 And I log out
65 # Check that the entry is no longer visible by students.
66 And I log in as "student2"
67 And I follow "Course 1"
68 And I follow "Test glossary name"
69 Then I should see "No entries found in this section"