integration_test.rb 8.5 KB

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