MDL-71913 mod_folder: Add tertiary navigation
[moodle.git] / mod / data / tests / behat / manageapproved.feature
CommitLineData
ec9e1bec
RW
1@mod @mod_data
2Feature: Users can edit approved entries in database activities
3 In order to control whether approved database entries can be changed
4 As a teacher
5 I need to be able to enable or disable management of approved entries
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | student1 | Student | 1 | student1@example.com |
11 | teacher1 | Teacher | 1 | teacher1@example.com |
12 And the following "courses" exist:
13 | fullname | shortname | category |
14 | Course 1 | C1 | 0 |
15 And the following "course enrolments" exist:
16 | user | course | role |
17 | teacher1 | C1 | editingteacher |
18 | student1 | C1 | student |
ec9e1bec
RW
19
20 @javascript
21 Scenario: Students can manage their approved entries to a database
776f4bd8
AN
22 Given the following "activity" exists:
23 | activity | data |
24 | course | C1 |
25 | idnumber | Test database name |
26 | name | Test database name |
27 | approval | 1 |
28 | manageapproved | 1 |
29 And I am on the "Test database name" "data activity" page logged in as teacher1
ec9e1bec
RW
30 And I add a "Text input" field to "Test database name" database and I fill the form with:
31 | Field name | Test field name |
32 | Field description | Test field description |
33 # To generate the default templates.
34 And I follow "Templates"
35 And I log out
36 # Add an entry as a student.
776f4bd8 37 And I am on the "Test database name" "data activity" page logged in as student1
ec9e1bec
RW
38 And I add an entry to "Test database name" database with:
39 | Test field name | Student entry |
40 And I press "Save and view"
41 And I log out
42 # Approve the student's entry as a teacher.
776f4bd8 43 And I am on the "Test database name" "data activity" page logged in as teacher1
ec9e1bec
RW
44 And I follow "Approve"
45 And I log out
46 # Make sure the student can still edit their entry after it's approved.
776f4bd8 47 When I am on the "Test database name" "data activity" page logged in as student1
ec9e1bec
RW
48 Then I should see "Student entry"
49 And "Edit" "link" should exist
50
51 @javascript
52 Scenario: Students can not manage their approved entries to a database
776f4bd8
AN
53 # Create database activity and don't allow editing of approved entries.
54 Given the following "activity" exists:
55 | activity | data |
56 | course | C1 |
57 | idnumber | Test database name |
58 | name | Test database name |
59 | approval | 1 |
60 | manageapproved | 0 |
61 And I am on the "Test database name" "data activity" page logged in as teacher1
ec9e1bec
RW
62 And I add a "Text input" field to "Test database name" database and I fill the form with:
63 | Field name | Test field name |
64 | Field description | Test field description |
65 # To generate the default templates.
66 And I follow "Templates"
67 And I log out
68 # Add an entry as a student.
776f4bd8 69 And I am on the "Test database name" "data activity" page logged in as student1
ec9e1bec
RW
70 And I add an entry to "Test database name" database with:
71 | Test field name | Student entry |
72 And I press "Save and view"
73 And I log out
74 # Approve the student's entry as a teacher.
776f4bd8 75 And I am on the "Test database name" "data activity" page logged in as teacher1
ec9e1bec
RW
76 And I follow "Approve"
77 And I log out
78 # Make sure the student isn't able to edit their entry after it's approved.
776f4bd8
AN
79 When I am on the "Test database name" "data activity" page logged in as student1
80 Then "Edit" "link" should not exist
81 And I should see "Student entry"