agent_organization_profile_test.rb 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. watch_for(
  20. css: '.active .profile-window',
  21. value: 'note',
  22. )
  23. watch_for(
  24. css: '.active .profile-window',
  25. value: 'member',
  26. )
  27. # update note
  28. set(
  29. css: '.active .profile [data-name="note"]',
  30. value: note,
  31. contenteditable: true,
  32. )
  33. click( css: '.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 a[data-type="edit"]' )
  38. watch_for(
  39. css: '.active .modal',
  40. value: 'note',
  41. )
  42. watch_for(
  43. css: '.active .modal',
  44. value: note,
  45. )
  46. set(
  47. css: '.active .modal [data-name="note"]',
  48. value: 'some note abc',
  49. )
  50. click( css: '.active .modal button.js-submit' )
  51. watch_for(
  52. css: '.active .profile-window',
  53. value: 'some note abc',
  54. )
  55. # create new ticket
  56. ticket_create(
  57. data: {
  58. customer: 'nico',
  59. group: 'Users',
  60. title: 'org profile check ' + message,
  61. body: 'org profile check ' + message,
  62. },
  63. )
  64. # switch to org tab, verify if ticket is shown
  65. organization_open_by_search(
  66. value: 'Zammad Foundation',
  67. )
  68. watch_for(
  69. css: '.active .profile-window',
  70. value: 'org profile check ' + message,
  71. )
  72. tasks_close_all()
  73. # work with two browser windows
  74. message = 'comment 1 ' + rand(99_999_999_999_999_999).to_s
  75. # use current session
  76. browser1 = @browser
  77. browser2 = browser_instance
  78. login(
  79. browser: browser2,
  80. username: 'agent1@example.com',
  81. password: 'test',
  82. url: browser_url,
  83. )
  84. tasks_close_all(
  85. browser: browser2,
  86. )
  87. organization_open_by_search(
  88. browser: browser1,
  89. value: 'Zammad Foundation',
  90. )
  91. organization_open_by_search(
  92. browser: browser2,
  93. value: 'Zammad Foundation',
  94. )
  95. # update note
  96. set(
  97. browser: browser1,
  98. css: '.active .profile [data-name="note"]',
  99. value: message,
  100. contenteditable: true,
  101. )
  102. click(
  103. browser: browser1,
  104. css: '.empty-search',
  105. )
  106. # verify
  107. watch_for(
  108. browser: browser2,
  109. css: '.active .profile-window',
  110. value: message,
  111. )
  112. end
  113. end