From a1e81b8d3d4866ea78e8b6ca692252c77b969c9b Mon Sep 17 00:00:00 2001 From: David Monllao Date: Mon, 24 Feb 2014 13:35:46 +0800 Subject: [PATCH 1/5] MDL-44440 behat: Log out compatible with clean .navbar needs to be clicked before following log in or log out links. --- auth/tests/behat/behat_auth.php | 59 +++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/auth/tests/behat/behat_auth.php b/auth/tests/behat/behat_auth.php index e0d623807335f..9ac8d1571dd50 100644 --- a/auth/tests/behat/behat_auth.php +++ b/auth/tests/behat/behat_auth.php @@ -69,8 +69,49 @@ public function i_log_in_as($username) { // Wait for the homepage to be ready. $this->getSession()->wait(self::TIMEOUT * 1000, self::PAGE_READY_JS); + // If it is needed, it expands the navigation bar with the 'Log in' link. + if ($clicknavbar = $this->get_expand_navbar_step()) { + array_unshift($steps, $clicknavbar); + } + + return $steps; + } + + /** + * Logs out of the system. + * + * @Given /^I log out$/ + */ + public function i_log_out() { + + $steps = array(new When('I follow "' . get_string('logout') . '"')); + + // No need to check anything else if we run without JS. + if (!$this->running_javascript()) { + return $steps; + } + + // If it is needed, it expands the navigation bar with the 'Log out' link. + if ($clicknavbar = $this->get_expand_navbar_step()) { + array_unshift($steps, $clicknavbar); + } + + return $steps; + } + + /** + * Returns a step to open the navigation bar if it is needed. + * + * The top log in and log out links are hidden when middle or small + * size windows (or devices) are used. This step returns a step definition + * clicking to expand the navbar if it is hidden. + * + * @return Given|bool A step definition or false if there is no need to show the navbar. + */ + protected function get_expand_navbar_step() { + // Checking if we need to click the navbar button to show the navigation menu, it - // is hidden by default when using clean theme and a medium or small size screen size. + // is hidden by default when using clean theme and a medium or small screen size. // The DOM and the JS should be all ready and loaded. Running without spinning // as this is a widely used step and we can not spend time here trying to see @@ -82,20 +123,10 @@ public function i_log_in_as($username) { )"; // Adding an extra click we need to show the 'Log in' link. - if ($this->getSession()->getDriver()->evaluateScript($navbuttonjs)) { - array_unshift($steps, new Given('I click on ".btn-navbar" "css_element"')); + if (!$this->getSession()->getDriver()->evaluateScript($navbuttonjs)) { + return false; } - return $steps; - } - - /** - * Logs out of the system. - * - * @Given /^I log out$/ - */ - public function i_log_out() { - return new When('I follow "' . get_string('logout') . '"'); + return new Given('I click on ".btn-navbar" "css_element"'); } - } From 26fb3f5b71fb95ffd9a4fad3e15e4228e102ac7c Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Thu, 13 Feb 2014 14:27:44 +0800 Subject: [PATCH 2/5] MDL-44440 navigation: Added behat step to navigate from navigation/Admin block This step will help navigate to different parts of moodle using navigation or adminstration block. --- lib/tests/behat/behat_navigation.php | 124 +++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) diff --git a/lib/tests/behat/behat_navigation.php b/lib/tests/behat/behat_navigation.php index 7807f3746b775..8de69a411afbf 100644 --- a/lib/tests/behat/behat_navigation.php +++ b/lib/tests/behat/behat_navigation.php @@ -111,4 +111,128 @@ public function i_collapse_node($nodetext) { $node = $this->find('xpath', $xpath, $exception); $node->click(); } + + /** + * Helper function to get top navigation node in tree. + * + * @param string $nodetext name of top navigation node in tree. + * @param NodeElement $blocknode Block node in which to find node. + * @return NodeElement + * @throws ExpectationException if note not found. + */ + protected function get_top_navigation_node($nodetext) { + // Avoid problems with quotes. + $nodetextliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($nodetext); + $exception = new ExpectationException('Top navigation node "' . $nodetext . ' not found in "', $this->getSession()); + + // First find in navigation block. + $xpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' content ')]" . + "/ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" . + "/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . + "/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . + "[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . + "/span[normalize-space(.)=" . $nodetextliteral ."]]" . + "|" . + "//div[contains(concat(' ', normalize-space(@class), ' '), ' content ')]/div" . + "/ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" . + "/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . + "/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . + "[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . + "/span[normalize-space(.)=" . $nodetextliteral ."]]" . + "|" . + "//div[contains(concat(' ', normalize-space(@class), ' '), ' content ')]/div" . + "/ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" . + "/li[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . + "/span[normalize-space(.)=" . $nodetextliteral ."]]"; + $node = $this->find('xpath', $xpath, $exception); + + return $node; + } + + /** + * Helper function to get sub-navigation node. + * + * @param string $nodetext node to find. + * @param NodeElement $parentnode parent navigation node. + * @return NodeElement. + * @throws ExpectationException if note not found. + */ + protected function get_navigation_node($nodetext, $parentnode = null) { + // Avoid problems with quotes. + $nodetextliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($nodetext); + + $xpath = "/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . + "[child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . + "/child::span[normalize-space(.)=" . $nodetextliteral ."]]"; + $node = $parentnode->find('xpath', $xpath); + if (!$node) { + $xpath = "/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . + "[child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . + "/child::a[normalize-space(.)=" . $nodetextliteral ."]]"; + $node = $parentnode->find('xpath', $xpath); + } + + if (!$node) { + throw new ExpectationException('Sub-navigation node "' . $nodetext . ' not found under "' . $parentnode->getText() . + '" block', $this->getSession()); + } + return $node; + } + + /** + * Click link in navigation tree that matches the text in parentnode/s (comma seperated if more then one) + * @Given /^I navigate to "(?P(?:[^"]|\\")*)" node in "(?P(?:[^"]|\\")*)"$/ + * + * @throws ExpectationException + * @param string $nodetext navigation node to click. + * @param string $parentnodes comma seperated list of parent nodes. + * @param strin $blockname name of the block. + */ + public function i_navigate_to_node_in($nodetext, $parentnodes) { + // Create array of all parentnodes. + $parentnodes = explode(',', $parentnodes); + $countparentnode = count($parentnodes); + + // Expand first node, and get it. + $node = $this->get_top_navigation_node($parentnodes[0]); + + // Expand parent, sub-parent nodes in navigation if js enabled. + if ($node->hasClass('collapsed') || ($node->hasAttribute('data-loaded') && $node->getAttribute('data-loaded') == 0)) { + $xpath = "/p[contains(concat(' ', normalize-space(@class), ' '), ' tree_item ')]/span"; + $nodetoexpand = $node->find('xpath', $xpath); + $this->ensure_node_is_visible($nodetoexpand); + $nodetoexpand->click(); + } + + // If sub-parent nodes then get to the last one. + if ($countparentnode > 1) { + for ($i = 1; $i < $countparentnode; $i++) { + $node = $this->get_navigation_node($parentnodes[$i], $node); + + // Keep expanding all sub-parents if js enabled. + if ($this->running_javascript()) { + $xpath = "/p[contains(concat(' ', normalize-space(@class), ' '), ' tree_item ')]"; + if ($node->hasClass('collapsed')) { + $nodetoexpand = $node->find('xpath', $xpath); + $this->ensure_node_is_visible($nodetoexpand); + $nodetoexpand->click(); + } + } + } + } + + // Finally, click on requested node under navigation. + $nodetextliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($nodetext); + $xpath = "/ul/li/p[contains(concat(' ', normalize-space(@class), ' '), ' tree_item ')]" . + "/a[normalize-space(.)=" . $nodetextliteral . "]"; + $node = $node->find('xpath', $xpath); + + // Throw exxeption if no node found. + if (!$node) { + throw new ExpectationException('Navigation node "' . $nodetext . ' not found under "' . $parentnodes . + '" block', $this->getSession()); + } + $this->ensure_node_is_visible($node); + $node->click(); + } } From 370e88d4fe4814f300382c46e014cb4efa3d125b Mon Sep 17 00:00:00 2001 From: David Monllao Date: Mon, 24 Feb 2014 18:14:57 +0800 Subject: [PATCH 3/5] MDL-44440 behat: Other fixes to make clean work properly - Update the step to follow links inside a treeview to work also when JS is disabled. - Make regions accept header and footer. - Change some locators refering to non-clean compatible regions. - Restricting click to the table row in forum tracking because seems to conflict with the navigation bar when using narrow window sizes. --- .../behat/tests/behat/basic_actions.feature | 4 ++-- .../tests/behat/manipulate_forms.feature | 3 +-- .../behat/tests/behat/nasty_strings.feature | 3 +-- auth/tests/behat/login.feature | 8 +++---- lib/behat/classes/behat_selectors.php | 2 +- lib/tests/behat/behat_navigation.php | 21 +++++++++++++------ .../tests/behat/track_read_posts.feature | 4 ++-- .../upload/tests/behat/upload_file.feature | 3 +-- 8 files changed, 27 insertions(+), 21 deletions(-) diff --git a/admin/tool/behat/tests/behat/basic_actions.feature b/admin/tool/behat/tests/behat/basic_actions.feature index 4f482dc6cb737..36f28a8a2e522 100644 --- a/admin/tool/behat/tests/behat/basic_actions.feature +++ b/admin/tool/behat/tests/behat/basic_actions.feature @@ -40,7 +40,7 @@ Feature: Page contents assertions And I log in as "admin" And I follow "Course 1" When I dock "Administration" block - Then I should not see "Question bank" in the "region-pre" "region" + Then I should not see "Question bank" in the ".block-region" "css_element" And I click on "//div[@id='dock']/descendant::h2[normalize-space(.)='Administration']" "xpath_element" @javascript @@ -50,4 +50,4 @@ Feature: Page contents assertions | Course 1 | C1 | 0 | And I log in as "admin" When I dock "Administration" block - Then I should not see "Turn editing on" in the "region-pre" "region" + Then I should not see "Turn editing on" in the ".block-region" "css_element" diff --git a/admin/tool/behat/tests/behat/manipulate_forms.feature b/admin/tool/behat/tests/behat/manipulate_forms.feature index ce44fad1f34bf..c069a79e3f70a 100644 --- a/admin/tool/behat/tests/behat/manipulate_forms.feature +++ b/admin/tool/behat/tests/behat/manipulate_forms.feature @@ -7,8 +7,7 @@ Feature: Forms manipulation @javascript Scenario: Basic forms manipulation Given I log in as "admin" - And I follow "Admin User" - And I follow "Edit profile" + And I navigate to "Edit profile" node in "My profile settings" When I set the field "First name" to "Field value" And I set the field "Text editor" to "Plain text area" And I set the field "Unmask" to "1" diff --git a/admin/tool/behat/tests/behat/nasty_strings.feature b/admin/tool/behat/tests/behat/nasty_strings.feature index c67d6cd6c1395..cfdd9e763aafc 100644 --- a/admin/tool/behat/tests/behat/nasty_strings.feature +++ b/admin/tool/behat/tests/behat/nasty_strings.feature @@ -10,8 +10,7 @@ Feature: Transform steps arguments | fullname | shortname | category | | Course 1 | C1 | 0 | And I log in as "admin" - And I follow "Admin User" - And I follow "Edit profile" + And I navigate to "Edit profile" node in "My profile settings" Scenario: Use nasty strings on steps arguments When I set the field "Surname" to "$NASTYSTRING1" diff --git a/auth/tests/behat/login.feature b/auth/tests/behat/login.feature index eff7f6fb6b4e0..9ba4537d4c3d0 100644 --- a/auth/tests/behat/login.feature +++ b/auth/tests/behat/login.feature @@ -6,12 +6,12 @@ Feature: Authentication Scenario: Log in with the predefined admin user with Javascript disabled Given I log in as "admin" - Then I should see "You are logged in as Admin User" + Then I should see "You are logged in as Admin User" in the "page-footer" "region" @javascript Scenario: Log in with the predefined admin user with Javascript enabled Given I log in as "admin" - Then I should see "You are logged in as Admin User" + Then I should see "You are logged in as Admin User" in the "page-footer" "region" Scenario: Log in as an existing admin user filling the form Given the following "users" exists: @@ -22,7 +22,7 @@ Feature: Authentication And I set the field "Username" to "testuser" And I set the field "Password" to "testuser" And I press "Log in" - Then I should see "You are logged in as" + Then I should see "You are logged in as" in the "page-footer" "region" Scenario: Log in as an unexisting user filling the form Given the following "users" exists: @@ -38,4 +38,4 @@ Feature: Authentication Scenario: Log out Given I log in as "admin" When I log out - Then I should see "You are not logged in" + Then I should see "You are not logged in" in the "page-footer" "region" diff --git a/lib/behat/classes/behat_selectors.php b/lib/behat/classes/behat_selectors.php index 48688b077f574..d9d9246f60aa7 100644 --- a/lib/behat/classes/behat_selectors.php +++ b/lib/behat/classes/behat_selectors.php @@ -89,7 +89,7 @@ class behat_selectors { //div[contains(concat(' ', normalize-space(@class), ' '), concat(' ', %locator%, ' '))] | //div[contains(concat(' ', normalize-space(@class), ' '), ' block ')]/descendant::h2[normalize-space(.) = %locator%]/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' block ')] XPATH , 'region' => << <<hasClass('collapsed') || ($node->hasAttribute('data-loaded') && $node->getAttribute('data-loaded') == 0)) { $xpath = "/p[contains(concat(' ', normalize-space(@class), ' '), ' tree_item ')]/span"; $nodetoexpand = $node->find('xpath', $xpath); - $this->ensure_node_is_visible($nodetoexpand); - $nodetoexpand->click(); + + if ($this->running_javascript()) { + $this->ensure_node_is_visible($nodetoexpand); + $nodetoexpand->click(); + } } // If sub-parent nodes then get to the last one. @@ -214,8 +217,10 @@ public function i_navigate_to_node_in($nodetext, $parentnodes) { $xpath = "/p[contains(concat(' ', normalize-space(@class), ' '), ' tree_item ')]"; if ($node->hasClass('collapsed')) { $nodetoexpand = $node->find('xpath', $xpath); - $this->ensure_node_is_visible($nodetoexpand); - $nodetoexpand->click(); + if ($this->running_javascript()) { + $this->ensure_node_is_visible($nodetoexpand); + $nodetoexpand->click(); + } } } } @@ -227,12 +232,16 @@ public function i_navigate_to_node_in($nodetext, $parentnodes) { "/a[normalize-space(.)=" . $nodetextliteral . "]"; $node = $node->find('xpath', $xpath); - // Throw exxeption if no node found. + // Throw exception if no node found. if (!$node) { throw new ExpectationException('Navigation node "' . $nodetext . ' not found under "' . $parentnodes . '" block', $this->getSession()); } - $this->ensure_node_is_visible($node); + + if ($this->running_javascript()) { + $this->ensure_node_is_visible($node); + } + $node->click(); } } diff --git a/mod/forum/tests/behat/track_read_posts.feature b/mod/forum/tests/behat/track_read_posts.feature index da92f8605e316..ad871284e2587 100644 --- a/mod/forum/tests/behat/track_read_posts.feature +++ b/mod/forum/tests/behat/track_read_posts.feature @@ -59,7 +59,7 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos And I follow "Test forum name" And I follow "Track unread posts" And I wait to be redirected - And I follow "1" + And I click on "1" "link" in the "Admin User" "table_row" And I follow "Course 1" And I should not see "1 unread post" @@ -156,7 +156,7 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos And I follow "Test forum name" And I follow "Track unread posts" And I wait to be redirected - And I follow "1" + And I click on "1" "link" in the "Admin User" "table_row" And I follow "Course 1" And I should not see "1 unread post" diff --git a/repository/upload/tests/behat/upload_file.feature b/repository/upload/tests/behat/upload_file.feature index 4a932635b5f52..baf94253c93aa 100644 --- a/repository/upload/tests/behat/upload_file.feature +++ b/repository/upload/tests/behat/upload_file.feature @@ -10,8 +10,7 @@ Feature: Upload files | fullname | shortname | category | | Course 1 | C1 | 0 | And I log in as "admin" - And I follow "Admin User" - And I follow "My private files" + And I navigate to "My private files" node in "My profile" And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager Then I should see "1" elements in "Files" filemanager And I should see "empty.txt" in the "div.fp-content" "css_element" From a542553d425c03de8736bedbe1c68e0af0650fcf Mon Sep 17 00:00:00 2001 From: David Monllao Date: Tue, 4 Mar 2014 17:40:56 +0800 Subject: [PATCH 4/5] MDL-44440 behat: Refactoring features to use I navigate to Replacing multiple "I expand node" steps by the new "I navigate to". Also fixing few I navigate to when dealing with non-JS. --- admin/tests/behat/upload_users.feature | 6 +- .../tool/behat/tests/behat/list_steps.feature | 4 +- .../uploadcourse/tests/behat/create.feature | 4 +- .../uploadcourse/tests/behat/update.feature | 4 +- badges/tests/behat/award_badge.feature | 8 +- .../behat/block_activity_modules.feature | 5 +- blocks/tests/behat/manage_blocks.feature | 5 +- cohort/tests/behat/add_cohort.feature | 6 +- cohort/tests/behat/behat_cohort.php | 9 +- .../tests/behat/upload_cohort_users.feature | 6 +- lib/tests/behat/behat_navigation.php | 163 ++++++++++-------- lib/tests/behat/behat_permissions.php | 9 +- .../upload/tests/behat/upload_file.feature | 4 +- user/tests/behat/edituserpassword.feature | 5 +- 14 files changed, 114 insertions(+), 124 deletions(-) diff --git a/admin/tests/behat/upload_users.feature b/admin/tests/behat/upload_users.feature index d67085b329ce3..6c0cf64e30346 100644 --- a/admin/tests/behat/upload_users.feature +++ b/admin/tests/behat/upload_users.feature @@ -14,11 +14,7 @@ Feature: Upload users | Section 1 | math102 | S1 | | Section 3 | math102 | S3 | And I log in as "admin" - And I collapse "Front page settings" node - And I expand "Site administration" node - And I expand "Users" node - And I expand "Accounts" node - And I follow "Upload users" + And I navigate to "Upload users" node in "Site administration,Users,Accounts" When I upload "lib/tests/fixtures/upload_users.csv" file to "File" filemanager And I press "Upload users" Then I should see "Upload users preview" diff --git a/admin/tool/behat/tests/behat/list_steps.feature b/admin/tool/behat/tests/behat/list_steps.feature index 8061f4ed88cb9..2301c78701d20 100644 --- a/admin/tool/behat/tests/behat/list_steps.feature +++ b/admin/tool/behat/tests/behat/list_steps.feature @@ -7,9 +7,7 @@ Feature: List the system steps definitions Background: Given I am on homepage And I log in as "admin" - And I expand "Site administration" node - And I expand "Development" node - And I follow "Acceptance testing" + And I navigate to "Acceptance testing" node in "Site administration,Development" @javascript Scenario: Accessing the list diff --git a/admin/tool/uploadcourse/tests/behat/create.feature b/admin/tool/uploadcourse/tests/behat/create.feature index 60688091aad55..4692a9916fdf8 100644 --- a/admin/tool/uploadcourse/tests/behat/create.feature +++ b/admin/tool/uploadcourse/tests/behat/create.feature @@ -9,9 +9,7 @@ Feature: An admin can create courses using a CSV file | fullname | shortname | category | | First course | C1 | 0 | And I log in as "admin" - And I expand "Site administration" node - And I expand "Courses" node - And I follow "Upload courses" + And I navigate to "Upload courses" node in "Site administration,Courses" @javascript Scenario: Creation of unexisting courses diff --git a/admin/tool/uploadcourse/tests/behat/update.feature b/admin/tool/uploadcourse/tests/behat/update.feature index 4f115892406b3..bf16f5d81f65b 100644 --- a/admin/tool/uploadcourse/tests/behat/update.feature +++ b/admin/tool/uploadcourse/tests/behat/update.feature @@ -9,9 +9,7 @@ Feature: An admin can update courses using a CSV file | fullname | shortname | category | | Some random name | C1 | 0 | And I log in as "admin" - And I expand "Site administration" node - And I expand "Courses" node - And I follow "Upload courses" + And I navigate to "Upload courses" node in "Site administration,Courses" @javascript Scenario: Updating a course fullname diff --git a/badges/tests/behat/award_badge.feature b/badges/tests/behat/award_badge.feature index b6ac009ab00a9..01c05fa3086c7 100644 --- a/badges/tests/behat/award_badge.feature +++ b/badges/tests/behat/award_badge.feature @@ -7,9 +7,7 @@ Feature: Award badges @javascript Scenario: Award profile badge Given I log in as "admin" - And I expand "Site administration" node - And I expand "Badges" node - And I follow "Add a new badge" + And I navigate to "Add a new badge" node in "Site administration,Badges" And I set the following fields to these values: | Name | Profile Badge | | Description | Test badge description | @@ -44,9 +42,7 @@ Feature: Award badges | teacher | teacher | 1 | teacher1@asd.com | | student | student | 1 | student1@asd.com | And I log in as "admin" - And I expand "Site administration" node - And I expand "Badges" node - And I follow "Add a new badge" + And I navigate to "Add a new badge" node in "Site administration,Badges" And I set the following fields to these values: | Name | Site Badge | | Description | Site badge description | diff --git a/blocks/activity_modules/tests/behat/block_activity_modules.feature b/blocks/activity_modules/tests/behat/block_activity_modules.feature index 50df25fb6a6cf..6199d69859f3e 100644 --- a/blocks/activity_modules/tests/behat/block_activity_modules.feature +++ b/blocks/activity_modules/tests/behat/block_activity_modules.feature @@ -6,10 +6,7 @@ Feature: Block activity modules Background: Given I log in as "admin" - And I expand "Site administration" node - And I expand "Plugins" node - And I expand "Activity modules" node - And I follow "Manage activities" + And I navigate to "Manage activities" node in "Site administration,Plugins,Activity modules" And I click on "//a[@title=\"Show\"]" "xpath_element" in the "Feedback" "table_row" Scenario: Add activities block on the frontpage diff --git a/blocks/tests/behat/manage_blocks.feature b/blocks/tests/behat/manage_blocks.feature index 13e23be1bed08..542911f51280e 100644 --- a/blocks/tests/behat/manage_blocks.feature +++ b/blocks/tests/behat/manage_blocks.feature @@ -15,10 +15,7 @@ Feature: Block appearances | user | course | role | | teacher1 | C1 | editingteacher | And I log in as "admin" - And I expand "Site administration" node - And I expand "Appearance" node - And I expand "Themes" node - And I follow "Theme selector" + And I navigate to "Theme selector" node in "Site administration,Appearance,Themes" And I click on "Change theme" "button" in the "Default" "table_row" And I click on "Use theme" "button" in the "Afterburner" "table_row" And I press "Continue" diff --git a/cohort/tests/behat/add_cohort.feature b/cohort/tests/behat/add_cohort.feature index b490ef5504f98..5391230829e7d 100644 --- a/cohort/tests/behat/add_cohort.feature +++ b/cohort/tests/behat/add_cohort.feature @@ -12,11 +12,7 @@ Feature: Add cohorts of users | user3 | Third | User | third@user.com | | user4 | Forth | User | forth@user.com | And I log in as "admin" - And I collapse "Front page settings" node - And I expand "Site administration" node - And I expand "Users" node - And I expand "Accounts" node - And I follow "Cohorts" + And I navigate to "Cohorts" node in "Site administration,Users,Accounts" And I press "Add" And I set the following fields to these values: | Name | Test cohort name | diff --git a/cohort/tests/behat/behat_cohort.php b/cohort/tests/behat/behat_cohort.php index adeb88b3b7709..f41f57d5195ea 100644 --- a/cohort/tests/behat/behat_cohort.php +++ b/cohort/tests/behat/behat_cohort.php @@ -60,14 +60,13 @@ public function i_add_user_to_cohort_members($user, $cohortidnumber) { // With JS enabled we should expand a few tree nodes. if ($this->running_javascript()) { + $parentnodes = get_string('administrationsite') . ',' . + get_string('users', 'admin') . ',' . + get_string('accounts', 'admin'); $steps = array_merge( array( new Given('I am on homepage'), - new Given('I collapse "' . get_string('frontpagesettings', 'admin') . '" node'), - new Given('I expand "' . get_string('administrationsite') . '" node'), - new Given('I expand "' . get_string('users', 'admin') . '" node'), - new Given('I expand "' . get_string('accounts', 'admin') . '" node'), - new Given('I follow "' . get_string('cohorts', 'cohort') . '"') + new Given('I navigate to "' . get_string('cohorts', 'cohort') . '" node in "' . $parentnodes . '"') ), $steps ); diff --git a/cohort/tests/behat/upload_cohort_users.feature b/cohort/tests/behat/upload_cohort_users.feature index 22133290607c2..2d896b261256a 100644 --- a/cohort/tests/behat/upload_cohort_users.feature +++ b/cohort/tests/behat/upload_cohort_users.feature @@ -22,11 +22,7 @@ Feature: Upload users to a cohort And I follow "Course 2" And I add "Cohort sync" enrolment method with: | Cohort | Cohort 2 | - And I collapse "Course administration" node - And I expand "Site administration" node - And I expand "Users" node - And I expand "Accounts" node - When I follow "Upload users" + When I navigate to "Upload users" node in "Site administration,Users,Accounts" And I upload "lib/tests/fixtures/upload_users_cohorts.csv" file to "File" filemanager And I press "Upload users" And I press "Upload users" diff --git a/lib/tests/behat/behat_navigation.php b/lib/tests/behat/behat_navigation.php index 8600d0056bfb4..06c071436eaac 100644 --- a/lib/tests/behat/behat_navigation.php +++ b/lib/tests/behat/behat_navigation.php @@ -112,87 +112,37 @@ public function i_collapse_node($nodetext) { $node->click(); } - /** - * Helper function to get top navigation node in tree. - * - * @param string $nodetext name of top navigation node in tree. - * @param NodeElement $blocknode Block node in which to find node. - * @return NodeElement - * @throws ExpectationException if note not found. - */ - protected function get_top_navigation_node($nodetext) { - // Avoid problems with quotes. - $nodetextliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($nodetext); - $exception = new ExpectationException('Top navigation node "' . $nodetext . ' not found in "', $this->getSession()); - - // First find in navigation block. - $xpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' content ')]" . - "/ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" . - "/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . - "/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . - "[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . - "/span[normalize-space(.)=" . $nodetextliteral ."]]" . - "|" . - "//div[contains(concat(' ', normalize-space(@class), ' '), ' content ')]/div" . - "/ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" . - "/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . - "/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . - "[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . - "/span[normalize-space(.)=" . $nodetextliteral ."]]" . - "|" . - "//div[contains(concat(' ', normalize-space(@class), ' '), ' content ')]/div" . - "/ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" . - "/li[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . - "/span[normalize-space(.)=" . $nodetextliteral ."]]"; - $node = $this->find('xpath', $xpath, $exception); - - return $node; - } - - /** - * Helper function to get sub-navigation node. - * - * @param string $nodetext node to find. - * @param NodeElement $parentnode parent navigation node. - * @return NodeElement. - * @throws ExpectationException if note not found. - */ - protected function get_navigation_node($nodetext, $parentnode = null) { - // Avoid problems with quotes. - $nodetextliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($nodetext); - - $xpath = "/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . - "[child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . - "/child::span[normalize-space(.)=" . $nodetextliteral ."]]"; - $node = $parentnode->find('xpath', $xpath); - if (!$node) { - $xpath = "/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . - "[child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . - "/child::a[normalize-space(.)=" . $nodetextliteral ."]]"; - $node = $parentnode->find('xpath', $xpath); - } - - if (!$node) { - throw new ExpectationException('Sub-navigation node "' . $nodetext . ' not found under "' . $parentnode->getText() . - '" block', $this->getSession()); - } - return $node; - } - /** * Click link in navigation tree that matches the text in parentnode/s (comma seperated if more then one) + * * @Given /^I navigate to "(?P(?:[^"]|\\")*)" node in "(?P(?:[^"]|\\")*)"$/ * * @throws ExpectationException * @param string $nodetext navigation node to click. * @param string $parentnodes comma seperated list of parent nodes. - * @param strin $blockname name of the block. + * @return void */ public function i_navigate_to_node_in($nodetext, $parentnodes) { + + // Site admin is different and needs special treatment. + $siteadminstr = get_string('administrationsite'); + // Create array of all parentnodes. $parentnodes = explode(',', $parentnodes); $countparentnode = count($parentnodes); + // If JS is disabled and Site administration is not expanded we + // should follow it, so all the lower-level nodes are available. + if (!$this->running_javascript()) { + if ($parentnodes[0] === $siteadminstr) { + // We don't know if there if Site admin is already expanded so + // don't wait, it is non-JS and we already waited for the DOM. + if ($siteadminlink = $this->getSession()->getPage()->find('named', array('link', "'" . $siteadminstr . "'"))) { + $siteadminlink->click(); + } + } + } + // Expand first node, and get it. $node = $this->get_top_navigation_node($parentnodes[0]); @@ -204,6 +154,11 @@ public function i_navigate_to_node_in($nodetext, $parentnodes) { if ($this->running_javascript()) { $this->ensure_node_is_visible($nodetoexpand); $nodetoexpand->click(); + + // Site administration node needs to be expanded. + if ($parentnodes[0] === $siteadminstr) { + $this->getSession()->wait(self::TIMEOUT * 1000, self::PAGE_READY_JS); + } } } @@ -234,8 +189,8 @@ public function i_navigate_to_node_in($nodetext, $parentnodes) { // Throw exception if no node found. if (!$node) { - throw new ExpectationException('Navigation node "' . $nodetext . ' not found under "' . $parentnodes . - '" block', $this->getSession()); + throw new ExpectationException('Navigation node "' . $nodetext . '" not found under "' . + $parentnodes . '"', $this->getSession()); } if ($this->running_javascript()) { @@ -244,4 +199,72 @@ public function i_navigate_to_node_in($nodetext, $parentnodes) { $node->click(); } + + /** + * Helper function to get top navigation node in tree. + * + * @throws ExpectationException if note not found. + * @param string $nodetext name of top navigation node in tree. + * @return NodeElement + */ + protected function get_top_navigation_node($nodetext) { + + // Avoid problems with quotes. + $nodetextliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($nodetext); + $exception = new ExpectationException('Top navigation node "' . $nodetext . ' not found in "', $this->getSession()); + + // First find in navigation block. + $xpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' content ')]" . + "/ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" . + "/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . + "/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . + "[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . + "/span[normalize-space(.)=" . $nodetextliteral ."]]" . + "|" . + "//div[contains(concat(' ', normalize-space(@class), ' '), ' content ')]/div" . + "/ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" . + "/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . + "/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . + "[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . + "/span[normalize-space(.)=" . $nodetextliteral ."]]" . + "|" . + "//div[contains(concat(' ', normalize-space(@class), ' '), ' content ')]/div" . + "/ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" . + "/li[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . + "/span[normalize-space(.)=" . $nodetextliteral ."]]"; + $node = $this->find('xpath', $xpath, $exception); + + return $node; + } + + /** + * Helper function to get sub-navigation node. + * + * @throws ExpectationException if note not found. + * @param string $nodetext node to find. + * @param NodeElement $parentnode parent navigation node. + * @return NodeElement. + */ + protected function get_navigation_node($nodetext, $parentnode = null) { + + // Avoid problems with quotes. + $nodetextliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($nodetext); + + $xpath = "/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . + "[child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . + "/child::span[normalize-space(.)=" . $nodetextliteral ."]]"; + $node = $parentnode->find('xpath', $xpath); + if (!$node) { + $xpath = "/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . + "[child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . + "/child::a[normalize-space(.)=" . $nodetextliteral ."]]"; + $node = $parentnode->find('xpath', $xpath); + } + + if (!$node) { + throw new ExpectationException('Sub-navigation node "' . $nodetext . '" not found under "' . + $parentnode->getText() . '"', $this->getSession()); + } + return $node; + } } diff --git a/lib/tests/behat/behat_permissions.php b/lib/tests/behat/behat_permissions.php index 1e6fd98b2663c..c17b6ed93d40e 100644 --- a/lib/tests/behat/behat_permissions.php +++ b/lib/tests/behat/behat_permissions.php @@ -50,13 +50,12 @@ class behat_permissions extends behat_base { */ public function i_set_the_following_system_permissions_of_role($rolename, $table) { + $parentnodes = get_string('administrationsite') . ',' . + get_string('users', 'admin') . ',' . + get_string('permissions', 'role'); return array( new Given('I am on homepage'), - new Given('I collapse "' . get_string('frontpagesettings', 'admin') . '" node'), - new Given('I expand "' . get_string('administrationsite') . '" node'), - new Given('I expand "' . get_string('users', 'admin') . '" node'), - new Given('I expand "' . get_string('permissions', 'role') . '" node'), - new Given('I follow "' . get_string('defineroles', 'role') . '"'), + new Given('I navigate to "' . get_string('defineroles', 'role') . '" node in "' . $parentnodes . '"'), new Given('I follow "Edit ' . $this->escape($rolename) . ' role"'), new Given('I fill the capabilities form with the following permissions:', $table), new Given('I press "' . get_string('savechanges') . '"') diff --git a/repository/upload/tests/behat/upload_file.feature b/repository/upload/tests/behat/upload_file.feature index baf94253c93aa..3fb3d680e9931 100644 --- a/repository/upload/tests/behat/upload_file.feature +++ b/repository/upload/tests/behat/upload_file.feature @@ -10,11 +10,11 @@ Feature: Upload files | fullname | shortname | category | | Course 1 | C1 | 0 | And I log in as "admin" - And I navigate to "My private files" node in "My profile" + When I navigate to "My private files" node in "My profile" And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager Then I should see "1" elements in "Files" filemanager And I should see "empty.txt" in the "div.fp-content" "css_element" - When I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager as: + And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager as: | Save as | empty_copy.txt | Then I should see "2" elements in "Files" filemanager And I should see "empty.txt" diff --git a/user/tests/behat/edituserpassword.feature b/user/tests/behat/edituserpassword.feature index 8bff06662f068..0a3a0fe2815f0 100644 --- a/user/tests/behat/edituserpassword.feature +++ b/user/tests/behat/edituserpassword.feature @@ -8,10 +8,7 @@ Feature: Enable/disable password field based on authentication selected. Scenario: Verify the password field is enabled/disabled based on authentication selected, in user edit advanced page. Given I log in as "admin" And I follow "My home" - And I expand "Site administration" node - And I expand "Users" node - And I expand "Accounts" node - When I follow "Add a new user" + When I navigate to "Add a new user" node in "Site administration,Users,Accounts" Then the "newpassword" "field" should be enabled And I set the field "auth" to "Web services authentication" And the "newpassword" "field" should be disabled From 1f631c7c6335348e3781eab6c7ee7760ecd41721 Mon Sep 17 00:00:00 2001 From: David Monllao Date: Mon, 10 Mar 2014 13:31:01 +0800 Subject: [PATCH 5/5] MDL-44440 behat: Changing , for > as a navigation tree nodes separator Using greater than as seems a more natural separator than the comma when separating nodes which have a hierarchy relation. --- admin/tests/behat/upload_users.feature | 2 +- admin/tool/behat/tests/behat/list_steps.feature | 2 +- admin/tool/uploadcourse/tests/behat/create.feature | 2 +- admin/tool/uploadcourse/tests/behat/update.feature | 2 +- badges/tests/behat/award_badge.feature | 4 ++-- .../tests/behat/block_activity_modules.feature | 2 +- blocks/tests/behat/manage_blocks.feature | 2 +- cohort/tests/behat/add_cohort.feature | 2 +- cohort/tests/behat/behat_cohort.php | 4 ++-- cohort/tests/behat/upload_cohort_users.feature | 2 +- lib/tests/behat/behat_navigation.php | 4 ++-- lib/tests/behat/behat_permissions.php | 4 ++-- user/tests/behat/edituserpassword.feature | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/admin/tests/behat/upload_users.feature b/admin/tests/behat/upload_users.feature index 6c0cf64e30346..09ae81e555842 100644 --- a/admin/tests/behat/upload_users.feature +++ b/admin/tests/behat/upload_users.feature @@ -14,7 +14,7 @@ Feature: Upload users | Section 1 | math102 | S1 | | Section 3 | math102 | S3 | And I log in as "admin" - And I navigate to "Upload users" node in "Site administration,Users,Accounts" + And I navigate to "Upload users" node in "Site administration > Users > Accounts" When I upload "lib/tests/fixtures/upload_users.csv" file to "File" filemanager And I press "Upload users" Then I should see "Upload users preview" diff --git a/admin/tool/behat/tests/behat/list_steps.feature b/admin/tool/behat/tests/behat/list_steps.feature index 2301c78701d20..3e4d31e2434f2 100644 --- a/admin/tool/behat/tests/behat/list_steps.feature +++ b/admin/tool/behat/tests/behat/list_steps.feature @@ -7,7 +7,7 @@ Feature: List the system steps definitions Background: Given I am on homepage And I log in as "admin" - And I navigate to "Acceptance testing" node in "Site administration,Development" + And I navigate to "Acceptance testing" node in "Site administration > Development" @javascript Scenario: Accessing the list diff --git a/admin/tool/uploadcourse/tests/behat/create.feature b/admin/tool/uploadcourse/tests/behat/create.feature index 4692a9916fdf8..a348ee0d151b4 100644 --- a/admin/tool/uploadcourse/tests/behat/create.feature +++ b/admin/tool/uploadcourse/tests/behat/create.feature @@ -9,7 +9,7 @@ Feature: An admin can create courses using a CSV file | fullname | shortname | category | | First course | C1 | 0 | And I log in as "admin" - And I navigate to "Upload courses" node in "Site administration,Courses" + And I navigate to "Upload courses" node in "Site administration > Courses" @javascript Scenario: Creation of unexisting courses diff --git a/admin/tool/uploadcourse/tests/behat/update.feature b/admin/tool/uploadcourse/tests/behat/update.feature index bf16f5d81f65b..40a7783882abf 100644 --- a/admin/tool/uploadcourse/tests/behat/update.feature +++ b/admin/tool/uploadcourse/tests/behat/update.feature @@ -9,7 +9,7 @@ Feature: An admin can update courses using a CSV file | fullname | shortname | category | | Some random name | C1 | 0 | And I log in as "admin" - And I navigate to "Upload courses" node in "Site administration,Courses" + And I navigate to "Upload courses" node in "Site administration > Courses" @javascript Scenario: Updating a course fullname diff --git a/badges/tests/behat/award_badge.feature b/badges/tests/behat/award_badge.feature index 01c05fa3086c7..a23b682fc131f 100644 --- a/badges/tests/behat/award_badge.feature +++ b/badges/tests/behat/award_badge.feature @@ -7,7 +7,7 @@ Feature: Award badges @javascript Scenario: Award profile badge Given I log in as "admin" - And I navigate to "Add a new badge" node in "Site administration,Badges" + And I navigate to "Add a new badge" node in "Site administration > Badges" And I set the following fields to these values: | Name | Profile Badge | | Description | Test badge description | @@ -42,7 +42,7 @@ Feature: Award badges | teacher | teacher | 1 | teacher1@asd.com | | student | student | 1 | student1@asd.com | And I log in as "admin" - And I navigate to "Add a new badge" node in "Site administration,Badges" + And I navigate to "Add a new badge" node in "Site administration > Badges" And I set the following fields to these values: | Name | Site Badge | | Description | Site badge description | diff --git a/blocks/activity_modules/tests/behat/block_activity_modules.feature b/blocks/activity_modules/tests/behat/block_activity_modules.feature index 6199d69859f3e..c641a90a4041d 100644 --- a/blocks/activity_modules/tests/behat/block_activity_modules.feature +++ b/blocks/activity_modules/tests/behat/block_activity_modules.feature @@ -6,7 +6,7 @@ Feature: Block activity modules Background: Given I log in as "admin" - And I navigate to "Manage activities" node in "Site administration,Plugins,Activity modules" + And I navigate to "Manage activities" node in "Site administration > Plugins > Activity modules" And I click on "//a[@title=\"Show\"]" "xpath_element" in the "Feedback" "table_row" Scenario: Add activities block on the frontpage diff --git a/blocks/tests/behat/manage_blocks.feature b/blocks/tests/behat/manage_blocks.feature index 542911f51280e..7d7b26695524a 100644 --- a/blocks/tests/behat/manage_blocks.feature +++ b/blocks/tests/behat/manage_blocks.feature @@ -15,7 +15,7 @@ Feature: Block appearances | user | course | role | | teacher1 | C1 | editingteacher | And I log in as "admin" - And I navigate to "Theme selector" node in "Site administration,Appearance,Themes" + And I navigate to "Theme selector" node in "Site administration > Appearance > Themes" And I click on "Change theme" "button" in the "Default" "table_row" And I click on "Use theme" "button" in the "Afterburner" "table_row" And I press "Continue" diff --git a/cohort/tests/behat/add_cohort.feature b/cohort/tests/behat/add_cohort.feature index 5391230829e7d..92ed0f9f592f6 100644 --- a/cohort/tests/behat/add_cohort.feature +++ b/cohort/tests/behat/add_cohort.feature @@ -12,7 +12,7 @@ Feature: Add cohorts of users | user3 | Third | User | third@user.com | | user4 | Forth | User | forth@user.com | And I log in as "admin" - And I navigate to "Cohorts" node in "Site administration,Users,Accounts" + And I navigate to "Cohorts" node in "Site administration > Users > Accounts" And I press "Add" And I set the following fields to these values: | Name | Test cohort name | diff --git a/cohort/tests/behat/behat_cohort.php b/cohort/tests/behat/behat_cohort.php index f41f57d5195ea..0f982db01c6af 100644 --- a/cohort/tests/behat/behat_cohort.php +++ b/cohort/tests/behat/behat_cohort.php @@ -60,8 +60,8 @@ public function i_add_user_to_cohort_members($user, $cohortidnumber) { // With JS enabled we should expand a few tree nodes. if ($this->running_javascript()) { - $parentnodes = get_string('administrationsite') . ',' . - get_string('users', 'admin') . ',' . + $parentnodes = get_string('administrationsite') . ' > ' . + get_string('users', 'admin') . ' > ' . get_string('accounts', 'admin'); $steps = array_merge( array( diff --git a/cohort/tests/behat/upload_cohort_users.feature b/cohort/tests/behat/upload_cohort_users.feature index 2d896b261256a..5d3e637e81994 100644 --- a/cohort/tests/behat/upload_cohort_users.feature +++ b/cohort/tests/behat/upload_cohort_users.feature @@ -22,7 +22,7 @@ Feature: Upload users to a cohort And I follow "Course 2" And I add "Cohort sync" enrolment method with: | Cohort | Cohort 2 | - When I navigate to "Upload users" node in "Site administration,Users,Accounts" + When I navigate to "Upload users" node in "Site administration > Users > Accounts" And I upload "lib/tests/fixtures/upload_users_cohorts.csv" file to "File" filemanager And I press "Upload users" And I press "Upload users" diff --git a/lib/tests/behat/behat_navigation.php b/lib/tests/behat/behat_navigation.php index 06c071436eaac..4d9271bdbb2f9 100644 --- a/lib/tests/behat/behat_navigation.php +++ b/lib/tests/behat/behat_navigation.php @@ -113,7 +113,7 @@ public function i_collapse_node($nodetext) { } /** - * Click link in navigation tree that matches the text in parentnode/s (comma seperated if more then one) + * Click link in navigation tree that matches the text in parentnode/s (seperated using greater-than character if more than one) * * @Given /^I navigate to "(?P(?:[^"]|\\")*)" node in "(?P(?:[^"]|\\")*)"$/ * @@ -128,7 +128,7 @@ public function i_navigate_to_node_in($nodetext, $parentnodes) { $siteadminstr = get_string('administrationsite'); // Create array of all parentnodes. - $parentnodes = explode(',', $parentnodes); + $parentnodes = array_map('trim', explode('>', $parentnodes)); $countparentnode = count($parentnodes); // If JS is disabled and Site administration is not expanded we diff --git a/lib/tests/behat/behat_permissions.php b/lib/tests/behat/behat_permissions.php index c17b6ed93d40e..4cd7adb987e17 100644 --- a/lib/tests/behat/behat_permissions.php +++ b/lib/tests/behat/behat_permissions.php @@ -50,8 +50,8 @@ class behat_permissions extends behat_base { */ public function i_set_the_following_system_permissions_of_role($rolename, $table) { - $parentnodes = get_string('administrationsite') . ',' . - get_string('users', 'admin') . ',' . + $parentnodes = get_string('administrationsite') . ' > ' . + get_string('users', 'admin') . ' > ' . get_string('permissions', 'role'); return array( new Given('I am on homepage'), diff --git a/user/tests/behat/edituserpassword.feature b/user/tests/behat/edituserpassword.feature index 0a3a0fe2815f0..0c5232c939d89 100644 --- a/user/tests/behat/edituserpassword.feature +++ b/user/tests/behat/edituserpassword.feature @@ -8,7 +8,7 @@ Feature: Enable/disable password field based on authentication selected. Scenario: Verify the password field is enabled/disabled based on authentication selected, in user edit advanced page. Given I log in as "admin" And I follow "My home" - When I navigate to "Add a new user" node in "Site administration,Users,Accounts" + When I navigate to "Add a new user" node in "Site administration > Users > Accounts" Then the "newpassword" "field" should be enabled And I set the field "auth" to "Web services authentication" And the "newpassword" "field" should be disabled