diff --git a/admin/tests/behat/behat_admin.php b/admin/tests/behat/behat_admin.php index 6b4f88f69ae..91afdcf7e7a 100644 --- a/admin/tests/behat/behat_admin.php +++ b/admin/tests/behat/behat_admin.php @@ -28,7 +28,8 @@ require_once(__DIR__ . '/../../../lib/behat/behat_base.php'); require_once(__DIR__ . '/../../../lib/behat/behat_field_manager.php'); -use Behat\Gherkin\Node\TableNode as TableNode, +use Behat\Behat\Context\Step\Given as Given, + Behat\Gherkin\Node\TableNode as TableNode, Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException; /** @@ -110,4 +111,23 @@ class behat_admin extends behat_base { $this->getSession()->wait($timeout, $javascript); } } + + /** + * Goes to notification page ensuring site admin navigation is loaded. + * + * @Given /^I go to notifications page$/ + * @return Given[] + */ + public function i_go_to_notifications_page() { + if ($this->running_javascript()) { + return array( + new Given('I expand "' . get_string('administrationsite') . '" node'), + new Given('I follow "' . get_string('notifications') . '"') + ); + } else { + return array( + new Given('I follow "' . get_string('administrationsite') . '"') + ); + } + } } diff --git a/admin/tests/behat/display_short_names.feature b/admin/tests/behat/display_short_names.feature index f17f092191f..86231b27460 100644 --- a/admin/tests/behat/display_short_names.feature +++ b/admin/tests/behat/display_short_names.feature @@ -15,7 +15,8 @@ Feature: Display extended course names And I should not see "C_shortname Course fullname" Scenario: Courses list with extended course names - Given I click on "Courses" "link" in the "//div[@id='settingsnav']/descendant::li[contains(concat(' ', normalize-space(@class), ' '), ' type_setting ')][not(contains(., 'Site administration'))][contains(., 'Appearance')]" "xpath_element" + Given I go to notifications page + And I click on "Courses" "link" in the "//div[@id='settingsnav']/descendant::li[contains(concat(' ', normalize-space(@class), ' '), ' type_setting ')][contains(., 'Appearance')]" "xpath_element" And I check "Display extended course names" When I press "Save changes" And I am on homepage diff --git a/course/tests/behat/behat_course.php b/course/tests/behat/behat_course.php index f42eaff2257..af9ce1e4db2 100644 --- a/course/tests/behat/behat_course.php +++ b/course/tests/behat/behat_course.php @@ -85,13 +85,14 @@ class behat_course extends behat_base { * @return Given[] */ public function i_go_to_the_courses_management_page() { - - return array( - new Given('I am on homepage'), - new Given('I expand "' . get_string('administrationsite') . '" node'), - new Given('I expand "' . get_string('courses', 'admin') . '" node'), - new Given('I follow "' . get_string('coursemgmt', 'admin') . '"'), - ); + if ($this->running_javascript()) { + $scenario = array(new Given('I expand "' . get_string('administrationsite') . '" node')); + } else { + $scenario = array(new Given('I follow "' . get_string('administrationsite') . '"')); + } + $scenario[] = new Given('I expand "' . get_string('courses', 'admin') . '" node'); + $scenario[] = new Given('I follow "' . get_string('coursemgmt', 'admin') . '"'); + return $scenario; } /** diff --git a/mod/forum/tests/behat/edit_post_student.feature b/mod/forum/tests/behat/edit_post_student.feature index 4b3afcd72a7..0f4aa79ad12 100644 --- a/mod/forum/tests/behat/edit_post_student.feature +++ b/mod/forum/tests/behat/edit_post_student.feature @@ -15,7 +15,7 @@ Feature: Students can edit or delete their forum posts within a set time limit | user | course | role | | student1 | C1 | student | And I log in as "admin" - And I expand "Site administration" node + And I go to notifications page And I expand "Security" node And I follow "Site policies" And I select "1 minutes" from "Maximum time to edit posts"