Merge branch 'MDL-72125-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Ilya Tregubov 2021-07-19 13:03:46 +02:00
commit 494a9bb41f
50 changed files with 1269 additions and 1352 deletions

View file

@ -120,7 +120,7 @@ class behat_core_generator extends behat_generator_base {
'activities' => [
'singular' => 'activity',
'datagenerator' => 'activity',
'required' => ['activity', 'idnumber', 'course'],
'required' => ['activity', 'course'],
'switchids' => ['course' => 'course', 'gradecategory' => 'gradecat', 'grouping' => 'groupingid'],
],
'blocks' => [
@ -389,6 +389,17 @@ class behat_core_generator extends behat_generator_base {
}
}
if (!array_key_exists('idnumber', $data)) {
$data['idnumber'] = $data['name'];
if (strlen($data['name']) > 100) {
throw new Exception(
"Activity '{$activityname}' cannot be used as the default idnumber. " .
"The idnumber has a max length of 100 chars. " .
"Please manually specify an idnumber."
);
}
}
// We split $data in the activity $record and the course module $options.
$cmoptions = array();
$cmcolumns = $DB->get_columns('course_modules');

View file

@ -368,6 +368,25 @@ abstract class behat_generator_base {
return $id;
}
/**
* Gets the course cmid for the specified activity based on the activity's idnumber.
*
* Note: this does not check the module type, only the idnumber.
*
* @throws Exception
* @param string $idnumber
* @return int
*/
protected function get_activity_id(string $idnumber) {
global $DB;
if (!$id = $DB->get_field('course_modules', 'id', ['idnumber' => $idnumber])) {
throw new Exception('The specified activity with idnumber "' . $idnumber . '" could not be found.');
}
return $id;
}
/**
* Gets the group id from it's idnumber.
* @throws Exception

View file

@ -57,4 +57,33 @@ abstract class component_generator_base {
*/
public function reset() {
}
/**
* Set the current user during data generation.
*
* This should be avoided wherever possible, but in some situations underlying code will insert data as the current
* user.
*
* @param stdClass $user
*/
protected function set_user(?stdClass $user = null): void {
global $CFG, $DB;
if ($user === null) {
$user = (object) [
'id' => 0,
'mnethostid' => $CFG->mnet_localhost_id,
];
} else {
$user = clone($user);
unset($user->description);
unset($user->access);
unset($user->preference);
}
// Ensure session is empty, as it may contain caches and user-specific info.
\core\session\manager::init_empty_session();
\core\session\manager::set_user($user);
}
}

View file

