Merge branch 'MDL-75794-main' of https://github.com/aanabit/moodle into main

This commit is contained in:
Paul Holden 2024-02-23 12:54:00 +00:00
commit bb6652699e
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164
11 changed files with 309 additions and 224 deletions

View File

@ -6,37 +6,36 @@ Feature: Restore Moodle 2 course backups with different user data settings
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| teacher1 | Teacher | 1 | teacher1@example.com |
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| data | Test database name | n | C1 | data1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I add a "Short text" field to "Test database name" database and I fill the form with:
| Field name | Test field name |
| Field description | Test field description |
And I navigate to "Templates" in current page administration
And I wait until the page is ready
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I add an entry to "Test database name" database with:
| Test field name | Student entry |
And I press "Save"
And I log out
And the following "mod_data > fields" exist:
| database | type | name | description |
| data1 | text | Test field name | Test field description |
And the following "mod_data > templates" exist:
| database | name |
| data1 | singletemplate |
| data1 | listtemplate |
| data1 | addtemplate |
| data1 | asearchtemplate |
| data1 | rsstemplate |
And the following "mod_data > entries" exist:
| database | user | Test field name |
| data1 | student1 | Student entry |
And I log in as "admin"
And I backup "Course 1" course using this options:
| Initial | Include enrolled users | 1 |
| Confirmation | Filename | test_backup.mbz |
| Initial | Include enrolled users | 1 |
| Confirmation | Filename | test_backup.mbz |
@javascript
Scenario: Restore a backup with user data

View File

@ -22,28 +22,27 @@ Feature: Using the database activities which support point scale
@javascript
Scenario: Database rescale grade should not be possible when users are graded
Given I am on the "Course 1" course page logged in as teacher1
And I add a "Short text" field to "Test database name" database and I fill the form with:
| Field name | Test field name |
| Field description | Test field description |
And I navigate to "Templates" in current page administration
And I wait until the page is ready
And I am on the "Test database name" "data activity editing" page
Given the following "mod_data > fields" exist:
| database | type | name | description |
| data1 | text | Test field name | Test field description |
And the following "mod_data > templates" exist:
| database | name |
| data1 | singletemplate |
| data1 | listtemplate |
| data1 | addtemplate |
| data1 | asearchtemplate |
| data1 | rsstemplate |
And the following "mod_data > entries" exist:
| database | user | Test field name |
| data1 | student1 | Student original entry |
| data1 | student1 | Student original entry 2 |
And I am on the "Test database name" "data activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the field "Ratings > Aggregate type" to "Count of ratings"
And I set the field "Ratings > Type" to "Point"
And I press "Save and return to course"
And I log out
Given I log in as "student1"
And I am on "Course 1" course homepage
And I add an entry to "Test database name" database with:
| Test field name | Student original entry |
| Test field name | Student original entry 2 |
And I press "Save"
And I log out
And I am on the "Test database name" "data activity" page logged in as teacher1
And I press "Save and display"
And I select "Single view" from the "jump" singleselect
And I set the field "rating" to "51"
And I am on the "Test database name" "data activity editing" page
And I expand all fieldsets
When I expand all fieldsets
Then the "Maximum grade" "field" should be disabled

View File

