integration_test.rb 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class IntegrationTest < TestCase
  4. def test_sipgate
  5. @browser = browser_instance
  6. login(
  7. username: 'master@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all()
  12. # change settings
  13. click(css: 'a[href="#manage"]')
  14. click(css: 'a[href="#system/integration"]')
  15. click(css: 'a[href="#system/integration/sipgate"]')
  16. sleep 2
  17. switch(
  18. css: '.content.active .main .js-switch',
  19. type: 'on',
  20. )
  21. set(
  22. css: '.content.active .main .js-inboundBlockCallerId input[name=caller_id]',
  23. value: '041 1234567',
  24. )
  25. set(
  26. css: '.content.active .main .js-inboundBlockCallerId input[name=note]',
  27. value: 'block spam caller id',
  28. )
  29. click(css: '.content.active .main .js-inboundBlockCallerId .js-add')
  30. click(css: '.content.active .main .js-submit')
  31. exists(
  32. css: '.content.active .main .js-inboundBlockCallerId [value="0411234567"]',
  33. )
  34. exists(
  35. css: '.content.active .main .js-inboundBlockCallerId [value="block spam caller id"]',
  36. )
  37. click(css: 'a[href="#dashboard"]')
  38. click(css: 'a[href="#manage"]')
  39. click(css: 'a[href="#system/integration"]')
  40. click(css: 'a[href="#system/integration/sipgate"]')
  41. exists(
  42. css: '.content.active .main .js-inboundBlockCallerId [value="0411234567"]',
  43. )
  44. exists(
  45. css: '.content.active .main .js-inboundBlockCallerId [value="block spam caller id"]',
  46. )
  47. reload()
  48. exists(
  49. css: '.content.active .main .js-inboundBlockCallerId [value="0411234567"]',
  50. )
  51. exists(
  52. css: '.content.active .main .js-inboundBlockCallerId [value="block spam caller id"]',
  53. )
  54. click(css: '.content.active .main .js-inboundBlockCallerId .js-remove')
  55. click(css: '.content.active .main .js-submit')
  56. sleep 6
  57. switch(
  58. css: '.content.active .main .js-switch',
  59. type: 'off',
  60. )
  61. reload()
  62. exists_not(
  63. css: '.content.active .main .js-inboundBlockCallerId [value="0411234567"]',
  64. )
  65. exists_not(
  66. css: '.content.active .main .js-inboundBlockCallerId [value="block spam caller id"]',
  67. )
  68. end
  69. def test_slack
  70. @browser = browser_instance
  71. login(
  72. username: 'master@example.com',
  73. password: 'test',
  74. url: browser_url,
  75. )
  76. tasks_close_all()
  77. # change settings
  78. click(css: 'a[href="#manage"]')
  79. click(css: 'a[href="#system/integration"]')
  80. click(css: 'a[href="#system/integration/slack"]')
  81. sleep 2
  82. switch(
  83. css: '.content.active .main .js-switch',
  84. type: 'on',
  85. )
  86. click(css: '.content.active .main .checkbox-replacement')
  87. select(
  88. css: '.content.active .main select[name="group_ids"]',
  89. value: 'Users',
  90. )
  91. set(
  92. css: '.content.active .main input[name="webhook"]',
  93. value: 'http://some_url/webhook/123',
  94. )
  95. set(
  96. css: '.content.active .main input[name="username"]',
  97. value: 'someuser',
  98. )
  99. click(css: '.content.active .main .js-submit')
  100. match(
  101. css: '.content.active .main select[name="group_ids"]',
  102. value: 'Users',
  103. )
  104. match(
  105. css: '.content.active .main input[name="webhook"]',
  106. value: 'http://some_url/webhook/123',
  107. )
  108. match(
  109. css: '.content.active .main input[name="username"]',
  110. value: 'someuser',
  111. )
  112. click(css: 'a[href="#dashboard"]')
  113. click(css: 'a[href="#manage"]')
  114. click(css: 'a[href="#system/integration"]')
  115. click(css: 'a[href="#system/integration/slack"]')
  116. match(
  117. css: '.content.active .main select[name="group_ids"]',
  118. value: 'Users',
  119. )
  120. match(
  121. css: '.content.active .main input[name="webhook"]',
  122. value: 'http://some_url/webhook/123',
  123. )
  124. match(
  125. css: '.content.active .main input[name="username"]',
  126. value: 'someuser',
  127. )
  128. reload()
  129. match(
  130. css: '.content.active .main select[name="group_ids"]',
  131. value: 'Users',
  132. )
  133. match(
  134. css: '.content.active .main input[name="webhook"]',
  135. value: 'http://some_url/webhook/123',
  136. )
  137. match(
  138. css: '.content.active .main input[name="username"]',
  139. value: 'someuser',
  140. )
  141. switch(
  142. css: '.content.active .main .js-switch',
  143. type: 'off',
  144. )
  145. end
  146. def test_clearbit
  147. @browser = browser_instance
  148. login(
  149. username: 'master@example.com',
  150. password: 'test',
  151. url: browser_url,
  152. )
  153. tasks_close_all()
  154. # change settings
  155. click(css: 'a[href="#manage"]')
  156. click(css: 'a[href="#system/integration"]')
  157. click(css: 'a[href="#system/integration/clearbit"]')
  158. sleep 2
  159. switch(
  160. css: '.content.active .main .js-switch',
  161. type: 'on',
  162. )
  163. set(
  164. css: '.content.active .main input[name="api_key"]',
  165. value: 'some_api_key',
  166. )
  167. set(
  168. css: '.content.active .main .js-userSync .js-new [name="source"]',
  169. value: 'source1',
  170. )
  171. set(
  172. css: '.content.active .main .js-userSync .js-new [name="destination"]',
  173. value: 'destination1',
  174. )
  175. click(css: '.content.active .main .js-userSync .js-add')
  176. click(css: '.content.active .main .js-submit')
  177. click(css: 'a[href="#dashboard"]')
  178. click(css: 'a[href="#manage"]')
  179. click(css: 'a[href="#system/integration"]')
  180. click(css: 'a[href="#system/integration/clearbit"]')
  181. match(
  182. css: '.content.active .main input[name="api_key"]',
  183. value: 'some_api_key',
  184. )
  185. exists(
  186. css: '.content.active .main .js-userSync [value="source1"]',
  187. )
  188. exists(
  189. css: '.content.active .main .js-userSync [value="destination1"]',
  190. )
  191. reload()
  192. match(
  193. css: '.content.active .main input[name="api_key"]',
  194. value: 'some_api_key',
  195. )
  196. exists(
  197. css: '.content.active .main .js-userSync [value="source1"]',
  198. )
  199. exists(
  200. css: '.content.active .main .js-userSync [value="destination1"]',
  201. )
  202. switch(
  203. css: '.content.active .main .js-switch',
  204. type: 'off',
  205. )
  206. set(
  207. css: '.content.active .main input[name="api_key"]',
  208. value: '-empty-',
  209. )
  210. click(css: '.content.active .main .js-submit')
  211. reload()
  212. match_not(
  213. css: '.content.active .main input[name="api_key"]',
  214. value: 'some_api_key',
  215. )
  216. match(
  217. css: '.content.active .main input[name="api_key"]',
  218. value: '-empty-',
  219. )
  220. exists(
  221. css: '.content.active .main .js-userSync [value="source1"]',
  222. )
  223. exists(
  224. css: '.content.active .main .js-userSync [value="destination1"]',
  225. )
  226. end
  227. def test_icinga
  228. @browser = browser_instance
  229. login(
  230. username: 'master@example.com',
  231. password: 'test',
  232. url: browser_url,
  233. )
  234. tasks_close_all()
  235. # change settings
  236. click(css: 'a[href="#manage"]')
  237. click(css: 'a[href="#system/integration"]')
  238. click(css: 'a[href="#system/integration/icinga"]')
  239. sleep 2
  240. switch(
  241. css: '.content.active .main .js-switch',
  242. type: 'on',
  243. )
  244. set(
  245. css: '.content.active .main input[name="icinga_sender"]',
  246. value: 'some@othersender.com',
  247. )
  248. select(
  249. css: '.content.active .main select[name="icinga_auto_close"]',
  250. value: 'no',
  251. )
  252. click(css: '.content.active .main .js-submit')
  253. match(
  254. css: '.content.active .main input[name="icinga_sender"]',
  255. value: 'some@othersender.com',
  256. )
  257. match(
  258. css: '.content.active .main select[name="icinga_auto_close"]',
  259. value: 'no',
  260. )
  261. click(css: 'a[href="#dashboard"]')
  262. click(css: 'a[href="#manage"]')
  263. click(css: 'a[href="#system/integration"]')
  264. click(css: 'a[href="#system/integration/icinga"]')
  265. match(
  266. css: '.content.active .main input[name="icinga_sender"]',
  267. value: 'some@othersender.com',
  268. )
  269. match(
  270. css: '.content.active .main select[name="icinga_auto_close"]',
  271. value: 'no',
  272. )
  273. reload()
  274. match(
  275. css: '.content.active .main input[name="icinga_sender"]',
  276. value: 'some@othersender.com',
  277. )
  278. match(
  279. css: '.content.active .main select[name="icinga_auto_close"]',
  280. value: 'no',
  281. )
  282. switch(
  283. css: '.content.active .main .js-switch',
  284. type: 'off',
  285. )
  286. set(
  287. css: '.content.active .main input[name="icinga_sender"]',
  288. value: 'icinga@monitoring.example.com',
  289. )
  290. select(
  291. css: '.content.active .main select[name="icinga_auto_close"]',
  292. value: 'yes',
  293. )
  294. click(css: '.content.active .main .js-submit')
  295. match(
  296. css: '.content.active .main input[name="icinga_sender"]',
  297. value: 'icinga@monitoring.example.com',
  298. )
  299. match(
  300. css: '.content.active .main select[name="icinga_auto_close"]',
  301. value: 'yes',
  302. )
  303. end
  304. end