@ -103,6 +103,9 @@ EOD;
* @return component_generator_base or rather an instance of the appropriate subclass.
*/
public function get_plugin_generator($component) {
// Note: This global is included so that generator have access to it.
// CFG is widely used in require statements.
global $CFG;
list($type, $plugin) = core_component::normalize_component($component);
$cleancomponent = $type . '_' . $plugin;
if ($cleancomponent != $component) {

View file

@ -20,19 +20,12 @@ Feature: In an assignment, teachers can provide feedback comments on student sub
@javascript
Scenario: Teachers should be able to add and remove feedback comments via the quick grading interface
Given the following "activities" exist:
| activity | course | idnumber | name | assignsubmission_onlinetext_enabled | assignfeedback_comments_enabled |
| assign | C1 | assign1 | Test assignment1 | 1 | 1 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment1"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student1 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 assignment1"
| activity | course | name | assignsubmission_onlinetext_enabled | assignfeedback_comments_enabled |
| assign | C1 | Test assignment name | 1 | 1 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
Then I click on "Quick grading" "checkbox"
And I set the field "Feedback comments" to "Feedback from teacher."

View file

@ -19,11 +19,9 @@ Feature: Check that any changes to assignment feedback comments are not lost
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | course | idnumber | assignfeedback_comments_enabled |
| assign | Test assignment name | C1 | ASSIGN01 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | name | course | assignfeedback_comments_enabled |
| assign | Test assignment name | C1 | 1 |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
When I set the following fields to these values:

View file

@ -18,42 +18,37 @@ Feature: In an assignment, teacher can annotate PDF files during grading
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignfeedback_editpdf_enabled | 1 |
| assignfeedback_comments_enabled | 1 |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 2 |
| assignsubmission_file_maxsizebytes | 102400 |
| maxfilessubmission | 2 |
| submissiondrafts | 0 |
And the following "mod_assign > submission" exists:
| assign | Test assignment name |
| user | student1 |
| file | mod/assign/feedback/editpdf/tests/fixtures/submission.pdf, mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf |
And I log in as "admin"
And I am on site homepage
And I navigate to "Plugins > Activity modules > Assignment > Feedback plugins > Annotate PDF" in site administration
And I upload "pix/help.png" file to "" filemanager
And I upload "pix/docs.png" file to "" filemanager
When I press "Save changes"
Then I should see "Changes saved"
And I press "Save changes"
And I should see "Changes saved"
And I follow "Test ghostscript path"
And I should see "The ghostscript path appears to be OK"
And I am on site homepage
And I log out
And 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 PDF file |
| assignsubmission_file_enabled | 1 |
| Maximum number of uploaded files | 2 |
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 upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager
And I upload "mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf" file to "File submissions" filemanager
And I press "Save changes"
And I should see "Submitted for grading"
And I should see "submission.pdf"
And I should see "Not graded"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Submitted for grading" "table_row"
And I should see "Page 1 of 3"
Then I should see "Page 1 of 3"
And I click on ".navigate-next-button" "css_element"
And I should see "Page 2 of 3"
And I click on ".stampbutton" "css_element"
@ -102,29 +97,25 @@ Feature: In an assignment, teacher can annotate PDF files during grading
| grouping | group |
| G1 | G1 |
| G1 | G2 |
And 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 PDF file |
| assignsubmission_file_enabled | 1 |
| Maximum number of uploaded files | 2 |
| Students submit in groups | Yes |
| Grouping for student groups | G1 |
And I log out
When 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 upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager
And I press "Save changes"
Then I should see "Submitted for grading"
And I should see "submission.pdf"
And I should see "Not graded"
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 the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignfeedback_comments_enabled | 1 |
| assignfeedback_editpdf_enabled | 1 |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 2 |
| assignsubmission_file_maxsizebytes | 102400 |
| maxfilessubmission | 2 |
| teamsubmission | 1 |
| grouping | G1 |
| submissiondrafts | 0 |
And the following "mod_assign > submission" exists:
| assign | Test assignment name |
| user | student1 |
| file | mod/assign/feedback/editpdf/tests/fixtures/submission.pdf |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 2" "table_row"
And I click on "Grade" "link" in the "Student 2" "table_row"

View file

@ -17,28 +17,21 @@ Feature: Ensure that a comment remains visible if its popup menu is open
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And 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 PDF file |
| assignsubmission_file_enabled | 1 |
| assignfeedback_editpdf_enabled | 1 |
| Maximum number of uploaded files | 1 |
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 upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager
And I press "Save changes"
And I should see "Submitted for grading"
And I should see "submission.pdf"
And I should see "Not graded"
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 the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 1 |
| assignsubmission_file_maxsizebytes | 102400 |
| assignfeedback_editpdf_enabled | 1 |
| submissiondrafts | 0 |
And the following "mod_assign > submission" exists:
| assign | Test assignment name |
| user | student1 |
| file | mod/assign/feedback/editpdf/tests/fixtures/submission.pdf |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Submitted for grading" "table_row"
And I wait for the complete PDF to load

View file

@ -26,28 +26,22 @@ Feature: In a group assignment, teacher can annotate PDF files for all users
| user | group |
| student1 | G1 |
| student2 | G1 |
And 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 PDF file |
| assignsubmission_file_enabled | 1 |
| Maximum number of uploaded files | 1 |
| 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 upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager
And I press "Save changes"
And I should see "Submitted for grading"
And I should see "submission.pdf"
And I should see "Not graded"
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 the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 1 |
| assignsubmission_file_maxsizebytes | 102400 |
| assignfeedback_editpdf_enabled | 1 |
| submissiondrafts | 0 |
| teamsubmission | 1 |
And the following "mod_assign > submission" exists:
| assign | Test assignment name |
| user | student1 |
| file | mod/assign/feedback/editpdf/tests/fixtures/submission.pdf |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Submitted for grading" "table_row"
And I wait for the complete PDF to load
@ -64,27 +58,22 @@ Feature: In a group assignment, teacher can annotate PDF files for all users
And I should see "The changes to the grade and feedback were saved"
And I click on "Edit settings" "link"
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 am on the "Test assignment name" Activity page logged in as student1
When I follow "View annotated PDF..."
Then I should see "Annotate PDF"
And I wait until the page is ready
And I click on "Close" "button"
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 am on the "Test assignment name" Activity page logged in as student2
And I should not see "View annotated PDF..."
@javascript
Scenario: Submit a PDF file as a student and annotate the PDF as a teacher and all students in the group get a copy of the annotated PDF.
Given I press "Save changes"
And I am on "Course 1" course homepage
And I should see "The changes to the grade and feedback were saved"
And I am on the "Test assignment name" Activity page
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 am on the "Test assignment name" Activity page logged in as student1
When I follow "View annotated PDF..."
And I change window size to "large"
Then I should see "Annotate PDF"
@ -92,7 +81,6 @@ Feature: In a group assignment, teacher can annotate PDF files for all users
And I wait until the page is ready
And I click on "Close" "button"
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 am on the "Test assignment name" Activity page logged in as student2
And I should see "View annotated PDF..."

View file

@ -18,33 +18,26 @@ Feature: In an assignment, teacher can view the feedback for a previous attempt.
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And 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 PDF file |
| assignsubmission_file_enabled | 1 |
| Maximum number of uploaded files | 2 |
| Additional attempts | Manually |
| Maximum attempts | Unlimited |
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 upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager
And I upload "mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf" file to "File submissions" filemanager
And I press "Save changes"
And I should see "Submitted for grading"
And I should see "submission.pdf"
And I should see "Not graded"
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 the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| maxattempts | 0 |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 2 |
| assignsubmission_file_maxsizebytes | 102400 |
| assignfeedback_editpdf_enabled | 1 |
| submissiondrafts | 0 |
| attemptreopenmethod | manual |
And the following "mod_assign > submission" exists:
| assign | Test assignment name |
| user | student1 |
| file | mod/assign/feedback/editpdf/tests/fixtures/submission.pdf, mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf |
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Submitted for grading" "table_row"
And I should see "Page 1 of 3"
Then I should see "Page 1 of 3"
And I click on ".navigate-next-button" "css_element"
And I should see "Page 2 of 3"
And I click on ".stampbutton" "css_element"

View file

@ -25,32 +25,24 @@ Feature: In an assignment, teacher can submit feedback files during grading
| user | group |
| student1 | G1 |
| student2 | G1 |
And 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 PDF file |
| Maximum number of uploaded files | 2 |
| Students submit in groups | Yes |
And I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
And I follow "Expand all"
And I set the field "assignfeedback_file_enabled" to "1"
And I press "Save and display"
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 upload "mod/assign/feedback/file/tests/fixtures/submission.txt" file to "File submissions" filemanager
And I press "Save changes"
And I should see "Submitted for grading"
And I should see "submission.txt"
And I should see "Not graded"
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 the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 1 |
| assignsubmission_file_maxsizebytes | 1024 |
| assignfeedback_comments_enabled | 1 |
| assignfeedback_file_enabled | 1 |
| maxfilessubmission | 2 |
| teamsubmission | 1 |
| submissiondrafts | 0 |
And the following "mod_assign > submission" exists:
| assign | Test assignment name |
| user | student1 |
| file | mod/assign/feedback/file/tests/fixtures/submission.txt |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I click on "Grade" "link" in the ".submissionlinks" "css_element"
And I upload "mod/assign/feedback/file/tests/fixtures/feedback.txt" file to "Feedback files" filemanager
@ -60,14 +52,10 @@ Feature: In an assignment, teacher can submit feedback files during grading
And I press "Save changes"
And I click on "Course 1" "link" in the "[data-region=assignment-info]" "css_element"
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 am on the "Test assignment name" Activity page logged in as student1
And I should see "feedback.txt"
And I log out
When I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student2
Then I should not see "feedback.txt"
@javascript
@ -75,12 +63,8 @@ Feature: In an assignment, teacher can submit feedback files during grading
Given I press "Save changes"
And I click on "Course 1" "link" in the "[data-region=assignment-info]" "css_element"
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 am on the "Test assignment name" Activity page logged in as student1
And I should see "feedback.txt"
And I log out
When I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I am on the "Test assignment name" Activity page logged in as student2
Then I should see "feedback.txt"

View file

@ -22,11 +22,9 @@ Feature: In an assignment, limit submittable file types
@javascript
Scenario: File types validation for an assignment
Given the following "activities" exist:
| activity | course | idnumber | name | intro | duedate | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | assignsubmission_file_maxfiles | assignsubmission_file_maxsizebytes |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 1388534400 | 0 | 1 | 1 | 0 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | duedate | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | assignsubmission_file_maxfiles | assignsubmission_file_maxsizebytes |
| assign | C1 | Test assignment name | 1388534400 | 0 | 1 | 1 | 0 |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
When I set the field "Accepted file types" to "image/png;doesntexist;.anything;unreal/mimetype;nodot"
And I press "Save and display"
@ -46,11 +44,9 @@ Feature: In an assignment, limit submittable file types
@javascript @_file_upload
Scenario: Uploading permitted file types for an assignment
Given the following "activities" exist:
| activity | course | idnumber | name | intro | duedate | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | assignsubmission_file_maxfiles | assignsubmission_file_maxsizebytes | assignsubmission_file_filetypes |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 1388534400 | 0 | 1 | 3 | 0 | image/png,spreadsheet,.xml,.txt |
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | duedate | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | assignsubmission_file_maxfiles | assignsubmission_file_maxsizebytes | assignsubmission_file_filetypes |
| assign | C1 | Test assignment name | 1388534400 | 0 | 1 | 3 | 0 | image/png,spreadsheet,.xml,.txt |
And I am on the "Test assignment name" Activity page logged in as student1
When I press "Add submission"
And I should see "Accepted file types"
And I should see "Image (PNG)"
@ -67,11 +63,9 @@ Feature: In an assignment, limit submittable file types
@javascript @_file_upload
Scenario: No filetypes allows all
Given the following "activities" exist:
| activity | course | idnumber | name | intro | duedate | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | assignsubmission_file_maxfiles | assignsubmission_file_maxsizebytes | assignsubmission_file_filetypes |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 1388534400 | 0 | 1 | 2 | 0 | |
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | duedate | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | assignsubmission_file_maxfiles | assignsubmission_file_maxsizebytes | assignsubmission_file_filetypes |
| assign | C1 | Test assignment name | 1388534400 | 0 | 1 | 2 | 0 | |
And I am on the "Test assignment name" Activity page logged in as student1
When I press "Add submission"
And I should not see "Accepted file types"
And I upload "lib/tests/fixtures/gd-logo.png" file to "File submissions" filemanager

View file

@ -0,0 +1,69 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
require_once("{$CFG->dirroot}/mod/assign/tests/generator/assignsubmission_subplugin_generator.php");
/**
* Online Text assignment submission subplugin data generator.
*
* @package assignsubmission_file
* @category test
* @copyright 2021 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class assignsubmission_file_generator extends assignsubmission_subplugin_generator {
/**
* Add submission data in the correct format for a call to `assign::save_submission()` from a table containing
* submission data for a single activity.
*
* Data should be added to the $submission object passed into the function.
*
* @param stdClass $submission The submission record to be modified
* @param assign $assign The assignment being submitted to
* @param array $data The data received
*/
public function add_submission_data(stdClass $submission, assign $assign, array $data): void {
global $CFG;
if (array_key_exists('file', $data)) {
$files = explode(',', $data['file']);
$itemid = file_get_unused_draft_itemid();
$fs = get_file_storage();
foreach ($files as $filepath) {
// All paths are relative to $CFG->dirroot.
$filepath = trim($filepath);
$filepath = "{$CFG->dirroot}/{$filepath}";
$filename = basename($filepath);
$fs->create_file_from_pathname((object) [
'itemid' => $itemid,
'contextid' => context_user::instance($submission->userid)->id,
'component' => 'user',
'filearea' => 'draft',
'filepath' => '/',
'filename' => $filename,
], $filepath);
}
$submission->files_filemanager = $itemid;
$submission->file_editor = [
'itemid' => $itemid,
];
}
}
}

View file

@ -0,0 +1,47 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
require_once("{$CFG->dirroot}/mod/assign/tests/generator/assignsubmission_subplugin_generator.php");
/**
* Online Text assignment submission subplugin data generator.
*
* @package assignsubmission_onlinetext
* @category test
* @copyright 2021 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class assignsubmission_onlinetext_generator extends assignsubmission_subplugin_generator {
/**
* Add submission data in the correct format for a call to `assign::save_submission()` from a table containing
* submission data for a single activity.
*
* Data should be added to the $submission object passed into the function.
*
* @param stdClass $submission The submission record to be modified
* @param assign $assign The assignment being submitted to
* @param array $data The data received
*/
public function add_submission_data(stdClass $submission, assign $assign, array $data): void {
if (array_key_exists('onlinetext', $data)) {
$submission->onlinetext_editor = [
'itemid' => file_get_unused_draft_itemid(),
'text' => $data['onlinetext'],
'format' => FORMAT_HTML,
];
}
}
}

View file

@ -9,35 +9,29 @@ Feature: In an assignment, students start a new attempt based on their previous
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| attemptreopenmethod | manual |
| hidegrader | 1 |
| submissiondrafts | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And 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 |
| Additional attempts | Manually |
| Hide grader identity from students | 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"
When I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student first 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"
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student first submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
@ -45,16 +39,14 @@ Feature: In an assignment, students start a new attempt based on their previous
And I press "Save changes"
And I click on "Edit settings" "link"
And I log out
Then I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I should not see "Teacher 1"
When I am on the "Test assignment name" Activity page logged in as student1
Then I should not see "Teacher 1"
And I press "Add a new attempt based on previous 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 am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I should see "I'm the student first submission"
@ -88,29 +80,24 @@ Feature: In an assignment, students start a new attempt based on their previous
| student2 | G1 |
| student3 | G2 |
| student4 | G2 |
And 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 | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| Students submit in groups | Yes |
| Additional attempts | Manually |
| Maximum attempts | 3 |
| Group mode | Separate groups |
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's first 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 the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| attemptreopenmethod | manual |
| submissiondrafts | 0 |
| groupmode | 1 |
| teamsubmission | 1 |
| hidegrader | 1 |
| maxattempts | 3 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student first submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
Then "Student 1" row "Status" column of "generaltable" table should contain "Submitted for grading"
And "Student 2" row "Status" column of "generaltable" table should contain "Submitted for grading"
@ -128,18 +115,15 @@ Feature: In an assignment, students start a new attempt based on their previous
And I click on "Go" "button" confirming the dialogue
And I should not see "The grades were not saved because someone has modified one or more records more recently than when you loaded the page."
And I log out
And I log in as "student3"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student3
And I should see "This is attempt 1 ( 3 attempts allowed )."
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student's 3 group 2 first attempt |
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 am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And "Student 1" row "Status" column of "generaltable" table should contain "Reopened"
And "Student 2" row "Status" column of "generaltable" table should contain "Reopened"
@ -151,18 +135,16 @@ Feature: In an assignment, students start a new attempt based on their previous
And I press "Save changes"
And I follow "Assignment: Test assignment name"
And I log out
And I log in as "student4"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student4
And I should see "This is attempt 2 ( 3 attempts allowed )."
And I press "Add a new attempt"
And I set the following fields to these values:
| Online text | I'm the student's 4 group 2 second attempt |
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 am on the "Test assignment name" Activity page logged in as teacher1
And I select "Group 2" from the "group" singleselect
And I click on "Grade" "link" in the ".submissionlinks" "css_element"
And I should see "2" in the "#id_attemptsettings" "css_element"

