2015-11-04 18:21:17 +01:00
var common = require ( '../casper_lib/common.js' ) . common ;
common . start _and _log _in ( ) ;
2016-10-07 19:09:05 +02:00
casper . then ( function ( ) {
var menu _selector = '#settings-dropdown' ;
casper . waitUntilVisible ( menu _selector , function ( ) {
casper . click ( menu _selector ) ;
} ) ;
} ) ;
2015-11-04 18:21:17 +01:00
casper . then ( function ( ) {
2017-04-07 21:39:58 +02:00
casper . test . info ( 'Organization page' ) ;
casper . click ( 'a[href^="#organization"]' ) ;
2016-07-27 12:34:08 +02:00
} ) ;
2016-12-03 01:12:52 +01:00
casper . waitForSelector ( '#settings_overlay_container.show' , function ( ) {
2017-04-07 21:39:58 +02:00
casper . test . info ( 'Organization page is active' ) ;
casper . test . assertUrlMatch ( /^http:\/\/[^/]+\/#organization/ , 'URL suggests we are on organization page' ) ;
2015-11-04 18:21:17 +01:00
} ) ;
2017-08-18 01:23:55 +02:00
casper . then ( function ( ) {
casper . click ( "li[data-section='organization-settings']" ) ;
} ) ;
2017-06-10 07:03:53 +02:00
// Test changing notifications stream
casper . then ( function ( ) {
casper . test . info ( 'Changing notifications stream to Verona by filtering with "verona"' ) ;
2017-09-26 23:48:13 +02:00
casper . click ( "#id_realm_notifications_stream > button.dropdown-toggle" ) ;
2017-06-10 07:03:53 +02:00
2017-10-20 16:55:04 +02:00
casper . waitUntilVisible ( '#id_realm_notifications_stream ul.dropdown-menu' , function ( ) {
casper . sendKeys ( '#id_realm_notifications_stream .dropdown-search > input[type=text]' , 'verona' ) ;
casper . click ( "#id_realm_notifications_stream .dropdown-list-body li.stream_name" ) ;
2017-06-10 07:03:53 +02:00
} ) ;
casper . waitUntilVisible ( '#admin-realm-notifications-stream-status' , function ( ) {
casper . test . assertSelectorHasText ( '#admin-realm-notifications-stream-status' ,
'Notifications stream changed!' ) ;
casper . test . assertSelectorHasText ( '#realm_notifications_stream_name' , '#Verona' ) ;
} ) ;
} ) ;
casper . then ( function ( ) {
casper . click ( ".notifications-stream-disable" ) ;
casper . waitUntilVisible ( '#admin-realm-notifications-stream-status' , function ( ) {
casper . test . assertSelectorHasText ( '#admin-realm-notifications-stream-status' ,
'Notifications stream disabled!' ) ;
casper . test . assertSelectorHasText ( '#realm_notifications_stream_name' , 'Disabled' ) ;
} ) ;
} ) ;
2017-10-20 16:55:04 +02:00
// Test changing signup notifications stream
casper . then ( function ( ) {
casper . test . info ( 'Changing signup notifications stream to Verona by filtering with "verona"' ) ;
casper . click ( "#id_realm_signup_notifications_stream > button.dropdown-toggle" ) ;
casper . waitUntilVisible ( '#id_realm_signup_notifications_stream ul.dropdown-menu' , function ( ) {
casper . sendKeys ( '#id_realm_signup_notifications_stream .dropdown-search > input[type=text]' , 'verona' ) ;
casper . click ( "#id_realm_signup_notifications_stream .dropdown-list-body li.stream_name" ) ;
} ) ;
casper . waitUntilVisible ( '#admin-realm-signup-notifications-stream-status' , function ( ) {
casper . test . assertSelectorHasText ( '#admin-realm-signup-notifications-stream-status' ,
'Signup notifications stream changed!' ) ;
casper . test . assertSelectorHasText ( '#realm_signup_notifications_stream_name' , '#Verona' ) ;
} ) ;
} ) ;
casper . then ( function ( ) {
casper . click ( ".signup-notifications-stream-disable" ) ;
casper . waitUntilVisible ( '#admin-realm-signup-notifications-stream-status' , function ( ) {
casper . test . assertSelectorHasText ( '#admin-realm-signup-notifications-stream-status' ,
'Signup notifications stream disabled!' ) ;
casper . test . assertSelectorHasText ( '#realm_signup_notifications_stream_name' , 'Disabled' ) ;
} ) ;
} ) ;
2017-05-18 14:06:57 +02:00
// Test permissions setting
casper . then ( function ( ) {
casper . click ( "li[data-section='organization-permissions']" ) ;
} ) ;
2017-05-25 00:50:07 +02:00
function submit _permissions _change ( ) {
2018-03-22 14:07:52 +01:00
casper . test . assertSelectorHasText ( '#org-submit-other-permissions' , "Save" ) ;
casper . click ( '#org-submit-other-permissions' ) ;
2017-05-25 00:50:07 +02:00
}
2017-03-08 13:45:54 +01:00
// Test setting limiting stream creation to administrators
2017-04-21 01:10:59 +02:00
casper . then ( function ( ) {
2018-01-05 15:34:10 +01:00
casper . test . info ( "Test setting limiting stream creation to administrators" ) ;
casper . waitUntilVisible ( "#id_realm_create_stream_permission" , function ( ) {
casper . evaluate ( function ( ) {
$ ( "#id_realm_create_stream_permission" ) . val ( "by_admins_only" ) . change ( ) ;
} ) ;
submit _permissions _change ( ) ;
} ) ;
} ) ;
casper . then ( function ( ) {
// Test setting was activated
2018-03-22 14:07:52 +01:00
casper . waitUntilVisible ( '#org-submit-other-permissions[data-status="saved"]' , function ( ) {
casper . test . assertSelectorHasText ( '#org-submit-other-permissions' ,
'Saved' ) ;
2018-01-05 15:34:10 +01:00
} ) ;
} ) ;
casper . then ( function ( ) {
casper . waitUntilVisible ( "#id_realm_create_stream_permission" , function ( ) {
casper . evaluate ( function ( ) {
$ ( "#id_realm_create_stream_permission" ) . val ( "by_admin_user_with_custom_time" ) . change ( ) ;
$ ( "#id_realm_waiting_period_threshold" ) . val ( '6' ) ;
} ) ;
submit _permissions _change ( ) ;
} ) ;
2016-07-27 12:34:08 +02:00
} ) ;
casper . then ( function ( ) {
2016-05-12 10:28:00 +02:00
// Test setting was activated
2018-03-22 14:07:52 +01:00
casper . waitUntilVisible ( '#org-submit-other-permissions[data-status="saved"]' , function ( ) {
casper . test . assertSelectorHasText ( '#org-submit-other-permissions' ,
'Saved' ) ;
2016-05-12 10:28:00 +02:00
} ) ;
} ) ;
casper . then ( function ( ) {
// Leave the page and return
2016-11-29 18:50:56 +01:00
casper . click ( '#settings-dropdown' ) ;
2017-03-09 00:20:22 +01:00
casper . click ( 'a[href^="#streams"]' ) ;
2016-11-29 18:50:56 +01:00
casper . click ( '#settings-dropdown' ) ;
2017-04-07 21:39:58 +02:00
casper . click ( 'a[href^="#organization"]' ) ;
2016-07-27 12:34:08 +02:00
} ) ;
2016-05-12 10:28:00 +02:00
2018-01-05 15:34:10 +01:00
casper . waitUntilVisible ( '#id_realm_create_stream_permission' , function ( ) {
2016-07-27 12:34:08 +02:00
// Test Setting was saved
casper . test . assertEval ( function ( ) {
2018-01-05 15:34:10 +01:00
return $ ( 'input[type="text"][id="id_realm_waiting_period_threshold"]' ) . val ( ) === '6' ;
} , 'Waiting period threshold set to 6 days' ) ;
2016-05-12 10:28:00 +02:00
2016-07-27 12:34:08 +02:00
// Deactivate setting
2017-04-21 01:10:59 +02:00
2018-01-05 15:34:10 +01:00
casper . evaluate ( function ( ) {
$ ( "#id_realm_create_stream_permission" ) . val ( "by_admins_only" ) . change ( ) ;
} ) ;
2017-05-25 00:50:07 +02:00
submit _permissions _change ( ) ;
2016-07-27 12:34:08 +02:00
} ) ;
casper . then ( function ( ) {
2018-03-22 14:07:52 +01:00
// Test setting was activated
casper . waitUntilVisible ( '#org-submit-other-permissions[data-status="saved"]' , function ( ) {
casper . test . assertSelectorHasText ( '#org-submit-other-permissions' ,
'Saved' ) ;
2016-05-12 10:28:00 +02:00
} ) ;
} ) ;
2016-07-27 12:34:08 +02:00
casper . then ( function ( ) {
// Test custom realm emoji
2016-12-03 01:12:52 +01:00
casper . click ( "li[data-section='emoji-settings']" ) ;
2016-12-03 01:12:52 +01:00
casper . waitUntilVisible ( '.admin-emoji-form' , function ( ) {
2016-07-27 12:34:08 +02:00
casper . fill ( 'form.admin-emoji-form' , {
2017-05-02 23:13:40 +02:00
name : 'mouseface' ,
2017-03-13 05:45:50 +01:00
emoji _file _input : 'static/images/logo/zulip-icon-128x128.png' ,
2016-12-03 01:12:52 +01:00
} , true ) ;
2016-02-12 21:08:56 +01:00
} ) ;
} ) ;
2016-07-27 12:34:08 +02:00
casper . then ( function ( ) {
casper . waitUntilVisible ( 'div#admin-emoji-status' , function ( ) {
casper . test . assertSelectorHasText ( 'div#admin-emoji-status' , 'Custom emoji added!' ) ;
} ) ;
2016-02-12 21:08:56 +01:00
} ) ;
2016-07-27 12:34:08 +02:00
casper . then ( function ( ) {
2017-07-14 14:56:53 +02:00
casper . waitUntilVisible ( 'tr#emoji_mouseface' , function ( ) {
casper . test . assertSelectorHasText ( 'tr#emoji_mouseface .emoji_name' , 'mouseface' ) ;
2018-03-11 18:55:20 +01:00
casper . test . assertExists ( 'tr#emoji_mouseface img' ) ;
2017-07-14 14:56:53 +02:00
casper . click ( 'tr#emoji_mouseface button.delete' ) ;
2016-07-27 12:34:08 +02:00
} ) ;
2016-02-12 21:08:56 +01:00
} ) ;
2016-07-27 12:34:08 +02:00
casper . then ( function ( ) {
2017-07-14 14:56:53 +02:00
casper . waitWhileVisible ( 'tr#emoji_mouseface' , function ( ) {
casper . test . assertDoesntExist ( 'tr#emoji_mouseface' ) ;
2016-07-27 12:34:08 +02:00
} ) ;
2016-02-12 21:08:56 +01:00
} ) ;
2017-12-14 05:51:45 +01:00
// Test custom profile fields
casper . test . info ( "Testing custom profile fields" ) ;
casper . thenClick ( "li[data-section='profile-field-settings']" ) ;
casper . then ( function ( ) {
casper . waitUntilVisible ( '.admin-profile-field-form' , function ( ) {
casper . fill ( 'form.admin-profile-field-form' , {
name : 'Teams' ,
2018-04-03 18:04:03 +02:00
field _type : '1' ,
2017-12-14 05:51:45 +01:00
} ) ;
casper . click ( 'form.admin-profile-field-form button.button' ) ;
} ) ;
} ) ;
casper . then ( function ( ) {
casper . waitUntilVisible ( 'div#admin-profile-field-status' , function ( ) {
casper . test . assertSelectorHasText ( 'div#admin-profile-field-status' ,
'Custom profile field added!' ) ;
casper . test . assertSelectorHasText ( '.profile-field-row span.profile_field_name' , 'Teams' ) ;
casper . test . assertSelectorHasText ( '.profile-field-row span.profile_field_type' , 'Short Text' ) ;
casper . click ( '.profile-field-row button.open-edit-form' ) ;
} ) ;
} ) ;
casper . then ( function ( ) {
casper . waitUntilVisible ( 'tr.profile-field-form form' , function ( ) {
casper . fill ( 'tr.profile-field-form form.name-setting' , {
name : 'team' ,
} ) ;
casper . click ( 'tr.profile-field-form button.submit' ) ;
} ) ;
} ) ;
casper . then ( function ( ) {
casper . waitUntilVisible ( 'div#admin-profile-field-status' , function ( ) {
casper . test . assertSelectorHasText ( 'div#admin-profile-field-status' ,
'Custom profile field updated!' ) ;
casper . test . assertSelectorHasText ( '.profile-field-row span.profile_field_name' , 'team' ) ;
casper . test . assertSelectorHasText ( '.profile-field-row span.profile_field_type' , 'Short Text' ) ;
casper . click ( '.profile-field-row button.delete' ) ;
} ) ;
} ) ;
casper . then ( function ( ) {
casper . waitUntilVisible ( 'div#admin-profile-field-status' , function ( ) {
casper . test . assertSelectorHasText ( 'div#admin-profile-field-status' ,
'Custom profile field deleted!' ) ;
} ) ;
} ) ;
2016-02-13 19:17:15 +01:00
// Test custom realm filters
2017-02-09 09:01:38 +01:00
casper . then ( function ( ) {
2016-12-03 01:12:52 +01:00
casper . click ( "li[data-section='filter-settings']" ) ;
2016-12-03 01:12:52 +01:00
casper . waitUntilVisible ( '.admin-filter-form' , function ( ) {
2017-02-09 09:01:38 +01:00
casper . fill ( 'form.admin-filter-form' , {
pattern : '#(?P<id>[0-9]+)' ,
url _format _string : 'https://trac.example.com/ticket/%(id)s' ,
} ) ;
2017-03-18 10:44:00 +01:00
casper . click ( 'form.admin-filter-form button.button' ) ;
2016-02-13 19:17:15 +01:00
} ) ;
} ) ;
2017-02-09 09:01:38 +01:00
casper . then ( function ( ) {
casper . waitUntilVisible ( 'div#admin-filter-status' , function ( ) {
casper . test . assertSelectorHasText ( 'div#admin-filter-status' , 'Custom filter added!' ) ;
} ) ;
2016-02-13 19:17:15 +01:00
} ) ;
2017-02-09 09:01:38 +01:00
casper . then ( function ( ) {
2016-12-03 01:12:52 +01:00
casper . waitUntilVisible ( '.filter_row' , function ( ) {
2017-02-09 09:01:38 +01:00
casper . test . assertSelectorHasText ( '.filter_row span.filter_pattern' , '#(?P<id>[0-9]+)' ) ;
casper . test . assertSelectorHasText ( '.filter_row span.filter_url_format_string' , 'https://trac.example.com/ticket/%(id)s' ) ;
casper . click ( '.filter_row button' ) ;
} ) ;
2016-02-13 19:17:15 +01:00
} ) ;
2017-02-09 09:01:38 +01:00
casper . then ( function ( ) {
2016-12-03 01:12:52 +01:00
casper . waitWhileVisible ( '.filter_row' , function ( ) {
2017-02-09 09:01:38 +01:00
casper . test . assertDoesntExist ( '.filter_row' ) ;
} ) ;
2016-02-13 19:17:15 +01:00
} ) ;
2017-02-09 09:01:38 +01:00
casper . then ( function ( ) {
2016-12-03 01:12:52 +01:00
casper . waitUntilVisible ( '.admin-filter-form' , function ( ) {
2017-02-09 09:01:38 +01:00
casper . fill ( 'form.admin-filter-form' , {
pattern : 'a$' ,
url _format _string : 'https://trac.example.com/ticket/%(id)s' ,
} ) ;
2017-03-18 10:44:00 +01:00
casper . click ( 'form.admin-filter-form button.button' ) ;
2016-02-13 19:17:15 +01:00
} ) ;
} ) ;
2017-02-09 09:01:38 +01:00
casper . then ( function ( ) {
casper . waitUntilVisible ( 'div#admin-filter-pattern-status' , function ( ) {
casper . test . assertSelectorHasText ( 'div#admin-filter-pattern-status' , 'Failed: Invalid filter pattern, you must use the following format OPTIONAL_PREFIX(?P<id>.+)' ) ;
} ) ;
2016-02-13 19:17:15 +01:00
} ) ;
2017-02-09 09:13:30 +01:00
var stream _name = "Scotland" ;
2016-05-20 22:08:42 +02:00
function get _suggestions ( str ) {
casper . then ( function ( ) {
casper . evaluate ( function ( str ) {
$ ( '.create_default_stream' )
. focus ( )
. val ( str )
. trigger ( $ . Event ( 'keyup' , { which : 0 } ) ) ;
} , str ) ;
} ) ;
}
function select _from _suggestions ( item ) {
casper . then ( function ( ) {
casper . evaluate ( function ( item ) {
var tah = $ ( '.create_default_stream' ) . data ( ) . typeahead ;
tah . mouseenter ( {
2017-01-12 00:17:43 +01:00
currentTarget : $ ( '.typeahead:visible li:contains("' + item + '")' ) [ 0 ] ,
2016-05-20 22:08:42 +02:00
} ) ;
tah . select ( ) ;
} , { item : item } ) ;
} ) ;
}
// Test default stream creation and addition
casper . then ( function ( ) {
2016-12-03 01:12:52 +01:00
casper . click ( "li[data-section='default-streams-list']" ) ;
2017-02-09 09:13:30 +01:00
casper . waitUntilVisible ( ".create_default_stream" , function ( ) {
// It matches with all the stream names which has 'O' as a substring (Rome, Scotland, Verona
// etc). 'O' is used to make sure that it works even if there are multiple suggestions.
// Uppercase 'O' is used instead of the lowercase version to make sure that the suggestions
// are case insensitive.
get _suggestions ( "O" ) ;
select _from _suggestions ( stream _name ) ;
} ) ;
} ) ;
casper . then ( function ( ) {
2016-12-03 01:12:52 +01:00
casper . waitUntilVisible ( '.default_stream_row[id=' + stream _name + ']' , function ( ) {
2016-05-20 22:08:42 +02:00
casper . test . assertSelectorHasText ( '.default_stream_row[id=' + stream _name + '] .default_stream_name' , stream _name ) ;
} ) ;
2016-07-27 12:34:08 +02:00
} ) ;
casper . then ( function ( ) {
2016-12-03 01:12:52 +01:00
casper . waitUntilVisible ( '.default_stream_row[id=' + stream _name + ']' , function ( ) {
2016-05-20 22:08:42 +02:00
casper . test . assertSelectorHasText ( '.default_stream_row[id=' + stream _name + '] .default_stream_name' , stream _name ) ;
casper . click ( '.default_stream_row[id=' + stream _name + '] button.remove-default-stream' ) ;
} ) ;
2016-07-27 12:34:08 +02:00
} ) ;
casper . then ( function ( ) {
2016-12-03 01:12:52 +01:00
casper . waitWhileVisible ( '.default_stream_row[id=' + stream _name + ']' , function ( ) {
2016-05-20 22:08:42 +02:00
casper . test . assertDoesntExist ( '.default_stream_row[id=' + stream _name + ']' ) ;
} ) ;
} ) ;
2016-07-27 12:34:08 +02:00
2016-12-03 01:12:52 +01:00
2015-11-04 18:21:17 +01:00
// TODO: Test stream deletion
2017-02-27 03:43:13 +01:00
// Test uploading realm icon image
casper . then ( function ( ) {
2017-08-18 01:23:55 +02:00
casper . click ( "li[data-section='organization-profile']" ) ;
2017-03-05 20:36:21 +01:00
var selector = 'img#realm-settings-icon[src^="https://secure.gravatar.com/avatar/"]' ;
casper . waitUntilVisible ( selector , function ( ) {
casper . test . assertEqual ( casper . visible ( '#realm_icon_delete_button' ) , false ) ;
2018-03-26 12:06:42 +02:00
// Hack: Rather than submitting the form, we just fill the
// form and then trigger a click event by clicking the button.
2017-03-05 20:36:21 +01:00
casper . fill ( 'form.admin-realm-form' , {
realm _icon _file _input : 'static/images/logo/zulip-icon-128x128.png' ,
2018-03-26 12:06:42 +02:00
} , false ) ;
casper . click ( "#realm_icon_upload_button" ) ;
2017-03-05 20:36:21 +01:00
casper . waitWhileVisible ( "#upload_icon_spinner .loading_indicator_spinner" , function ( ) {
casper . test . assertExists ( 'img#realm-settings-icon[src^="/user_avatars/1/realm/icon.png?version=2"]' ) ;
casper . test . assertEqual ( casper . visible ( '#realm_icon_delete_button' ) , true ) ;
} ) ;
2017-02-27 03:43:13 +01:00
} ) ;
} ) ;
// Test deleting realm icon image
casper . then ( function ( ) {
2017-08-18 01:23:55 +02:00
casper . click ( "li[data-section='organization-profile']" ) ;
2017-02-27 03:43:13 +01:00
casper . click ( "#realm_icon_delete_button" ) ;
casper . test . assertEqual ( casper . visible ( '#realm_icon_delete_button' ) , true ) ;
2017-03-14 22:40:37 +01:00
casper . waitWhileVisible ( '#realm_icon_delete_button' , function ( ) {
2017-02-27 03:43:13 +01:00
casper . test . assertExists ( 'img#realm-settings-icon[src^="https://secure.gravatar.com/avatar/"]' ) ;
casper . test . assertEqual ( casper . visible ( '#realm_icon_delete_button' ) , false ) ;
} ) ;
} ) ;
2017-05-25 00:50:07 +02:00
2016-08-04 17:32:41 +02:00
casper . then ( function ( ) {
2016-12-03 01:12:52 +01:00
casper . click ( "li[data-section='organization-settings']" ) ;
2017-02-10 06:58:09 +01:00
casper . waitUntilVisible ( '#id_realm_default_language' , function ( ) {
casper . test . info ( "Changing realm default language" ) ;
casper . evaluate ( function ( ) {
$ ( '#id_realm_default_language' ) . val ( 'de' ) . change ( ) ;
} ) ;
2018-03-31 07:39:22 +02:00
casper . test . assertSelectorHasText ( '#org-submit-user-defaults' , "Save" ) ;
casper . click ( '#org-submit-user-defaults' ) ;
2016-08-04 17:32:41 +02:00
} ) ;
} ) ;
2017-02-10 06:58:09 +01:00
casper . then ( function ( ) {
2018-03-31 07:39:22 +02:00
casper . waitUntilVisible ( '#org-submit-user-defaults[data-status="saved"]' , function ( ) {
casper . test . assertSelectorHasText ( '#org-submit-user-defaults' ,
2018-03-14 23:45:42 +01:00
'Saved' ) ;
2017-02-10 06:58:09 +01:00
} ) ;
2016-08-04 17:32:41 +02:00
} ) ;
2017-05-25 00:50:07 +02:00
function submit _org _authentication _change ( ) {
casper . click ( 'form.org-authentications-form button.button' ) ;
}
2016-11-02 21:51:56 +01:00
// Test authentication methods setting
2017-02-10 06:58:09 +01:00
casper . then ( function ( ) {
2016-12-03 01:12:52 +01:00
casper . click ( "li[data-section='auth-methods']" ) ;
2017-04-21 01:10:59 +02:00
casper . waitUntilVisible ( ".method_row[data-method='Email'] input[type='checkbox'] + span" , function ( ) {
casper . click ( ".method_row[data-method='Email'] input[type='checkbox'] + span" ) ;
2017-05-25 00:50:07 +02:00
submit _org _authentication _change ( ) ;
2017-02-10 06:58:09 +01:00
} ) ;
2016-11-02 21:51:56 +01:00
} ) ;
// Test setting was activated--default is checked
casper . then ( function ( ) {
// Scroll to bottom so that casper snapshots show the auth methods table
this . scrollToBottom ( ) ;
// Test setting was activated
casper . waitUntilVisible ( '#admin-realm-authentication-methods-status' , function ( ) {
casper . test . assertSelectorHasText ( '#admin-realm-authentication-methods-status' , 'Authentication methods saved!' ) ;
casper . test . assertEval ( function ( ) {
return ! ( document . querySelector ( ".method_row[data-method='Email'] input[type='checkbox']" ) . checked ) ;
} ) ;
} ) ;
} ) ;
casper . then ( function ( ) {
// Leave the page and return
casper . click ( '#settings-dropdown' ) ;
2017-03-09 00:20:22 +01:00
casper . click ( 'a[href^="#streams"]' ) ;
2016-11-02 21:51:56 +01:00
casper . click ( '#settings-dropdown' ) ;
2017-04-07 21:39:58 +02:00
casper . click ( 'a[href^="#organization"]' ) ;
2016-11-02 21:51:56 +01:00
2017-04-21 01:10:59 +02:00
casper . waitUntilVisible ( ".method_row[data-method='Email'] input[type='checkbox'] + span" , function ( ) {
2016-11-02 21:51:56 +01:00
// Test Setting was saved
casper . test . assertEval ( function ( ) {
return ! ( document . querySelector ( ".method_row[data-method='Email'] input[type='checkbox']" ) . checked ) ;
} ) ;
} ) ;
} ) ;
// Deactivate setting--default is checked
casper . then ( function ( ) {
2017-04-21 01:10:59 +02:00
casper . click ( ".method_row[data-method='Email'] input[type='checkbox'] + span" ) ;
2017-05-25 00:50:07 +02:00
submit _org _authentication _change ( ) ;
2016-11-02 21:51:56 +01:00
casper . waitUntilVisible ( '#admin-realm-authentication-methods-status' , function ( ) {
casper . test . assertSelectorHasText ( '#admin-realm-authentication-methods-status' , 'Authentication methods saved!' ) ;
casper . test . assertEval ( function ( ) {
return document . querySelector ( ".method_row[data-method='Email'] input[type='checkbox']" ) . checked ;
} ) ;
} ) ;
} ) ;
2015-11-04 18:21:17 +01:00
common . then _log _out ( ) ;
casper . run ( function ( ) {
casper . test . done ( ) ;
} ) ;