diff --git a/course/tests/behat/behat_course.php b/course/tests/behat/behat_course.php index cce6fd7b275..08d1e2db354 100644 --- a/course/tests/behat/behat_course.php +++ b/course/tests/behat/behat_course.php @@ -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; } /** diff --git a/course/tests/behat/course_controls.feature b/course/tests/behat/course_controls.feature index e80301a997d..90a911e9967 100644 --- a/course/tests/behat/course_controls.feature +++ b/course/tests/behat/course_controls.feature @@ -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" 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" exists