diff --git a/lib/tests/behat/behat_forms.php b/lib/tests/behat/behat_forms.php index 410956ff257..b686efbdc6d 100644 --- a/lib/tests/behat/behat_forms.php +++ b/lib/tests/behat/behat_forms.php @@ -60,21 +60,6 @@ class behat_forms extends behat_base { $buttonnode->press(); } - /** - * Presses button with specified id|name|title|alt|value, and confirming the alert dialog. - * - * @When /^I press "(?P(?:[^"]|\\")*)", confirming the dialog$/ - * @throws ElementNotFoundException Thrown by behat_base::find - * @param string $button - */ - public function press_button_confirm_dialog($button) { - - // Ensures the button is present. - $buttonnode = $this->find_button($button); - $buttonnode->press(); - $this->getSession()->getDriver()->getWebDriverSession()->accept_alert(); - } - /** * Fills a form with field/value data. More info in http://docs.moodle.org/dev/Acceptance_testing#Providing_values_to_steps. * diff --git a/lib/tests/behat/behat_general.php b/lib/tests/behat/behat_general.php index a0f28989ce8..773fcbdc0d3 100644 --- a/lib/tests/behat/behat_general.php +++ b/lib/tests/behat/behat_general.php @@ -190,21 +190,6 @@ class behat_general extends behat_base { $linknode->click(); } - /** - * Clicks link with specified id|title|alt|text, and confirming the alert dialog. - * - * @When /^I follow "(?P(?:[^"]|\\")*)", confirming the dialog$/ - * @throws ElementNotFoundException Thrown by behat_base::find - * @param string $link - */ - public function click_link_confirm_dialog($link) { - - $linknode = $this->find_link($link); - $this->ensure_node_is_visible($linknode); - $linknode->click(); - $this->accept_currently_displayed_alert_dialog(); - } - /** * Waits X seconds. Required after an action that requires data from an AJAX request. * @@ -297,6 +282,18 @@ class behat_general extends behat_base { $node->click(); } + /** + * Clicks the specified element and confirms the expected dialogue. + * + * @When /^I click on "(?P(?:[^"]|\\")*)" "(?P[^"]*)" confirming the dialogue$/ + * @throws ElementNotFoundException Thrown by behat_base::find + * @param string $link + */ + public function i_click_on_confirming_the_dialogue($element, $selectortype) { + $this->i_click_on($element, $selectortype); + $this->accept_currently_displayed_alert_dialog(); + } + /** * Click on the element of the specified type which is located inside the second element. * diff --git a/mod/assign/tests/behat/prevent_submission_changes.feature b/mod/assign/tests/behat/prevent_submission_changes.feature index f0ec1bbeabc..1b4a5b04fdc 100644 --- a/mod/assign/tests/behat/prevent_submission_changes.feature +++ b/mod/assign/tests/behat/prevent_submission_changes.feature @@ -100,26 +100,26 @@ Feature: Prevent or allow assignment submission changes And I follow "Test assignment name" When I follow "View/grade all submissions" And I set the field "selectall" to "1" - And I press "Go", confirming the dialog + And I click on "Go" "button" confirming the dialogue Then I should see "Submission changes not allowed" in the "Student 1" "table_row" And I should see "Submission changes not allowed" in the "Student 2" "table_row" And I log out - When I log in as "student2" + And I log in as "student2" And I follow "Course 1" And I follow "Test assignment name" - Then I should not see "Edit submission" + And I should not see "Edit submission" And I log out - When I log in as "teacher1" + And I log in as "teacher1" And I follow "Course 1" And I follow "Test assignment name" And I follow "View/grade all submissions" And I set the field "selectall" to "1" And I set the field "id_operation" to "Unlock submissions" - And I press "Go", confirming the dialog - Then I should not see "Submission changes not allowed" in the "Student 1" "table_row" + And I click on "Go" "button" confirming the dialogue + And I should not see "Submission changes not allowed" in the "Student 1" "table_row" And I should not see "Submission changes not allowed" in the "Student 2" "table_row" And I log out - When I log in as "student2" + And I log in as "student2" And I follow "Course 1" And I follow "Test assignment name" And I press "Edit submission"