View file

@ -1,7 +1,7 @@
@mod @mod_assign
Feature: Switch role does not cause an error message in assignsubmission_comments
Background:
Scenario: I switch role to student and an error doesn't occur
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
@ -14,10 +14,15 @@ Feature: Switch role does not cause an error message in assignsubmission_comment
And the following "activities" exist:
| activity | course | idnumber | name | intro | teamsubmission |
| assign | C1 | a1 | Test assignment one | This is the description text | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
Scenario: I switch role to student and an error doesn't occur
And the following "activity" exists:
| activity | assign |
| idnumber | ass1 |
| course | C1 |
| name | Test assignment |
| intro | This is the description text |
| teamsubmission | 1 |
| submissiondrafts | 0 |
And I am on the "C1" Course page logged in as teacher1
When I follow "Switch role to..." in the user menu
And I press "Student"
And I follow "Test assignment"

View file

@ -25,49 +25,40 @@ Feature: Assign reset
And the following "activity" exists:
| activity | assign |
| course | C1 |
| idnumber | 0001 |
| name | Test assignment name |
| intro | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_onlinetext_wordlimit_enabled | 1 |
| assignsubmission_onlinetext_wordlimit | 10 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
Scenario: Use course reset to clear all attempt data
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student first submission |
And I press "Save changes"
And I press "Submit assignment"
And I press "Continue"
Then I should see "Submitted for grading"
Given the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student first submission |
And I am on the "Test assignment name" Activity page logged in as student1
And I should see "Submitted for grading"
And I should see "I'm the student first submission"
And I should see "Not graded"
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 am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "Submitted for grading"
And I am on "Course 1" course homepage
And I navigate to "Reset" in current page administration
When I navigate to "Reset" in current page administration
And I set the following fields to these values:
| Delete all submissions | 1 |
And I press "Reset course"
And I press "Continue"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page
And I navigate to "View all submissions" in current page administration
Then I should not see "Submitted for grading"
@javascript
Scenario: Use course reset to remove user overrides.
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "User overrides" in current page administration
And I press "Add user override"
And I set the following fields to these values:
@ -92,9 +83,7 @@ Feature: Assign reset
Then I should not see "Sam1 Student1"
Scenario: Use course reset to remove group overrides.
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "Group overrides" in current page administration
And I press "Add group override"
And I set the following fields to these values:
@ -119,9 +108,7 @@ Feature: Assign reset
Then I should not see "Group 1"
Scenario: Use course reset to reset blind marking assignment.
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| blindmarking | 1 |

View file

@ -30,21 +30,19 @@ Feature: Assign group override
| student2 | G2 |
| student3 | G1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | assignsubmission_onlinetext_enabled |
| assign | Test assignment name | Submit your online text | C1 | assign1 | 1 |
| activity | name | intro | course | assignsubmission_onlinetext_enabled |
| assign | Test assignment name | Submit your online text | C1 | 1 |
Scenario: Add, modify then delete a group override
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Group overrides" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Group overrides" in current page administration
And I press "Add group override"
And I set the following fields to these values:
| Override group | Group 1 |
| Due date | ##1 Jan 2020 08:00## |
And I press "Save"
And I should see "Wednesday, 1 January 2020, 8:00"
Then I click on "Edit" "link" in the "Group 1" "table_row"
Then I should see "Wednesday, 1 January 2020, 8:00"
And I click on "Edit" "link" in the "Group 1" "table_row"
And I set the following fields to these values:
| Due date | ##1 Jan 2030 08:00## |
And I press "Save"
@ -54,17 +52,15 @@ Feature: Assign group override
And I should not see "Group 1"
Scenario: Duplicate a user override
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Group overrides" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Group overrides" in current page administration
And I press "Add group override"
And I set the following fields to these values:
| Override group | Group 1 |
| Due date | ##1 Jan 2020 08:00## |
And I press "Save"
And I should see "Wednesday, 1 January 2020, 8:00"
Then I click on "copy" "link"
Then I should see "Wednesday, 1 January 2020, 8:00"
And I click on "copy" "link"
And I set the following fields to these values:
| Override group | Group 2 |
| Due date | ##1 Jan 2030 08:00## |
@ -73,10 +69,8 @@ Feature: Assign group override
And I should see "Group 2"
Scenario: Allow a group to have a different due date
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Allow submissions from | disabled |
| Due date | ##1 Jan 2000 08:00## |
@ -101,10 +95,8 @@ Feature: Assign group override
And the activity date in "Test assignment name" should contain "Due: Wednesday, 1 January 2020, 8:00"
Scenario: Allow a group to have a different cut off date
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Due date | disabled |
| Allow submissions from | disabled |
@ -129,10 +121,8 @@ Feature: Assign group override
And I should see "You have not made a submission yet."
Scenario: Allow a group to have a different start date
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Due date | disabled |
| Allow submissions from | ##1 January 2030 08:00## |
@ -159,10 +149,8 @@ Feature: Assign group override
@javascript
Scenario: Add both a user and group override and verify that both are applied correctly
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Due date | disabled |
| Allow submissions from | ##1 January 2040 08:00## |
@ -204,12 +192,10 @@ Feature: Assign group override
| capability | permission | role | contextlevel | reference |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | assign2 | 1 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
And I navigate to "Group overrides" in current page administration
| activity | name | intro | course | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | 1 |
And I am on the "Assignment 2" Activity page logged in as teacher1
When I navigate to "Group overrides" in current page administration
Then I should see "No groups you can access."
And the "Add group override" "button" should be disabled
@ -219,15 +205,13 @@ Feature: Assign group override
| capability | permission | role | contextlevel | reference |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | assign2 | 1 |
| activity | name | intro | course | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | 1 |
And the following "group members" exist:
| user | group |
| teacher1 | G1 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
And I navigate to "Group overrides" in current page administration
And I am on the "Assignment 2" Activity page logged in as teacher1
When I navigate to "Group overrides" in current page administration
And I press "Add group override"
Then the "Override group" select box should contain "Group 1"
And the "Override group" select box should not contain "Group 2"
@ -238,14 +222,12 @@ Feature: Assign group override
| capability | permission | role | contextlevel | reference |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | assign2 | 1 |
| activity | name | intro | course | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | 1 |
And the following "group members" exist:
| user | group |
| teacher1 | G1 |
And I log in as "admin"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
And I am on the "Assignment 2" Activity page logged in as admin
And I navigate to "Group overrides" in current page administration
And I press "Add group override"
And I set the following fields to these values:
@ -257,9 +239,8 @@ Feature: Assign group override
| Allow submissions from | ##1 January 2020 08:00## |
And I press "Save"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
When I am on the "Assignment 2" Activity page logged in as teacher1
And I navigate to "Group overrides" in current page administration
Then I should see "Group 1" in the ".generaltable" "css_element"
And I should not see "Group 2" in the ".generaltable" "css_element"

View file

@ -1,7 +1,7 @@
@mod @mod_assign @javascript
@mod @mod_assign
Feature: When a Teacher hides an assignment from view for students it should consistently indicate it is hidden.
Scenario: Grade multiple students on one page
Background: Grade multiple students on one page
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
@ -13,25 +13,27 @@ Feature: When a Teacher hides an assignment from view for students it should con
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
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 hidden assignment |
And I open "Test hidden assignment" actions menu
And I choose "Hide" in the open action menu
And I follow "Test hidden assignment"
And I should see "Test hidden assignment"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test hidden assignment |
| visible | 0 |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test visible assignment |
Scenario: A teacher can view a hidden assignment
When I am on the "Test hidden assignment" Activity page logged in as teacher1
Then I should see "Test hidden assignment"
And I should see "Yes" in the "Hidden from students" "table_row"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "2" and I fill the form with:
| Assignment name | Test visible assignment |
And I follow "Test visible assignment"
And I should see "Test visible assignment"
Scenario: A teacher can view a visible assignment
Given I am on the "Test visible assignment" Activity page logged in as teacher1
Then I should see "Test visible assignment"
And I should see "No" in the "Hidden from students" "table_row"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
Scenario: A student cannot view a hidden assignment
And I am on the "C1" Course page logged in as student1
And I should not see "Test hidden assignment"
And I should see "Test visible assignment"

View file

@ -6,29 +6,25 @@ Feature: Assignment with no calendar capabilites
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "admin"
And I am on "Course 1" course homepage
| user | course | role |
| teacher1 | C1 | editingteacher |
And I am on the "C1" Course page logged in as admin
And I navigate to "Users > Permissions" in current page administration
And I override the system permissions of "Teacher" role with:
| capability | permission |
| moodle/calendar:manageentries | Prohibit |
And I log out
| capability | permission |
| moodle/calendar:manageentries | Prohibit |
Scenario: Editing an assignment
Given I log in as "admin"
And the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| assign | Test assignment name | Test assignment description | C1 | 1 | assign1 |
And I am on "Course 1" course homepage
And I follow "Test assignment name"
Given the following "activities" exist:
| activity | name | intro | course | section |
| assign | Test assignment name | Test assignment description | C1 | 1 |
And I am on the "Test assignment name" Activity page
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Allow submissions from | ##1 January 2017## |
@ -37,9 +33,8 @@ Feature: Assignment with no calendar capabilites
| Remind me to grade by | ##1 March 2017## |
And I press "Save and return to course"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test assignment name"
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Allow submissions from | ##1 January 2018## |

View file