@ -6,16 +6,16 @@ Feature: Users can add entries to database activities
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| teacher1 | Teacher | 1 | teacher1@example.com |
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| data | Test database name | n | C1 | data1 |
@ -26,33 +26,35 @@ Feature: Users can add entries to database activities
| database | type | name | description |
| data1 | text | Test field name | Test field description |
| data1 | text | Test field 2 name | Test field 2 description |
When I am on the "Course 1" course page logged in as student1
And I add an entry to "Test database name" database with:
| Test field name | Student original entry |
| Test field 2 name | Student original entry 2 |
And I press "Save"
Then I should see "Student original entry"
And I open the action menu in "#defaulttemplate-single" "css_element"
And the following "mod_data > templates" exist:
| database | name |
| data1 | singletemplate |
| data1 | listtemplate |
| data1 | addtemplate |
| data1 | asearchtemplate |
| data1 | rsstemplate |
And the following "mod_data > entries" exist:
| database | user | Test field name | Test field 2 name |
| data1 | student1 | Student original entry | Student original entry 2 |
And I am on the "data1" Activity page logged in as student1
And I open the action menu in "#data-listview-content" "css_element"
And I choose "Edit" in the open action menu
And I set the following fields to these values:
| Test field name | Student original entry |
| Test field 2 name | |
| Test field name | Student original entry |
| Test field 2 name | |
And I press "Save"
Then I should not see "Student original entry 2"
And I open the action menu in "#defaulttemplate-single" "css_element"
And I open the action menu in "#data-singleview-content" "css_element"
And I choose "Edit" in the open action menu
And I set the following fields to these values:
| Test field name | Student edited entry |
And I press "Save"
And I should see "Student edited entry"
And I add an entry to "Test database name" database with:
| Test field name | Student second entry |
And I press "Save and add another"
And the field "Test field name" does not match value "Student second entry"
And I add an entry to "Test database name" database with:
| Test field name | Student third entry |
And I press "Save"
And I select "List view" from the "jump" singleselect
And the following "mod_data > entries" exist:
| database | user | Test field name | Test field 2 name |
| data1 | student1 | Student second entry | |
| data1 | student1 | Student third entry | |
And I am on the "data1" Activity page logged in as student1
And I should see "Student edited entry"
And I should see "Student second entry"
And I should see "Student third entry"
@ -66,34 +68,47 @@ Feature: Users can add entries to database activities
@javascript @editor @editor_atto @atto @atto_h5p
Scenario: If a new text area entry is added, the filepicker is displayed in the H5P Atto button
Given I am on the "Course 1" course page logged in as teacher1
And I add a "Text area" field to "Test database name" database and I fill the form with:
| Field name | Textarea field name |
And I am on "Course 1" course homepage
When I add an entry to "Test database name" database with:
| Textarea field name | This is the content |
Given the following "mod_data > fields" exist:
| database | type | name |
| data1 | textarea | Textarea field name |
And the following "mod_data > templates" exist:
| database | name |
| data1 | singletemplate |
| data1 | listtemplate |
| data1 | addtemplate |
| data1 | asearchtemplate |
| data1 | rsstemplate |
And I am on the "Course 1" course page logged in as teacher1
When I click on "Test database name" "link"
And I click on "Add entry" "button"
And I click on "Insert H5P" "button"
Then I should see "Browse repositories..."
@javascript
Scenario: If maximum number of entries is set other than None then add entries should be seen only if number of entries is less than it
Given I am on the "Test database name" "data activity" page logged in as teacher1
Given the following "mod_data > fields" exist:
| database | type | name |
| data1 | text | Test1 |
And the following "mod_data > templates" exist:
| database | name |
| data1 | singletemplate |
| data1 | listtemplate |
| data1 | addtemplate |
| data1 | asearchtemplate |
| data1 | rsstemplate |
And the following "mod_data > entries" exist:
| database | user | Test1 |
| data1 | student1 | foo |
| data1 | student1 | bar |
And I am on the "Test database name" "data activity" page logged in as teacher1
And I navigate to "Settings" in current page administration
And I expand all fieldsets
And I set the following fields to these values:
| Maximum number of entries | 2 |
And I press "Save and display"
And I add a "Short text" field to "Test database name" database and I fill the form with:
| Field name | Test1 |
And I log out
And I am on the "Test database name" "data activity" page logged in as student1
And I press "Add entry"
And I set the field "Test1" to "foo"
And I press "Save"
And I press "Add entry"
And I set the field "Test1" to "bar"
And I press "Save"
And I should not see "Add entry"
When I am on the "Test database name" "data activity" page logged in as student1
Then I should not see "Add entry"
And I log out
And I am on the "Test database name" "data activity" page logged in as teacher1
And I navigate to "Settings" in current page administration
@ -107,11 +122,18 @@ Feature: Users can add entries to database activities
@javascript
Scenario: Guest user cannot add entries to a database
Given I am on the "Course 1" "enrolment methods" page logged in as teacher1
Given the following "mod_data > fields" exist:
| database | type | name |
| data1 | text | Textarea field name |
And the following "mod_data > templates" exist:
| database | name |
| data1 | singletemplate |
| data1 | listtemplate |
| data1 | addtemplate |
| data1 | asearchtemplate |
| data1 | rsstemplate |
And I am on the "Course 1" "enrolment methods" page logged in as teacher1
And I click on "Enable" "link" in the "Guest access" "table_row"
And I am on "Course 1" course homepage
And I add a "Text area" field to "Test database name" database and I fill the form with:
| Field name | Textarea field name |
And I log out
When I am on the "Test database name" "data activity" page logged in as "guest"
Then I should not see "Add entry"

