weekly on-sync release 3.7dev
[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
12efa527 7 Scenario: Approve and undo approve glossary entries
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
28 And I log in as "student1"
fdeeaff9 29 And I am on "Course 1" course homepage
222e0a00
AG
30 And I follow "Test glossary name"
31 When I add a glossary entry with the following data:
32 | Concept | Just a test concept |
33 | Definition | Concept definition |
34 | Keyword(s) | Black |
35 And I log out
36 # Test that students can not see the unapproved entry.
37 And I log in as "student2"
fdeeaff9 38 And I am on "Course 1" course homepage
222e0a00
AG
39 And I follow "Test glossary name"
40 Then I should see "No entries found in this section"
41 And I log out
42 # Approve the entry.
43 And I log in as "teacher1"
fdeeaff9 44 And I am on "Course 1" course homepage
222e0a00
AG
45 And I follow "Test glossary name"
46 And I follow "Waiting approval"
47 Then I should see "(this entry is currently hidden)"
48 And I follow "Approve"
49 And I follow "Test glossary name"
50 Then I should see "Concept definition"
51 And I log out
52 # Check that the entry can now be viewed by students.
53 And I log in as "student2"
fdeeaff9 54 And I am on "Course 1" course homepage
222e0a00
AG
55 And I follow "Test glossary name"
56 Then I should see "Concept definition"
57 And I log out
12efa527 58 # Undo the approval of the previous entry.
222e0a00 59 And I log in as "teacher1"
fdeeaff9 60 And I am on "Course 1" course homepage
222e0a00 61 And I follow "Test glossary name"
12efa527 62 And I follow "Undo approval"
222e0a00
AG
63 And I log out
64 # Check that the entry is no longer visible by students.
65 And I log in as "student2"
fdeeaff9 66 And I am on "Course 1" course homepage
222e0a00 67 And I follow "Test glossary name"
12efa527 68 Then I should see "No entries found in this section"