maintenance_message_test.rb 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class MaintenanceMessageTest < TestCase
  4. def test_websocket
  5. message = 'message 1äöüß ' + rand(99999999999999999).to_s
  6. tests = [
  7. {
  8. :name => 'start',
  9. :instance1 => browser_instance,
  10. :instance2 => browser_instance,
  11. :instance1_username => 'master@example.com',
  12. :instance1_password => 'test',
  13. :instance2_username => 'agent1@example.com',
  14. :instance2_password => 'test',
  15. :url => browser_url,
  16. :action => [
  17. {
  18. :where => :instance1,
  19. :execute => 'check',
  20. :css => '#login',
  21. :result => false,
  22. },
  23. {
  24. :where => :instance2,
  25. :execute => 'check',
  26. :css => '#login',
  27. :result => false,
  28. },
  29. {
  30. :execute => 'wait',
  31. :value => 1,
  32. },
  33. {
  34. :where => :instance1,
  35. :execute => 'click',
  36. :css => 'a[href="#admin"]',
  37. },
  38. {
  39. :execute => 'wait',
  40. :value => 1,
  41. },
  42. {
  43. :where => :instance1,
  44. :execute => 'click',
  45. :css => 'a[href="#maintenance"]',
  46. },
  47. {
  48. :execute => 'wait',
  49. :value => 1,
  50. },
  51. {
  52. :where => :instance1,
  53. :execute => 'set',
  54. :css => 'input[name="title"]',
  55. :value => message,
  56. },
  57. {
  58. :where => :instance1,
  59. :execute => 'set',
  60. :css => 'textarea[name="message"]',
  61. :value => message,
  62. },
  63. {
  64. :where => :instance1,
  65. :execute => 'click',
  66. :css => 'button[type="submit"]',
  67. },
  68. {
  69. :execute => 'wait',
  70. :value => 5,
  71. },
  72. {
  73. :where => :instance2,
  74. :execute => 'check',
  75. :css => '.modal-header',
  76. :result => true,
  77. },
  78. {
  79. :where => :instance2,
  80. :execute => 'match',
  81. :css => 'body',
  82. :value => message,
  83. :match_result => true,
  84. },
  85. {
  86. :where => :instance2,
  87. :execute => 'click',
  88. :css => 'div.modal-backdrop.fade.in',
  89. },
  90. ],
  91. },
  92. {
  93. :name => 'start',
  94. :instance1 => browser_instance,
  95. :instance2 => browser_instance,
  96. :instance1_username => 'master@example.com',
  97. :instance1_password => 'test',
  98. :instance2_username => 'agent1@example.com',
  99. :instance2_password => 'test',
  100. :url => browser_url,
  101. :action => [
  102. {
  103. :where => :instance1,
  104. :execute => 'check',
  105. :css => '#login',
  106. :result => false,
  107. },
  108. {
  109. :where => :instance2,
  110. :execute => 'check',
  111. :css => '#login',
  112. :result => false,
  113. },
  114. {
  115. :execute => 'wait',
  116. :value => 1,
  117. },
  118. {
  119. :where => :instance1,
  120. :execute => 'click',
  121. :css => 'a[href="#admin"]',
  122. },
  123. {
  124. :execute => 'wait',
  125. :value => 1,
  126. },
  127. {
  128. :where => :instance1,
  129. :execute => 'click',
  130. :css => 'a[href="#maintenance"]',
  131. },
  132. {
  133. :execute => 'wait',
  134. :value => 1,
  135. },
  136. {
  137. :where => :instance1,
  138. :execute => 'set',
  139. :css => 'input[name="title"]',
  140. :value => message,
  141. },
  142. {
  143. :where => :instance1,
  144. :execute => 'set',
  145. :css => 'textarea[name="message"]',
  146. :value => message,
  147. },
  148. {
  149. :execute => 'wait',
  150. :value => 5,
  151. },
  152. {
  153. :where => :instance2,
  154. :execute => 'check',
  155. :css => 'div.modal-backdrop.fade.in',
  156. :result => false,
  157. },
  158. {
  159. :where => :instance2,
  160. :execute => 'match',
  161. :css => 'body',
  162. :value => message,
  163. :match_result => false,
  164. },
  165. ],
  166. },
  167. ]
  168. browser_double_test(tests)
  169. end
  170. end