@ -19,22 +19,20 @@ Feature: Assign user override
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | assignsubmission_onlinetext_enabled |
| assign | Test assignment name | Submit your online text | C1 | assign1 | 1 |
| activity | name | intro | course | assignsubmission_onlinetext_enabled |
| assign | Test assignment name | Submit your online text | C1 | 1 |
@javascript
Scenario: Add, modify then delete a user override
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "User overrides" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "User overrides" in current page administration
And I press "Add user override"
And I set the following fields to these values:
| Override user | Student1 |
| Due date | ##first day of January 2020 08:00## |
And I press "Save"
And I should see "Wednesday, 1 January 2020, 8:00"
Then I click on "Edit" "link" in the "Sam1 Student1" "table_row"
Then I should see "Wednesday, 1 January 2020, 8:00"
And I click on "Edit" "link" in the "Sam1 Student1" "table_row"
And I set the following fields to these values:
| Due date | ##first day of January 2030 08:00## |
And I press "Save"
@ -45,17 +43,15 @@ Feature: Assign user override
@javascript
Scenario: Duplicate a user override
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "User overrides" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "User overrides" in current page administration
And I press "Add user override"
And I set the following fields to these values:
| Override user | Student1 |
| Due date | ##2020-01-01 08:00## |
And I press "Save"
And I should see "Wednesday, 1 January 2020, 8:00"
Then I click on "copy" "link"
Then I should see "Wednesday, 1 January 2020, 8:00"
And I click on "copy" "link"
And I set the following fields to these values:
| Override user | Student2 |
| Due date | ##2030-01-01 08:00## |
@ -65,10 +61,8 @@ Feature: Assign user override
@javascript
Scenario: Allow a user to have a different due date
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Allow submissions from | disabled |
| Due date | ##1 Jan 2000 08:00## |
@ -80,12 +74,12 @@ Feature: Assign user override
| Override user | Student1 |
| Due date | ##1 Jan 2020 08:00## |
And I press "Save"
And I should see "Wednesday, 1 January 2020, 8:00"
Then I should see "Wednesday, 1 January 2020, 8:00"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
Then the activity date in "Test assignment name" should contain "Due: Saturday, 1 January 2000, 8:00"
And the activity date in "Test assignment name" should contain "Due: Saturday, 1 January 2000, 8:00"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
@ -94,10 +88,8 @@ Feature: Assign user override
@javascript
Scenario: Allow a user to have a different cut off date
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Due date | disabled |
| Allow submissions from | disabled |
@ -123,10 +115,8 @@ Feature: Assign user override
@javascript
Scenario: Allow a user to have a different start date
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Due date | disabled |
| Allow submissions from | ##1 January 2030 08:00## |
@ -155,12 +145,10 @@ Feature: Assign user override
| capability | permission | role | contextlevel | reference |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | assign2 | 1 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
And I navigate to "User overrides" in current page administration
| activity | name | intro | course | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | 1 |
And I am on the "Assignment 2" Activity page logged in as teacher1
When I navigate to "User overrides" in current page administration
Then I should see "No groups you can access."
And the "Add user override" "button" should be disabled
@ -170,8 +158,8 @@ Feature: Assign user override
| capability | permission | role | contextlevel | reference |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | assign2 | 1 |
| activity | name | intro | course | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | 1 |
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
@ -181,10 +169,8 @@ Feature: Assign user override
| teacher1 | G1 |
| student1 | G1 |
| student2 | G2 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
And I navigate to "User overrides" in current page administration
And I am on the "Assignment 2" Activity page logged in as teacher1
When I navigate to "User overrides" in current page administration
And I press "Add user override"
Then the "Override user" select box should contain "Sam1 Student1, student1@example.com"
And the "Override user" select box should not contain "Sam2 Student2, student2@example.com"
@ -196,8 +182,8 @@ Feature: Assign user override
| capability | permission | role | contextlevel | reference |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | assign2 | 1 |
| activity | name | intro | course | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | 1 |
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
@ -207,9 +193,7 @@ Feature: Assign user override
| teacher1 | G1 |
| student1 | G1 |
| student2 | G2 |
And I log in as "admin"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
And I am on the "Assignment 2" Activity page logged in as admin
And I navigate to "User overrides" in current page administration
And I press "Add user override"
And I set the following fields to these values:
@ -221,18 +205,15 @@ Feature: Assign user override
| Allow submissions from | ##first day of January 2015 08:00## |
And I press "Save"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
And I navigate to "User overrides" in current page administration
And I am on the "Assignment 2" Activity page logged in as teacher1
When I navigate to "User overrides" in current page administration
Then I should see "Student1" in the ".generaltable" "css_element"
And I should not see "Student2" in the ".generaltable" "css_element"
But I should not see "Student2" in the ".generaltable" "css_element"
@javascript
Scenario: Create a user override when the assignment is not available to the student
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test assignment name"
Given I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
And I set the field "Availability" to "Hide from students"

View file

@ -6,56 +6,42 @@ Feature: Bulk remove submissions
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 0 |
| 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 |
| 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 |
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
@javascript
Scenario: Bulk remove submissions should remove the data that was submitted
Given I log in as "admin"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
| Test assignment name | student2 | I'm the student2 submission |
And 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 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 student1 submission |
And I press "Save changes"
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 press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student2 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 am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "I'm the student1 submission"
And I should see "I'm the student2 submission"
@ -65,45 +51,30 @@ Feature: Bulk remove submissions
Then I should not see "I'm the student1 submission"
And I should not see "I'm the student2 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 am on the "Test assignment name" Activity page logged in as student1
And I should not see "I'm the student1 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 am on the "Test assignment name" Activity page logged in as student2
And I should not see "I'm the student2 submission1"
@javascript
Scenario: Bulk remove submissions should be unavailable if the user is missing the editing submission capability
Given 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 student1 submission |
And I press "Save changes"
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 press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student2 submission |
And I press "Save changes"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
| Test assignment name | student2 | I'm the student2 submission |
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "I'm the student1 submission"
And I should see "I'm the student2 submission"
@ -113,45 +84,33 @@ Feature: Bulk remove submissions
@javascript
Scenario: Notification should be displayed when non-group users are selected for submission bulk removal
in separate group mode
Given I log in as "admin"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| groupmode | 1 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
| Test assignment name | student2 | I'm the student2 submission |
And 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 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 |
| groupmode | 1 |
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 student1 submission |
And I press "Save changes"
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 press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student2 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 am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "I'm the student1 submission"
And I should see "I'm the student2 submission"
And I set the field "selectall" to "1"
When I set the field "operation" to "Remove submission"
And I click on "Go" "button" confirming the dialogue
Then I should see "I'm the student1 submission"
And I should see "I'm the student2 submission"
And I should see "The submission of Student 1 cannot be removed"
@ -159,44 +118,30 @@ Feature: Bulk remove submissions
@javascript
Scenario: Bulk remove submission when group users are added to the bulk
removing submissions process in separate group mode
removing submissions process in separate group mode
Given the following "group members" exist:
| user | group |
| student1 | G1 |
| student2 | G1 |
| user | group |
| student1 | G1 |
| student2 | G1 |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| groupmode | 1 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
| Test assignment name | student2 | I'm the student2 submission |
And 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 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 |
| groupmode | 1 |
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 student1 submission |
And I press "Save changes"
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 press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student2 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 am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "I'm the student1 submission"
And I should see "I'm the student2 submission"

View file

@ -17,28 +17,21 @@ Feature: In an assignment, teachers can edit a students submission inline
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And 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 |
| assignfeedback_comments_enabled | 1 |
| assignfeedback_file_enabled | 1 |
| assignfeedback_comments_commentinline | 1 |
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 first submission |
And I press "Save changes"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| assignfeedback_comments_enabled | 1 |
| assignfeedback_file_enabled | 1 |
| assignfeedback_comments_commentinline | 1 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student first submission |
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
@ -56,9 +49,8 @@ Feature: In an assignment, teachers can edit a students submission inline
And I should see "I'm the teacher feedback" in the "Student 1" "table_row"
And I should see "empty.txt" in the "Student 1" "table_row"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I am on the "Test assignment name" Activity page logged in as student1
And I should see "Submitted for grading" in the "Submission status" "table_row"
And I should see "Graded" in the "Grading status" "table_row"
And I should see "I'm the student first submission" in the "Online text" "table_row"

View file

@ -20,18 +20,19 @@ Feature: Check that the assignment grade can not be input in a wrong format.
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And 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 | Test assignment description |
| Use marking workflow | Yes |
When I follow "Test assignment name"
Then I navigate to "View all submissions" in current page administration
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| markingworkflow | 1 |
| submissiondrafts | 0 |
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "50,,6"
And I press "Save changes"
And I should see "The grade provided could not be understood: 50,,6"
Then I should see "The grade provided could not be understood: 50,,6"
@javascript
Scenario: Error in the decimal separator .
@ -49,15 +50,16 @@ Feature: Check that the assignment grade can not be input in a wrong format.
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And 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 | Test assignment description |
| Use marking workflow | Yes |
When I follow "Test assignment name"
Then I navigate to "View all submissions" in current page administration
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| markingworkflow | 1 |
| submissiondrafts | 0 |
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "50..6"
And I press "Save changes"
And I should see "The grade provided could not be understood: 50..6"
Then I should see "The grade provided could not be understood: 50..6"

View file

@ -18,15 +18,16 @@ Feature: Check that the assignment grade can be updated correctly
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And 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 | Test assignment description |
| Use marking workflow | Yes |
When I follow "Test assignment name"
| name | course | idnumber |
| Group 1 | C1 | G1 |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| markingworkflow | 1 |
| submissiondrafts | 0 |
And I am on the "Test assignment name" Activity page logged in as teacher1
Then I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "50"
@ -53,16 +54,17 @@ Feature: Check that the assignment grade can be updated correctly
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And 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 | Test assignment description |
| Use marking workflow | Yes |
| Students submit in groups | Yes |
| Group mode | No groups |
When I follow "Test assignment name"
Then I navigate to "View all submissions" in current page administration
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| markingworkflow | 1 |
| submissiondrafts | 0 |
| teamsubmission | 1 |
| groupmode | 0 |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "50"
And I set the field "Notify students" to "0"
@ -70,4 +72,4 @@ Feature: Check that the assignment grade can be updated correctly
And I click on "Edit settings" "link"
And I follow "Test assignment name"
And I navigate to "View all submissions" in current page administration
And "Student 1" row "Grade" column of "generaltable" table should contain "50.00"
Then "Student 1" row "Grade" column of "generaltable" table should contain "50.00"

