agent_organization_profile_test.rb 2.6 KB

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