admin_object_manager_test.rb 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class AdminObjectManagerTest < TestCase
  4. def test_basic_a
  5. @browser = browser_instance
  6. login(
  7. username: 'master@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all()
  12. click(css: 'a[href="#manage"]')
  13. click(css: 'a[href="#system/object_manager"]')
  14. click(css: '#content .js-new')
  15. modal_ready()
  16. # already existing
  17. set(
  18. css: '.modal input[name="name"]',
  19. value: 'customer_id',
  20. )
  21. set(
  22. css: '.modal input[name="display"]',
  23. value: 'Customer Should Not Creatable',
  24. )
  25. click(css: '.modal button.js-submit')
  26. sleep 4
  27. watch_for(
  28. css: '.modal',
  29. value: '(already exists)',
  30. )
  31. # invalid name
  32. set(
  33. css: '.modal input[name="name"]',
  34. value: 'some_other_id',
  35. )
  36. set(
  37. css: '.modal input[name="display"]',
  38. value: 'Should Not Creatable',
  39. )
  40. click(css: '.modal button.js-submit')
  41. sleep 4
  42. watch_for(
  43. css: '.modal',
  44. value: '(are not allowed)',
  45. )
  46. # invalid name
  47. set(
  48. css: '.modal input[name="name"]',
  49. value: 'some_other_ids',
  50. )
  51. set(
  52. css: '.modal input[name="display"]',
  53. value: 'Should Not Creatable',
  54. )
  55. click(css: '.modal button.js-submit')
  56. sleep 4
  57. watch_for(
  58. css: '.modal',
  59. value: '(are not allowed)',
  60. )
  61. # invalid name
  62. set(
  63. css: '.modal input[name="name"]',
  64. value: 'some spaces',
  65. )
  66. set(
  67. css: '.modal input[name="display"]',
  68. value: 'Should Not Creatable',
  69. )
  70. click(css: '.modal button.js-submit')
  71. sleep 4
  72. watch_for(
  73. css: '.modal',
  74. value: '(are not allowed)',
  75. )
  76. click(css: '.modal .js-close')
  77. modal_ready()
  78. # valid name
  79. click(css: '#content .js-new')
  80. modal_ready()
  81. set(
  82. css: '.modal input[name="name"]',
  83. value: 'browser_test1',
  84. )
  85. set(
  86. css: '.modal input[name="display"]',
  87. value: 'Browser Test 1',
  88. )
  89. click(css: '.modal button.js-submit')
  90. watch_for(
  91. css: '#content table',
  92. value: 'browser_test1',
  93. )
  94. watch_for(
  95. css: '#content',
  96. value: 'Database Update required',
  97. )
  98. click(css: '#content .tab-pane.active div.js-execute')
  99. watch_for(
  100. css: '.modal',
  101. value: 'New Version',
  102. )
  103. click(css: '.modal button.js-submit')
  104. # create new ticket
  105. ticket = ticket_create(
  106. data: {
  107. customer: 'nico',
  108. group: 'Users',
  109. priority: '2 normal',
  110. state: 'open',
  111. title: 'ticket attribute test #1',
  112. body: 'ticket attribute test #1',
  113. },
  114. #custom_data_select: {
  115. # key1: 'some value',
  116. #},
  117. custom_data_input: {
  118. browser_test1: 'some value öäüß',
  119. },
  120. disable_group_check: true,
  121. )
  122. # update ticket
  123. ticket_update(
  124. data: {},
  125. #custom_data_select: {
  126. # key1: 'some value',
  127. #},
  128. custom_data_input: {
  129. browser_test1: 'some value ABC',
  130. },
  131. )
  132. # discard new attribute
  133. click(css: 'a[href="#manage"]')
  134. click(css: 'a[href="#system/object_manager"]')
  135. watch_for(
  136. css: '#content table',
  137. value: 'browser_test1',
  138. )
  139. match_not(
  140. css: '#content',
  141. value: 'Database Update required',
  142. )
  143. click(css: '#content .tab-pane.active table tbody tr:last-child .js-delete')
  144. sleep 4
  145. watch_for(
  146. css: '#content',
  147. value: 'Database Update required',
  148. )
  149. watch_for(
  150. css: '#content table',
  151. value: 'browser_test1',
  152. )
  153. click(css: '#content .tab-pane.active div.js-execute')
  154. watch_for(
  155. css: '.modal',
  156. value: 'New Version',
  157. )
  158. click(css: '.modal button.js-submit')
  159. sleep 5
  160. match_not(
  161. css: '#content',
  162. value: 'Database Update required',
  163. )
  164. match_not(
  165. css: '#content table',
  166. value: 'browser_test1',
  167. )
  168. end
  169. end