View file

@ -19,26 +19,19 @@ Feature: In an assignment, teachers can edit feedback for a students previous su
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And 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 |
| assignfeedback_comments_enabled | 1 |
| Additional attempts | Manually |
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 press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student first 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 the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignfeedback_comments_enabled | 1 |
| submissiondrafts | 0 |
| attemptreopenmethod | manual |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student2 | I'm the student first submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 2" "table_row"
And I set the following fields to these values:
@ -48,14 +41,12 @@ Feature: In an assignment, teachers can edit feedback for a students previous su
And I press "Save changes"
And I click on "Edit settings" "link"
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 am on the "Test assignment name" Activity page logged in as student2
And I should see "I'm the teacher first feedback" in the "Feedback comments" "table_row"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 2" "table_row"
And I click on "View a different attempt" "link"
@ -67,10 +58,9 @@ Feature: In an assignment, teachers can edit feedback for a students previous su
And I press "Save changes"
And I click on "Edit settings" "link"
And I log out
Then I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I should see "I'm the teacher second feedback" in the "Feedback comments" "table_row"
And I am on the "Test assignment name" Activity page logged in as student2
Then I should see "I'm the teacher second feedback" in the "Feedback comments" "table_row"
And I should see "50.00"
And I click on ".mod-assign-history-link" "css_element"
And I should not see "I'm the teacher second feedback" in the "Feedback comments" "table_row"

View file

@ -14,25 +14,18 @@ Feature: In an assignment, the administrator can edit students' submissions
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
When I log in as "admin"
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 |
| groupmode | No groups |
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 student1 submission |
And I press "Save changes"
And I log out
And I log in as "admin"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
And I am on the "Test assignment name" Activity page logged in as admin
And I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 1" "table_row"
And I choose "Edit submission" in the open action menu

View file

@ -17,18 +17,17 @@ Feature: In an assignment, students can upload files for assessment
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And 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 | 0 |
| assignsubmission_file_enabled | 1 |
| Maximum number of uploaded files | 2 |
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 the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 0 |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 2 |
| assignsubmission_file_maxsizebytes | 1000000 |
And I am on the "Test assignment name" Activity page logged in as student1
When I press "Add submission"
And I upload "lib/tests/fixtures/empty.txt" file to "File submissions" filemanager
And I press "Save changes"

View file

@ -21,26 +21,25 @@ Feature: In an assignment, teachers can filter displayed submissions by assigned
| student1 | C1 | student |
| student2 | C1 | student |
| marker1 | C1 | teacher |
And 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 |
| Use marking workflow | Yes |
| Use marking allocation | Yes |
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| markingworkflow | 1 |
| markingallocation | 1 |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "allocatedmarker" to "Marker 1"
And I set the field "Notify students" to "0"
And I press "Save changes"
And I click on "Edit settings" "link"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I am on the "Test assignment name" Activity page
And I navigate to "View all submissions" in current page administration
And I set the field "markerfilter" to "Marker 1"
Then I should see "Student 1"

View file

@ -21,11 +21,9 @@ Feature: In an assignment, teachers can filter displayed submissions and see dra
| student2 | C1 | student |
| student3 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | assignsubmission_onlinetext_enabled | submissiondrafts |
| assign | C1 | assign1 | Test assignment | 1 | 1 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment"
| activity | course | name | assignsubmission_onlinetext_enabled | submissiondrafts |
| assign | C1 | Test assignment | 1 | 1 |
And I am on the "Test assignment" Activity page logged in as student1
And I press "Add submission"
And I set the following fields to these values:
| Online text | This submission is submitted |
@ -33,9 +31,8 @@ Feature: In an assignment, teachers can filter displayed submissions and see dra
And I press "Submit assignment"
And I press "Continue"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment"
And I am on the "Test assignment" Activity page logged in as student2
And I press "Add submission"
And I set the following fields to these values:
| Online text | This submission is NOT submitted |
@ -44,9 +41,7 @@ Feature: In an assignment, teachers can filter displayed submissions and see dra
@javascript
Scenario: View assignments with draft status on the view all submissions page
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment"
Given I am on the "Test assignment" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
When I set the field "Filter" to "Draft"
Then I should see "Student 2"
@ -55,9 +50,7 @@ Feature: In an assignment, teachers can filter displayed submissions and see dra
@javascript
Scenario: View assignments with draft status in the grader
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment"
Given I am on the "Test assignment" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
When I click on "[data-region=user-filters]" "css_element"

View file

@ -26,7 +26,6 @@ Feature: In an assignment, teachers can change filters in the grading app
| activity | assign |
| course | C1 |
| name | Test assignment name & |
| idnumber | assign |
| description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
@ -35,9 +34,7 @@ Feature: In an assignment, teachers can change filters in the grading app
@javascript
Scenario: Set filters in the grading table and see them in the grading app
Given I log in as "teacher1"
And I am on "Course 1 &" course homepage
And I follow "Test assignment name &"
Given I am on the "Test assignment name &" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I should not see "Course 1 &amp;"
@ -47,11 +44,8 @@ Feature: In an assignment, teachers can change filters in the grading app
And I set the field "workflowstate" to "In marking"
And I set the field "Notify students" to "0"
And I press "Save changes"
And I click on "Edit settings" "link"
And I log out
When I log in as "teacher1"
And I am on "Course 1 &" course homepage
And I follow "Test assignment name &"
And I am on the "Test assignment name &" Activity page
And I navigate to "View all submissions" in current page administration
And I set the field "filter" to "Not submitted"
And I set the field "markerfilter" to "Marker 1"
@ -63,20 +57,15 @@ Feature: In an assignment, teachers can change filters in the grading app
@javascript
Scenario: Set filters in the grading app and see them in the grading table
Given I log in as "teacher1"
And I am on "Course 1 &" course homepage
And I follow "Test assignment name &"
Given I am on the "Test assignment name &" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "allocatedmarker" to "Marker 1"
And I set the field "workflowstate" to "In marking"
And I set the field "Notify students" to "0"
And I press "Save changes"
And I click on "Edit settings" "link"
And I log out
When I log in as "teacher1"
And I am on "Course 1 &" course homepage
And I follow "Test assignment name &"
And I am on the "Test assignment name &" Activity page
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I click on "[data-region=user-filters]" "css_element"

View file

@ -21,15 +21,16 @@ Feature: View the grading status of an assignment
@javascript
Scenario: View the grading status for an assignment with marking workflow enabled
# Add the assignment.
And 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 | Test assignment description |
| Online text | 1 |
| Use marking workflow | Yes |
And I log out
Given the following "activity" exists:
| activity | assign |
| idnumber | ass1 |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| markingworkflow | 1 |
| assignfeedback_comments_enabled | 1 |
| assignsubmission_onlinetext_enabled | 1 |
# Add a submission.
And I log in as "student1"
And I am on "Course 1" course homepage
@ -117,14 +118,16 @@ Feature: View the grading status of an assignment
@javascript
Scenario: View the grading status for an assignment with marking workflow disabled
# Add the assignment.
And 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 | Test assignment description |
| Online text | 1 |
And I log out
Given the following "activity" exists:
| activity | assign |
| idnumber | ass1 |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignfeedback_comments_enabled | 1 |
| markingworkflow | 0 |
| assignsubmission_onlinetext_enabled | 1 |
# Add a submission.
And I log in as "student1"
And I am on "Course 1" course homepage

View file

@ -30,11 +30,9 @@ Feature: Grant an extension to an offline student
@javascript
Scenario: Granting an extension to an offline assignment
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | duedate |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | duedate |
| assign | C1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 1" "table_row"
And I follow "Grant extension"
@ -43,19 +41,16 @@ Feature: Grant an extension to an offline student
And I press "Save changes"
Then I should see "Extension granted until:" in the "Student 1" "table_row"
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 am on the "Test assignment name" Activity page logged in as student1
And I should see "Extension due date"
@javascript @_alert
Scenario: Granting extensions to an offline assignment (batch action)
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | duedate |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | duedate |
| assign | C1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
And I set the field "selectall" to "1"
And I set the field "operation" to "Grant extension"
@ -75,19 +70,16 @@ Feature: Grant an extension to an offline student
And I should see "Extension granted until:" in the "Student 5" "table_row"
And I should see "Extension granted until:" in the "Student 6" "table_row"
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 am on the "Test assignment name" Activity page logged in as student1
And I should see "Extension due date"
@javascript
Scenario: Validating that extension date is after due date
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | allowsubmissionsfromdate | duedate |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 | 1388620800 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | allowsubmissionsfromdate | duedate |
| assign | C1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 | 1388620800 |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 1" "table_row"
And I follow "Grant extension"
@ -105,11 +97,9 @@ Feature: Grant an extension to an offline student
@javascript @_alert
Scenario: Granting extensions to an offline assignment (batch action)
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | allowsubmissionsfromdate | duedate |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 | 1388620800 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | allowsubmissionsfromdate | duedate |
| assign | C1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 | 1388620800 |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
And I set the field "selectall" to "1"
And I set the field "operation" to "Grant extension"

View file

