[ Index ]

PHP Cross Reference of Unnamed Project

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


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1