Merge branch 'MDL-43802_master' of git://github.com/dmonllao/moodle

This commit is contained in:
Damyon Wiese 2014-02-18 14:01:33 +08:00
commit 60c85b8596
2 changed files with 14 additions and 19 deletions

View File

@ -702,26 +702,20 @@ class behat_course extends behat_base {
$deletestring = get_string('delete');
$steps = array(
new Given('I click on "' . $this->escape($deletestring) . '" "link" in the "' . $this->escape($activityname) . '" activity')
);
// JS enabled.
// Not using chain steps here because the exceptions catcher have problems detecting
// JS modal windows and avoiding interacting them at the same time.
if ($this->running_javascript()) {
$element = $this->get_activity_element($deletestring, 'link', $activityname);
$element->click();
$this->getSession()->getDriver()->getWebDriverSession()->accept_alert();
$steps[] = new Given('I click on "' . get_string('yes') . '" "button" in the "Confirm" "dialogue"');
} else {
// With JS disabled.
$steps = array(
new Given('I click on "' . $this->escape($deletestring) . '" "link" in the "' . $this->escape($activityname) . '" activity'),
new Given('I press "' . get_string('yes') . '"')
);
return $steps;
$steps[] = new Given('I press "' . get_string('yes') . '"');
}
return $steps;
}
/**

View File

@ -1,13 +1,12 @@
@core @core_course @_alert
@core @core_course
Feature: Course activity controls works as expected
In order to manage my course's activities
As a teacher
I need to edit, hide, show and indent activities inside course sections
# The difference between these two scenario outlines is that one is with
# JS enabled and the other one with JS disabled, also with JS disabled we
# add the delete activity checking; we can not use Background sections
# when using Scenario Outlines because of Behat framework restrictions.
# JS enabled and the other one with JS disabled; we can not use Background
# sections when using Scenario Outlines because of Behat framework restrictions.
# We are testing:
# * Javascript on and off
@ -68,7 +67,9 @@ Feature: Course activity controls works as expected
And I open "Test forum name 1" actions menu
And I click on "Hide" "link" in the "Test forum name 1" activity
And "#section-2" "css_element" <should_see_other_sections> exists
And I close "Test forum name 1" actions menu
And I open "Test forum name 1" actions menu
And I delete "Test forum name 1" activity
And I should not see "Test forum name 1" in the "#region-main" "css_element"
And I duplicate "Test forum name 2" activity editing the new copy with:
| Forum name | Edited test forum name 2 |
And "#section-2" "css_element" <should_see_other_sections> exists