@ -26,14 +26,14 @@ Feature: Group assignment submissions
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And 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 | Test assignment description |
| Students submit in groups | Yes |
| Group mode | No groups |
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| submissiondrafts | 0 |
| teamsubmission | 1 |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
Then "//tr[contains(., 'Student 0')][contains(., 'Default group')]" "xpath_element" should exist
And "//tr[contains(., 'Student 1')][contains(., 'Default group')]" "xpath_element" should exist
@ -48,12 +48,14 @@ Feature: Group assignment submissions
And I set the following fields to these values:
| Group mode | Separate groups |
And I press "Save and display"
And I navigate to "Users > Groups" in current page administration
And I add "Student 0 (student0@example.com)" user to "Group 1" group members
And I add "Student 1 (student1@example.com)" user to "Group 1" group members
And the following "group members" exist:
| user | group |
| student0 | G1 |
| student1 | G1 |
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 set the field "Separate groups" to "Group 1"
And "//tr[contains(., 'Student 0')][contains(., 'Group 1')]" "xpath_element" should exist
And "//tr[contains(., 'Student 1')][contains(., 'Group 1')]" "xpath_element" should exist
And I should not see "Student 2"
@ -89,45 +91,32 @@ Feature: Group assignment submissions
| user | group |
| student1 | G1 |
| student2 | G1 |
And 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 | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| Students submit in groups | Yes |
| Group mode | No groups |
| Require group to make submission | No |
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's first 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 the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| teamsubmission | 1 |
| preventsubmissionnotingroup | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student's first submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
Then "Student 1" row "Status" column of "generaltable" table should contain "Submitted for grading"
And "Student 2" row "Status" column of "generaltable" table should contain "Submitted for grading"
And "Student 3" row "Status" column of "generaltable" table should not contain "Submitted for grading"
And "Student 4" row "Status" column of "generaltable" table should not contain "Submitted for grading"
And I log out
And I log in as "student3"
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's first 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 the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student3 | I'm the student's first submission |
And I am on the "Test assignment name" Activity page
And I navigate to "View all submissions" in current page administration
And "Student 1" row "Status" column of "generaltable" table should contain "Submitted for grading"
And "Student 2" row "Status" column of "generaltable" table should contain "Submitted for grading"
@ -160,29 +149,23 @@ Feature: Group assignment submissions
| user | group |
| student1 | G1 |
| student2 | G1 |
And 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 | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| Students submit in groups | Yes |
| Additional attempts | Manually |
| Group mode | No groups |
| Require group to make submission | No |
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's first 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 the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| teamsubmission | 1 |
| attemptreopenmethod | manual |
| requireallteammemberssubmit | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student's first submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
@ -238,71 +221,38 @@ Feature: Group assignment submissions
| grouping | group |
| GG1 | G1 |
| GG1 | G2 |
# Groupmode 1 = Separate Groups
And the following "activity" exists:
| activity | assign |
| course | C1 |
| idnumber | 0001 |
| name | Test assignment name |
| intro | Test assignment description |
| section | 1 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Students submit in groups | Yes |
| Grouping for student groups | Grouping 1 |
| Group mode | Separate groups |
| Require group to make submission | No |
And I press "Save and return to course"
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's 1 submission |
And I press "Save changes"
And I press "Submit assignment"
And I press "Continue"
And I log out
And I log in as "student3"
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's 3 submission |
And I press "Save changes"
And I press "Submit assignment"
And I press "Continue"
And I log out
And I log in as "student5"
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's 5 submission |
And I press "Save changes"
And I press "Submit assignment"
And I press "Continue"
And I log out
And I log in as "admin"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| teamsubmission | 1 |
| attemptreopenmethod | manual |
| requireallteammemberssubmit | 0 |
| groupmode | 1 |
| teamsubmissiongroupingid | GG1 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student's first submission |
| Test assignment name | student3 | I'm the student's first submission |
| Test assignment name | student5 | I'm the student's first submission |
And I am on the "Test assignment name" Activity page logged in as admin
And I should see "3" in the "Groups" "table_row"
And I should see "3" in the "Submitted" "table_row"
When I set the field "Separate groups" to "Group 1"
And I press "Go"
When I select "Group 1" from the "Separate groups" singleselect
Then I should see "1" in the "Groups" "table_row"
And I should see "1" in the "Submitted" "table_row"
And I set the field "Separate groups" to "Group 2"
And I press "Go"
When I select "Group 2" from the "Separate groups" singleselect
And I should see "1" in the "Groups" "table_row"
And I should see "1" in the "Submitted" "table_row"
And I set the field "Separate groups" to "Group 3"
And I press "Go"
When I select "Group 3" from the "Separate groups" singleselect
And I should see "1" in the "Groups" "table_row"
And I should see "1" in the "Submitted" "table_row"
@ -328,49 +278,42 @@ Feature: Group assignment submissions
| student1 | G1 |
| student2 | G1 |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| idnumber | 0001 |
| name | Test assignment name |
| intro | Test assignment description |
| section | 1 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| submissiondrafts | 1 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| teamsubmission | 1 |
| attemptreopenmethod | manual |
| requireallteammemberssubmit | 0 |
# Groupmode 0 = No Groups
| groupmode | 0 |
| preventsubmissionnotingroup | 0 |
| submissiondrafts | 0 |
| teamsubmission | 1 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student's first submission |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Require students to click the submit button | Yes |
| Students submit in groups | Yes |
| Group mode | No groups |
| Require group to make submission | No |
| Require all group members submit | No |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I add the "Activities" block
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's first submission |
And I press "Save changes"
And I press "Submit assignment"
And I press "Continue"
And I am on "Course 1" course homepage
And I am on the "C1" Course page logged in as student1
And I click on "Assignments" "link" in the "Activities" "block"
And I should see "Submitted for grading"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I am on the "C1" Course page logged in as student2
And I click on "Assignments" "link" in the "Activities" "block"
And I should see "Submitted for grading"
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 am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
Then "Student 1" row "Status" column of "generaltable" table should contain "Submitted for grading"
And "Student 2" row "Status" column of "generaltable" table should contain "Submitted for grading"

View file

@ -17,29 +17,25 @@ Feature: Hide grader identities identity from students
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
# Set up the test assignment
And I log in as "teacher1"
And I follow "Course 1"
And I turn 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 | 0 |
| assignsubmission_file_enabled | 1 |
| Maximum number of uploaded files | 2 |
| Hide grader identity from students | 0 |
And I log out
# Upload to the test assignment
And I log in as "student1"
And I follow "Course 1"
And I follow "Test assignment name"
When I press "Add submission"
And I upload "lib/tests/fixtures/empty.txt" file to "File submissions" filemanager
And I press "Save changes"
And I log out
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
| teamsubmission | 1 |
| asignsubmission_onlinetext_enabled | 0 |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 2 |
| assignsubmission_file_maxsizebytes | 1000000 |
| assignfeedback_comments_enabled | 1 |
| hidegrader | 0 |
And the following "mod_assign > submission" exists:
| assign | Test assignment name |
| user | student1 |
| file | lib/tests/fixtures/empty.txt |
# Grade the submission and leave feedback
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should not see "Graded" in the "Student 1" "table_row"
And I click on "Grade" "link" in the "Student 1" "table_row"
@ -53,29 +49,24 @@ Feature: Hide grader identities identity from students
@javascript
Scenario: Hidden grading is disabled.
When I log in as "student1"
And I follow "Course 1"
And I follow "Test assignment name"
And I should see "Graded" in the "Grading status" "table_row"
Given I am on the "Test assignment name" Activity page logged in as student1
Then I should see "Graded" in the "Grading status" "table_row"
And I should see "Catch for us the foxes."
And I should see "Teacher" in the "Graded by" "table_row"
@javascript
Scenario: Hidden grading is enabled.
# Enable the hidden grader option
When I log in as "teacher1"
And I follow "Course 1"
And I follow "Test assignment name"
Given I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I follow "Expand all"
And I set the field "Hide grader identity from students" to "1"
And I press "Save and return to course"
And I log out
# Check the student doesn't see the grader's identity
And I log in as "student1"
And I follow "Course 1"
And I follow "Test assignment name"
And I should see "Graded" in the "Grading status" "table_row"
When I am on the "Test assignment name" Activity page logged in as student1
Then I should see "Graded" in the "Grading status" "table_row"
And I should see "Catch for us the foxes."
And I should not see "Graded by"
@ -84,9 +75,7 @@ Feature: Hide grader identities identity from students
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| mod/assign:showhiddengrader | Allow | student | Course | C1 |
When I log in as "student1"
And I follow "Course 1"
And I follow "Test assignment name"
When I am on the "Test assignment name" Activity page logged in as student1
And I should see "Graded" in the "Grading status" "table_row"
And I should see "Catch for us the foxes."
And I should see "Teacher" in the "Graded by" "table_row"

View file

@ -17,19 +17,17 @@ Feature: In an assignment, students can add and edit text online
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And 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_onlinetext_wordlimit_enabled | 1 |
| assignsubmission_onlinetext_wordlimit | 10 |
| 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 the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_onlinetext_wordlimit_enabled | 1 |
| assignsubmission_onlinetext_wordlimit | 10 |
| assignsubmission_file_enabled | 0 |
And I am on the "Test assignment name" Activity page logged in as student1
When I press "Add submission"
And I set the following fields to these values:
| Online text | This is more than 10 words. 1 2 3 4 5 6 7 8 9 10. |
@ -64,17 +62,15 @@ Feature: In an assignment, students can add and edit text online
| student1 | C1 | student |
And the following config values are set as admin:
| autosavefrequency | 1 | editor_atto |
And 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 the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And I am on the "Test assignment name" Activity page logged in as student1
When I press "Add submission"
And I set the following fields to these values:
| Online text | text submission |

View file

@ -81,11 +81,11 @@ Feature: Outcome grading
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And the following "group members" exist:
| user | group |
| student0 | G1 |
| student1 | G1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I add "Student 0 (student0@example.com)" user to "Group 1" group members
And I add "Student 1 (student1@example.com)" user to "Group 1" group members
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 |

View file

@ -16,22 +16,18 @@ Feature: In an assignment, page titles are informative
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled |
| assign | C1 | ants1 | History of ants | Tell me the history of ants | 1 |
| activity | course | name | intro | assignsubmission_onlinetext_enabled |
| assign | C1 | History of ants | Tell me the history of ants | 1 |
Scenario: I view an assignment as a student and take an action
When I log in as "student1"
And I am on "Course 1" course homepage
Then I follow "History of ants"
And "title[text() = 'C1: History of ants']" "xpath_element" should exist in the "head" "css_element"
When I am on the "History of ants" Activity page logged in as student1
Then "title[text() = 'C1: History of ants']" "xpath_element" should exist in the "head" "css_element"
And I press "Add submission"
And "title[text() = 'C1: History of ants - Edit submission']" "xpath_element" should exist in the "head" "css_element"
Scenario: I view an assignment as a teacher and take an action
When I log in as "teacher1"
And I am on "Course 1" course homepage
Then I follow "History of ants"
And "title[text() = 'C1: History of ants']" "xpath_element" should exist in the "head" "css_element"
When I am on the "History of ants" Activity page logged in as teacher1
Then "title[text() = 'C1: History of ants']" "xpath_element" should exist in the "head" "css_element"
And I navigate to "View all submissions" in current page administration
And "title[text() = 'C1: History of ants - Grading']" "xpath_element" should exist in the "head" "css_element"
And I click on "Grade" "link" in the "Student 1" "table_row"

