Merge branch 'MDL-71912-master-v5' of git://github.com/abgreeve/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2021-11-10 16:42:00 +01:00
commit d824172077
25 changed files with 145 additions and 47 deletions

View File

@ -67,7 +67,7 @@ Feature: Enable Block Completion in a course using activity completion
And I follow "More details"
And I should see "Yes" in the "Activity completion" "table_row"
@javascript @skip_interim
@javascript
Scenario: Add the block to a the course and add course completion items with passing grade
Given I am on the "Test assign name" "assign activity" page logged in as teacher1
And I navigate to "Settings" in current page administration
@ -78,7 +78,7 @@ Feature: Enable Block Completion in a course using activity completion
| gradepass | 50 |
And I press "Save and return to course"
And I am on the "Test assign name" "assign activity" page
And I navigate to "View all submissions" in current page administration
And I follow "View all submissions"
And I click on "Grade" "link" in the "Student" "table_row"
And I set the field "Grade out of 100" to "53"
And I set the field "Notify students" to "0"
@ -101,7 +101,7 @@ Feature: Enable Block Completion in a course using activity completion
And I should see "Achieving grade, Achieving passing grade" in the "Activity completion" "table_row"
And I should see "Yes" in the "Activity completion" "table_row"
@javascript @skip_interim
@javascript
Scenario: Add the block to a the course and add course completion items with failing grade.
Given I am on the "Test assign name" "assign activity" page logged in as teacher1
And I navigate to "Settings" in current page administration
@ -112,7 +112,7 @@ Feature: Enable Block Completion in a course using activity completion
| gradepass | 50 |
And I press "Save and return to course"
And I am on the "Test assign name" "assign activity" page
And I navigate to "View all submissions" in current page administration
And I follow "View all submissions"
And I click on "Grade" "link" in the "Student" "table_row"
And I set the field "Grade out of 100" to "49"
And I set the field "Notify students" to "0"

View File

@ -150,10 +150,10 @@ Feature: Using the activity grade form element
Then I should see "You cannot change the type, as grades already exist for this item."
And the "Maximum grade" "field" should be disabled
@javascript @skip_interim
@javascript
Scenario: Attempting to change the maximum grade when no rescaling option has been chosen
Given I am on the "Test assignment name" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I follow "View all submissions"
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 press "Save changes"

View File

