MDL-42731 behat: load 'Site administration' when expanding node in non-javascript mode

This commit is contained in:
Marina Glancy 2013-11-22 21:12:22 +11:00
parent e7c71c448b
commit 6dfd8325f0
6 changed files with 37 additions and 29 deletions

View File

@ -125,23 +125,4 @@ 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') . '"')
);
}
}
}

View File

@ -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 go to notifications page
Given I expand "Site administration" node
And I expand "Appearance" node
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"

View File

@ -85,14 +85,12 @@ class behat_course extends behat_base {
* @return Given[]
*/
public function i_go_to_the_courses_management_page() {
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;
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') . '"')
);
}
/**

View File

@ -70,6 +70,30 @@ class behat_deprecated extends behat_base {
$elementnode->click();
}
/**
* Goes to notification page ensuring site admin navigation is loaded.
*
* Step [I expand "Site administration" node] will ensure that administration menu
* is opened in both javascript and non-javascript modes.
*
* @deprecated since 2.7
* @todo MDL-42862 This will be deleted in Moodle 2.9
*
* @Given /^I go to notifications page$/
* @return Given[]
*/
public function i_go_to_notifications_page() {
$alternative = array(
'I expand "' . get_string('administrationsite') . '" node',
'I click on "' . get_string('notifications') . '" "link" in the "'.get_string('administration').'" "block"'
);
$this->deprecated_message($alternative);
return array(
new Given($alternative[0]),
new Given($alternative[1]),
);
}
/**
* Throws an exception if $CFG->behat_usedeprecated is not allowed.
*

View File

@ -53,6 +53,10 @@ class behat_navigation extends behat_base {
// all of tree's nodes; adding this because of scenarios that shares the
// same steps with and without Javascript enabled.
if (!$this->running_javascript()) {
if ($nodetext === get_string('administrationsite')) {
// Administration menu is not loaded by default any more. Click the link to expand.
return new Given('I click on "'.$nodetext.'" "link" in the "'.get_string('administration').'" "block"');
}
return false;
}

View File

@ -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 go to notifications page
And I expand "Site administration" node
And I expand "Security" node
And I follow "Site policies"
And I select "1 minutes" from "Maximum time to edit posts"