switch_to_user_test.rb 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 .dropdown--actions',
  22. )
  23. click(
  24. css: '.content.active .icon-switchView',
  25. )
  26. sleep 3
  27. watch_for(
  28. css: '.switchBackToUser',
  29. value: 'zammad looks like',
  30. )
  31. watch_for(
  32. css: '.switchBackToUser',
  33. value: 'Nicole',
  34. )
  35. login = @browser.find_elements({ css: '.user-menu .user a' })[0].attribute('title')
  36. assert_equal(login, 'nicole.braun@zammad.org')
  37. click(css: '.switchBackToUser .js-close')
  38. sleep 5
  39. login = @browser.find_elements({ css: '.user-menu .user a' })[0].attribute('title')
  40. assert_equal(login, 'master@example.com')
  41. end
  42. end