switch_to_user_test.rb 1.1 KB

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