View file

@ -21,51 +21,45 @@ Feature: Prevent or allow assignment submission changes
@javascript
Scenario: Preventing changes and allowing them again
Given 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"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student submission |
And I am on the "Test assignment name" Activity page logged in as student1
And I press "Edit submission"
And I set the following fields to these values:
| Online text | I'm the student submission and he/she edited me |
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 am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 1" "table_row"
And I follow "Prevent submission changes"
Then I should see "Submission changes not allowed"
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 am on the "Test assignment name" Activity page logged in as student1
And "Edit submission" "button" should not exist
And I should see "This assignment is not accepting submissions"
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 am on the "Test assignment name" Activity page logged in as teacher1
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 "Allow submission changes"
And I should not see "Submission changes not allowed"
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 am on the "Test assignment name" Activity page logged in as student1
And I should not see "This assignment is not accepting submissions"
And I press "Edit submission"
And I set the following fields to these values:
@ -76,41 +70,26 @@ Feature: Prevent or allow assignment submission changes
@javascript @_alert
Scenario: Preventing changes and allowing them again (batch action)
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 1 | 0 |
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 "student2"
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 student2 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"
| activity | course | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled |
| assign | C1 | Test assignment name | Test assignment description | 1 | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student submission |
| Test assignment name | student2 | I'm the student2 submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
And I set the field "selectall" to "1"
And I click on "Go" "button" confirming the dialogue
Then I should see "Submission changes not allowed" in the "Student 1" "table_row"
And I should see "Submission changes not allowed" in the "Student 2" "table_row"
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 am on the "Test assignment name" Activity page logged in as student2
And I should not see "Edit submission"
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 am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I set the field "selectall" to "1"
And I set the field "id_operation" to "Unlock submissions"
@ -118,9 +97,8 @@ Feature: Prevent or allow assignment submission changes
And I should not see "Submission changes not allowed" in the "Student 1" "table_row"
And I should not see "Submission changes not allowed" in the "Student 2" "table_row"
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 am on the "Test assignment name" Activity page logged in as student2
And I press "Edit submission"
And I set the following fields to these values:
| Online text | I'm the student2 submission and he/she edited me |

View file

@ -17,27 +17,20 @@ Feature: In an assignment, teachers grade multiple students on one page
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
When I log in as "admin"
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 |
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 student1 submission |
And I press "Save changes"
And I log out
And I log in as "admin"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I wait until the page is ready
When I click on "Grade" "link" in the "Student 1" "table_row"
And I press "Save changes"
And I click on "Edit settings" "link"
And I follow "Test assignment name"

View file

@ -23,16 +23,14 @@ I should be able to create an assignment with a due date relative to the course
| student2 | C1 | student | ##yesterday## |
# One assignment, valid for 2 months.
And the following "activities" exist:
| activity | name | intro | course | idnumber | assignsubmission_onlinetext_enabled | timeopen | duedate |
| assign | Test assignment name | Test assignment description | C1 | assign0 | 1 |##first day of -4 months## | ##last day of -3 months## |
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | name | course | assignsubmission_onlinetext_enabled | timeopen | duedate |
| assign | Test assignment name | C1 | 1 | ##first day of -4 months## | ##last day of -3 months## |
When I am on the "Test assignment name" Activity page logged in as student1
Then I should see "Assignment is overdue by:" in the "Time remaining" "table_row"
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 am on the "Test assignment name" Activity page logged in as student2
And I should not see "Assignment is overdue by:" in the "Time remaining" "table_row"
Scenario: As a student the due date I see for submitting my assignment is relative to my course start date
@ -51,37 +49,35 @@ I should be able to create an assignment with a due date relative to the course
| student1 | C1 | student | 1609804800 |
And the following "activities" exist:
# The assignment's due date is 3 Jan 2021.
| activity | name | intro | course | idnumber | assignsubmission_onlinetext_enabled | duedate |
| assign | Test assignment name | Test assignment description | C1 | assign0 | 1 | 1609632000 |
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | name | course | assignsubmission_onlinetext_enabled | duedate |
| assign | Test assignment name | C1 | 1 | 1609632000 |
When I am on the "Test assignment name" Activity page logged in as student1
Then the activity date in "Test assignment name" should contain "Due: Thursday, 7 January 2021, 8:00"
Scenario: As a teacher, I should see the relative dates when reviewing assignment submissions
Given the following config values are set as admin:
| enablecourserelativedates | 1 |
And the following "courses" exist:
| fullname | shortname | category | groupmode | relativedatesmode | startdate |
| Course 1 | C1 | 0 | 1 | 1 | ##first day of 4 months ago## |
| fullname | shortname | category | groupmode | relativedatesmode | startdate |
| Course 1 | C1 | 0 | 1 | 1 | ##first day of 4 months ago## |
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 |
| 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:
# Two students, one started 4 months ago and one yesterday.
| user | course | role | timestart |
| teacher1 | C1 | editingteacher | ##first day of 4 months ago## |
| student1 | C1 | student | ##first day of 4 months ago## |
| student2 | C1 | student | ##yesterday## |
| user | course | role | timestart |
| teacher1 | C1 | editingteacher | ##first day of 4 months ago## |
| student1 | C1 | student | ##first day of 4 months ago## |
| student2 | C1 | student | ##yesterday## |
# One assignment, valid for 2 months.
And the following "activities" exist:
| activity | name | intro | course | idnumber | assignsubmission_onlinetext_enabled | timeopen | duedate |
| assign | Test assignment name | Test assignment description | C1 | assign0 | 1 |##first day of 4 months ago## | ##last day of 3 months ago## |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | name | course | assignsubmission_onlinetext_enabled | timeopen | duedate |
| assign | Test assignment name | C1 | 1 | ##first day of 4 months ago## | ##last day of 3 months ago## |
And I am on the "Test assignment name" Activity page logged in as teacher1
And the activity date in "Test assignment name" should contain "after course start"
And I should see "Calculated for each student" in the "Time remaining" "table_row"
When I navigate to "View all submissions" in current page administration

View file

@ -26,105 +26,85 @@ Feature: Remove a submission
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
Given the following "group members" exist:
And 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"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
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"
When 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 am on the "Test assignment name" Activity page logged in as student1
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"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| teamsubmission | 1 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
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"
When 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 am on the "Test assignment name" Activity page logged in as student2
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"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student submission |
And I am on the "Test assignment name" Activity page logged in as student1
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"
When I am on the "Test assignment name" Activity page logged in as teacher1
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 am on the "Test assignment name" Activity page logged in as student1
And I should not see "I'm the student submission"

View file

@ -19,26 +19,20 @@ Feature: Submissions are unlocked when a new attempt is given
@javascript
Scenario: A locked submission should unlock when a new attempt is automatically given.
And 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 |
| Additional attempts | Automatically until pass |
| Grade to pass | 50 |
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 student1 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"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| attemptreopenmethod | untilpass |
| gradepass | 50 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
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 "Prevent submission changes"
@ -53,30 +47,23 @@ Feature: Submissions are unlocked when a new attempt is given
@javascript
Scenario: A locked submission should unlock when a new attempt is manually given.
And 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 |
| Additional attempts | Manually |
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 student1 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"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| attemptreopenmethod | manual |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 1" "table_row"
When I open the action menu in "Student 1" "table_row"
And I follow "Prevent submission changes"
And I should see "Submission changes not allowed"
Then I should see "Submission changes not allowed"
And I open the action menu in "Student 1" "table_row"
And I follow "Allow another attempt"
Then I should see "Reopened"
And I should see "Reopened"
And I should not see "Submission changes not allowed"

View file

@ -21,12 +21,13 @@ Feature: Check that the assignment grade can be rescaled when the max grade is c
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And 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 | Test assignment description |
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "40"

View file

