MDL-58265 core_test: add I am on course homepage in edit mode step
[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"
c987d1b2 22 And I am on course page "Course 1"
222e0a00
AG
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"
c987d1b2 30 And I am on course page "Course 1"
222e0a00
AG
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"
c987d1b2 39 And I am on course page "Course 1"
222e0a00
AG
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"
c987d1b2 45 And I am on course page "Course 1"
222e0a00
AG
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"
c987d1b2 55 And I am on course page "Course 1"
222e0a00
AG
56 And I follow "Test glossary name"
57 Then I should see "Concept definition"
58 And I log out
12efa527 59 # Undo the approval of the previous entry.
222e0a00 60 And I log in as "teacher1"
c987d1b2 61 And I am on course page "Course 1"
222e0a00 62 And I follow "Test glossary name"
12efa527 63 And I follow "Undo approval"
222e0a00
AG
64 And I log out
65 # Check that the entry is no longer visible by students.
66 And I log in as "student2"
c987d1b2 67 And I am on course page "Course 1"
222e0a00 68 And I follow "Test glossary name"
12efa527 69 Then I should see "No entries found in this section"