agent_user_profile_test.rb 3.0 KB

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