agent_user_profile_test.rb 3.0 KB

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