MDL-71914 mod_glossary: Updated glossary behat tests

This commit is contained in:
Peter Dias 2021-07-28 11:33:24 +08:00
parent 57220ca4e3
commit f3ee54ae04
12 changed files with 28 additions and 28 deletions

View File

@ -100,7 +100,7 @@ Feature: Random glossary entry block is used in a course
And I am on "Course 1" course homepage
And I should see "There are no entries yet in the chosen glossary" in the "ManualGlossaryblock" "block"
And I follow "GlossaryManual"
And I follow "Waiting approval"
And I follow "Pending approval"
And I follow "Approve"
And I click on "Course 1" "link" in the "#page-navbar" "css_element"
And I should see "Concept1" in the "ManualGlossaryblock" "block"

View File

@ -30,7 +30,7 @@ Feature: Random glossary entry block linking to global glossary
When I log in as "admin"
And I am on "Course 2" course homepage
And I follow "Tips and Tricks"
And I press "Add a new entry"
And I press "Add entry"
And I set the following fields to these values:
| Concept | Never come late |
| Definition | Come in time for your classes |

View File

@ -26,7 +26,7 @@ Feature: Using the glossary activities which support point scale
@javascript
Scenario: Glossary rescale grade should not be possible when users are graded
Given I am on the "Test glossary name" "glossary activity" page logged in as student1
And I press "Add a new entry"
And I press "Add entry"
And I set the following fields to these values:
| Concept | Testing score |
| Definition | Scoring high on tests |

View File

@ -46,7 +46,7 @@ class behat_mod_glossary extends behat_base {
* @param TableNode $data
*/
public function i_add_a_glossary_entry_with_the_following_data(TableNode $data) {
$this->execute("behat_forms::press_button", get_string('addentry', 'mod_glossary'));
$this->execute("behat_forms::press_button", get_string('addsingleentry', 'mod_glossary'));
$this->execute("behat_forms::i_set_the_following_fields_to_these_values", $data);
@ -60,9 +60,11 @@ class behat_mod_glossary extends behat_base {
* @param string $categoryname Category name
*/
public function i_add_a_glossary_entries_category_named($categoryname) {
$this->execute("behat_navigation::go_to_breadcrumb_location", get_string('categoryview', 'mod_glossary'));
$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'));

View File

@ -31,7 +31,7 @@ Feature: Glossary entries can be organised in categories
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 follow "Browse by category"
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"
@ -69,14 +69,14 @@ Feature: Glossary entries can be organised in categories
| Concept | EntryCategoryAL |
| Definition | Definition |
| Categories | CategoryAutoLinks |
And I press "Add a new entry"
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 follow "Browse by category"
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"
@ -97,7 +97,7 @@ Feature: Glossary entries can be organised in categories
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 follow "Browse by category"
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"
@ -105,7 +105,7 @@ Feature: Glossary entries can be organised in categories
And I press "Yes"
And I wait to be redirected
And I am on the MyGlossary "glossary activity" page
And I follow "Browse by category"
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"

View File

@ -24,7 +24,7 @@ Feature: Edited glossary entries handle tags correctly
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 a new entry"
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 |
@ -49,7 +49,7 @@ Feature: Edited glossary entries handle tags correctly
And I press "Continue"
And I log out
Given I am on the "Test glossary" "glossary activity" page logged in as teacher1
And I press "Add a new entry"
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"

View File

@ -40,7 +40,7 @@ Feature: A teacher can choose whether glossary entries require approval
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 "Waiting approval"
And I follow "Pending approval"
Then I should see "(this entry is currently hidden)"
And I follow "Approve"
And I am on the "Test glossary name" "glossary activity" page

View File

@ -47,7 +47,7 @@ Feature: View activity completion in the glossary activity
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 a new entry"
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 |

View File

@ -65,7 +65,7 @@ Feature: Pass grade completion in the glossary activity
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 a new entry"
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 |
@ -93,7 +93,7 @@ Feature: Pass grade completion in the glossary activity
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 a new entry"
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 |

View File

@ -25,7 +25,7 @@ Feature: A teacher can choose whether to allow duplicate entries in a glossary
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 a new entry"
When I press "Add entry"
And I set the following fields to these values:
| Concept | Unique concept |
| Definition | There is no definition restriction |

View File

@ -29,10 +29,9 @@ Feature: A teacher can choose whether to provide a printer-friendly glossary ent
When I add a glossary entry with the following data:
| Concept | Just a test concept |
| Definition | Concept definition |
Then "Printer-friendly version" "link" should exist
And "//*[contains(concat(' ', normalize-space(@class), ' '), ' printicon ')][contains(@href, 'print.php')]" "xpath_element" should exist
And I follow "Printer-friendly version"
And I should see "Just a test concept"
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
@ -46,5 +45,4 @@ Feature: A teacher can choose whether to provide a printer-friendly glossary ent
When I add a glossary entry with the following data:
| Concept | Just a test concept |
| Definition | Concept definition |
Then "Printer-friendly version" "link" should not exist
And "//*[contains(concat(' ', normalize-space(@class), ' '), ' printicon ')][contains(@href, 'print.php')]" "xpath_element" should not exist
And "//select[contains(concat(' ', normalize-space(@class), ' '), ' urlselect ')]" "xpath_element" should not exist

View File

@ -50,7 +50,7 @@ Feature: Glossary entries can be searched or browsed by alphabet, category, date
@javascript
Scenario: Browse by category
When I follow "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"
@ -60,7 +60,7 @@ Feature: Glossary entries can be searched or browsed by alphabet, category, date
@javascript
Scenario: Browse by date
When I follow "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"
@ -69,7 +69,7 @@ Feature: Glossary entries can be searched or browsed by alphabet, category, date
@javascript
Scenario: Browse by author
When I follow "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"