agent_user_profile_test.rb 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. require 'browser_test_helper'
  2. class AgentUserProfileTest < TestCase
  3. def test_user_profile
  4. message = "1 #{rand(99_999_999)}"
  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. modal_ready()
  38. watch_for(
  39. css: '.active .modal',
  40. value: 'some note 123',
  41. )
  42. set(
  43. css: '.modal [name="lastname"]',
  44. value: 'B2',
  45. )
  46. set(
  47. css: '.modal [data-name="note"]',
  48. value: 'some note abc',
  49. )
  50. click(css: '.active .modal button.js-submit')
  51. modal_disappear()
  52. watch_for(
  53. css: '.active .profile-window',
  54. value: 'some note abc',
  55. )
  56. verify_task(
  57. data: {
  58. title: 'Nicole B2',
  59. }
  60. )
  61. # change lastname back
  62. click(css: '.active .js-action .icon-arrow-down', fast: true)
  63. click(css: '.active .js-action [data-type="edit"]')
  64. modal_ready()
  65. set(
  66. css: '.modal [name="lastname"]',
  67. value: 'Braun',
  68. )
  69. click(css: '.active .modal button.js-submit')
  70. modal_disappear()
  71. verify_task(
  72. data: {
  73. title: 'Nicole Braun',
  74. }
  75. )
  76. # create new ticket
  77. ticket_create(
  78. data: {
  79. customer: 'nico',
  80. group: 'Users',
  81. title: "user profile check #{message}",
  82. body: "user profile check #{message}",
  83. },
  84. )
  85. # switch to org tab, verify if ticket is shown
  86. user_open_by_search(value: 'Braun')
  87. watch_for(
  88. css: '.active .profile-window',
  89. value: "user profile check #{message}",
  90. )
  91. tasks_close_all()
  92. # work with two browser windows
  93. message = "comment 1 #{rand(99_999_999_999_999_999)}"
  94. # use current session
  95. browser1 = @browser
  96. browser2 = browser_instance
  97. login(
  98. browser: browser2,
  99. username: 'agent1@example.com',
  100. password: 'test',
  101. url: browser_url,
  102. )
  103. tasks_close_all(
  104. browser: browser2,
  105. )
  106. user_open_by_search(
  107. browser: browser1,
  108. value: 'Braun',
  109. )
  110. user_open_by_search(
  111. browser: browser2,
  112. value: 'Braun',
  113. )
  114. # update note
  115. set(
  116. browser: browser1,
  117. css: '.active [data-name="note"]',
  118. value: message,
  119. )
  120. empty_search(
  121. browser: browser1,
  122. )
  123. watch_for(
  124. browser: browser2,
  125. css: '.active .profile-window',
  126. value: message,
  127. )
  128. end
  129. end