View File

@ -38,49 +38,6 @@ use Behat\Gherkin\Node\TableNode as TableNode;
*/
class behat_mod_data extends behat_base {
/**
* Adds a new field to a database
*
* @Given /^I add a "(?P<fieldtype_string>(?:[^"]|\\")*)" field to "(?P<activityname_string>(?:[^"]|\\")*)" database and I fill the form with:$/
*
* @param string $fieldtype
* @param string $activityname
* @param TableNode $fielddata
*/
public function i_add_a_field_to_database_and_i_fill_the_form_with($fieldtype, $activityname, TableNode $fielddata) {
$this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($activityname), 'data activity']);
$fieldsstr = get_string('fields', 'mod_data');
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration", $fieldsstr);
$this->execute('behat_general::i_click_on', [get_string('newfield', 'mod_data'), "button"]);
$this->execute('behat_general::i_click_on_in_the',
[$this->escape($fieldtype), "link", "#action_bar", "css_element"]
);
if (!$this->running_javascript()) {
$this->execute('behat_general::i_click_on_in_the',
array(get_string('go'), "button", ".fieldadd", "css_element")
);
}
$this->execute("behat_forms::i_set_the_following_fields_to_these_values", $fielddata);
$this->execute('behat_forms::press_button', get_string('save'));
}
/**
* Adds an entry to a database.
*
* @Given /^I add an entry to "(?P<activityname_string>(?:[^"]|\\")*)" database with:$/
*
* @param string $activityname
* @param TableNode $entrydata
*/
public function i_add_an_entry_to_database_with($activityname, TableNode $entrydata) {
$this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($activityname), 'mod_data > add entry']);
$this->execute("behat_forms::i_set_the_following_fields_to_these_values", $entrydata);
}
/**
* Convert page names to URLs for steps like 'When I am on the "[identifier]" "[page type]" page'.
*

View File

@ -0,0 +1,99 @@
<?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.
use Behat\Gherkin\Node\TableNode as TableNode;
require_once(__DIR__ . '/../../../../lib/behat/behat_deprecated_base.php');
/**
* Steps definitions that are now deprecated and will be removed in the next releases.
*
* This file only contains the steps that previously were in the behat_*.php files in the SAME DIRECTORY.
* When deprecating steps from other components or plugins, create a behat_COMPONENT_deprecated.php
* file in the same directory where the steps were defined.
*
* @package mod_data
* @category test
* @copyright 2024 Amaia Anabitarte <amaia@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_mod_data_deprecated extends behat_deprecated_base
{
/**
* Adds a new field to a database
*
* @Given /^I add a "(?P<fieldtype_string>(?:[^"]|\\")*)" field to "(?P<activityname_string>(?:[^"]|\\")*)" database and I fill the form with:$/
*
* @param string $fieldtype
* @param string $activityname
* @param TableNode $fielddata
* @todo MDL-79721 This will be deleted in Moodle 4.8.
*
* @deprecated since 4.4
*/
public function i_add_a_field_to_database_and_i_fill_the_form_with($fieldtype, $activityname, TableNode $fielddata)
{
$this->deprecated_message([
'behat_mod_data::i_add_a_field_to_database_and_i_fill_the_form_with is deprecated',
'mod_data > fields generator',
]);
$this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($activityname), 'data activity']);
$fieldsstr = get_string('fields', 'mod_data');
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration", $fieldsstr);
$this->execute('behat_general::i_click_on', [get_string('newfield', 'mod_data'), "button"]);
$this->execute('behat_general::i_click_on_in_the',
[$this->escape($fieldtype), "link", "#action_bar", "css_element"]
);
if (!$this->running_javascript()) {
$this->execute('behat_general::i_click_on_in_the',
array(get_string('go'), "button", ".fieldadd", "css_element")
);
}
$this->execute("behat_forms::i_set_the_following_fields_to_these_values", $fielddata);
$this->execute('behat_forms::press_button', get_string('save'));
}
/**
* Adds an entry to a database.
*
* @Given /^I add an entry to "(?P<activityname_string>(?:[^"]|\\")*)" database with:$/
*
* @param string $activityname
* @param TableNode $entrydata
* @deprecated since 4.4
* @todo MDL-79721 This will be deleted in Moodle 4.8.
*
*/
public function i_add_an_entry_to_database_with($activityname, TableNode $entrydata)
{
$this->deprecated_message([
'behat_mod_data::i_add_an_entry_to_database_with is deprecated',
'mod_data > entries generator',
]);
$this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($activityname), 'mod_data > add entry']);
$this->execute("behat_forms::i_set_the_following_fields_to_these_values", $entrydata);
}
}

