first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,55 @@
@mod @mod_choice @core_completion
Feature: Automatic completion in the choice activity
In order for me to know what to do to complete the choice activity
As a student
I need to be able to see the completion requirements of the choice activity
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "course" exists:
| fullname | Course 1 |
| shortname | C1 |
| category | 0 |
| enablecompletion | 1 |
And the following "activity" exists:
| activity | choice |
| name | What to drink? |
| intro | Friday drinks, anyone? |
| course | C1 |
| idnumber | choice1 |
| completion | 2 |
| completionview | 1 |
| completionsubmit | 1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| teacher1 | C1 | editingteacher |
Scenario: Viewing a choice activity with automatic completion as a student
When I am on the "What to drink?" "choice activity" page logged in as student1
Then the "View" completion condition of "What to drink?" is displayed as "done"
And the "Make a choice" completion condition of "What to drink?" is displayed as "todo"
And I set the field "Beer" to "1"
And I press "Save my choice"
And the "View" completion condition of "What to drink?" is displayed as "done"
And the "Make a choice" completion condition of "What to drink?" is displayed as "done"
Scenario: Viewing a choice activity with automatic completion as a teacher
When I am on the "What to drink?" "choice activity" page logged in as teacher1
Then "What to drink?" should have the "View" completion condition
And "What to drink?" should have the "Make a choice" completion condition
@javascript
Scenario: Overriding automatic choice completion for a user
Given I am on the "Course 1" course page logged in as teacher1
And I navigate to "Reports" in current page administration
And I click on "Activity completion" "link"
And I click on "Student 1, What to drink?: Not completed" "link"
And I press "Save changes"
And I log out
When I am on the "What to drink?" "choice activity" page logged in as student1
Then the "View" completion condition of "What to drink?" overridden by "Teacher 1" is displayed as "done"
And the "Make a choice" completion condition of "What to drink?" overridden by "Teacher 1" is displayed as "done"
@@ -0,0 +1,81 @@
@mod @mod_choice @core_completion
Feature: Manual completion in the choice activity
To avoid navigating from the choice activity to the course homepage to mark the choice activity as complete
As a student
I need to be able to mark the choice activity as complete within the choice activity itself
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "course" exists:
| fullname | Course 1 |
| shortname | C1 |
| category | 0 |
| enablecompletion | 1 |
And the following "activity" exists:
| activity | choice |
| name | What to drink? |
| intro | Friday drinks, anyone? |
| course | C1 |
| idnumber | choice1 |
| completion | 1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| teacher1 | C1 | editingteacher |
@javascript
Scenario: Toggle manual completion as a student
Given I am on the "What to drink?" "choice activity" page logged in as student1
And the manual completion button of "What to drink?" is displayed as "Mark as done"
When I toggle the manual completion state of "What to drink?"
Then the manual completion button of "What to drink?" is displayed as "Done"
But "Mark as done" "button" should not exist
# Just make sure that the change persisted.
And I reload the page
And I wait until the page is ready
And I should not see "Mark as done"
And the manual completion button of "What to drink?" is displayed as "Done"
And I toggle the manual completion state of "What to drink?"
And the manual completion button of "What to drink?" is displayed as "Mark as done"
But "Done" "button" should not exist
# Just make sure that the change persisted.
And I reload the page
And the manual completion button of "What to drink?" is displayed as "Mark as done"
But "Done" "button" should not exist
Scenario: Viewing a choice activity with manual completion as a teacher
When I am on the "What to drink?" "choice activity" page logged in as teacher1
Then the manual completion button for "What to drink?" should be disabled
@javascript
Scenario: Overriding a manual choice completion for a user to done
Given I am on the "Course 1" course page logged in as teacher1
And I navigate to "Reports" in current page administration
And I click on "Activity completion" "link"
And I click on "Student 1, What to drink?: Not completed" "link"
And I press "Save changes"
And I log out
When I am on the "What to drink?" "choice activity" page logged in as student1
Then the manual completion button of "What to drink?" overridden by "Teacher 1" is displayed as "Done"
And I toggle the manual completion state of "What to drink?"
And the manual completion button of "What to drink?" is displayed as "Mark as done"
@javascript
Scenario: Overriding a manual choice completion for a user to not done
Given I am on the "What to drink?" "choice activity" page logged in as student1
And I press "Mark as done"
And I wait until the page is ready
And I log out
And I am on the "Course 1" course page logged in as teacher1
And I navigate to "Reports" in current page administration
And I click on "Activity completion" "link"
And I click on "Student 1, What to drink?: Completed" "link"
And I press "Save changes"
And I log out
Given I am on the "What to drink?" "choice activity" page logged in as student1
Then the manual completion button of "What to drink?" overridden by "Teacher 1" is displayed as "Mark as done"
And I toggle the manual completion state of "What to drink?"
And the manual completion button of "What to drink?" is displayed as "Done"
+26
View File
@@ -0,0 +1,26 @@
@mod @mod_choice
Feature: Add choice activity
In order to ask questions as a choice of multiple responses
As a teacher
I need to add choice activities to courses
Scenario: Add a choice activity and complete the activity as a student
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Choice name | Choice Description | C1 | choice1 | Option 1, Option 2 | 1 |
When I log in as "student1"
And I am on "Course 1" course homepage
And I choose "Option 1" from "Choice name" choice activity
Then I should see "Your selection: Option 1"
And I should see "Your choice has been saved"
@@ -0,0 +1,51 @@
@mod @mod_choice
Feature: Allow choice preview
In order to allow students to preview options before a choice activity is opened for submission
As a teacher
I need to enable the choice preview option
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice name |
| intro | Choice Description |
| section | 1 |
| option | Option 1, Option 2 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Scenario: Enable the choice preview option and view the activity as a student before the opening time
And I follow "Choice name"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| timeopen[enabled] | 1 |
| timeclose[enabled] | 1 |
| timeopen[day] | 30 |
| timeopen[month] | December |
| timeopen[year] | 2037 |
| timeclose[day] | 31 |
| timeclose[month] | December |
| timeclose[year] | 2037 |
| Show preview | 1 |
And I press "Save and return to course"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Choice name"
Then I should see "This is just a preview of the available options for this activity"
And the "choice_1" "radio" should be disabled
And the "choice_2" "radio" should be disabled
And "Save my choice" "button" should not exist
@@ -0,0 +1,86 @@
<?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/>.
/**
* Steps definitions for choice activity.
*
* @package mod_choice
* @category test
* @copyright 2013 David Monllaó
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
/**
* Choice activity definitions.
*
* @package mod_choice
* @category test
* @copyright 2013 David Monllaó
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_mod_choice extends behat_base {
/**
* Chooses the specified option from the choice activity named as specified. You should be located in the activity's course page.
*
* @Given /^I choose "(?P<option_string>(?:[^"]|\\")*)" from "(?P<choice_activity_string>(?:[^"]|\\")*)" choice activity$/
* @param string $option
* @param string $choiceactivity
* @return array
*/
public function I_choose_option_from_activity($option, $choiceactivity) {
$this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($choiceactivity), 'choice activity']);
$this->execute('behat_forms::i_set_the_field_to', array( $this->escape($option), 1));
$this->execute("behat_forms::press_button", get_string('savemychoice', 'choice'));
}
/**
* Chooses the specified option from the choice activity named as specified and save the choice.
* You should be located in the activity's course page.
*
* @Given /^I choose options (?P<option_string>"(?:[^"]|\\")*"(?:,"(?:[^"]|\\")*")*) from "(?P<choice_activity_string>(?:[^"]|\\")*)" choice activity$/
* @param string $option
* @param string $choiceactivity
* @return array
*/
public function I_choose_options_from_activity($option, $choiceactivity) {
// Get Behat general and forms contexts.
$behatgeneral = behat_context_helper::get('behat_general');
$behatforms = behat_context_helper::get('behat_forms');
// Go to choice activity.
$this->execute("behat_navigation::i_am_on_page_instance", [$this->escape($choiceactivity), 'choice activity']);
// Wait for page to be loaded.
$this->wait_for_pending_js();
// Set all options.
$options = explode('","', trim($option, '"'));
foreach ($options as $option) {
$behatforms->i_set_the_field_to($this->escape($option), '1');
}
// Save choice.
$behatforms->press_button(get_string('savemychoice', 'choice'));
}
}
@@ -0,0 +1,105 @@
@mod @mod_choice
Feature: Editing choice block
In order to customise choice page
As a teacher or admin
I need to add remove block from the choice page
# This tests that the hacky block editing is not borked by legacy forms in choice activity.
Scenario: Add a choice activity as admin and check blog menu block should contain link.
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice name 1 |
| intro | Choice Description 1 |
| section | 1 |
| option | Option 1, Option 2 |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| blog_menu | Activity module | choice1 | mod-choice-* | side-pre |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I follow "Choice name 1"
And I should see "View all entries about this Choice"
When I configure the "Blog menu" block
And I press "Save changes"
Then I should see "View all entries about this Choice"
And I open the "Blog menu" blocks action menu
And I click on "Delete" "link" in the "Blog menu" "block"
And I press "Yes"
And I should not see "View all entries about this Choice"
And I should see "Choice Description 1"
Scenario: Add a choice activity as teacher and check blog menu block contain choice link.
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice name 1 |
| intro | Choice Description 1 |
| section | 1 |
| option | Option 1, Option 2 |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| blog_menu | Activity module | choice1 | mod-choice-* | side-pre |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Choice name 1"
And I should see "View all entries about this Choice"
When I configure the "Blog menu" block
And I press "Save changes"
Then I should see "View all entries about this Choice"
And I open the "Blog menu" blocks action menu
And I click on "Delete" "link" in the "Blog menu" "block"
And I press "Yes"
And I should not see "View all entries about this Choice"
And I should see "Choice Description 1"
Scenario: Add a choice activity as teacher (with dual role) and check blog menu block contain choice link.
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher1 | C1 | student |
And the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice name 1 |
| intro | Choice Description 1 |
| section | 1 |
| option | Option 1, Option 2 |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| blog_menu | Activity module | choice1 | mod-choice-* | side-pre |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Choice name 1"
And I should see "View all entries about this Choice"
When I configure the "Blog menu" block
And I press "Save changes"
Then I should see "View all entries about this Choice"
And I open the "Blog menu" blocks action menu
And I click on "Delete" "link" in the "Blog menu" "block"
And I press "Yes"
And I should not see "View all entries about this Choice"
And I should see "Choice Description 1"
@@ -0,0 +1,56 @@
@mod @mod_choice
Feature: Teacher can choose whether to allow students to change their choice response
In order to allow students to change their choice
As a teacher
I need to enable the option to change the choice
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
Scenario: Change a choice response as a student
Given the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | Choice name |
| name | Choice name |
| intro | Choice Description |
| section | 1 |
| option | Option 1, Option 2 |
| allowupdate | 0 |
When I am on the "Course 1" course page logged in as student1
And I choose "Option 1" from "Choice name" choice activity
And I should see "Your selection: Option 1"
And I should see "Your choice has been saved"
Then "Save my choice" "button" should not exist
Scenario: Change a choice response as a student
Given the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | Choice name |
| name | Choice name |
| intro | Choice Description |
| section | 1 |
| option | Option 1, Option 2 |
| allowupdate | 1 |
When I am on the "Course 1" course page logged in as student1
And I choose "Option 1" from "Choice name" choice activity
And I should see "Your selection: Option 1"
And I should see "Your choice has been saved"
Then I should see "Your selection: Option 1"
And "Save my choice" "button" should exist
And "Remove my choice" "link" should exist
And I set the field "Option 2" to "1"
And I press "Save my choice"
And I should see "Your choice has been saved"
And I should see "Your selection: Option 2"
@@ -0,0 +1,104 @@
@mod @mod_choice
Feature: Restrict availability of the choice module to a deadline
In order to limit the time a student can mace a selection
As a teacher
I need to restrict answering to within a time period
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
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
Scenario: Enable the choice activity with a start deadline in the future
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Choice name | Choice Description | C1 | choice1 | Option 1, Option 2 | 1 |
And I am on "Course 1" course homepage
And I follow "Choice name"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| timeopen[enabled] | 1 |
| timeopen[day] | 30 |
| timeopen[month] | December |
| timeopen[year] | 2037 |
And I press "Save and return to course"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Choice name"
Then "choice_1" "radio" should not exist
And "choice_2" "radio" should not exist
And "Save my choice" "button" should not exist
Scenario: Enable the choice activity with a start deadline in the past
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Choice name | Choice Description | C1 | choice1 | Option 1, Option 2 | 1 |
And I am on "Course 1" course homepage
And I follow "Choice name"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| timeopen[enabled] | 1 |
| timeopen[day] | 30 |
| timeopen[month] | December |
| timeopen[year] | 2007 |
And I press "Save and return to course"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Choice name"
And "choice_1" "radio" should exist
And "choice_2" "radio" should exist
And "Save my choice" "button" should exist
Scenario: Enable the choice activity with a end deadline in the future
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Choice name | Choice Description | C1 | choice1 | Option 1, Option 2 | 1 |
And I am on "Course 1" course homepage
And I follow "Choice name"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| timeclose[enabled] | 1 |
| timeclose[day] | 30 |
| timeclose[month] | December |
| timeclose[year] | 2037 |
And I press "Save and return to course"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Choice name"
And "choice_1" "radio" should exist
And "choice_2" "radio" should exist
And "Save my choice" "button" should exist
Scenario: Enable the choice activity with a end deadline in the past
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Choice name | Choice Description | C1 | choice1 | Option 1, Option 2 | 1 |
And I am on "Course 1" course homepage
And I follow "Choice name"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| timeclose[enabled] | 1 |
| timeclose[day] | 30 |
| timeclose[month] | December |
| timeclose[year] | 2007 |
And I press "Save and return to course"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Choice name"
Then "choice_1" "radio" should not exist
And "choice_2" "radio" should not exist
And "Save my choice" "button" should not exist
@@ -0,0 +1,51 @@
@mod @mod_choice
Feature: Choice with no calendar capabilites
In order to allow work effectively
As a teacher
I need to be able to create choices even when I cannot edit calendar events
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| 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 the "Course 1" "permissions" page
And I override the system permissions of "Teacher" role with:
| capability | permission |
| moodle/calendar:manageentries | Prohibit |
And I log out
Scenario: Editing a choice
And the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Test choice name | Test choice description | C1 | choice1 | Option 1, Option 2 | 1 |
Given I log in as "admin"
And I am on "Course 1" course homepage
And I follow "Test choice name"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| id_timeopen_enabled | 1 |
| id_timeopen_day | 1 |
| id_timeopen_month | 1 |
| id_timeopen_year | 2017 |
| id_timeclose_enabled | 1 |
| id_timeclose_day | 1 |
| id_timeclose_month | 2 |
| id_timeclose_year | 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 choice name"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| id_timeopen_year | 2018 |
| id_timeclose_year | 2018 |
And I press "Save and return to course"
Then I should see "Test choice name"
+60
View File
@@ -0,0 +1,60 @@
@mod @mod_choice
Feature: Group choice
In order to view choice responses for large courses
As a user
I need to filter the responses to a choice by group
Background:
And the following "courses" exist:
| fullname | shortname |
| Test Course 1 | C1 |
And the following "groups" exist:
| name | course | idnumber | participation |
| Group 1 | C1 | G1 | 1 |
| Group 2 | C1 | G2 | 1 |
| Group 3 | C1 | G3 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | TeacherG1 | 1 | teacher1@example.com |
| user1 | User1G1 | 1 | user1@example.com |
| user2 | User2G2 | 2 | user2@example.com |
| user3 | User3None | 3 | user3@example.com |
| user4 | User4NPgroup | 4 | user4@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| user1 | C1 | student |
| user2 | C1 | student |
| user3 | C1 | student |
| user4 | C1 | student |
And the following "group members" exist:
| user | group |
| teacher1 | G1 |
| user1 | G1 |
| user2 | G2 |
| user4 | G3 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | showresults | publish | groupmode |
| choice | Separate Choice | Choice with separate groups | C1 | choice1 | 3 | 1 | 1 |
| choice | Visible Choice | Choice with visible groups | C1 | choice2 | 3 | 1 | 2 |
Scenario Outline: Users should see their own participation groups in "separate groups" mode, and all
participation groups in "visible groups" mode.
Given I am on the "<choice>" "choice activity" page logged in as "<user>"
Then I <all> "All participants"
And I <G1> "Group 1"
And I <G2> "Group 2"
And I should not see "Group 3"
Examples:
| choice | user | all | G1 | G2 |
| choice1 | teacher1 | should see | should see | should see |
| choice1 | user1 | should not see | should see | should not see |
| choice1 | user2 | should not see | should not see | should see |
| choice1 | user3 | should see | should not see | should not see |
| choice1 | user4 | should see | should not see | should not see |
| choice2 | teacher1 | should see | should see | should see |
| choice2 | user1 | should see | should see | should see |
| choice2 | user2 | should see | should see | should see |
| choice2 | user3 | should see | should see | should see |
| choice2 | user4 | should see | should see | should see |
@@ -0,0 +1,134 @@
@mod @mod_choice
Feature: Include responses from inactive users
In order to view responses from inactive or suspended users in choice results
As a teacher
I need to enable the choice include inactive option
Background:
Given 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 |
| student3 | Student | 3 | student3@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
Scenario: Enable the choice include inactive option and check that responses from inactive students are visible
Given the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice name |
| intro | Choice Description |
| section | 1 |
| option | Option 1, Option 2, Option 3 |
| includeinactive | 1 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I choose "Option 1" from "Choice name" choice activity
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I choose "Option 2" from "Choice name" choice activity
And I log out
And I log in as "student3"
And I am on "Course 1" course homepage
And I choose "Option 3" from "Choice name" choice activity
And I log out
And the following "course enrolments" exist:
| user | course | role | status |
| student1 | C1 | student | 1 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I click on "Choice name" "link" in the "region-main" "region"
And I navigate to "Responses" in current page administration
Then I should see "Student 1"
And I should see "Student 2"
And I should see "Student 3"
And I log out
And the following "course enrolments" exist:
| user | course | role | timestart |
| student2 | C1 | student | 2145830400 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I click on "Choice name" "link" in the "region-main" "region"
Then I navigate to "Responses" in current page administration
And I should see "Student 1"
And I should see "Student 2"
And I should see "Student 3"
And I log out
And the following "course enrolments" exist:
| user | course | role | timeend |
| student3 | C1 | student | 1425168000 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I click on "Choice name" "link" in the "region-main" "region"
Then I navigate to "Responses" in current page administration
And I should see "Student 1"
And I should see "Student 2"
And I should see "Student 3"
And I log out
Scenario: Disable the choice include inactive option and check that responses from inactive students are not visible
Given the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice name |
| intro | Choice Description |
| section | 1 |
| option | Option 1, Option 2, Option 3 |
| includeinactive | 0 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I choose "Option 1" from "Choice name" choice activity
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I choose "Option 2" from "Choice name" choice activity
And I log out
And I log in as "student3"
And I am on "Course 1" course homepage
And I choose "Option 3" from "Choice name" choice activity
And I log out
And the following "course enrolments" exist:
| user | course | role | status |
| student1 | C1 | student | 1 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I click on "Choice name" "link" in the "region-main" "region"
Then I navigate to "Responses" in current page administration
And I should not see "Student 1"
And I should see "Student 2"
And I should see "Student 3"
And I log out
And the following "course enrolments" exist:
| user | course | role | timestart |
| student2 | C1 | student | 2145830400 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I click on "Choice name" "link" in the "region-main" "region"
Then I navigate to "Responses" in current page administration
And I should not see "Student 1"
And I should not see "Student 2"
And I should see "Student 3"
And I log out
And the following "course enrolments" exist:
| user | course | role | timeend |
| student3 | C1 | student | 1425168000 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I click on "Choice name" "link" in the "region-main" "region"
Then I navigate to "Responses" in current page administration
And I should not see "Student 1"
And I should not see "Student 2"
And I should not see "Student 3"
And I log out
@@ -0,0 +1,60 @@
@mod @mod_choice
Feature: Limit choice responses
In order to restrict students from selecting a response more than a specified number of times
As a teacher
I need to limit the choice responses
Scenario: Limit the number of responses allowed for a choice activity and verify the result as students
Given 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 |
| student3 | Student | 3 | student3@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | option | showavailable | limitanswers |
| choice | Choice name | Choice description | C1 | choice1 | Option 1, Option 2 | 1 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Choice name"
And I navigate to "Settings" in current page administration
And I set the field "Limit 1" to "1"
And I press "Save and display"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Choice name"
And I choose "Option 1" from "Choice name" choice activity
Then I should see "Your selection: Option 1"
And I should see "Your choice has been saved"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Choice name"
And I should see "Option 1 (Full)"
And I should see "Responses: 1"
And I should see "Limit: 1"
And the "choice_1" "radio" should be disabled
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Choice name"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Limit the number of responses allowed | No |
And I press "Save and return to course"
And I log out
And I log in as "student3"
And I am on "Course 1" course homepage
And I follow "Choice name"
Then I should not see "Limit: 1"
And the "choice_1" "radio" should be enabled
@@ -0,0 +1,121 @@
@mod @mod_choice
Feature: Teacher can modify choices of the students
In order to have all students choices
As a teacher
I need to be able to make choice for studnets
Background:
Given 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 |
| student3 | Student | 3 | student3@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | option |
| choice | Choice name | Test choice description | C1 | choice1 | Option 1, Option 2, Option 3 |
@javascript
Scenario: Delete students choice response as a teacher
Given I am on the "Choice name" "choice activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the field "Show column for unanswered" to "Yes"
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 choose "Option 1" from "Choice name" choice activity
Then I should see "Your selection: Option 1"
And I should see "Your choice has been saved"
And I log out
And I log in as "teacher1"
And I change window size to "large"
And I am on the "Choice name" "choice activity" page
And I navigate to "Responses" in current page administration
And I click on "Student 1 Option 1" "checkbox"
And I select "Delete" from the "With selected" singleselect
And "Student 1 Option 1" "checkbox" should not exist
And "Student 1 Not answered yet" "checkbox" should exist
@javascript
Scenario: Teacher set answers of students who did not respond or change existing answers
Given I am on the "Choice name" "choice activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the field "Show column for unanswered" to "Yes"
And I press "Save and return to course"
And I log out
And I am on the "Course 1" course page logged in as student1
And I choose "Option 1" from "Choice name" choice activity
Then I should see "Your selection: Option 1"
And I should see "Your choice has been saved"
And I log out
And I change window size to "large"
And I am on the "Choice name" "choice activity" page logged in as teacher1
And I navigate to "Responses" in current page administration
And I click on "Student 1 Option 1" "checkbox"
And I click on "Student 2 Not answered yet" "checkbox"
And I click on "Student 3 Not answered yet" "checkbox"
And I select "Choose: Option 2" from the "With selected" singleselect
And "Student 1 Option 1" "checkbox" should not exist
And "Student 2 Not answered yet" "checkbox" should not exist
And "Student 3 Not answered yet" "checkbox" should not exist
And "Student 1 Option 2" "checkbox" should exist
And "Student 2 Option 2" "checkbox" should exist
And "Student 3 Option 2" "checkbox" should exist
@javascript
Scenario: Teacher can delete answers in the multiple answer choice
Given I am on the "Choice name" "choice activity editing" page logged in as teacher1
And I set the field "Allow more than one choice to be selected" to "Yes"
And I press "Save and return to course"
And I log out
And I am on the "Course 1" course page logged in as student1
And I choose options "Option 1","Option 2" from "Choice name" choice activity
And I should see "Your selection: Option 1; Option 2"
And I should see "Your choice has been saved"
And I log out
And I change window size to "large"
And I am on the "Choice name" "choice activity" page logged in as teacher1
And I navigate to "Responses" in current page administration
And I click on "Student 1 Option 2" "checkbox"
And I select "Delete" from the "With selected" singleselect
And I click on "Student 1 Option 1" "checkbox"
And I select "Choose: Option 3" from the "With selected" singleselect
And I log out
And I am on the "Choice name" "choice activity" page logged in as student1
And I should see "Your selection: Option 1; Option 3"
@javascript
Scenario: Teacher can manage answers on view page if the names are displayed
Given I am on the "Course 1" course page logged in as student1
And I choose "Option 1" from "Choice name" choice activity
Then I should see "Your selection: Option 1"
And I should see "Your choice has been saved"
And I log out
And I change window size to "large"
And I am on the "Choice name" "choice activity editing" page logged in as teacher1
And I set the following fields to these values:
| Publish results | Always show results to students |
| Privacy of results | Publish full results, showing names and their choices |
| Show column for unanswered | Yes |
And I press "Save and display"
And I click on "Student 1 Option 1" "checkbox"
And I click on "Student 2 Not answered yet" "checkbox"
And I select "Choose: Option 3" from the "With selected" singleselect
And "Student 1 Option 1" "checkbox" should not exist
And "Student 1 Option 3" "checkbox" should exist
And "Student 2 Not answered yet" "checkbox" should not exist
And "Student 2 Option 3" "checkbox" should exist
And I click on "Student 1 Option 3" "checkbox"
And I select "Delete" from the "With selected" singleselect
And "Student 1 Option 3" "checkbox" should not exist
And "Student 1 Not answered yet" "checkbox" should exist
@@ -0,0 +1,87 @@
@mod @mod_choice
Feature: Multiple option choice response
In order to ask questions as a choice of multiple responses
As a teacher
I need to add choice activities to courses with multiple options enabled
Scenario: Complete a choice with multiple options enabled
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exist:
| activity | name | intro | course | idnumber | option | allowmultiple |
| choice | Choice name | Choice description | C1 | 00001 | Option 1, Option 2, Option 3 | 1 |
When I log in as "student1"
And I am on "Course 1" course homepage
And I choose options "Option 1","Option 2" from "Choice name" choice activity
Then I should see "Your selection: Option 1; Option 2"
And I should see "Your choice has been saved"
Scenario: Complete a choice with multiple options enabled and limited responses set
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activity" exist:
| activity | name | intro | course | idnumber | option | allowmultiple | showavailable | limitanswers |
| choice | Choice name | Choice description | C1 | choice1 | Option 1, Option 2, Option 3 | 1 | 1 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Choice name"
And I follow "Settings"
And I set the following fields to these values:
| Limit 1 | 1 |
| Limit 2 | 1 |
| Limit 3 | 1 |
And I press "Save and display"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
And I choose options "Option 1","Option 2" from "Choice name" choice activity
Then I should see "Your selection: Option 1; Option 2"
And I should see "Your choice has been saved"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Choice name"
And I should see "Option 1 (Full)"
And I should see "Option 2 (Full)"
And I should see "Option 3"
And the "#choice_1" "css_element" should be disabled
And the "#choice_2" "css_element" should be disabled
And the "#choice_3" "css_element" should be enabled
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Choice name"
And I navigate to "Responses" in current page administration
Then I should see "Option 1 (Full)"
And I should see "Limit: 1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Choice name"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Limit the number of responses allowed | No |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I follow "Choice name"
And I navigate to "Responses" in current page administration
Then I should not see "Limit: 1"
And I log out
+54
View File
@@ -0,0 +1,54 @@
@mod @mod_choice
Feature: Test the display of the choice module on my home
In order to know my status in a choice activity
As a user
I need to see it in My dashboard.
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Test choice name | Test choice description | C1 | choice1 | Option 1, Option 2 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test choice name"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| timeopen[enabled] | 1 |
| timeclose[enabled] | 1 |
| timeclose[day] | 1 |
| timeclose[month] | January |
| timeclose[year] | 2030 |
| timeclose[hour] | 08 |
| timeclose[minute] | 00 |
| Allow choice to be updated | No |
And I press "Save and return to course"
And I log out
Scenario: View my home as a student after answering the choice
Given I log in as "student1"
And I am on "Course 1" course homepage
And I choose "Option 1" from "Test choice name" choice activity
And I should see "Your selection: Option 1"
And I should see "Your choice has been saved"
And "Save my choice" "button" should not exist
And I log out
Scenario: View my home as a teacher
Given I log in as "student1"
And I am on "Course 1" course homepage
And I choose "Option 1" from "Test choice name" choice activity
And I should see "Your selection: Option 1"
And I should see "Your choice has been saved"
And "Save my choice" "button" should not exist
And I log out
+117
View File
@@ -0,0 +1,117 @@
@mod @mod_choice
Feature: A student can see how the results of the choice activity will be published
In order to put my mind at ease when it comes to answering a choice
As a student
I need to learn how my choice will be handled and published to the other course participants.
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
Scenario: Results will not be published to the students
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option |
| choice | Choice 1 | Choice description | C1 | choice1 | Option 1, Option 2 |
And I am on "Course 1" course homepage
And I follow "Choice 1"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Publish results | Do not publish results to students |
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 "Choice 1"
Then I should see "The results of this activity will not be published after you answer."
Scenario: Full results will be shown to the students after they answer
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option |
| choice | Choice 1 | Choice description | C1 | choice1 | Option 1, Option 2 |
And I am on "Course 1" course homepage
When I follow "Choice 1"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Publish results | Show results to students after they answer |
| Privacy of results | Publish full results, showing names and their choices |
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 "Choice 1"
Then I should see "Full results, showing everyone's choices, will be published after you answer."
Scenario: Anonymous results will be shown to students after they answer
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option |
| choice | Choice 1 | Choice description | C1 | choice1 | Option 1, Option 2 |
And I am on "Course 1" course homepage
When I follow "Choice 1"
And I navigate to "Settings" in current page administration
And I set the field "Publish results" to "Show results to students after they answer"
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 "Choice 1"
Then I should see "Anonymous results will be published after you answer."
Scenario: Full results will be shown to students only after the choice is closed
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option |
| choice | Choice 1 | Choice description | C1 | choice1 | Option 1, Option 2 |
And I am on "Course 1" course homepage
When I follow "Choice 1"
And I navigate to "Settings" in current page administration
And I set the field "Publish results" to "Show results to students only after the choice is closed"
And I set the field "Privacy of results" to "Publish full results, showing names and their choices"
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 "Choice 1"
Then I should see "Full results, showing everyone's choices, will be published after the activity is closed."
Scenario: Anonymous results will be shown to students only after the choice is closed
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option |
| choice | Choice 1 | Choice description | C1 | choice1 | Option 1, Option 2 |
And I am on "Course 1" course homepage
When I follow "Choice 1"
And I navigate to "Settings" in current page administration
And I set the field "Publish results" to "Show results to students only after the choice is closed"
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 "Choice 1"
Then I should see "Anonymous results will be published after the activity is closed."
Scenario: Results will always be shown to students
And the following "activities" exist:
| activity | name | intro | course | idnumber | option |
| choice | Choice 1 | Choice description | C1 | choice1 | Option 1, Option 2 |
And I am on "Course 1" course homepage
When I follow "Choice 1"
And I navigate to "Settings" in current page administration
And I set the field "Publish results" to "Always show results to students"
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 "Choice 1"
Then I should not see "Full results, showing everyone's choices, will be published after you answer."
And I should not see "Full results, showing everyone's choices, will be published after the activity is closed."
And I should not see "Anonymous results will be published after you answer."
And I should not see "Anonymous results will be published after the activity is closed."
And I should not see "The results of this activity will not be published after you answer."
@@ -0,0 +1,132 @@
@mod @mod_choice
Feature: A teacher can choose one of 4 options for publishing choice results
In order to display choice activities outcomes
As a teacher
I need to publish the choice activity results in different ways
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
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
Scenario: Do not publish results to students
Given the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice 1 |
| intro | Choice Description |
| section | 1 |
| option | Option 1, Option 2 |
And I am on "Course 1" course homepage
And I follow "Choice 1"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Publish results | Do not publish results to students |
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 choose "Option 1" from "Choice 1" choice activity
Then I should see "Your selection: Option 1"
And I should not see "Responses"
And I should not see "Graph display"
Scenario: Show results to students after they answer
Given the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice 1 |
| intro | Choice Description |
| section | 1 |
| option | Option 1, Option 2 |
And I am on "Course 1" course homepage
And I follow "Choice 1"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Publish results | Show results to students after they answer |
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 "Choice 1"
Then I should not see "Responses"
And I am on "Course 1" course homepage
And I choose "Option 1" from "Choice 1" choice activity
And I should see "Your selection: Option 1"
And I should see "Responses"
Scenario: Show results to students only after the choice is closed
Given the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice 1 |
| intro | Choice Description |
| section | 1 |
| option | Option 1, Option 2 |
And I am on "Course 1" course homepage
And I follow "Choice 1"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Publish results | Show results to students only after the choice is closed |
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 "Choice 1"
Then I should not see "Responses"
And I choose "Option 1" from "Choice 1" choice activity
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Choice 1"
And I follow "Settings"
And I expand all fieldsets
And I set the following fields to these values:
| timeopen[enabled] | 1 |
| timeopen[day] | 1 |
| timeopen[month] | January |
| timeopen[year] | 2010 |
| timeclose[enabled] | 1 |
| timeclose[day] | 2 |
| timeclose[month] | January |
| timeclose[year] | 2010 |
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 "Choice 1"
And I should see "Responses"
Scenario: Always show results to students
Given the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice 1 |
| intro | Choice Description |
| section | 1 |
| option | Option 1, Option 2 |
And I am on "Course 1" course homepage
And I follow "Choice 1"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Publish results | Always show results to students |
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 "Choice 1"
And I should see "Responses"
@@ -0,0 +1,65 @@
@mod @mod_choice
Feature: A teacher can choose whether to publish choice activity results anonymously or showing names
In order to keep students privacy or to give more info to students
As a teacher
I need to select whether I want other students to know who selected what option
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And I log in as "teacher1"
Scenario: Publish anonymous results
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Choice 1 | Choice Description | C1 | choice1 | Option 1, Option 2 | 1 |
And I am on "Course 1" course homepage
And I follow "Choice 1"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Publish results | Always show results to students |
| Privacy of results | Publish anonymous results, do not show student names |
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 choose "Option 1" from "Choice 1" choice activity
And I log out
When I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Choice 1"
Then I should not see "Student 1"
And I should not see "Users who chose this option"
Scenario: Publish full results
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Choice 1 | Choice Description | C1 | choice1 | Option 1, Option 2 | 1 |
And I am on "Course 1" course homepage
And I follow "Choice 1"
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Publish results | Always show results to students |
| Privacy of results | Publish full results, showing names and their choices |
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 choose "Option 1" from "Choice 1" choice activity
And I log out
When I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Choice 1"
Then I should see "Student 1"
And I should see "Users who chose this option"
@@ -0,0 +1,43 @@
@mod @mod_choice
Feature: Update a choice activity removing options
In order to remove incorrect or unwanted options
As a teacher
I need to update the choice activity
Scenario: Update a choice activity that has student responses.
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Choice name | Choice Description | C1 | choice1 | Option 1, Option 2, Option 3 | 1 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I choose "Option 3" from "Choice name" choice activity
And I should see "Your selection: Option 3"
And I should see "Your choice has been saved"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I choose "Option 2" from "Choice name" choice activity
And I should see "Your selection: Option 2"
And I should see "Your choice has been saved"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I click on "Choice name" "link" in the "region-main" "region"
And I navigate to "Settings" in current page administration
And I set the field "option[2]" to ""
And I press "Save and display"
Then I navigate to "Responses" in current page administration
And I should see "1" in the "Number of responses" "table_row"