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,77 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Steps definitions related with the glossary activity.
*
* @package mod_glossary
* @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');
use Behat\Gherkin\Node\TableNode as TableNode;
/**
* Glossary-related steps definitions.
*
* @package mod_glossary
* @category test
* @copyright 2013 David Monllaó
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_mod_glossary extends behat_base {
/**
* Adds an entry to the current glossary with the provided data. You should be in the glossary page.
*
* @Given /^I add a glossary entry with the following data:$/
* @param TableNode $data
*/
public function i_add_a_glossary_entry_with_the_following_data(TableNode $data) {
$this->execute("behat_forms::press_button", get_string('addsingleentry', 'mod_glossary'));
$this->execute("behat_forms::i_set_the_following_fields_to_these_values", $data);
$this->execute("behat_forms::press_button", get_string('savechanges'));
}
/**
* Adds a category with the specified name to the current glossary. You need to be in the glossary page.
*
* @Given /^I add a glossary entries category named "(?P<category_name_string>(?:[^"]|\\")*)"$/
* @param string $categoryname Category name
*/
public function i_add_a_glossary_entries_category_named($categoryname) {
$params = [
get_string('categoryview', 'mod_glossary'),
get_string('explainalphabet', 'glossary')
];
$this->execute("behat_forms::i_select_from_the_singleselect", $params);
$this->execute("behat_forms::press_button", get_string('editcategories', 'mod_glossary'));
$this->execute("behat_forms::press_button", get_string('addcategory', 'glossary'));
$this->execute('behat_forms::i_set_the_field_to', array('name', $this->escape($categoryname)));
$this->execute("behat_forms::press_button", get_string('savechanges'));
$this->execute("behat_forms::press_button", get_string('back', 'mod_glossary'));
}
}
+116
View File
@@ -0,0 +1,116 @@
@mod @mod_glossary
Feature: Glossary entries can be organised in categories
In order to organise glossary entries
As a teacher
I need to be able to create, edit and delete categories
@javascript
Scenario: Glossary entries can be organised in categories and categories can be autolinked
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 | displayformat | course | idnumber |
| glossary | MyGlossary | Test glossary description | encyclopedia | C1 | glossary1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| label | name | check autolinking of CategoryAutoLinks and CategoryNoLinks text | C1 | label1 |
And the "glossary" filter is "on"
# Log in as a teacher and make sure nothing is yet autolinked
When I am on the "Course 1" course page logged in as teacher1
Then I should see "CategoryAutoLinks"
And I should see "CategoryNoLinks"
And "a.glossary.autolink" "css_element" should not exist
# Create, edit and delete categories
And I am on the MyGlossary "glossary activity" page
And I select "Browse by category" from the "Browse the glossary using this index" singleselect
And I press "Edit categories"
And I press "Add category"
And I set the field "name" to "CategoryNoLinks"
And I press "Save changes"
And I should see "0 Entries" in the "CategoryNoLinks" "table_row"
And I press "Add category"
And I set the field "name" to "CategoryAutoLinks"
And I set the field "usedynalink" to "Yes"
And I press "Save changes"
And I should see "0 Entries" in the "CategoryAutoLinks" "table_row"
And I press "Add category"
And I set the field "name" to "Category2"
And I press "Save changes"
And I click on "Edit" "link" in the "Category2" "table_row"
And I set the field "name" to "Category3"
And I press "Save changes"
And I should see "Category3"
And I should not see "Category2"
And I click on "Delete" "link" in the "Category3" "table_row"
And I press "No"
And I should see "Category3"
And I click on "Delete" "link" in the "Category3" "table_row"
And I press "Yes"
And I should not see "Category3"
And I press "Back"
# Add glossary entries in categories and outside
And I add a glossary entry with the following data:
| Concept | EntryNoCategory |
| Definition | Definition |
And I add a glossary entry with the following data:
| Concept | EntryCategoryNL |
| Definition | Definition |
| Categories | CategoryNoLinks |
And I add a glossary entry with the following data:
| Concept | EntryCategoryAL |
| Definition | Definition |
| Categories | CategoryAutoLinks |
And I press "Add entry"
And I set the following fields to these values:
| Concept | EntryCategoryBoth |
| Definition | Definition |
| Categories | CategoryAutoLinks,CategoryNoLinks |
And I press "Save changes"
# Make sure entries appear in their categories
And I select "Browse by category" from the "Browse the glossary using this index" singleselect
And "//h3[contains(.,'CATEGORYAUTOLINKS')]" "xpath_element" should appear before "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
And "//h4[contains(.,'EntryCategoryAL')]" "xpath_element" should appear before "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
And "(//h4[contains(.,'EntryCategoryBoth')])[1]" "xpath_element" should appear before "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
And "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element" should appear before "(//h4[contains(.,'EntryCategoryBoth')])[2]" "xpath_element"
And "//h4[contains(.,'EntryCategoryNL')]" "xpath_element" should appear after "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
And I should not see "EntryNoCategory"
And I set the field "hook" to "Not categorised"
And I set the field "Categories" to "Not categorised"
And I should see "EntryNoCategory"
And I should not see "EntryCategoryNL"
And I should not see "EntryCategoryAL"
And I should not see "EntryCategoryBoth"
# Check that category is autolinked from the text in the course
And I am on "Course 1" course homepage
And I should see "CategoryAutoLinks"
And I should see "CategoryAutoLinks" in the "a.glossary.autolink" "css_element"
And I should see "CategoryNoLinks"
And "//a[contains(.,'CategoryNoLinks')]" "xpath_element" should not exist
# Delete a category with entries
And I am on the MyGlossary "glossary activity" page
And I select "Browse by category" from the "Browse the glossary using this index" singleselect
And I press "Edit categories"
And I should see "2 Entries" in the "CategoryNoLinks" "table_row"
And I should see "2 Entries" in the "CategoryAutoLinks" "table_row"
And I click on "Delete" "link" in the "CategoryAutoLinks" "table_row"
And I press "Yes"
And I wait to be redirected
And I am on the MyGlossary "glossary activity" page
And I select "Browse by category" from the "Browse the glossary using this index" singleselect
And I should see "EntryCategoryNL"
And I should not see "EntryNoCategory"
And I should not see "EntryCategoryAL"
And I should see "EntryCategoryBoth"
And I set the field "Categories" to "Not categorised"
And I should see "EntryNoCategory"
And I should see "EntryCategoryAL"
And I should not see "EntryCategoryBoth"
@@ -0,0 +1,49 @@
@mod @mod_glossary
Feature: Create a glossary entry.
In order to create glossary entries
As a user
I should be able to enter an entry without using reserved keywords
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 | format |
| Course 1 | C1 | topics |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | glossary |
| course | C1 |
| name | Test glossary |
Scenario: Glossary entry edition of custom tags works as expected
Given I am on the "Test glossary" "glossary activity" page logged in as "teacher1"
When I press "Add entry"
And I set the following fields to these values:
| Concept | Dummy first entry |
| Definition | Dream is the start of a journey |
| Keyword(s) | " |
And I press "Save changes"
Then I should see "One or more keywords contain a special character which cannot be used."
@javascript @_file_upload
Scenario: Create glossary entry with attached file
Given I am on the "Test glossary" "glossary activity" page logged in as student1
# As a student, add a glossary entry with attachment
And I press "Add entry"
And I set the following fields to these values:
| Concept | Entry 1 |
| Definition | Definition of Entry 1 |
| Attachment | mod/glossary/tests/fixtures/musicians.xml |
And I press "Save changes"
# Confirm you can download attachment from student's entry as teacher
When I am on the "Test glossary" "glossary activity" page logged in as teacher1
Then I should see "Entry 1"
And following "musicians.xml" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Paul McCartney |
@@ -0,0 +1,67 @@
@mod @mod_glossary @core_tag @javascript
Feature: Edited glossary entries handle tags correctly
In order to get glossary entries properly labelled
As a user
I need to introduce the tags while editing
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 | format |
| Course 1 | C1 | topics |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| course | C1 |
| activity | glossary |
| name | Test glossary |
| intro | A glossary about dreams! |
Scenario: Glossary entry edition of custom tags works as expected
Given I am on the "Test glossary" "glossary activity" page logged in as teacher1
And I press "Add entry"
And I set the following fields to these values:
| Concept | Dummy first entry |
| Definition | Dream is the start of a journey |
| Tags | Example, Entry, Cool |
And I press "Save changes"
Then I should see "Example" in the ".glossary-tags" "css_element"
And I should see "Entry" in the ".glossary-tags" "css_element"
And I should see "Cool" in the ".glossary-tags" "css_element"
And I click on "Edit" "link" in the ".entrylowersection" "css_element"
And I expand all fieldsets
Then I should see "Example" in the ".form-autocomplete-selection" "css_element"
Then I should see "Entry" in the ".form-autocomplete-selection" "css_element"
Then I should see "Cool" in the ".form-autocomplete-selection" "css_element"
Scenario: Glossary entry edition of standard tags works as expected
Given the following "tags" exist:
| name | isstandard |
| OT1 | 1 |
| OT2 | 1 |
| OT3 | 1 |
And I am on the "Test glossary" "glossary activity" page logged in as teacher1
And I press "Add entry"
And I expand all fieldsets
And I open the autocomplete suggestions list
And I should see "OT1" in the ".form-autocomplete-suggestions" "css_element"
And I should see "OT2" in the ".form-autocomplete-suggestions" "css_element"
And I should see "OT3" in the ".form-autocomplete-suggestions" "css_element"
When I set the following fields to these values:
| Concept | Dummy first entry |
| Definition | Dream is the start of a journey |
| Tags | OT1, OT3 |
And I press "Save changes"
Then I should see "OT1" in the ".glossary-tags" "css_element"
And I should see "OT3" in the ".glossary-tags" "css_element"
And I should not see "OT2" in the ".glossary-tags" "css_element"
And I click on "Edit" "link" in the ".entrylowersection" "css_element"
And I expand all fieldsets
And I should see "OT1" in the ".form-autocomplete-selection" "css_element"
And I should see "OT3" in the ".form-autocomplete-selection" "css_element"
And I should not see "OT2" in the ".form-autocomplete-selection" "css_element"
@@ -0,0 +1,35 @@
@mod @mod_glossary
Feature: A teacher can set whether glossary entries are always editable or not
In order to ensure students think before adding new entries
As a teacher
I need to prevent entries to be always editable
Scenario: Glossary entries are not always editable
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 | editalways |
| glossary | Test glossary name | Test glossary description | C1 | glossary1 | 0 |
And the following config values are set as admin:
| maxeditingtime | 5 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test glossary name"
When I add a glossary entry with the following data:
| Concept | Test concept name |
| Definition | Test concept description |
Then "Delete entry: Test concept name" "link" should exist
And "Edit entry: Test concept name" "link" should exist
And I wait "6" seconds
And I reload the page
And "Delete entry: Test concept name" "link" should not exist
And "Edit entry: Test concept name" "link" should not exist
@@ -0,0 +1,80 @@
@mod @mod_glossary
Feature: A teacher can choose whether glossary entries require approval
In order to check entries before they are displayed
As a user
I need to enable entries requiring approval
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 the following "activity" exists:
| activity | glossary |
| course | C1 |
| idnumber | 0001 |
| name | Test glossary name |
| intro | Test glossary entries require approval |
| section | 1 |
| defaultapproval | 0 |
Scenario: Approve and undo approve glossary entries
Given I am on the "Test glossary name" "glossary activity" page logged in as student1
When I add a glossary entry with the following data:
| Concept | Just a test concept |
| Definition | Concept definition |
| Keyword(s) | Black |
And I log out
# Test that students can not see the unapproved entry.
And I am on the "Test glossary name" "glossary activity" page logged in as student2
Then I should see "No entries found in this section"
And I log out
# Approve the entry.
And I am on the "Test glossary name" "glossary activity" page logged in as teacher1
And I follow "Pending approval (1)"
Then I should see "(this entry is currently hidden)"
And I follow "Approve"
And I am on the "Test glossary name" "glossary activity" page
Then I should see "Concept definition"
And I log out
# Check that the entry can now be viewed by students.
And I am on the "Test glossary name" "glossary activity" page logged in as student2
Then I should see "Concept definition"
And I log out
# Undo the approval of the previous entry.
And I am on the "Test glossary name" "glossary activity" page logged in as teacher1
And I follow "Undo approval"
And I log out
# Check that the entry is no longer visible by students.
And I am on the "Test glossary name" "glossary activity" page logged in as student2
Then I should see "No entries found in this section"
@javascript
Scenario: View pending approval glossary items
Given I am on the "Test glossary name" "glossary activity" page logged in as student1
When I add a glossary entry with the following data:
| Concept | Just a test concept |
| Definition | Concept definition |
| Keyword(s) | Black |
| Tags | Test |
And I log out
And I log in as "teacher1"
And I turn editing mode on
And the following config values are set as admin:
| unaddableblocks | | theme_boost|
And I add the "Navigation" block if not present
And I expand "Site pages" node
And I click on "Tags" "link" in the "Navigation" "block"
And I follow "Test"
Then I should see "Glossary entries"
And I should see "Just a test concept"
And I should see "Entry not approved"
@@ -0,0 +1,82 @@
@mod @mod_glossary @core_completion
Feature: View activity completion in the glossary activity
In order to have visibility of glossary completion requirements
As a student
I need to be able to view my glossary completion progress
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Vinnie | Student1 | student1@example.com |
| teacher1 | Darrell | Teacher1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | enablecompletion | showcompletionconditions |
| Course 1 | C1 | 1 | 1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| teacher1 | C1 | editingteacher |
And the following "activity" exists:
| activity | glossary |
| course | C1 |
| name | Music history |
| section | 1 |
And I am on the "Music history" "glossary activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the following fields to these values:
| Aggregate type | Average of ratings |
| scale[modgrade_type] | Point |
| scale[modgrade_point] | 100 |
| Add requirements | 1 |
| View the activity | 1 |
| Receive a grade | 1 |
| Any grade | 1 |
| completionentriesenabled | 1 |
| completionentries | 1 |
And I press "Save and display"
And I log out
Scenario: View automatic completion items as a teacher
Given I am on the "Music history" "glossary activity" page logged in as teacher1
Then "Music history" should have the "View" completion condition
And "Music history" should have the "Make entries: 1" completion condition
And "Music history" should have the "Receive a grade" completion condition
Scenario: View automatic completion items as a student
Given I am on the "Music history" "glossary activity" page logged in as student1
And the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 1" completion condition of "Music history" is displayed as "todo"
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
And I am on the "Music history" "glossary activity" page
And I press "Add entry"
And I set the following fields to these values:
| Concept | Blast beats |
| Definition | Repeated fast tempo hits combining bass, snare and cymbal |
And I press "Save changes"
And the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 1" completion condition of "Music history" is displayed as "done"
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
And I log out
And I am on the "Music history" "glossary activity" page logged in as teacher1
And I set the field "rating" to "3"
And I press "Rate"
And I log out
When I am on the "Music history" "glossary activity" page logged in as student1
Then the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 1" completion condition of "Music history" is displayed as "done"
And the "Receive a grade" completion condition of "Music history" is displayed as "done"
@javascript
Scenario: Use manual completion
Given I am on the "Music history" "glossary activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the field "Students must manually mark the activity as done" to "1"
And I press "Save and display"
# Teacher view.
And the manual completion button for "Music history" should be disabled
And I log out
# Student view.
When I am on the "Music history" "glossary activity" page logged in as student1
Then the manual completion button of "Music history" is displayed as "Mark as done"
And I toggle the manual completion state of "Music history"
And the manual completion button of "Music history" is displayed as "Done"
@@ -0,0 +1,108 @@
@mod @mod_glossary @core_completion
Feature: Pass grade completion in the glossary activity
In order to have visibility of glossary completion requirements
As a student
I need to be able to view my glossary completion progress
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Vinnie | Student1 | student1@example.com |
| teacher1 | Darrell | Teacher1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category | enablecompletion |
| Course 1 | C1 | 0 | 1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| teacher1 | C1 | editingteacher |
And the following "activity" exists:
| activity | glossary |
| course | C1 |
| idnumber | mh1 |
| name | Music history |
| section | 1 |
When I am on the "Music history" "glossary activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the following fields to these values:
| Aggregate type | Average of ratings |
| scale[modgrade_type] | Point |
| scale[modgrade_point] | 100 |
| Ratings > Grade to pass | 50 |
| Add requirements | 1 |
| View the activity | 1 |
| Receive a grade | 1 |
| Passing grade | 1 |
| completionentriesenabled | 1 |
| completionentries | 1 |
And I press "Save and display"
And I log out
Scenario: View automatic completion items as a teacher
Given I log in as "teacher1"
And I am on "Course 1" course homepage
When I follow "Music history"
Then "Music history" should have the "View" completion condition
And "Music history" should have the "Make entries: 1" completion condition
And "Music history" should have the "Receive a grade" completion condition
And "Music history" should have the "Receive a passing grade" completion condition
Scenario: View automatic completion items as a failing student
Given I am on the "Music history" "glossary activity" page logged in as student1
And the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 1" 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"
When I am on "Course 1" course homepage
And I follow "Music history"
And I press "Add entry"
And I set the following fields to these values:
| Concept | Blast beats |
| Definition | Repeated fast tempo hits combining bass, snare and cymbal |
And I press "Save changes"
And the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 1" completion condition of "Music history" is displayed as "done"
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 I log out
And I am on the "Music history" "glossary activity" page logged in as teacher1
And I set the field "rating" to "3"
And I press "Rate"
And I log out
When I am on the "Music history" "glossary activity" page logged in as student1
Then the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 1" completion condition of "Music history" is displayed as "done"
And the "Receive a grade" completion condition of "Music history" is displayed as "done"
And the "Receive a passing grade" completion condition of "Music history" is displayed as "failed"
Scenario: View automatic completion items as a passing student
Given I am on the "Music history" "glossary activity" page logged in as student1
And the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 1" 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"
When I am on "Course 1" course homepage
And I follow "Music history"
And I press "Add entry"
And I set the following fields to these values:
| Concept | Blast beats |
| Definition | Repeated fast tempo hits combining bass, snare and cymbal |
And I press "Save changes"
And the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 1" completion condition of "Music history" is displayed as "done"
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 I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Music history"
And I set the field "rating" to "60"
And I press "Rate"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Music history"
Then the "View" completion condition of "Music history" is displayed as "done"
And the "Make entries: 1" completion condition of "Music history" is displayed as "done"
And the "Receive a grade" completion condition of "Music history" is displayed as "done"
And the "Receive a passing grade" completion condition of "Music history" is displayed as "done"
@@ -0,0 +1,99 @@
@mod @mod_glossary
Feature: Glossary can be set to various display formats
In order to display different glossary formats
As a teacher
I can set the glossary activity display format
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | One | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
Given the following "activities" exist:
| activity | course | name |
| glossary | C1 | Glossary 1 |
And the following "mod_glossary > entries" exist:
| glossary | concept | definition |
| Glossary 1 | Entry 1 | Entry 1 definition |
| Glossary 1 | Entry 2 | Entry 2 definition |
Scenario: Glossary display format is entry list style
Given I am on the "Glossary 1" "glossary activity editing" page logged in as teacher1
And I set the following fields to these values:
| displayformat | entrylist |
When I press "Save and display"
# Confirm that glossary display format is entry list.
# In this format, the concept definitions are not displayed.
Then I should not see "by Admin User"
And I should not see "Entry 1 definition"
And I should not see "Entry 2 definition"
And ".entrylist" "css_element" should exist
Scenario: Glossary display format is FAQ-style
Given I am on the "Glossary 1" "glossary activity editing" page logged in as teacher1
And I set the following fields to these values:
| displayformat | faq |
When I press "Save and display"
# Confirm that glossary format is FAQ.
# In this format, the words Question and Answer are displayed.
Then I should see "Question:"
And I should see "Answer:"
And ".faq" "css_element" should exist
@_file_upload @javascript
Scenario: Glossary display format is full without author style
Given I am on the "Glossary 1" "glossary activity editing" page logged in as teacher1
And I set the following fields to these values:
| displayformat | fullwithoutauthor |
And I press "Save and display"
And I press "Add entry"
# Add an entry with an attachment.
And I set the following fields to these values:
| Concept | Entry 3 |
| Definition | Entry 3 definition |
| Attachment | lib/tests/fixtures/gd-logo.png |
When I press "Save changes"
# Confirm that glossary format is full without author style.
# In this format, the image link should exist and author's name should not be visible.
Then "gd-logo.png" "link" should exist
And I should not see "by Admin User"
And ".fullwithoutauthor" "css_element" should exist
@_file_upload @javascript
Scenario: Glossary display format is encyclopedia style
Given I am on the "Glossary 1" "glossary activity editing" page logged in as teacher1
And I set the following fields to these values:
| displayformat | encyclopedia |
And I press "Save and display"
And I press "Add entry"
# Add an entry with an attachment.
And I set the following fields to these values:
| Concept | Entry 3 |
| Definition | Entry 3 definition |
| Attachment | lib/tests/fixtures/gd-logo.png |
When I press "Save changes"
# Confirm that glossary format is encyclopedia.
# In this format, the image element should be displayed.
Then "//img[contains(@src, 'gd-logo.png')]" "xpath_element" should exist
And ".encyclopedia" "css_element" should exist
Scenario Outline: Glossary display format can be set to dictionary, continuous and full with author
Given I am on the "Glossary 1" "glossary activity editing" page logged in as teacher1
# Assign the corresponding display format to glossary activity.
And I set the following fields to these values:
| displayformat | <display_format> |
When I press "Save and display"
# Confirm that glossary format is the display format set in the previous step.
Then I should <visibility> "by Admin User"
And ".<display_format>" "css_element" should exist
Examples:
| display_format | visibility |
| dictionary | not see |
| continuous | not see |
| fullwithauthor | see |
@@ -0,0 +1,44 @@
@mod @mod_glossary @_file_upload
Feature: Importing glossary entries
In order to add glossary entries by bulk
As a teacher
I need to be able to import glossary entries from a file
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Terry1 | Teacher1 | teacher1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | course | idnumber | name |
| glossary | C1 | glossary1 | Glossary 1 |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| recent_activity | Course | C1 | course-view-* | side-pre |
| tags | Course | C1 | course-view-* | side-pre |
And I am on the "Glossary 1" "glossary activity" page logged in as teacher1
@javascript @block_recent_activity
Scenario: Importing glossary entries and checking the Recent activity block
Given I press "Import entries"
And I upload "mod/glossary/tests/fixtures/texfilter_glossary_en.xml" file to "File to import" filemanager
When I press "Submit"
Then I should see "103" in the "Total entries:" "table_row"
And I should see "103" in the "Imported entries:" "table_row"
And I am on "Course 1" course homepage
And I should see "Added Glossary" in the "Recent activity" "block"
And I should see "New glossary entries:" in the "Recent activity" "block"
@javascript @block_tags
Scenario: Importing glossary entries and checking Tags block
Given I press "Import entries"
And I upload "mod/glossary/tests/fixtures/musicians.xml" file to "File to import" filemanager
When I press "Submit"
And I am on "Course 1" course homepage
And I click on "Beatles" "link" in the "Tags" "block"
Then I should see "Paul McCartney"
@@ -0,0 +1,34 @@
@mod @mod_glossary
Feature: A teacher can choose whether to allow duplicate entries in a glossary
In order to avoid confusion
As a teacher
I need to avoid having duplicate concept definitions
@javascript
Scenario: Prevent duplicate entries
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 |
And the following "activity" exists:
| course | C1 |
| activity | glossary |
| name | Test glossary name |
| intro | Test glossary description |
| allowduplicatedentries | 0 |
And I am on the "Test glossary name" "glossary activity" page logged in as teacher1
And I add a glossary entry with the following data:
| Concept | Unique concept |
| Definition | I'm the definition of an unique concept |
When I press "Add entry"
And I set the following fields to these values:
| Concept | Unique concept |
| Definition | There is no definition restriction |
And I press "Save changes"
Then I should see "This concept already exists. No duplicates allowed in this glossary."
And I press "Cancel"
@@ -0,0 +1,48 @@
@mod @mod_glossary
Feature: A teacher can choose whether to provide a printer-friendly glossary entries list
In order to print glossaries easily
As a user
I need to provide users a different view to print the glossary contents
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 |
@javascript
Scenario: Printer-friendly glossary view enabled
Given the following "activity" exists:
| course | C1 |
| activity | glossary |
| name | Test glossary name |
| intro | Test glossary description |
| allowprintview | 1 |
And I am on the "Test glossary name" "glossary activity" page logged in as student1
When I add a glossary entry with the following data:
| Concept | Just a test concept |
| Definition | Concept definition |
And I click on "Export entries" "button"
And I click on "Print" "link"
Then I should see "Just a test concept"
@javascript
Scenario: Printer-friendly glossary view disabled
Given the following "activity" exists:
| course | C1 |
| activity | glossary |
| name | Test glossary name |
| intro | Test glossary description |
| allowprintview | 0 |
And I am on the "Test glossary name" "glossary activity" page logged in as student1
When I add a glossary entry with the following data:
| Concept | Just a test concept |
| Definition | Concept definition |
And "//select[contains(concat(' ', normalize-space(@class), ' '), ' urlselect ')]" "xpath_element" should not exist
@@ -0,0 +1,74 @@
@mod @mod_glossary
Feature: Glossary entries can be searched or browsed by alphabet, category, date or author
In order to find entries in a glossary
As a user
I need to search the entries list by keyword, alphabet, category, date and author
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 | displayformat | course | idnumber |
| glossary | Test glossary name | Test glossary description | fullwithauthor | C1 | g1 |
And the following "mod_glossary > categories" exist:
| glossary | name |
| g1 | The ones I like |
| g1 | All for you |
And the following "mod_glossary > entries" exist:
| glossary | concept | definition | user | categories |
| g1 | Eggplant | Sour eggplants | teacher1 | All for you |
| g1 | Cucumber | Sweet cucumber | student1 | The ones I like |
And I am on the "Test glossary name" "glossary activity" page logged in as teacher1
@javascript
Scenario: Search by keyword and browse by alphabet
When I set the field "hook" to "cucumber"
And I press "Search"
Then I should see "Sweet cucumber"
And I should see "Search: cucumber"
And I click on "E" "link" in the ".entrybox" "css_element"
And I should see "Sour eggplants"
And I should not see "Sweet cucumber"
And I click on "X" "link" in the ".entrybox" "css_element"
And I should not see "Sweet cucumber"
And I should see "No entries found in this section"
@javascript
Scenario: Browse by category
When I select "Browse by category" from the "Browse the glossary using this index" singleselect
And I set the field "Categories" to "The ones I like"
Then I should see "Sweet cucumber"
And I should not see "Sour eggplants"
And I set the field "Categories" to "All for you"
And I should see "Sour eggplants"
And I should not see "Sweet cucumber"
@javascript
Scenario: Browse by date
When I select "Browse by date" from the "Browse the glossary using this index" singleselect
And I follow "By creation date"
Then "Delete entry: Eggplant" "link" should appear before "Delete entry: Cucumber" "link"
And I follow "By last update"
And I follow "By last update change to descending"
And "Delete entry: Cucumber" "link" should appear before "Delete entry: Eggplant" "link"
@javascript
Scenario: Browse by author
When I select "Browse by Author" from the "Browse the glossary using this index" singleselect
And I click on "T" "link" in the ".entrybox" "css_element"
Then I should see "Teacher 1"
And I should see "Sour eggplants"
And I should not see "Sweet cucumber"
And I click on "S" "link" in the ".entrybox" "css_element"
And I should see "Student 1"
And I should see "Sweet cucumber"
And I should not see "Sour eggplants"