View File

@ -24,6 +24,16 @@ Feature: View activity completion in the database activity
| section | 1 |
| completionentriesenabled | 1 |
| completionentries | 2 |
And the following "mod_data > fields" exist:
| database | type | name |
| mh1 | text | Instrument types |
And the following "mod_data > templates" exist:
| database | name |
| mh1 | singletemplate |
| mh1 | listtemplate |
| mh1 | addtemplate |
| mh1 | asearchtemplate |
| mh1 | rsstemplate |
Given I am on the "Music history" "data activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the following fields to these values:
@ -35,16 +45,14 @@ Feature: View activity completion in the database activity
| Receive a grade | 1 |
| Any grade | 1 |
And I press "Save and display"
And I add a "Short text" field to "Music history" database and I fill the form with:
| Field name | Instrument types |
And I log out
Scenario: View automatic completion items as a teacher
Given I am on the "Music history" "data activity" page logged in as teacher1
# We add an entry to let the user change to a different view.
When I add an entry to "Music history" database with:
| Instrument types | Drums |
And I press "Save"
Given the following "mod_data > entries" exist:
| database | user | Instrument types |
| mh1 | teacher1 | Drums |
When I am on the "Music history" "data activity" page logged in as teacher1
Then "Music history" should have the "View" completion condition
And "Music history" should have the "Make entries: 2" completion condition
And "Music history" should have the "Receive a grade" completion condition
@ -58,18 +66,18 @@ Feature: View activity completion in the database activity
And the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 2" completion condition of "Music history" is displayed as "todo"
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
And the following "mod_data > entries" exist:
| database | user | Instrument types |
| mh1 | student1 | Drums |
And I am on "Course 1" course homepage
And I add an entry to "Music history" database with:
| Instrument types | Drums |
And I press "Save"
# One entry is not enough to mark as complete.
And the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 2" completion condition of "Music history" is displayed as "todo"
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
And the following "mod_data > entries" exist:
| database | user | Instrument types |
| mh1 | student1 | Hurdygurdy |
And I am on "Course 1" course homepage
And I add an entry to "Music history" database with:
| Instrument types | Hurdygurdy |
And I press "Save"
Then the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 2" completion condition of "Music history" is displayed as "done"
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"

View File

