agent_organization_profile_test.rb 3.3 KB

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