Merge branch 'MDL-38940_master' of git://github.com/dmonllao/moodle

This commit is contained in:
Eloy Lafuente (stronk7)
2013-04-11 16:11:40 +02:00
2 changed files with 106 additions and 2 deletions
@@ -28,8 +28,7 @@
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
use Behat\Behat\Context\Step\Given as Given,
Behat\Gherkin\Node\TableNode as TableNode,
Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException;
Behat\Gherkin\Node\TableNode as TableNode;
/**
* Glossary-related steps definitions.
@@ -55,4 +54,21 @@ class behat_mod_glossary extends behat_base {
);
}
/**
* Adds a category with the specified name to the current glossary. You need to be in the glossary page.
*
* @Given /^I add a glossary entries category named "(?P<category_name_string>(?:[^"]|\\")*)"$/
* @param string $categoryname Category name
*/
public function i_add_a_glossary_entries_category_named($categoryname) {
return array(
new Given('I follow "' . get_string('categoryview', 'mod_glossary') . '"'),
new Given('I press "' . get_string('editcategories', 'mod_glossary') . '"'),
new Given('I press "Add Category"'),
new Given('I fill in "name" with "' . $categoryname . '"'),
new Given('I press "' . get_string('savechanges') . '"'),
new Given('I press "' . get_string('back', 'mod_glossary') . '"')
);
}
}
@@ -0,0 +1,88 @@
@mod_glossary @mod
Feature: Glossary entries can be searched or browsed by alphabet, category, date or author
In order to find entries in a glossary
As a moodle user
I need to search the entries list by keyword, alphabet, category, date and author
Background:
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 I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "Glossary" to section "1" and I fill the form with:
| Name | Test glossary name |
| Description | Test glossary description |
And I follow "Test glossary name"
And I add a glossary entries category named "The ones I like"
And I add a glossary entries category named "All for you"
And I add a glossary entry with the following data:
| Concept | Eggplant |
| Definition | Sour eggplants |
| Categories | All for you |
And I log out
And I log in as "student1"
And I follow "Course 1"
And I follow "Test glossary name"
And I add a glossary entry with the following data:
| Concept | Cucumber |
| Definition | Sweet cucumber |
| Categories | The ones I like |
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Test glossary name"
@javascript
Scenario: Search by keyword and browse by alphabet
When I fill in "hook" with "cucumber"
And I press "Search"
Then I should see "Sweet cucumber"
And I should see "Search: cucumber"
And I follow "Browse by alphabet"
And I click on "E" "link" in the ".entrybox" "css_element"
And I should see "Sour eggplants"
And I should not see "Sweet cucumber"
And I click on "X" "link" in the ".entrybox" "css_element"
And I should not see "Sweet cucumber"
And I should see "No entries found in this section"
@javascript
Scenario: Browse by category
When I follow "Browse by category"
And I select "The ones I like" from "Categories"
Then I should see "Sweet cucumber"
And I should not see "Sour eggplants"
And I select "All for you" from "Categories"
And I should see "Sour eggplants"
And I should not see "Sweet cucumber"
@javascript
Scenario: Browse by date
When I follow "Browse by date"
And I follow "By creation date"
Then "Delete: Eggplant" "link" should appear before "Delete: Cucumber" "link"
And I follow "By last update"
And I follow "By last update change to descending"
And "Delete: Cucumber" "link" should appear before "Delete: Eggplant" "link"
@javascript
Scenario: Browse by author
When I follow "Browse by Author"
And I click on "T" "link" in the ".entrybox" "css_element"
Then I should see "Teacher 1"
And I should see "Sour eggplants"
And I should not see "Sweet cucumber"
And I click on "S" "link" in the ".entrybox" "css_element"
And I should see "Student 1"
And I should see "Sweet cucumber"
And I should not see "Sour eggplants"