From df1ff55d7aade6a2dc7d4835fe1a079c5f42f428 Mon Sep 17 00:00:00 2001 From: David Monllao Date: Thu, 14 Mar 2013 15:58:16 +0800 Subject: [PATCH] MDL-38482 behat: Steps definitions for course management - To access the course management page - To create a course based in a table --- course/tests/behat/behat_course.php | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/course/tests/behat/behat_course.php b/course/tests/behat/behat_course.php index d7157fb3438..71a59b901f6 100644 --- a/course/tests/behat/behat_course.php +++ b/course/tests/behat/behat_course.php @@ -58,6 +58,36 @@ class behat_course extends behat_base { return new Given('I press "Turn editing off"'); } + /** + * Creates a new course with the provided table data matching course settings names with the desired values. + * + * @Given /^I create a course with:$/ + * @param TableNode $table The course data + */ + public function i_create_a_course_with(TableNode $table) { + return array( + new Given('I go to the courses management page'), + new Given('I press "Add a new course"'), + new Given('I fill the moodle form with:', $table), + new Given('I press "Save changes"') + ); + } + + /** + * Goes to the system courses/categories management page. + * + * @Given /^I go to the courses management page$/ + */ + public function i_go_to_the_courses_management_page() { + + return array( + new Given('I am on homepage'), + new Given('I expand "Site administration" node'), + new Given('I expand "Courses" node'), + new Given('I follow "Add/edit courses"'), + ); + } + /** * Adds the selected activity/resource filling the form data with the specified field/value pairs. *