@ -25,6 +25,9 @@ Feature: Completion pass grade
| idnumber | mh1 |
| name | Music history |
| section | 1 |
And the following "mod_data > fields" exist:
| database | type | name |
| mh1 | text | Instrument types |
And I am on the "Music history" "data activity" page logged in as teacher1
And I navigate to "Settings" in current page administration
And I expand all fieldsets
@ -40,17 +43,15 @@ Feature: Completion pass grade
| completionentriesenabled | 1 |
| completionentries | 2 |
And I press "Save and display"
And I add a "Short text" field to "Music history" database and I fill the form with:
| Field name | Instrument types |
And I log out
@javascript
Scenario: View automatic completion items as a teacher
Given I am on the "Music history" "data activity" page logged in as teacher1
# We add an entry to let the user change to a different view.
When I add an entry to "Music history" database with:
| Instrument types | Drums |
And I press "Save"
Given the following "mod_data > entries" exist:
| database | user | Instrument types |
| mh1 | teacher1 | Drums |
When I am on the "Music history" "data activity" page logged in as teacher1
Then "Music history" should have the "View" completion condition
And "Music history" should have the "Make entries: 2" completion condition
And "Music history" should have the "Receive a grade" completion condition
@ -68,19 +69,19 @@ Feature: Completion pass grade
And the "Make entries: 2" completion condition of "Music history" is displayed as "todo"
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
And the "Receive a passing grade" completion condition of "Music history" is displayed as "todo"
And the following "mod_data > entries" exist:
| database | user | Instrument types |
| mh1 | student1 | Drums |
And I am on "Course 1" course homepage
And I add an entry to "Music history" database with:
| Instrument types | Drums |
And I press "Save"
# One entry is not enough to mark as complete.
And the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 2" completion condition of "Music history" is displayed as "todo"
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
And the "Receive a passing grade" completion condition of "Music history" is displayed as "todo"
And the following "mod_data > entries" exist:
| database | user | Instrument types |
| mh1 | student1 | Hurdygurdy |
And I am on "Course 1" course homepage
And I add an entry to "Music history" database with:
| Instrument types | Hurdygurdy |
And I press "Save"
Then the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 2" completion condition of "Music history" is displayed as "done"
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
@ -107,19 +108,19 @@ Feature: Completion pass grade
And the "Make entries: 2" completion condition of "Music history" is displayed as "todo"
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
And the "Receive a passing grade" completion condition of "Music history" is displayed as "todo"
And the following "mod_data > entries" exist:
| database | user | Instrument types |
| mh1 | student1 | Drums |
And I am on "Course 1" course homepage
And I add an entry to "Music history" database with:
| Instrument types | Drums |
And I press "Save"
# One entry is not enough to mark as complete.
And the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 2" completion condition of "Music history" is displayed as "todo"
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
And the "Receive a passing grade" completion condition of "Music history" is displayed as "todo"
And the following "mod_data > entries" exist:
| database | user | Instrument types |
| mh1 | student1 | Hurdygurdy |
And I am on "Course 1" course homepage
And I add an entry to "Music history" database with:
| Instrument types | Hurdygurdy |
And I press "Save"
And the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 2" completion condition of "Music history" is displayed as "done"
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"

View File

@ -26,17 +26,19 @@ Feature: Users can edit approved entries in database activities
| name | Test database name |
| approval | 1 |
| manageapproved | 1 |
And I am on the "Test database name" "data activity" page logged in as teacher1
And I add a "Short text" field to "Test database name" database and I fill the form with:
| Field name | Test field name |
| Field description | Test field description |
And I log out
# Add an entry as a student.
And I am on the "Test database name" "data activity" page logged in as student1
And I add an entry to "Test database name" database with:
| Test field name | Student entry |
And I press "Save"
And I log out
And the following "mod_data > fields" exist:
| database | type | name | description |
| Test database name | text | Test field name | Test field description |
And the following "mod_data > templates" exist:
| database | name |
| Test database name | singletemplate |
| Test database name | listtemplate |
| Test database name | addtemplate |
| Test database name | asearchtemplate |
| Test database name | rsstemplate |
And the following "mod_data > entries" exist:
| database | user | Test field name |
| Test database name | student1 | Student entry |
# Approve the student's entry as a teacher.
And I am on the "Test database name" "data activity" page logged in as teacher1
And I open the action menu in ".defaulttemplate-listentry" "css_element"
@ -57,17 +59,19 @@ Feature: Users can edit approved entries in database activities
| name | Test database name |
| approval | 1 |
| manageapproved | 0 |
And I am on the "Test database name" "data activity" page logged in as teacher1
And I add a "Short text" field to "Test database name" database and I fill the form with:
| Field name | Test field name |
| Field description | Test field description |
And I log out
# Add an entry as a student.
And I am on the "Test database name" "data activity" page logged in as student1
And I add an entry to "Test database name" database with:
| Test field name | Student entry |
And I press "Save"
And I log out
And the following "mod_data > fields" exist:
| database | type | name | description |
| Test database name | text | Test field name | Test field description |
And the following "mod_data > templates" exist:
| database | name |
| Test database name | singletemplate |
| Test database name | listtemplate |
| Test database name | addtemplate |
| Test database name | asearchtemplate |
| Test database name | rsstemplate |
And the following "mod_data > entries" exist:
| database | user | Test field name |
| Test database name | student1 | Student entry |
# Approve the student's entry as a teacher.
And I am on the "Test database name" "data activity" page logged in as teacher1
And I open the action menu in ".defaulttemplate-listentry" "css_element"

