Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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
    And the "glossary" filter is "on"
27
# Log in as a teacher and make sure nothing is yet autolinked
28
    When I am on the "Course 1" course page logged in as teacher1
29
    Then I should see "CategoryAutoLinks"
30
    And I should see "CategoryNoLinks"
31
    And "a.glossary.autolink" "css_element" should not exist
32
# Create, edit and delete categories
33
    And I am on the MyGlossary "glossary activity" page
34
    And I select "Browse by category" from the "Browse the glossary using this index" singleselect
35
    And I press "Edit categories"
36
    And I press "Add category"
37
    And I set the field "name" to "CategoryNoLinks"
38
    And I press "Save changes"
39
    And I should see "0 Entries" in the "CategoryNoLinks" "table_row"
40
    And I press "Add category"
41
    And I set the field "name" to "CategoryAutoLinks"
42
    And I set the field "usedynalink" to "Yes"
43
    And I press "Save changes"
44
    And I should see "0 Entries" in the "CategoryAutoLinks" "table_row"
45
    And I press "Add category"
46
    And I set the field "name" to "Category2"
47
    And I press "Save changes"
48
    And I click on "Edit" "link" in the "Category2" "table_row"
49
    And I set the field "name" to "Category3"
50
    And I press "Save changes"
51
    And I should see "Category3"
52
    And I should not see "Category2"
53
    And I click on "Delete" "link" in the "Category3" "table_row"
54
    And I press "No"
55
    And I should see "Category3"
56
    And I click on "Delete" "link" in the "Category3" "table_row"
57
    And I press "Yes"
58
    And I should not see "Category3"
59
    And I press "Back"
60
# Add glossary entries in categories and outside
61
    And I add a glossary entry with the following data:
62
      | Concept    | EntryNoCategory |
63
      | Definition | Definition      |
64
    And I add a glossary entry with the following data:
65
      | Concept    | EntryCategoryNL |
66
      | Definition | Definition      |
67
      | Categories | CategoryNoLinks |
68
    And I add a glossary entry with the following data:
69
      | Concept    | EntryCategoryAL   |
70
      | Definition | Definition        |
71
      | Categories | CategoryAutoLinks |
72
    And I press "Add entry"
73
    And I set the following fields to these values:
74
      | Concept    | EntryCategoryBoth                 |
75
      | Definition | Definition                        |
76
      | Categories | CategoryAutoLinks,CategoryNoLinks |
77
    And I press "Save changes"
78
# Make sure entries appear in their categories
79
    And I select "Browse by category" from the "Browse the glossary using this index" singleselect
80
    And "//h3[contains(.,'CATEGORYAUTOLINKS')]" "xpath_element" should appear before "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
81
    And "//h4[contains(.,'EntryCategoryAL')]" "xpath_element" should appear before "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
82
    And "(//h4[contains(.,'EntryCategoryBoth')])[1]" "xpath_element" should appear before "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
83
    And "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element" should appear before "(//h4[contains(.,'EntryCategoryBoth')])[2]" "xpath_element"
84
    And "//h4[contains(.,'EntryCategoryNL')]" "xpath_element" should appear after "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
85
    And I should not see "EntryNoCategory"
86
    And I set the field "hook" to "Not categorised"
87
    And I set the field "Categories" to "Not categorised"
88
    And I should see "EntryNoCategory"
89
    And I should not see "EntryCategoryNL"
90
    And I should not see "EntryCategoryAL"
91
    And I should not see "EntryCategoryBoth"
92
# Check that category is autolinked from the text in the course
93
    And I am on "Course 1" course homepage
94
    And I should see "CategoryAutoLinks"
95
    And I should see "CategoryAutoLinks" in the "a.glossary.autolink" "css_element"
96
    And I should see "CategoryNoLinks"
97
    And "//a[contains(.,'CategoryNoLinks')]" "xpath_element" should not exist
98
# Delete a category with entries
99
    And I am on the MyGlossary "glossary activity" page
100
    And I select "Browse by category" from the "Browse the glossary using this index" singleselect
101
    And I press "Edit categories"
102
    And I should see "2 Entries" in the "CategoryNoLinks" "table_row"
103
    And I should see "2 Entries" in the "CategoryAutoLinks" "table_row"
104
    And I click on "Delete" "link" in the "CategoryAutoLinks" "table_row"
105
    And I press "Yes"
106
    And I wait to be redirected
107
    And I am on the MyGlossary "glossary activity" page
108
    And I select "Browse by category" from the "Browse the glossary using this index" singleselect
109
    And I should see "EntryCategoryNL"
110
    And I should not see "EntryNoCategory"
111
    And I should not see "EntryCategoryAL"
112
    And I should see "EntryCategoryBoth"
113
    And I set the field "Categories" to "Not categorised"
114
    And I should see "EntryNoCategory"
115
    And I should see "EntryCategoryAL"
116
    And I should not see "EntryCategoryBoth"