Skip to content

Commit 888464a

Browse files
committed
Fixes for behat automated tests
1 parent d72f5df commit 888464a

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

main/admin/user_add.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ function display_drh_list(){
201201
. '<img id="previewImage" >'
202202
. '</div>'
203203
. '<div>'
204-
. '<button class="btn btn-primary hidden" name="cropButton" id="cropButton"><em class="fa fa-crop"></em> '.get_lang('CropYourPicture').'</button>'
204+
. '<button class="btn btn-primary hidden" name="cropButton" id="cropButton" type="submit"><em class="fa fa-crop"></em> '.get_lang('CropYourPicture').'</button>'
205205
. '</div>'
206206
. '</div>'
207207
. '</div>'

tests/features/bootstrap/FeatureContext.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,4 +274,35 @@ public function iInviteAFrienToASocialGroup($friendId, $groupId)
274274
new Step\When('I press "submit"')
275275
];
276276
}
277+
/**
278+
* Sometimes the top admin toolbar has form buttons
279+
* that conflicts with the main page forms so we need
280+
* to disable it
281+
* @Given /^Admin top bar is disabled$/
282+
*/
283+
public function adminTopBarIsDisabled()
284+
{
285+
return [
286+
new Step\Given('I am a platform administrator'),
287+
new Step\Given('I am on "/main/admin/settings.php"'),
288+
new Step\When('I fill in "search_field" with "show_admin_toolbar"'),
289+
new Step\When('I press "submit_button"'),
290+
new Step\When('I select "do_not_show" from "show_admin_toolbar"'),
291+
new Step\When('I press "submit"')
292+
];
293+
}
294+
/**
295+
* @Given /^Admin top bar is enabled$/
296+
*/
297+
public function adminTopBarIsEnabled()
298+
{
299+
return [
300+
new Step\Given('I am a platform administrator'),
301+
new Step\Given('I am on "/main/admin/settings.php"'),
302+
new Step\When('I fill in "search_field" with "show_admin_toolbar"'),
303+
new Step\When('I press "submit_button"'),
304+
new Step\When('I select "show_to_admin_and_teachers" from "show_admin_toolbar"'),
305+
new Step\When('I press "submit"')
306+
];
307+
}
277308
}

tests/features/createUser.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Feature: Users management as admin
2626

2727
Scenario: Search and delete a user
2828
Given I am a platform administrator
29+
And Admin top bar is disabled
2930
And I am on "/main/admin/user_list.php"
3031
And I fill in "keyword" with "smarshall"
3132
And I press "submit"

0 commit comments

Comments
 (0)