[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/mod/glossary/tests/behat/ -> categories.feature (source)

   1  @mod @mod_glossary
   2  Feature: Glossary entries can be organised in categories
   3    In order to organise glossary entries
   4    As a teacher
   5    I need to be able to create, edit and delete categories
   6  
   7    @javascript
   8    Scenario: Glossary entries can be organised in categories and categories can be autolinked
   9      Given the following "users" exist:
  10        | username | firstname | lastname | email |
  11        | teacher1 | Teacher | 1 | [email protected] |
  12        | student1 | Student | 1 | [email protected] |
  13      And the following "courses" exist:
  14        | fullname | shortname | category |
  15        | Course 1 | C1 | 0 |
  16      And the following "course enrolments" exist:
  17        | user | course | role |
  18        | teacher1 | C1 | editingteacher |
  19        | student1 | C1 | student |
  20      And the following "activities" exist:
  21        | activity | name       | intro                                                           | course | idnumber  |
  22        | glossary | MyGlossary | Test glossary description                                       | C1     | glossary1 |
  23        | label    | name       | check autolinking of CategoryAutoLinks and CategoryNoLinks text | C1     | label1    |
  24  # Log in as admin and enable autolinking filter
  25      And I log in as "admin"
  26      And I expand "Site administration" node
  27      And I expand "Plugins" node
  28      And I expand "Filters" node
  29      And I follow "Manage filters"
  30      And I click on "On" "option" in the "Glossary auto-linking" "table_row"
  31      And I log out
  32  # Log in as a teacher and make sure nothing is yet autolinked
  33      And I log in as "teacher1"
  34      When I follow "Course 1"
  35      Then I should see "CategoryAutoLinks"
  36      And I should see "CategoryNoLinks"
  37      And "a.glossary.autolink" "css_element" should not exist
  38  # Create, edit and delete categories
  39      And I follow "MyGlossary"
  40      And I follow "Browse by category"
  41      And I press "Edit categories"
  42      And I press "Add Category"
  43      And I set the field "name" to "CategoryNoLinks"
  44      And I press "Save changes"
  45      And I should see "0 Entries" in the "CategoryNoLinks" "table_row"
  46      And I press "Add Category"
  47      And I set the field "name" to "CategoryAutoLinks"
  48      And I set the field "usedynalink" to "Yes"
  49      And I press "Save changes"
  50      And I should see "0 Entries" in the "CategoryAutoLinks" "table_row"
  51      And I press "Add Category"
  52      And I set the field "name" to "Category2"
  53      And I press "Save changes"
  54      And I click on "Edit" "link" in the "Category2" "table_row"
  55      And I set the field "name" to "Category3"
  56      And I press "Save changes"
  57      And I should see "Category3"
  58      And I should not see "Category2"
  59      And I click on "Delete" "link" in the "Category3" "table_row"
  60      And I press "No"
  61      And I should see "Category3"
  62      And I click on "Delete" "link" in the "Category3" "table_row"
  63      And I press "Yes"
  64      And I should not see "Category3"
  65      And I press "Back"
  66  # Add glossary entries in categories and outside
  67      And I add a glossary entry with the following data:
  68        | Concept    | EntryNoCategory |
  69        | Definition | Definition      |
  70      And I add a glossary entry with the following data:
  71        | Concept    | EntryCategoryNL |
  72        | Definition | Definition      |
  73        | Categories | CategoryNoLinks |
  74      And I add a glossary entry with the following data:
  75        | Concept    | EntryCategoryAL   |
  76        | Definition | Definition        |
  77        | Categories | CategoryAutoLinks |
  78      And I press "Add a new entry"
  79      And I set the following fields to these values:
  80        | Concept    | EntryCategoryBoth                 |
  81        | Definition | Definition                        |
  82        | Categories | CategoryAutoLinks,CategoryNoLinks |
  83      And I press "Save changes"
  84  # Make sure entries appear in their categories
  85      And I follow "Browse by category"
  86      And "//h3[contains(.,'CATEGORYAUTOLINKS')]" "xpath_element" should appear before "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
  87      And "//h4[contains(.,'EntryCategoryAL')]" "xpath_element" should appear before "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
  88      And "//h4[contains(.,'EntryCategoryBoth')]" "xpath_element" should appear before "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
  89      And "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element" should appear before "//h4[contains(.,'EntryCategoryBoth')]" "xpath_element"
  90      And "//h4[contains(.,'EntryCategoryNL')]" "xpath_element" should appear after "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
  91      And I should not see "EntryNoCategory"
  92      And I set the field "hook" to "Not categorised"
  93      And I click on "Not categorised" "option" in the "#catmenu select" "css_element"
  94      And I should see "EntryNoCategory"
  95      And I should not see "EntryCategoryNL"
  96      And I should not see "EntryCategoryAL"
  97      And I should not see "EntryCategoryBoth"
  98  # Check that category is autolinked from the text in the course
  99      And I follow "Course 1"
 100      And I should see "CategoryAutoLinks"
 101      And I should see "CategoryAutoLinks" in the "a.glossary.autolink" "css_element"
 102      And I should see "CategoryNoLinks"
 103      And "//a[contains(.,'CategoryNoLinks')]" "xpath_element" should not exist
 104  # Delete a category with entries
 105      And I follow "Course 1"
 106      And I follow "MyGlossary"
 107      And I follow "Browse by category"
 108      And I press "Edit categories"
 109      And I should see "2 Entries" in the "CategoryNoLinks" "table_row"
 110      And I should see "2 Entries" in the "CategoryAutoLinks" "table_row"
 111      And I click on "Delete" "link" in the "CategoryAutoLinks" "table_row"
 112      And I press "Yes"
 113      And I follow "Browse by category"
 114      And I should see "EntryCategoryNL"
 115      And I should not see "EntryNoCategory"
 116      And I should not see "EntryCategoryAL"
 117      And I should see "EntryCategoryBoth"
 118      And I click on "Not categorised" "option" in the "#catmenu select" "css_element"
 119      And I should see "EntryNoCategory"
 120      And I should see "EntryCategoryAL"
 121      And I should not see "EntryCategoryBoth"
 122      And I log out


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1