MDL-43738 behat: Functional tests for fields management
[moodle.git] / mod / assign / tests / behat / prevent_submission_changes.feature
CommitLineData
550d842e 1@mod @mod_assign
fac8515d
DM
2Feature: Prevent or allow assignment submission changes
3 In order to control when a student can change his/her submission
5d7b6307 4 As a teacher
fac8515d
DM
5 I need to prevent or allow student submission at any time
6
7 @javascript
8 Scenario: Preventing changes and allowing them again
9 Given the following "courses" exists:
10 | fullname | shortname | category | groupmode |
11 | Course 1 | C1 | 0 | 1 |
12 And the following "users" exists:
13 | username | firstname | lastname | email |
14 | teacher1 | Teacher | 1 | teacher1@asd.com |
15 | student1 | Student | 1 | student1@asd.com |
16 And the following "course enrolments" exists:
17 | user | course | role |
18 | teacher1 | C1 | editingteacher |
19 | student1 | C1 | student |
20 And I log in as "teacher1"
21 And I follow "Course 1"
22 And I turn editing mode on
23 And I add a "Assignment" to section "1" and I fill the form with:
24 | Assignment name | Test assignment name |
25 | Description | Submit your online text |
26 | assignsubmission_onlinetext_enabled | 1 |
27 | assignsubmission_file_enabled | 0 |
28 And I log out
29 And I log in as "student1"
30 And I follow "Course 1"
31 And I follow "Test assignment name"
32 And I press "Add submission"
33 And I fill the moodle form with:
34 | Online text | I'm the student submission |
35 And I press "Save changes"
36 And I press "Edit submission"
37 And I fill the moodle form with:
38 | Online text | I'm the student submission and he/she edited me |
39 And I press "Save changes"
40 And I log out
41 And I log in as "teacher1"
42 And I follow "Course 1"
43 And I follow "Test assignment name"
44 When I follow "View/grade all submissions"
45 And I click on "//tr[contains(., 'Student 1')]/descendant::td/descendant::img[@alt='Actions']/parent::a" "xpath_element"
46 And I follow "Prevent submission changes"
47 Then I should see "Submission changes not allowed"
48 And I log out
49 And I log in as "student1"
50 And I follow "Course 1"
51 And I follow "Test assignment name"
52 And "Edit submission" "button" should not exists
53 And I should see "This assignment is not accepting submissions"
54 And I log out
55 And I log in as "teacher1"
56 And I follow "Course 1"
57 And I follow "Test assignment name"
58 And I follow "View/grade all submissions"
59 And I click on "//tr[contains(., 'Student 1')]/descendant::td/descendant::img[@alt='Actions']/parent::a" "xpath_element"
60 And I follow "Allow submission changes"
becb7e51 61 And I should not see "Submission changes not allowed"
fac8515d
DM
62 And I log out
63 And I log in as "student1"
64 And I follow "Course 1"
65 And I follow "Test assignment name"
66 And I should not see "This assignment is not accepting submissions"
67 And I press "Edit submission"
68 And I fill the moodle form with:
69 | Online text | I'm the student submission edited again |
70 And I press "Save changes"
71 And I should see "I'm the student submission edited again"