agent_ticket_time_accounting_test.rb 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class AgentTicketTimeAccountingTest < TestCase
  4. def test_macro
  5. @browser = browser_instance
  6. login(
  7. username: 'master@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all()
  12. # enable time accounting
  13. click(
  14. css: 'a[href="#manage"]',
  15. )
  16. click(
  17. css: '.content.active a[href="#manage/time_accounting"]',
  18. )
  19. switch(
  20. css: '.content.active .js-timeAccountingSetting',
  21. type: 'on',
  22. )
  23. ticket1 = ticket_create(
  24. data: {
  25. customer: 'nico',
  26. group: 'Users',
  27. title: 'some subject - time accounting#1',
  28. body: 'some body - time accounting#1',
  29. },
  30. )
  31. ticket_update(
  32. data: {
  33. body: 'some note',
  34. },
  35. do_not_submit: true,
  36. )
  37. click(
  38. css: '.active .js-submit',
  39. )
  40. watch_for(
  41. css: '.content.active .modal',
  42. value: 'Time Accounting',
  43. )
  44. set(
  45. css: '.content.active .modal [name=time_unit]',
  46. value: '4',
  47. )
  48. click(
  49. css: '.content.active .modal .js-submit',
  50. )
  51. watch_for_disappear(
  52. css: '.content.active .modal',
  53. value: 'Time Accounting',
  54. )
  55. watch_for(
  56. css: '.content.active .js-timeUnit',
  57. value: '4',
  58. )
  59. ticket2 = ticket_create(
  60. data: {
  61. customer: 'nico',
  62. group: 'Users',
  63. title: 'some subject - time accounting#2',
  64. body: 'some body - time accounting#2',
  65. },
  66. )
  67. ticket_update(
  68. data: {
  69. body: 'some note',
  70. },
  71. do_not_submit: true,
  72. )
  73. click(
  74. css: '.active .js-submit',
  75. )
  76. watch_for(
  77. css: '.content.active .modal',
  78. value: 'Time Accounting',
  79. )
  80. set(
  81. css: '.content.active .modal [name=time_unit]',
  82. value: '4,6',
  83. )
  84. click(
  85. css: '.content.active .modal .js-submit',
  86. )
  87. watch_for_disappear(
  88. css: '.content.active .modal',
  89. value: 'Time Accounting',
  90. )
  91. watch_for(
  92. css: '.content.active .js-timeUnit',
  93. value: '4.6',
  94. )
  95. ticket_update(
  96. data: {
  97. body: 'some note2',
  98. },
  99. do_not_submit: true,
  100. )
  101. click(
  102. css: '.active .js-submit',
  103. )
  104. watch_for(
  105. css: '.content.active .modal',
  106. value: 'Time Accounting',
  107. )
  108. set(
  109. css: '.content.active .modal [name=time_unit]',
  110. value: '4abc',
  111. )
  112. click(
  113. css: '.content.active .modal .js-submit',
  114. )
  115. watch_for(
  116. css: '.content.active .modal [name=time_unit].has-error',
  117. )
  118. set(
  119. css: '.content.active .modal [name=time_unit]',
  120. value: '4 ',
  121. )
  122. click(
  123. css: '.content.active .modal .js-submit',
  124. )
  125. watch_for_disappear(
  126. css: '.content.active .modal',
  127. value: 'Time Accounting',
  128. )
  129. watch_for(
  130. css: '.content.active .js-timeUnit',
  131. value: '8.6',
  132. )
  133. # disable time accounting
  134. click(
  135. css: 'a[href="#manage"]',
  136. )
  137. click(
  138. css: '.content.active a[href="#manage/time_accounting"]',
  139. )
  140. switch(
  141. css: '.content.active .js-timeAccountingSetting',
  142. type: 'off',
  143. )
  144. end
  145. end