@mod @mod_assign Feature: Remove a submission In order to restart an assignment for a student As a teacher I need to remove a student submission at any time Background: Given I log in as "admin" And I set the following system permissions of "Teacher" role: | capability | permission | | mod/assign:editothersubmission | Allow | And I log out And the following "courses" exist: | fullname | shortname | category | groupmode | | Course 1 | C1 | 0 | 0 | And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@example.com | | student1 | Student | 1 | student1@example.com | | student2 | Student | 2 | student2@example.com | And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | | student2 | C1 | student | And the following "groups" exist: | name | course | idnumber | | Group 1 | C1 | G1 | Given the following "group members" exist: | user | group | | student1 | G1 | | student2 | G1 | @javascript Scenario: Remove a submission should remove the data that was submitted When I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I add a "Assignment" to section "1" and I fill the form with: | Assignment name | Test assignment name | | Description | Submit your online text | | assignsubmission_onlinetext_enabled | 1 | | assignsubmission_file_enabled | 0 | And I log out And I log in as "student1" And I am on "Course 1" course homepage And I follow "Test assignment name" And I press "Add submission" And I set the following fields to these values: | Online text | I'm the student submission | And I press "Save changes" And I log out And I log in as "teacher1" And I am on "Course 1" course homepage And I follow "Test assignment name" And I navigate to "View all submissions" in current page administration And I open the action menu in "Student 1" "table_row" And I follow "Remove submission" And I click on "Continue" "button" Then I should not see "I'm the student submission" And I log out And I log in as "student1" And I am on "Course 1" course homepage And I follow "Test assignment name" And I should not see "I'm the student submission" @javascript Scenario: Remove a group submission should remove the data from all group members When I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I add a "Assignment" to section "1" and I fill the form with: | Assignment name | Test assignment name | | Description | Submit your online text | | assignsubmission_onlinetext_enabled | 1 | | assignsubmission_file_enabled | 0 | | Students submit in groups | Yes | And I log out And I log in as "student1" And I am on "Course 1" course homepage And I follow "Test assignment name" And I press "Add submission" And I set the following fields to these values: | Online text | I'm the student submission | And I press "Save changes" And I log out And I log in as "teacher1" And I am on "Course 1" course homepage And I follow "Test assignment name" And I navigate to "View all submissions" in current page administration And I open the action menu in "Student 1" "table_row" And I follow "Remove submission" And I click on "Continue" "button" Then I should not see "I'm the student submission" And I log out And I log in as "student2" And I am on "Course 1" course homepage And I follow "Test assignment name" And I should not see "I'm the student submission" @javascript Scenario: A student can remove their own submission When I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I add a "Assignment" to section "1" and I fill the form with: | Assignment name | Test assignment name | | Description | Submit your online text | | assignsubmission_onlinetext_enabled | 1 | | assignsubmission_file_enabled | 0 | And I log out And I log in as "student1" And I am on "Course 1" course homepage And I follow "Test assignment name" And I press "Add submission" And I set the following fields to these values: | Online text | I'm the student submission | And I press "Save changes" And I am on "Course 1" course homepage And I follow "Test assignment name" And I click on "Remove submission" "button" And I click on "Continue" "button" And I log out And I log in as "teacher1" And I am on "Course 1" course homepage And I follow "Test assignment name" And I navigate to "View all submissions" in current page administration Then I should not see "I'm the student submission" And I log out And I log in as "student1" And I am on "Course 1" course homepage And I follow "Test assignment name" And I should not see "I'm the student submission"