@ -22,7 +22,6 @@ Feature: Set availability dates for an assignment
| activity | assign |
| course | C1 |
| name | Assignment name |
| idnumber | assign |
| description | Assignment description |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 1 |
@ -30,26 +29,21 @@ Feature: Set availability dates for an assignment
| submissiondrafts | 0 |
Scenario: Student cannot submit an assignment prior to the 'allow submissions from' date
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
Given I am on the "Assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I follow "Expand all"
# Set 'Allow submissions from' to tomorrow at noon.
And I set the field "Allow submissions from" to "##tomorrow noon##"
And I press "Save and return to course"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Assignment name"
When I am on the "Assignment name" Activity page logged in as student1
Then "Add submission" "button" should not exist
And the activity date in "Assignment name" should contain "Opens:"
And the activity date in "Assignment name" should contain "##tomorrow noon##%A, %d %B %Y, %I:%M##"
Scenario: Student can see the assignment's due date in the course calendar
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
Given I am on the "Assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I follow "Expand all"
# Set 'Allow submissions from' to the first day of this month at noon.
@ -60,17 +54,15 @@ Feature: Set availability dates for an assignment
And I turn editing mode on
And I add the "Calendar" block
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "C1" Course page logged in as student1
And I follow "This month"
When I hover over day "2" of this month in the calendar
Then I should see "C1: Assignment name is due"
@_file_upload
Scenario: Student can submit an assignment before the due date
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
Given I am on the "Assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I follow "Expand all"
# Set 'Allow submissions from' to now.
@ -79,9 +71,8 @@ Feature: Set availability dates for an assignment
And I set the field "Due date" to "##+2 days 5 hours 30 minutes##"
And I press "Save and return to course"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
When I am on the "Assignment name" Activity page logged in as student1
And the activity date in "Assignment name" should contain "Due:"
And the activity date in "Assignment name" should contain "##+2 days 5 hours 30 minutes##%A, %d %B %Y##"
And I should see "2 days 5 hours" in the "Time remaining" "table_row"
@ -91,18 +82,15 @@ Feature: Set availability dates for an assignment
When I press "Save changes"
Then I should see "Submitted for grading" in the "Submission status" "table_row"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
And I am on the "Assignment name" Activity page logged in as teacher1
And I should see "1" in the "Submitted" "table_row"
And I navigate to "View all submissions" in current page administration
And I should see "Submitted for grading" in the "Student 1" "table_row"
@_file_upload
Scenario: Student can submit an assignment after the due date and the submission is marked as late
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
Given I am on the "Assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I follow "Expand all"
# Set 'Allow submissions from' to 3 days ago.
@ -113,9 +101,8 @@ Feature: Set availability dates for an assignment
And I set the field "Cut-off date" to "##tomorrow noon##"
And I press "Save and return to course"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
And I am on the "Assignment name" Activity page logged in as student1
And the activity date in "Assignment name" should contain "Due:"
And the activity date in "Assignment name" should contain "##2 days 5 hours 30 minutes ago##%A, %d %B %Y##"
And I should see "Assignment is overdue by: 2 days 5 hours" in the "Time remaining" "table_row"
@ -126,18 +113,15 @@ Feature: Set availability dates for an assignment
Then I should see "Submitted for grading" in the "Submission status" "table_row"
And I should see "Assignment was submitted 2 days 5 hours late" in the "Time remaining" "table_row"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
And I am on the "Assignment name" Activity page logged in as teacher1
And I should see "1" in the "Submitted" "table_row"
And I navigate to "View all submissions" in current page administration
And I should see "Submitted for grading" in the "Student 1" "table_row"
And I should see "2 days 5 hours late" in the "Student 1" "table_row"
Scenario: Student cannot submit an assignment after the cut-off date
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
Given I am on the "Assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I follow "Expand all"
# Set 'Allow submissions from' to 3 days ago.
@ -148,14 +132,12 @@ Feature: Set availability dates for an assignment
And I set the field "Cut-off date" to "##yesterday noon##"
And I press "Save and return to course"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Assignment name"
When I am on the "Assignment name" Activity page logged in as student1
Then "Add submission" "button" should not exist
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
And I am on the "Assignment name" Activity page logged in as teacher1
And I should see "0" in the "Submitted" "table_row"
And I navigate to "View all submissions" in current page administration
And I should see "No submission" in the "Student 1" "table_row"

View file

@ -17,32 +17,23 @@ Feature: Assignments correctly add feedback to the grade report when workflow an
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
# Add the assignment.
And 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 | Test assignment description |
| Online text | 1 |
| File submissions | 0 |
| Use marking workflow | Yes |
| Anonymous submissions | Yes |
And I log out
# Add a submission.
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Test assignment name"
Then I should not see "Feedback"
And I should see "Not marked" in the "Grading status" "table_row"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student's first submission |
And I press "Save changes"
And I log out
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| assignfeedback_comments_enabled | 1 |
| teamsubmission | 1 |
| markingworkflow | 1 |
| blindmarking | 1 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student's first submission |
# Mark the submission.
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "Not marked" in the "I'm the student's first submission" "table_row"
And I click on "Grade" "link" in the "I'm the student's first submission" "table_row"
@ -76,8 +67,8 @@ Feature: Assignments correctly add feedback to the grade report when workflow an
And I set the field "Grading action" to "Reveal student identities"
And I press "Continue"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "C1" Course page logged in as student1
And I navigate to "User report" in the course gradebook
Then I should see "50"
And I should see "Great job! Lol, not really."
@ -102,8 +93,8 @@ Feature: Assignments correctly add feedback to the grade report when workflow an
And I navigate to "View all submissions" in current page administration
And I should see "Released" in the "Student 1" "table_row"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "C1" Course page logged in as student1
And I navigate to "User report" in the course gradebook
Then I should see "50"
And I should see "Great job! Lol, not really."

View file

@ -21,11 +21,9 @@ Feature: In an assignment, students can comment in their submissions
Scenario: Student comments an assignment submission
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 1 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | assignsubmission_onlinetext_enabled |
| assign | C1 | Test assignment name | 1 |
And I am on the "Test assignment name" Activity page logged in as student1
When I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student submission |
@ -49,19 +47,16 @@ Feature: In an assignment, students can comment in their submissions
Scenario: Teacher updated the comment box and clicked the save changes to reflect the comment
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 1 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | assignsubmission_onlinetext_enabled |
| assign | C1 | Test assignment name | 1 |
And I am on the "Test assignment name" Activity page logged in as student1
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 am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I click on ".comment-link" "css_element"
@ -73,19 +68,13 @@ Feature: In an assignment, students can comment in their submissions
Scenario: Teacher updated the comment box and clicked on save and show next to reflect the comment
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 1 |
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"
| activity | course | name | assignsubmission_onlinetext_enabled |
| assign | C1 | Test assignment name | 1 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I click on ".comment-link" "css_element"
@ -100,16 +89,14 @@ Feature: In an assignment, students can comment in their submissions
Scenario: Teacher can comment on an offline assignment
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignmentsubmission_file_enabled | assignfeedback_comments_enabled |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 0 | 0 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | assignsubmission_onlinetext_enabled | assignmentsubmission_file_enabled | assignfeedback_comments_enabled |
| assign | C1 | Test assignment name | 0 | 0 | 1 |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
When I set the following fields to these values:
| Grade out of 100 | 50 |
| Feedback comments | I'm the teacher feedback |
| Grade out of 100 | 50 |
| Feedback comments | I'm the teacher feedback |
And I press "Save changes"
And I click on "Edit settings" "link"
And I follow "Test assignment name"
@ -119,11 +106,9 @@ Feature: In an assignment, students can comment in their submissions
Scenario: Teacher can comment on assignments with a zero grade
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignmentsubmission_file_enabled | assignfeedback_comments_enabled |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 0 | 0 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | assignsubmission_onlinetext_enabled | assignmentsubmission_file_enabled | assignfeedback_comments_enabled |
| assign | C1 | Test assignment name | 0 | 0 | 1 |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:

View file

@ -0,0 +1,37 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Online Text assignment submission subplugin data generator.
*
* @package mod_assign
* @category test
* @copyright 2021 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class assignsubmission_subplugin_generator extends testing_module_generator {
/**
* Add submission data in the correct format for a call to `assign::save_submission()` from a table containing
* submission data for a single activity.
*
* Data should be added to the $submission object passed into the function.
*
* @param stdClass $submission The submission record to be modified
* @param assign $assign The assignment being submitted to
* @param array $data The data received
*/
abstract public function add_submission_data(stdClass $submission, assign $assign, array $data): void;
}

View file

@ -0,0 +1,52 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Behat data generator for mod_assign.
*
* @package mod_assign
* @category test
* @copyright 2021 Andrew Lyons
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_mod_assign_generator extends behat_generator_base {
/**
* Get a list of the entities that Behat can create using the generator step.
*
* @return array
*/
protected function get_creatable_entities(): array {
return [
'submissions' => [
'singular' => 'submission',
'datagenerator' => 'submission',
'required' => ['assign', 'user'],
'switchids' => ['assign' => 'assignid', 'user' => 'userid'],
],
];
}
/**
* Get the assignment CMID using an activity idnumber.
*
* @param string $idnumber
* @return int The cmid
*/
protected function get_assign_id(string $idnumber): int {
return $this->get_activity_id($idnumber);
}
}

View file

@ -26,6 +26,13 @@ defined('MOODLE_INTERNAL') || die();
*/
class mod_assign_generator extends testing_module_generator {
/**
* Create a new instance of the assignment activity.
*
* @param array|stdClass|null $record
* @param array|null $options
* @return stdClass
*/
public function create_instance($record = null, array $options = null) {
$record = (object)(array)$record;
@ -51,6 +58,10 @@ class mod_assign_generator extends testing_module_generator {
'markingallocation' => 0,
);
if (property_exists($record, 'teamsubmissiongroupingid')) {
$record->teamsubmissiongroupingid = $this->get_grouping_id($record->teamsubmissiongroupingid);
}
foreach ($defaultsettings as $name => $value) {
if (!isset($record->{$name})) {
$record->{$name} = $value;
@ -60,6 +71,64 @@ class mod_assign_generator extends testing_module_generator {
return parent::create_instance($record, (array)$options);
}
/**
* Create an assignment submission.
*
* @param array $data
*/
public function create_submission(array $data): void {
global $USER;
$currentuser = $USER;
$user = \core_user::get_user($data['userid']);
$this->set_user($user);
$submission = (object) [
'userid' => $user->id,
];
[$course, $cm] = get_course_and_cm_from_cmid($data['assignid'], 'assign');
$context = context_module::instance($cm->id);
$assign = new assign($context, $cm, $course);
foreach ($assign->get_submission_plugins() as $plugin) {
$pluginname = $plugin->get_type();
if (array_key_exists($pluginname, $data)) {
$plugingenerator = $this->datagenerator->get_plugin_generator("assignsubmission_{$pluginname}");
$plugingenerator->add_submission_data($submission, $assign, $data);
}
}
$assign->save_submission((object) $submission, $notices);
$this->set_user($currentuser);
}
/**
* Gets the grouping id from it's idnumber.
*
* @throws Exception
* @param string $idnumber
* @return int
*/
protected function get_grouping_id(string $idnumber): int {
global $DB;
// Do not fetch grouping ID for empty grouping idnumber.
if (empty($idnumber)) {
return null;
}
if (!$id = $DB->get_field('groupings', 'id', ['idnumber' => $idnumber])) {
if (is_numeric($idnumber)) {
return $idnumber;
}
throw new Exception('The specified grouping with idnumber "' . $idnumber . '" does not exist');
}
return $id;
}
/**
* Create an assign override (either user or group).
*