agent_user_profile_test.rb 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class AgentUserProfileTest < TestCase
  4. def test_user_profile
  5. message = '1 ' + rand(99_999_999).to_s
  6. @browser = browser_instance
  7. login(
  8. username: 'master@example.com',
  9. password: 'test',
  10. url: browser_url,
  11. )
  12. tasks_close_all()
  13. # search and open user
  14. user_open_by_search(value: 'Braun')
  15. verify_task(
  16. data: {
  17. title: 'Nicole Braun',
  18. }
  19. )
  20. watch_for(
  21. css: '.active .profile-window',
  22. value: 'note',
  23. )
  24. watch_for(
  25. css: '.active .profile-window',
  26. value: 'email',
  27. )
  28. # update note
  29. set(
  30. css: '.active [data-name="note"]',
  31. value: 'some note 123',
  32. )
  33. empty_search()
  34. sleep 2
  35. # check and change note again in edit screen
  36. click(css: '.active .js-action .icon-arrow-down', fast: true)
  37. click(css: '.active .js-action [data-type="edit"]')
  38. watch_for(
  39. css: '.active .modal',
  40. value: 'note',
  41. )
  42. watch_for(
  43. css: '.active .modal',
  44. value: 'some note 123',
  45. )
  46. set(
  47. css: '.modal [name="lastname"]',
  48. value: 'B2',
  49. )
  50. set(
  51. css: '.modal [data-name="note"]',
  52. value: 'some note abc',
  53. )
  54. click(css: '.active .modal button.js-submit')
  55. watch_for(
  56. css: '.active .profile-window',
  57. value: 'some note abc',
  58. )
  59. verify_task(
  60. data: {
  61. title: 'Nicole B2',
  62. }
  63. )
  64. # change lastname back
  65. click(css: '.active .js-action .icon-arrow-down', fast: true)
  66. click(css: '.active .js-action [data-type="edit"]')
  67. watch_for(
  68. css: '.active .modal',
  69. value: 'note',
  70. )
  71. set(
  72. css: '.modal [name="lastname"]',
  73. value: 'Braun',
  74. )
  75. click(css: '.active .modal button.js-submit')
  76. verify_task(
  77. data: {
  78. title: 'Nicole Braun',
  79. }
  80. )
  81. # create new ticket
  82. ticket_create(
  83. data: {
  84. customer: 'nico',
  85. group: 'Users',
  86. title: 'user profile check ' + message,
  87. body: 'user profile check ' + message,
  88. },
  89. )
  90. # switch to org tab, verify if ticket is shown
  91. user_open_by_search(value: 'Braun')
  92. watch_for(
  93. css: '.active .profile-window',
  94. value: 'user profile check ' + message,
  95. )
  96. tasks_close_all()
  97. # work with two browser windows
  98. message = 'comment 1 ' + rand(99_999_999_999_999_999).to_s
  99. # use current session
  100. browser1 = @browser
  101. browser2 = browser_instance
  102. login(
  103. browser: browser2,
  104. username: 'agent1@example.com',
  105. password: 'test',
  106. url: browser_url,
  107. )
  108. tasks_close_all(
  109. browser: browser2,
  110. )
  111. user_open_by_search(
  112. browser: browser1,
  113. value: 'Braun',
  114. )
  115. user_open_by_search(
  116. browser: browser2,
  117. value: 'Braun',
  118. )
  119. # update note
  120. set(
  121. browser: browser1,
  122. css: '.active [data-name="note"]',
  123. value: message,
  124. )
  125. empty_search(
  126. browser: browser1,
  127. )
  128. watch_for(
  129. browser: browser2,
  130. css: '.active .profile-window',
  131. value: message,
  132. )
  133. end
  134. end