From 14f267fa82631c05692c1a8305eb25e9755e4846 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 8 Jun 2015 10:59:23 +0200 Subject: [PATCH] Fixed switch to user feature and added browser tests. --- .../app/controllers/users.js.coffee | 4 +- app/assets/stylesheets/zammad.css.scss | 2 +- test/browser/switch_to_user_test.rb | 41 +++++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 test/browser/switch_to_user_test.rb diff --git a/app/assets/javascripts/app/controllers/users.js.coffee b/app/assets/javascripts/app/controllers/users.js.coffee index e91652cb1..f2d7ae8ee 100644 --- a/app/assets/javascripts/app/controllers/users.js.coffee +++ b/app/assets/javascripts/app/controllers/users.js.coffee @@ -54,8 +54,8 @@ class Index extends App.Controller header callbackAttributes = (value, object, attribute, header, refObject) -> - value = ' ' - attribute.class = 'glyphicon glyphicon-user' + value = ' ' + attribute.class = '' attribute.link = '#' attribute.title = App.i18n.translateInline('Switch to') value diff --git a/app/assets/stylesheets/zammad.css.scss b/app/assets/stylesheets/zammad.css.scss index d68b0b02d..8baf7efa4 100644 --- a/app/assets/stylesheets/zammad.css.scss +++ b/app/assets/stylesheets/zammad.css.scss @@ -4006,7 +4006,7 @@ footer { color: #fff; height: 45px; padding: 0 17px; - top: -45px !important; + /*top: -45px !important;*/ border-bottom: 5px solid hsl(205,90%,60%); } .switchBackToUser-icon { diff --git a/test/browser/switch_to_user_test.rb b/test/browser/switch_to_user_test.rb new file mode 100644 index 000000000..34e2c8966 --- /dev/null +++ b/test/browser/switch_to_user_test.rb @@ -0,0 +1,41 @@ +# encoding: utf-8 +require 'browser_test_helper' + +class SwitchToUserTest < TestCase + def test_agent_user + @browser = browser_instance + login( + username: 'master@example.com', + password: 'test', + url: browser_url, + ) + tasks_close_all() + + click( css: 'a[href="#manage"]' ) + click( css: 'a[href="#manage/users"]' ) + + set( + css: '#content .js-search', + value: 'nicole', + ) + sleep 3 + + click( + css: '#content .icon-user', + ) + + watch_for( + :css => '#app', + :value => 'zammad looks like', + ) + login = @browser.find_elements( { css: '.user-menu .user a' } )[0].attribute('title') + assert_equal(login, 'nicole.braun@zammad.org') + + click( css: '#app .js-close' ) + + login = @browser.find_elements( { css: '.user-menu .user a' } )[0].attribute('title') + assert_equal(login, 'master@example.com') + + end + +end