Fixed issue #249 - New users won't get initial user group.

This commit is contained in:
Martin Edenhofer 2016-12-14 15:48:41 +01:00
parent 1ffc19455a
commit f635a34a94
3 changed files with 89 additions and 2 deletions

View file

@ -102,12 +102,20 @@ class App.UiElement.user_permission
if !checked if !checked
if rolesWithGroupPlugin[role_id] is 'group' if rolesWithGroupPlugin[role_id] is 'group'
item.find('.js-groupList').addClass('hidden') item.find('.js-groupList').addClass('hidden')
# select groups if only one is available
if hideGroups
item.find('.js-groupList [name=group_ids]').prop('checked', false)
return return
# if role with groups plugin is selected, show group selection # if role with groups plugin is selected, show group selection
if rolesWithGroupPlugin[role_id] is 'group' if rolesWithGroupPlugin[role_id] is 'group'
item.find('.js-groupList:not(.js-groupListHide)').removeClass('hidden') item.find('.js-groupList:not(.js-groupListHide)').removeClass('hidden')
# select groups if only one is available
if hideGroups
item.find('.js-groupList [name=group_ids]').prop('checked', true)
for trigger in triggers for trigger in triggers
trigger.trigger('change') trigger.trigger('change')
) )

View file

@ -57,9 +57,72 @@ class AgentTicketActionLevel0Test < TestCase
css: '.modal [name="email"]', css: '.modal [name="email"]',
value: "#{agent}@example.com", value: "#{agent}@example.com",
) )
exists_not( exists(
css: '.modal select[name="group_ids"]', displayed: false,
css: '.modal [name="group_ids"]',
) )
exists(
css: '.modal [name="group_ids"]:checked',
)
click(
css: '.modal button.btn.btn--primary',
fast: true,
)
watch_for(
css: 'body div.modal',
value: 'Sending',
)
watch_for_disappear(
css: 'body div.modal',
value: 'Sending',
)
click(css: '#navigation a[href="#dashboard"]')
click(css: '.active.content .tab[data-area="first-steps-widgets"]')
watch_for(
css: '.active.content',
value: 'Configuration',
)
click(css: '.active.content .js-inviteAgent')
modal_ready()
set(
css: '.modal [name="firstname"]',
value: 'Bob2',
)
set(
css: '.modal [name="lastname"]',
value: 'Smith2',
)
set(
css: '.modal [name="email"]',
value: "#{agent}2@example.com",
)
# disable agent role
uncheck(
css: '.modal [name="role_ids"][value=2]',
)
exists(
displayed: false,
css: '.modal [name="group_ids"]',
)
exists_not(
css: '.modal [name="group_ids"]:checked',
)
# enable agent role
check(
css: '.modal [name="role_ids"][value=2]',
)
exists(
css: '.modal [name="group_ids"]',
)
exists(
css: '.modal [name="group_ids"]:checked',
)
click( click(
css: '.modal button.btn.btn--primary', css: '.modal button.btn.btn--primary',
fast: true, fast: true,

View file

@ -547,6 +547,12 @@ class TestCase < Test::Unit::TestCase
css: '.some_class', css: '.some_class',
) )
exists(
displayed: false, # true|false
browser: browser1,
css: '.some_class',
)
=end =end
def exists(params) def exists(params)
@ -558,6 +564,16 @@ class TestCase < Test::Unit::TestCase
screenshot(browser: instance, comment: 'exists_failed') screenshot(browser: instance, comment: 'exists_failed')
raise "#{params[:css]} dosn't exist, but should" raise "#{params[:css]} dosn't exist, but should"
end end
if params.key?(:displayed)
if params[:displayed] == true && !instance.find_elements(css: params[:css])[0].displayed?
raise "#{params[:css]} is not displayed, but should"
end
if params[:displayed] == false && instance.find_elements(css: params[:css])[0].displayed?
raise "#{params[:css]} is displayed, but should not"
end
end
true true
end end