From f7040fef9144d051bdc8f2844fea6f62a711d2ee Mon Sep 17 00:00:00 2001 From: David Monllao Date: Thu, 11 Apr 2013 10:46:11 +0800 Subject: [PATCH] MDL-38940 behat: Step definition to create glossary categories --- .../tests/behat/behat_mod_glossary.php | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/mod/glossary/tests/behat/behat_mod_glossary.php b/mod/glossary/tests/behat/behat_mod_glossary.php index 4d272685cab..a692634dfd4 100644 --- a/mod/glossary/tests/behat/behat_mod_glossary.php +++ b/mod/glossary/tests/behat/behat_mod_glossary.php @@ -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(?:[^"]|\\")*)"$/ + * @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') . '"') + ); + } }