switch_to_user_test.rb 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class SwitchToUserTest < TestCase
  4. def test_agent_user
  5. @browser = browser_instance
  6. login(
  7. username: 'master@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all()
  12. click(css: 'a[href="#manage"]')
  13. click(css: '.content.active a[href="#manage/users"]')
  14. set(
  15. css: '.content.active .js-search',
  16. value: 'nicole',
  17. )
  18. sleep 3
  19. @browser.mouse.move_to(@browser.find_elements({ css: '.content.active .table-overview tbody tr:first-child' } )[0])
  20. sleep 0.5
  21. click(
  22. css: '.content.active .icon-switchView',
  23. )
  24. sleep 3
  25. watch_for(
  26. css: '.switchBackToUser',
  27. value: 'zammad looks like',
  28. )
  29. watch_for(
  30. css: '.switchBackToUser',
  31. value: 'Nicole',
  32. )
  33. login = @browser.find_elements({ css: '.user-menu .user a' })[0].attribute('title')
  34. assert_equal(login, 'nicole.braun@zammad.org')
  35. click(css: '.switchBackToUser .js-close')
  36. sleep 5
  37. login = @browser.find_elements({ css: '.user-menu .user a' })[0].attribute('title')
  38. assert_equal(login, 'master@example.com')
  39. end
  40. end