View File

@ -44,11 +44,10 @@ Feature: Users can be required to specify certain fields when adding entries to
| data1 | multimenu | Not required Multimenu | 0 | Not required Multimenu | Option 1 |
Scenario: Students receive errors for empty required fields but not for optional fields
When I log in as "student1"
And I am on "Course 1" course homepage
And I add an entry to "Test database name" database with:
| Base Text input | Some input to allow us to submit the otherwise empty form |
And I press "Save"
Given I am on the "Test database name" "data activity" page logged in as student1
And I click on "Add entry" "button"
And I set the field "Base Text input" to "Some input to allow us to submit the otherwise empty form"
When I press "Save"
# Then ".alert" "css_element" should exist in the "//div[contains(@id,'defaulttemplate-addentry']//div[position()=1]]" "xpath_element"
Then ".alert" "css_element" should appear after "Checkbox" "text"
And ".alert" "css_element" should appear before "Required Checkbox" "text"
@ -74,10 +73,10 @@ Feature: Users can be required to specify certain fields when adding entries to
And I follow "Test database name"
And I should see "No entries yet"
Scenario: Students recieve no error for filled in required fields
When I log in as "student1"
And I am on "Course 1" course homepage
And I add an entry to "Test database name" database with:
Scenario: Students receive no error for filled in required fields
Given I am on the "Test database name" "data activity" page logged in as student1
And I click on "Add entry" "button"
And I set the following fields to these values:
| Base Text input | Some input to allow us to submit the otherwise empty form |
| Required Checkbox Option 1 | 1 |
| RTOC Option 1 | 1 |
@ -91,15 +90,15 @@ Feature: Users can be required to specify certain fields when adding entries to
| Required URL | http://example.com/ |
| Required Multimenu | 1 |
| Required Two-Option Multimenu | 1 |
And I press "Save"
When I press "Save"
And I select "List view" from the "jump" singleselect
Then I should not see "No entries in database"
And I should see "New entry text"
Scenario: Fields refill with data after having an error
When I log in as "student1"
And I am on "Course 1" course homepage
And I add an entry to "Test database name" database with:
Given I am on the "Test database name" "data activity" page logged in as student1
And I click on "Add entry" "button"
And I set the following fields to these values:
| RTOC Option 1 | 1 |
| Latitude | 0 |
| Longitude | 0 |
@ -111,7 +110,7 @@ Feature: Users can be required to specify certain fields when adding entries to
| Required URL | http://example.com/ |
| Required Multimenu | 1 |
| Required Two-Option Multimenu | 1 |
And I press "Save"
When I press "Save"
Then the following fields match these values:
| Base Text input | |
| Latitude | 0 |
@ -127,9 +126,9 @@ Feature: Users can be required to specify certain fields when adding entries to
@javascript
Scenario: A student fills in Latitude but not Longitude will see an error
Given I log in as "student1"
And I am on "Course 1" course homepage
When I add an entry to "Test database name" database with:
Given I am on the "Test database name" "data activity" page logged in as student1
And I click on "Add entry" "button"
And I set the following fields to these values:
| Base Text input | Some input to allow us to submit the otherwise empty form |
| Required Checkbox Option 1 | 1 |
| RTOC Option 1 | 1 |
@ -142,15 +141,15 @@ Feature: Users can be required to specify certain fields when adding entries to
| Required URL | http://example.com/ |
| Required Multimenu | 1 |
| Required Two-Option Multimenu | 1 |
And I set the field "Latitude" to "20"
#And I set the field with xpath "//div[@title='Not required Coordinates']//tr[td/label[normalize-space(.)='Latitude']]/td/input" to "20"
And I press "Save"
| Latitude | 20 |
When I press "Save"
Then I should see "Both latitude and longitude are required."
Scenario: A student filling in number and text fields with zero will not see an error.
Given I log in as "student1"
And I am on "Course 1" course homepage
When I add an entry to "Test database name" database with:
Scenario: A student fills in Latitude but not Longitude will see an error
Given I am on the "Test database name" "data activity" page logged in as student1
And I click on "Add entry" "button"
And I set the following fields to these values:
| Base Text input | Some input to allow us to submit the otherwise empty form |
| Required Checkbox Option 1 | 1 |
| RTOC Option 1 | 1 |
@ -164,7 +163,7 @@ Feature: Users can be required to specify certain fields when adding entries to
| Required URL | http://example.com/ |
| Required Multimenu | 1 |
| Required Two-Option Multimenu | 1 |
And I press "Save"
When I press "Save"
And I select "List view" from the "jump" singleselect
Then I should not see "No entries in database"
And I should see "Some input to allow us to submit the otherwise empty form"

