MDL-72179 behat: Add page resolvers for activity roles/perms
[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 |
19 And I log in as "teacher1"
fdeeaff9 20 And I am on "Course 1" course homepage with editing mode on
ec9e1bec
RW
21
22 @javascript
23 Scenario: Students can manage their approved entries to a database
24 # Create database activity and allow editing of
25 # approved entries.
26 And I add a "Database" to section "1" and I fill the form with:
27 | Name | Test database name |
28 | Description | Test |
29 | id_approval | Yes |
30 | id_manageapproved | Yes |
31 And I add a "Text input" field to "Test database name" database and I fill the form with:
32 | Field name | Test field name |
33 | Field description | Test field description |
34 # To generate the default templates.
35 And I follow "Templates"
36 And I log out
37 # Add an entry as a student.
38 And I log in as "student1"
fdeeaff9 39 And I am on "Course 1" course homepage
ec9e1bec
RW
40 And I add an entry to "Test database name" database with:
41 | Test field name | Student entry |
42 And I press "Save and view"
43 And I log out
44 # Approve the student's entry as a teacher.
45 And I log in as "teacher1"
fdeeaff9 46 And I am on "Course 1" course homepage
ec9e1bec
RW
47 And I follow "Test database name"
48 And I follow "Approve"
49 And I log out
50 # Make sure the student can still edit their entry after it's approved.
51 When I log in as "student1"
fdeeaff9 52 And I am on "Course 1" course homepage
ec9e1bec
RW
53 And I follow "Test database name"
54 Then I should see "Student entry"
55 And "Edit" "link" should exist
56
57 @javascript
58 Scenario: Students can not manage their approved entries to a database
59 # Create database activity and don't allow editing of
60 # approved entries.
61 And I add a "Database" to section "1" and I fill the form with:
62 | Name | Test database name |
63 | Description | Test |
64 | id_approval | Yes |
65 | id_manageapproved | No |
66 And I add a "Text input" field to "Test database name" database and I fill the form with:
67 | Field name | Test field name |
68 | Field description | Test field description |
69 # To generate the default templates.
70 And I follow "Templates"
71 And I log out
72 # Add an entry as a student.
73 And I log in as "student1"
fdeeaff9 74 And I am on "Course 1" course homepage
ec9e1bec
RW
75 And I add an entry to "Test database name" database with:
76 | Test field name | Student entry |
77 And I press "Save and view"
78 And I log out
79 # Approve the student's entry as a teacher.
80 And I log in as "teacher1"
fdeeaff9 81 And I am on "Course 1" course homepage
ec9e1bec
RW
82 And I follow "Test database name"
83 And I follow "Approve"
84 And I log out
85 # Make sure the student isn't able to edit their entry after it's approved.
86 When I log in as "student1"
fdeeaff9 87 And I am on "Course 1" course homepage
ec9e1bec
RW
88 And I follow "Test database name"
89 Then I should see "Student entry"
90 And "Edit" "link" should not exist