From 888464ad189c241d7055c4f065b54766aad13659 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Tue, 22 Mar 2016 15:13:48 -0500 Subject: [PATCH] Fixes for behat automated tests --- main/admin/user_add.php | 2 +- tests/features/bootstrap/FeatureContext.php | 31 +++++++++++++++++++++ tests/features/createUser.feature | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/main/admin/user_add.php b/main/admin/user_add.php index 13fee5457c..69abd9e450 100755 --- a/main/admin/user_add.php +++ b/main/admin/user_add.php @@ -201,7 +201,7 @@ $form->addHtml('' . '' . '' . '
' - . '' + . '' . '
' . '' . '' diff --git a/tests/features/bootstrap/FeatureContext.php b/tests/features/bootstrap/FeatureContext.php index ea706af84b..a49e906fde 100644 --- a/tests/features/bootstrap/FeatureContext.php +++ b/tests/features/bootstrap/FeatureContext.php @@ -274,4 +274,35 @@ class FeatureContext extends MinkContext new Step\When('I press "submit"') ]; } + /** + * Sometimes the top admin toolbar has form buttons + * that conflicts with the main page forms so we need + * to disable it + * @Given /^Admin top bar is disabled$/ + */ + public function adminTopBarIsDisabled() + { + return [ + new Step\Given('I am a platform administrator'), + new Step\Given('I am on "/main/admin/settings.php"'), + new Step\When('I fill in "search_field" with "show_admin_toolbar"'), + new Step\When('I press "submit_button"'), + new Step\When('I select "do_not_show" from "show_admin_toolbar"'), + new Step\When('I press "submit"') + ]; + } + /** + * @Given /^Admin top bar is enabled$/ + */ + public function adminTopBarIsEnabled() + { + return [ + new Step\Given('I am a platform administrator'), + new Step\Given('I am on "/main/admin/settings.php"'), + new Step\When('I fill in "search_field" with "show_admin_toolbar"'), + new Step\When('I press "submit_button"'), + new Step\When('I select "show_to_admin_and_teachers" from "show_admin_toolbar"'), + new Step\When('I press "submit"') + ]; + } } diff --git a/tests/features/createUser.feature b/tests/features/createUser.feature index 7f5001ac70..a7535d56ce 100644 --- a/tests/features/createUser.feature +++ b/tests/features/createUser.feature @@ -26,6 +26,7 @@ Feature: Users management as admin Scenario: Search and delete a user Given I am a platform administrator + And Admin top bar is disabled And I am on "/main/admin/user_list.php" And I fill in "keyword" with "smarshall" And I press "submit"