mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 12:45:04 +01:00
Merge branch 'wip-MDL-44337-master' of git://github.com/marinaglancy/moodle
This commit is contained in:
commit
a8aa086bf9
122
mod/glossary/tests/behat/categories.feature
Normal file
122
mod/glossary/tests/behat/categories.feature
Normal file
@ -0,0 +1,122 @@
|
||||
@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" exists:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
And the following "courses" exists:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exists:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activities" exists:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| glossary | MyGlossary | Test glossary description | C1 | glossary1 |
|
||||
| label | name | check autolinking of CategoryAutoLinks and CategoryNoLinks text | C1 | label1 |
|
||||
# Log in as admin and enable autolinking filter
|
||||
And I log in as "admin"
|
||||
And I expand "Site administration" node
|
||||
And I expand "Plugins" node
|
||||
And I expand "Filters" node
|
||||
And I follow "Manage filters"
|
||||
And I click on "On" "option" in the "Glossary auto-linking" "table_row"
|
||||
And I log out
|
||||
# Log in as a teacher and make sure nothing is yet autolinked
|
||||
And I log in as "teacher1"
|
||||
When I follow "Course 1"
|
||||
Then I should see "CategoryAutoLinks"
|
||||
And I should see "CategoryNoLinks"
|
||||
And "a.glossary.autolink" "css_element" should not exists
|
||||
# Create, edit and delete categories
|
||||
And I follow "MyGlossary"
|
||||
And I follow "Browse by category"
|
||||
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 a new 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 follow "Browse by category"
|
||||
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')]" "xpath_element" should appear before "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
|
||||
And "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element" should appear before "//h4[contains(.,'EntryCategoryBoth')]" "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 click on "Not categorised" "option" in the "#catmenu select" "css_element"
|
||||
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 follow "Course 1"
|
||||
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 exists
|
||||
# Delete a category with entries
|
||||
And I follow "Course 1"
|
||||
And I follow "MyGlossary"
|
||||
And I follow "Browse by category"
|
||||
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 follow "Browse by category"
|
||||
And I should see "EntryCategoryNL"
|
||||
And I should not see "EntryNoCategory"
|
||||
And I should not see "EntryCategoryAL"
|
||||
And I should see "EntryCategoryBoth"
|
||||
And I click on "Not categorised" "option" in the "#catmenu select" "css_element"
|
||||
And I should see "EntryNoCategory"
|
||||
And I should see "EntryCategoryAL"
|
||||
And I should not see "EntryCategoryBoth"
|
||||
And I log out
|
Loading…
x
Reference in New Issue
Block a user