View File

@ -76,14 +76,14 @@ Feature: Users can view and search database entries
@javascript
Scenario: Check that searching by tags works as expected
Given I log in as "student1"
And I am on "Course 1" course homepage
Given the following "mod_data > entries" exist:
| database | user | Test field name | Test field 2 name | Test field 3 name |
| data1 | student1 | Student original entry untagged | Student original entry untagged 2 | |
And I am on the "Test database name" "data activity" page logged in as student1
And I click on "Add entry" "button"
# This is required for now to prevent the tag suggestion menu from overlapping over the Save & view button.
And I change window size to "large"
And I add an entry to "Test database name" database with:
| Test field name | Student original entry untagged |
| Test field 2 name | Student original entry untagged 2 |
And I add an entry to "Test database name" database with:
And I set the following fields to these values:
| Test field name | Student original entry tagged |
| Test field 2 name | Student original entry tagged 2 |
And I set the field with xpath "//div[@class='datatagcontrol']//input[@type='text']" to "Tag1"
@ -98,7 +98,7 @@ Feature: Users can view and search database entries
And I should see "Tag1" in the "div.tag_list" "css_element"
And I click on "Advanced search" "checkbox"
And I set the field with xpath "//div[@class='datatagcontrol']//input[@type='text']" to "Tag1"
And I click on "[data-value='Tag1']" "css_element"
And I click on "#page-content" "css_element"
When I click on "Save settings" "button" in the "data_adv_form" "region"
Then I should see "Student original entry tagged"
And I should see "Student original entry tagged 2"
@ -107,18 +107,10 @@ Feature: Users can view and search database entries
@javascript
Scenario: Check that searching by first and last name works as expected
Given I log in as "student1"
And I am on "Course 1" course homepage
And I add an entry to "Test database name" database with:
| Test field name | Student entry 1 |
And I press "Save"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I add an entry to "Test database name" database with:
| Test field name | Student entry 2 |
And I press "Save"
And I log out
Given the following "mod_data > entries" exist:
| database | user | Test field name | Test field 2 name | Test field 3 name |
| data1 | student1 | Student entry 1 | | |
| data1 | student2 | Student entry 2 | | |
When I am on the "Test database name" "data activity" page logged in as teacher1
And I click on "Advanced search" "checkbox"
And I set the field "First name" to "Bob"

View File

@ -1,6 +1,11 @@
This files describes API changes in /mod/data - plugins,
information provided here is intended especially for developers.
=== 4.4 ===
* The following behat steps are now deprecated. Use data generators instead:
- I add a ":fieldtype" field to ":activityname" database and I fill the form with:
- I add an entry to ":activityname" database with:
== 4.3 ==
* Function data_export_xls() has been deprecated and moved to deprecatedlib, because xls support has already been dropped.
* Functions data_export_csv(), data_export_ods() and data_get_exportdata() have been deprecated due to a bigger