@ -76,7 +76,7 @@ class user_submission_actionmenu implements templatable, renderable {
* @return string The status of the submission.
*/
protected function get_current_status(): string {
if (!is_null($this->teamsubmission)) {
if (!is_null($this->teamsubmission) && isset($this->teamsubmission->status)) {
return $this->teamsubmission->status;
} else if (!empty((array)$this->submission)) {
return $this->submission->status;

View File

@ -56,10 +56,11 @@ Feature: Assign reset
And I follow "View all submissions"
Then I should not see "Submitted for grading"
@javascript @skip_interim
@javascript
Scenario: Use course reset to remove user overrides.
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "Overrides" in current page administration
And I select "User overrides" from the "jump" singleselect
And I press "Add user override"
And I set the following fields to these values:
| Override user | Student1 |

View File

@ -140,7 +140,7 @@ Feature: Assign group override
And I am on the "Test assignment name" Activity page logged in as student1
And I should not see "Tuesday, 1 January 2030, 8:00"
@javascript @skip_interim
@javascript
Scenario: Add both a user and group override and verify that both are applied correctly
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Settings" in current page administration
@ -160,6 +160,7 @@ Feature: Assign group override
And I should see "Tuesday, 1 January 2030, 8:00"
And I am on the "Test assignment name" Activity page
And I navigate to "Overrides" in current page administration
And I select "User overrides" from the "jump" singleselect
And I press "Add user override"
And I set the following fields to these values:
| Override user | Student1 |

View File

@ -144,7 +144,6 @@ Feature: Assign user override
Then I should see "No groups you can access."
And the "Add user override" "button" should be disabled
@skip_interim
Scenario: A teacher without accessallgroups permission should only be able to add user override for users that he/she shares groups with,
when the activity's group mode is "separate groups"
Given the following "permission overrides" exist:
@ -164,11 +163,12 @@ Feature: Assign user override
| student2 | G2 |
And I am on the "Assignment 2" Activity page logged in as teacher1
When I navigate to "Overrides" in current page administration
And I select "User overrides" from the "jump" singleselect
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"
@javascript @skip_interim
@javascript
Scenario: A teacher without accessallgroups permission should only be able to see the user override for users that he/she shares groups with,
when the activity's group mode is "separate groups"
Given the following "permission overrides" exist:
@ -188,6 +188,7 @@ Feature: Assign user override
| student2 | G2 |
And I am on the "Assignment 2" Activity page logged in as admin
And I navigate to "Overrides" in current page administration
And I select "User overrides" from the "jump" singleselect
And I press "Add user override"
And I set the following fields to these values:
| Override user | Student1 |
@ -201,6 +202,7 @@ Feature: Assign user override
And I am on the "Assignment 2" Activity page logged in as teacher1
When I navigate to "Overrides" in current page administration
And I select "User overrides" from the "jump" singleselect
Then I should see "Student1" in the ".generaltable" "css_element"
But I should not see "Student2" in the ".generaltable" "css_element"

View File

@ -68,7 +68,6 @@ Feature: Outcome grading
Then I should see "Outcome Test: Excellent" in the "Student 0" "table_row"
And I should not see "Outcome Test: Excellent" in the "Student 1" "table_row"
@skip_interim
Scenario: Giving an outcome to a group submission
Given the following "users" exist:
| username | firstname | lastname | email |

View File

@ -31,7 +31,7 @@ Feature: Remove a submission
| student1 | G1 |
| student2 | G1 |
@javascript @skip_chrome_zerosize @skip_interim
@javascript @skip_chrome_zerosize
Scenario: Remove a submission should remove the data that was submitted
Given the following "activity" exists:
| activity | assign |
@ -56,7 +56,7 @@ Feature: Remove a submission
And I am on the "Test assignment name" Activity page logged in as student1
And I should not see "I'm the student submission"
And I should see "No attempt" in the "Submission status" "table_row"
And I should see "No submissions have been made yet" in the "Submission status" "table_row"
@javascript @skip_chrome_zerosize
Scenario: Remove a group submission should remove the data from all group members
@ -86,7 +86,7 @@ Feature: Remove a submission
And I should not see "I'm the student submission"
And I should see "Nothing has been submitted for this assignment" in the "Submission status" "table_row"
@javascript @skip_chrome_zerosize @skip_interim
@javascript @skip_chrome_zerosize
Scenario: A student can remove their own submission
Given the following "activity" exists:
| activity | assign |
@ -113,4 +113,4 @@ Feature: Remove a submission
And I am on the "Test assignment name" Activity page logged in as student1
And I should not see "I'm the student submission"
And I should see "No attempt" in the "Submission status" "table_row"
And I should see "No submissions have been made yet" in the "Submission status" "table_row"

View File

@ -3,7 +3,7 @@ Feature: Submit assignment without group
As a teacher
I should be able to prevent students submitting team assignments as members of the default group
@javascript @skip_interim
@javascript
Scenario: Switch between group modes
Given the following "courses" exist:
| fullname | shortname | category | groupmode |

View File

@ -335,6 +335,26 @@ function book_extend_settings_navigation(settings_navigation $settingsnav, navig
$firstkey = null;
}
$params = $PAGE->url->params();
if ($PAGE->cm->modname === 'book' and !empty($params['id']) and !empty($params['chapterid'])
and has_capability('mod/book:edit', $PAGE->cm->context)) {
if (!empty($USER->editing)) {
$string = get_string("turneditingoff");
$edit = '0';
} else {
$string = get_string("turneditingon");
$edit = '1';
}
$url = new moodle_url('/mod/book/view.php', array('id'=>$params['id'], 'chapterid'=>$params['chapterid'], 'edit'=>$edit, 'sesskey'=>sesskey()));
$editnode = navigation_node::create($string, $url, navigation_node::TYPE_SETTING);
$editnode->set_show_in_secondary_navigation(false);
$booknode->add_node($editnode, $firstkey);
if (!$PAGE->theme->haseditswitch) {
$PAGE->set_button($OUTPUT->single_button($url, $string));
}
}
$plugins = core_component::get_plugin_list('booktool');
foreach ($plugins as $plugin => $dir) {
if (file_exists("$dir/lib.php")) {

View File

@ -61,7 +61,6 @@ Feature: In a book, create chapters and sub chapters
And I should see "1. Dummy first chapter" in the ".book_content" "css_element"
And I should see "1. Dummy first chapter" in the "strong" "css_element"
@skip_interim
Scenario: Change editing mode for an individual chapter
Given I am on the "Test book" Activity page
And I should see "Add new chapter"

View File

@ -1,4 +1,4 @@
@mod @mod_book @core_tag @javascript @skip_interim
@mod @mod_book @core_tag @javascript
Feature: Edited book chapters handle tags correctly
In order to get book chapters properly labelled
As a user

View File

@ -0,0 +1,77 @@
<?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/>.
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
// For that reason, we can't even rely on $CFG->admin being available here.
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
use Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException;
use Behat\Mink\Exception\ExpectationException as ExpectationException;
/**
* Step definitions related mod_lesson.
*
* @package mod_lesson
* @category test
* @copyright 2021 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_mod_lesson_behat extends behat_base {
/**
* Select the lesson edit type [Collapsed|Expanded]
*
* @Given i select edit type :edittype
*
* @param string $edittype The edit type of either Collapsed or Expanded
*/
public function i_select_edit_type(string $edittype): void {
$typestring = ($edittype == 'Collapsed') ? get_string('collapsed', 'mod_lesson') : get_string('full', 'mod_lesson');
try {
$this->execute("behat_forms::i_select_from_the_singleselect", [$typestring, 'jump']);
} catch (ElementNotFoundException $e) {
$this->execute("behat_general::click_link", [$typestring]);
}
}
/**
* Go to the lesson essay grading page.
*
* @Given i grade lesson essays
*/
public function i_grade_lesson_essays(): void {
try {
$this->execute("behat_general::i_click_on", [get_string('manualgrading', 'mod_lesson'), 'button']);
} catch (ElementNotFoundException $e) {
$this->execute("behat_general::click_link", [get_string('manualgrading', 'mod_lesson')]);
}
}
/**
* Go to the lesson edit page.
*
* @Given i edit the lesson
*/
public function i_edit_the_lesson(): void {
try {
$this->execute("behat_general::click_link", [get_string('edit', 'mod_lesson')]);
} catch (ElementNotFoundException $e) {
$this->execute("behat_general::i_click_on", [get_string('edit', 'mod_lesson'), 'button']);
}
}
}

View File

@ -1,4 +1,4 @@
@mod @mod_lesson @skip_interim
@mod @mod_lesson
Feature: In a lesson activity, teacher can delete question answers and
branch table contents
In order to modify an existing lesson
@ -47,7 +47,7 @@ branch table contents
| id_jumpto_1 | First page name |
| id_score_1 | 0 |
And I press "Save page"
And I select "Expanded" from the "jump" singleselect
And I select edit type "Expanded"
Scenario: Edit lesson content page
Given I click on "//th[normalize-space(.)='First page name']/descendant::a[3]" "xpath_element"

View File

@ -1,4 +1,4 @@
@mod @mod_lesson @skip_interim
@mod @mod_lesson
Feature: In a lesson activity, teacher can edit a cluster page
In order to modify an existing lesson and change navigation
As a teacher
@ -29,7 +29,7 @@ Feature: In a lesson activity, teacher can edit a cluster page
| id_answer_editor_0 | Next page |
| id_jumpto_0 | Next page |
And I press "Save page"
And I select "Expanded" from the "jump" singleselect
And I select edit type "Expanded"
And I click on "Add a cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][2]" "xpath_element"
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
And I set the field "Select a question type" to "Multichoice"

View File

@ -1,4 +1,4 @@
@mod @mod_lesson @skip_interim
@mod @mod_lesson
Feature: In a lesson activity, teacher can edit lesson's pages
In order to modify an existing lesson
As a teacher
@ -38,7 +38,7 @@ Feature: In a lesson activity, teacher can edit lesson's pages
| id_answer_editor_1 | Next page |
| id_jumpto_1 | Next page |
And I press "Save page"
And I select "Expanded" from the "jump" singleselect
And I select edit type "Expanded"
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
And I set the field "Select a question type" to "Numerical"
And I press "Add a question page"

View File

@ -1,4 +1,4 @@
@mod @mod_lesson @_file_upload @skip_interim
@mod @mod_lesson @_file_upload
Feature: In a lesson activity, teacher can add an essay question
As a teacher
I need to add an essay question in a lesson and grade student attempts
@ -47,7 +47,7 @@ Feature: In a lesson activity, teacher can add an essay question
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
And I click on "Grade essays" "button"
And I grade lesson essays
And I should see "Student 1"
And I should see "Essay question"
And I follow "Essay question"

View File

@ -1,4 +1,4 @@
@mod @mod_lesson @skip_interim
@mod @mod_lesson
Feature: In a lesson activity, students can exit and re-enter the activity when it consists only of cluster pages
As a student
I need to exit and re-enter a lesson out and into clusters.
@ -28,7 +28,7 @@ Feature: In a lesson activity, students can exit and re-enter the activity when
| id_answer_editor_0 | Next page |
| id_jumpto_0 | Next page |
And I press "Save page"
And I select "Expanded" from the "jump" singleselect
And I select edit type "Expanded"
And I click on "Add a cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][2]" "xpath_element"
And I follow "Update page: Cluster"
And I set the following fields to these values:

View File

@ -18,7 +18,6 @@ Feature: In a lesson activity, students can navigate through a series of pages i
| student1 | C1 | student |
And I log in as "teacher1"
@skip_interim
Scenario: Student navigation with pages and questions
Given the following "activities" exist:
| activity | name | intro | course | idnumber |
@ -41,7 +40,7 @@ Feature: In a lesson activity, students can navigate through a series of pages i
| id_answer_editor_1 | Next page |
| id_jumpto_1 | Next page |
And I press "Save page"
And I select "Expanded" from the "jump" singleselect
And I select edit type "Expanded"
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
And I set the field "Select a question type" to "Numerical"
And I press "Add a question page"

View File

@ -1,4 +1,4 @@
@mod @mod_lesson @skip_interim
@mod @mod_lesson
Feature: In Dashboard, teacher can see the number of student attempts to lessons
In order to know the number of student attempts to a lesson
As a teacher
@ -68,7 +68,7 @@ Feature: In Dashboard, teacher can see the number of student attempts to lessons
| id_response_editor_1 | Wrong |
| id_jumpto_1 | This page |
And I press "Save page"
And I select "Expanded" from the "jump" singleselect
And I select edit type "Expanded"
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
And I set the field "Select a question type" to "True/false"
And I press "Add a question page"

View File

@ -1,4 +1,4 @@
@mod @mod_lesson @skip_interim
@mod @mod_lesson
Feature: In a lesson activity, I need to edit pages in the lesson taking into account locale settings
Background:
@ -43,7 +43,7 @@ Feature: In a lesson activity, I need to edit pages in the lesson taking into ac
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test lesson name"
And I click on "Edit" "button" in the "region-main" "region"
And I edit the lesson
And I follow "Hardest question ever"
Then I should see "2#87"
And I should see "2#1:2#8"
@ -53,8 +53,8 @@ Feature: In a lesson activity, I need to edit pages in the lesson taking into ac
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test lesson name"
And I click on "Edit" "button" in the "region-main" "region"
And I select "Expanded" from the "jump" singleselect
And I edit the lesson
And I select edit type "Expanded"
Then I should see "2#87"
And I should see "2#1:2#8"
And I log out
@ -115,7 +115,7 @@ Feature: In a lesson activity, I need to edit pages in the lesson taking into ac
| core_langconfig | decsep | , |
And I am on "Course 1" course homepage with editing mode on
And I follow "Test lesson name"
Then I click on "Edit" "button" in the "region-main" "region"
Then I edit the lesson
And I follow "Hardest question ever"
Then I should see "2,87"
And I should see "2,1:2,8"

View File

@ -1,4 +1,4 @@
@mod @mod_lesson @skip_interim
@mod @mod_lesson
Feature: In a lesson activity, students can see their progress viewing a progress bar.
In order to create a lesson with conditional paths
As a teacher
@ -43,7 +43,7 @@ Feature: In a lesson activity, students can see their progress viewing a progres
| id_answer_editor_1 | Next page |
| id_jumpto_1 | Next page |
And I press "Save page"
And I select "Expanded" from the "jump" singleselect
And I select edit type "Expanded"
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
And I set the field "Select a question type" to "Numerical"
And I press "Add a question page"

View File

@ -1,4 +1,4 @@
@mod @mod_lesson @skip_interim
@mod @mod_lesson
Feature: In a lesson activity, students can see questions in random order
In order to create a lesson with clusters
As a teacher
@ -40,7 +40,7 @@ Feature: In a lesson activity, students can see questions in random order
| id_answer_editor_1 | Next page |
| id_jumpto_1 | Next page |
And I press "Save page"
And I select "Expanded" from the "jump" singleselect
And I select edit type "Expanded"
And I click on "Add a cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][4]" "xpath_element"
And I set the field "Select a question type" to "Multichoice"

View File

@ -1,4 +1,4 @@
@mod @mod_lesson @skip_interim
@mod @mod_lesson
Feature: In a lesson activity, students can see questions in random order and a single question drawn from a branch
In order to create a lesson with a cluster and a subcluster
As a teacher
@ -31,7 +31,7 @@ Feature: In a lesson activity, students can see questions in random order and a
| id_answer_editor_0 | Next page |
| id_jumpto_0 | Next page |
And I press "Save page"
And I select "Expanded" from the "jump" singleselect
And I select edit type "Expanded"
And I click on "Add a cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][2]" "xpath_element"
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
And I set the field "Select a question type" to "Multichoice"

View File

@ -1,4 +1,4 @@
@mod @mod_lesson @skip_interim
@mod @mod_lesson
Feature: In a lesson activity, a non editing teacher can grade essay questions
As a non editing teacher
I need to grade student answers to essay questions in lesson
@ -69,7 +69,7 @@ Feature: In a lesson activity, a non editing teacher can grade essay questions
And I am on "Course 1" course homepage
And I follow "Test lesson name"
Then I should see "Grade essays"
And I click on "Grade essays" "button"
And I grade lesson essays
And I should see "Student 1"
And I should see "Student 2"
And I should see "Essay question"
@ -94,6 +94,6 @@ Feature: In a lesson activity, a non editing teacher can grade essay questions
And I am on "Course 1" course homepage
And I follow "Test lesson name"
Then I should see "Grade essays"
And I click on "Grade essays" "button"
And I grade lesson essays
And I should not see "Student 1"
And I should see "Student 2"