agent_ticket_actions_level5_test.rb 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class AgentTicketActionLevel5Test < TestCase
  4. def test_I
  5. random = 'text_module_test_' + rand(99999999).to_s
  6. random2 = 'text_module_test_' + rand(99999999).to_s
  7. # user
  8. tests = [
  9. {
  10. :name => 'add #1',
  11. :action => [
  12. {
  13. :execute => 'close_all_tasks',
  14. },
  15. {
  16. :execute => 'click',
  17. :css => 'a[href="#manage"]',
  18. },
  19. {
  20. :execute => 'click',
  21. :css => 'a[href="#manage/text_modules"]',
  22. },
  23. {
  24. :execute => 'click',
  25. :css => 'a[data-type="new"]',
  26. },
  27. {
  28. :execute => 'set',
  29. :css => '.modal input[name=name]',
  30. :value => 'some name' + random,
  31. },
  32. {
  33. :execute => 'set',
  34. :css => '.modal input[name="keywords"]',
  35. :value => random,
  36. },
  37. {
  38. :execute => 'set',
  39. :css => '.modal textarea[name="content"]',
  40. :value => 'some content' + random,
  41. },
  42. {
  43. :execute => 'click',
  44. :css => '.modal button.submit',
  45. },
  46. {
  47. :execute => 'wait',
  48. :value => 3,
  49. },
  50. {
  51. :execute => 'match',
  52. :css => 'body',
  53. :value => random,
  54. :match_result => true,
  55. },
  56. ],
  57. },
  58. {
  59. :name => 'add #2',
  60. :action => [
  61. {
  62. :execute => 'click',
  63. :css => 'a[href="#manage"]',
  64. },
  65. {
  66. :execute => 'click',
  67. :css => 'a[href="#manage/text_modules"]',
  68. },
  69. {
  70. :execute => 'click',
  71. :css => 'a[data-type="new"]',
  72. },
  73. {
  74. :execute => 'set',
  75. :css => '.modal input[name=name]',
  76. :value => 'some name' + random2,
  77. },
  78. {
  79. :execute => 'set',
  80. :css => '.modal input[name="keywords"]',
  81. :value => random2,
  82. },
  83. {
  84. :execute => 'set',
  85. :css => '.modal textarea[name="content"]',
  86. :value => 'some content' + random2,
  87. },
  88. {
  89. :execute => 'click',
  90. :css => '.modal button.submit',
  91. },
  92. {
  93. :execute => 'wait',
  94. :value => 3,
  95. },
  96. {
  97. :execute => 'match',
  98. :css => 'body',
  99. :value => random2,
  100. :match_result => true,
  101. },
  102. ],
  103. },
  104. {
  105. :name => 'verify usage',
  106. :action => [
  107. {
  108. :execute => 'click',
  109. :css => 'a[href="#new"]',
  110. },
  111. {
  112. :execute => 'click',
  113. :css => 'a[href="#ticket/create/call_outbound"]',
  114. },
  115. {
  116. :execute => 'wait',
  117. :value => 2,
  118. },
  119. {
  120. :execute => 'set',
  121. :css => '.active textarea[name=body]',
  122. :value => '::' + random,
  123. },
  124. {
  125. :execute => 'wait',
  126. :value => 1,
  127. },
  128. {
  129. :execute => 'match',
  130. :css => 'body',
  131. :value => random,
  132. :match_result => true,
  133. },
  134. {
  135. :execute => 'click',
  136. :css => '.-sew-list-item.selected',
  137. },
  138. {
  139. :execute => 'wait',
  140. :value => 1,
  141. },
  142. {
  143. :execute => 'match',
  144. :css => '.active textarea[name=body]',
  145. :value => 'some content' + random,
  146. :match_result => true,
  147. },
  148. ],
  149. },
  150. ]
  151. browser_signle_test_with_login(tests, { :username => 'master@example.com' })
  152. end
  153. def test_II
  154. random = 'text_II_module_test_' + rand(99999999).to_s
  155. user_rand = rand(99999999).to_s
  156. login = 'agent-text-module-' + user_rand
  157. firstname = 'Text' + user_rand
  158. lastname = 'Module' + user_rand
  159. email = 'agent-text-module-' + user_rand + '@example.com'
  160. password = 'agentpw'
  161. # user
  162. tests = [
  163. {
  164. :name => 'start',
  165. :instance1 => browser_instance,
  166. :instance2 => browser_instance,
  167. :instance1_username => 'master@example.com',
  168. :instance1_password => 'test',
  169. :instance2_username => 'agent1@example.com',
  170. :instance2_password => 'test',
  171. :action => [
  172. # create ticket
  173. {
  174. :where => :instance2,
  175. :execute => 'close_all_tasks',
  176. },
  177. {
  178. :where => :instance2,
  179. :execute => 'click',
  180. :css => '.taskbar-new a[href="#new"]',
  181. },
  182. {
  183. :where => :instance2,
  184. :execute => 'click',
  185. :css => '.taskbar-new a[href="#ticket/create/call_inbound"]',
  186. },
  187. {
  188. :where => :instance2,
  189. :execute => 'set',
  190. :css => '.active input[name=title]',
  191. :value => 'A',
  192. },
  193. {
  194. :where => :instance2,
  195. :execute => 'click',
  196. :css => '.taskbar-new a[href="#new"]',
  197. },
  198. {
  199. :where => :instance2,
  200. :execute => 'click',
  201. :css => '.taskbar-new a[href="#ticket/create/call_outbound"]',
  202. },
  203. {
  204. :where => :instance2,
  205. :execute => 'set',
  206. :css => '.active input[name=title]',
  207. :value => 'B',
  208. },
  209. # create new text module
  210. {
  211. :where => :instance1,
  212. :execute => 'click',
  213. :css => 'a[href="#manage"]',
  214. },
  215. {
  216. :where => :instance1,
  217. :execute => 'click',
  218. :css => 'a[href="#manage/text_modules"]',
  219. },
  220. {
  221. :where => :instance1,
  222. :execute => 'click',
  223. :css => 'a[data-type="new"]',
  224. },
  225. {
  226. :where => :instance1,
  227. :execute => 'set',
  228. :css => '.modal input[name=name]',
  229. :value => 'some name' + random,
  230. },
  231. {
  232. :where => :instance1,
  233. :execute => 'set',
  234. :css => '.modal input[name="keywords"]',
  235. :value => random,
  236. },
  237. {
  238. :where => :instance1,
  239. :execute => 'set',
  240. :css => '.modal textarea[name="content"]',
  241. :value => 'some content <%= @ticket.customer.lastname %>' + random,
  242. },
  243. {
  244. :where => :instance1,
  245. :execute => 'click',
  246. :css => '.modal button.submit',
  247. },
  248. {
  249. :execute => 'wait',
  250. :value => 3,
  251. },
  252. {
  253. :where => :instance1,
  254. :execute => 'match',
  255. :css => 'body',
  256. :value => random,
  257. :match_result => true,
  258. },
  259. ],
  260. },
  261. # create user
  262. {
  263. :name => 'create user',
  264. :action => [
  265. {
  266. :where => :instance1,
  267. :execute => 'create_user',
  268. :login => login,
  269. :firstname => firstname,
  270. :lastname => lastname,
  271. :email => email,
  272. :password => password,
  273. },
  274. ],
  275. },
  276. {
  277. :name => 'check if text module exists in instance2, for ready to use',
  278. :action => [
  279. {
  280. :execute => 'wait',
  281. :value => 4,
  282. },
  283. {
  284. :where => :instance2,
  285. :execute => 'set',
  286. :css => '.active textarea[name=body]',
  287. :value => '::' + random,
  288. },
  289. {
  290. :where => :instance2,
  291. :execute => 'wait',
  292. :value => 1,
  293. },
  294. {
  295. :where => :instance2,
  296. :execute => 'match',
  297. :css => 'body',
  298. :value => random,
  299. :match_result => true,
  300. },
  301. {
  302. :where => :instance2,
  303. :execute => 'click',
  304. :css => '.-sew-list-item.selected',
  305. },
  306. {
  307. :where => :instance2,
  308. :execute => 'wait',
  309. :value => 1,
  310. },
  311. {
  312. :where => :instance2,
  313. :execute => 'match',
  314. :css => '.active textarea[name=body]',
  315. :value => 'some content ' + random,
  316. :match_result => true,
  317. },
  318. {
  319. :execute => 'wait',
  320. :value => 3,
  321. },
  322. {
  323. :where => :instance2,
  324. :execute => 'set',
  325. :css => '.active .ticket-create input[name="customer_id_autocompletion"]',
  326. :value => 'nicole',
  327. },
  328. {
  329. :execute => 'wait',
  330. :value => 4,
  331. },
  332. {
  333. :where => :instance2,
  334. :execute => 'sendkey',
  335. :css => '.active .ticket-create input[name="customer_id_autocompletion"]',
  336. :value => :arrow_down,
  337. },
  338. {
  339. :where => :instance2,
  340. :execute => 'sendkey',
  341. :css => '.active .ticket-create input[name="customer_id_autocompletion"]',
  342. :value => :tab,
  343. },
  344. {
  345. :where => :instance2,
  346. :execute => 'wait',
  347. :value => 1,
  348. },
  349. {
  350. :where => :instance2,
  351. :execute => 'set',
  352. :css => '.active textarea[name=body]',
  353. :value => '::' + random,
  354. },
  355. {
  356. :where => :instance2,
  357. :execute => 'wait',
  358. :value => 1,
  359. },
  360. {
  361. :where => :instance2,
  362. :execute => 'click',
  363. :css => '.-sew-list-item.selected',
  364. },
  365. {
  366. :where => :instance2,
  367. :execute => 'wait',
  368. :value => 1,
  369. },
  370. {
  371. :where => :instance2,
  372. :execute => 'match',
  373. :css => '.active textarea[name=body]',
  374. :value => 'some content Braun' + random,
  375. :match_result => true,
  376. },
  377. ],
  378. },
  379. {
  380. :name => 'verify zoom',
  381. :action => [
  382. {
  383. :where => :instance1,
  384. :execute => 'click',
  385. :css => 'a[href="#manage"]',
  386. },
  387. # create ticket
  388. {
  389. :where => :instance2,
  390. :execute => 'create_ticket',
  391. :group => 'Users',
  392. :subject => 'some subject 123äöü',
  393. :body => 'some body 123äöü',
  394. },
  395. # check ticket
  396. {
  397. :where => :instance2,
  398. :execute => 'match',
  399. :css => '.active div.ticket-article',
  400. :value => 'some body 123äöü',
  401. :match_result => true,
  402. },
  403. # check ticket zoom
  404. {
  405. :execute => 'wait',
  406. :value => 4,
  407. },
  408. {
  409. :where => :instance2,
  410. :execute => 'set',
  411. :css => '.active textarea[name=body]',
  412. :value => 'test',
  413. },
  414. {
  415. :execute => 'wait',
  416. :value => 2,
  417. },
  418. {
  419. :where => :instance2,
  420. :execute => 'set',
  421. :css => '.active textarea[name=body]',
  422. :value => '::' + random,
  423. },
  424. {
  425. :execute => 'wait',
  426. :value => 0.5,
  427. },
  428. {
  429. :where => :instance2,
  430. :execute => 'match',
  431. :css => 'body',
  432. :value => random,
  433. :match_result => true,
  434. },
  435. {
  436. :where => :instance2,
  437. :execute => 'click',
  438. :css => '.-sew-list-item.selected',
  439. },
  440. {
  441. :execute => 'wait',
  442. :value => 1,
  443. },
  444. {
  445. :where => :instance2,
  446. :execute => 'match',
  447. :css => '.active textarea[name=body]',
  448. :value => 'some content Braun' + random,
  449. :match_result => true,
  450. },
  451. ],
  452. },
  453. {
  454. :name => 'change customer',
  455. :action => [
  456. {
  457. :where => :instance1,
  458. :execute => 'click',
  459. :css => 'a[href="#manage"]',
  460. },
  461. # create ticket
  462. {
  463. :where => :instance2,
  464. :execute => 'click',
  465. :css => '.active .action button',
  466. },
  467. {
  468. :execute => 'wait',
  469. :value => 1,
  470. },
  471. {
  472. :where => :instance2,
  473. :execute => 'click',
  474. :css => '.active .action [data-type="customer"]',
  475. },
  476. {
  477. :execute => 'wait',
  478. :value => 1,
  479. },
  480. {
  481. :where => :instance2,
  482. :execute => 'set',
  483. :css => '#form-customer input[name="customer_id_autocompletion"]',
  484. :value => firstname,
  485. },
  486. {
  487. :execute => 'wait',
  488. :value => 4,
  489. },
  490. {
  491. :where => :instance2,
  492. :execute => 'sendkey',
  493. :css => '#form-customer input[name="customer_id_autocompletion"]',
  494. :value => :arrow_down,
  495. },
  496. {
  497. :where => :instance2,
  498. :execute => 'sendkey',
  499. :css => '#form-customer input[name="customer_id_autocompletion"]',
  500. :value => :tab,
  501. },
  502. {
  503. :where => :instance2,
  504. :execute => 'wait',
  505. :value => 1,
  506. },
  507. {
  508. :where => :instance2,
  509. :execute => 'click',
  510. :css => '.modal-content [type="submit"]',
  511. },
  512. {
  513. :where => :instance2,
  514. :execute => 'wait',
  515. :value => 4,
  516. },
  517. {
  518. :where => :instance2,
  519. :execute => 'set',
  520. :css => '.active textarea[name=body]',
  521. :value => '::' + random,
  522. },
  523. {
  524. :execute => 'wait',
  525. :value => 0.5,
  526. },
  527. # {
  528. # :where => :instance2,
  529. # :execute => 'match',
  530. # :css => 'body',
  531. # :value => random,
  532. # :match_result => true,
  533. # },
  534. {
  535. :where => :instance2,
  536. :execute => 'click',
  537. :css => '.-sew-list-item.selected',
  538. },
  539. {
  540. :execute => 'wait',
  541. :value => 1,
  542. },
  543. {
  544. :where => :instance2,
  545. :execute => 'match',
  546. :css => '.active textarea[name=body]',
  547. :value => 'some content ' + lastname,
  548. :match_result => true,
  549. },
  550. {
  551. :execute => 'wait',
  552. :value => 2,
  553. },
  554. ],
  555. },
  556. ]
  557. browser_double_test(tests)
  558. end
  559. end