taskbar_task_test.rb 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class TaskbarTaskTest < TestCase
  4. def test_persistant_task_a
  5. @browser = browser_instance
  6. login(
  7. username: 'agent1@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all()
  12. # persistant task
  13. click(css: 'a[href="#new"]')
  14. click(css: 'a[href="#ticket/create"]', wait: 0.8)
  15. set(
  16. css: '.active .newTicket input[name="title"]',
  17. value: 'some test AAA',
  18. )
  19. sleep 4
  20. end
  21. def test_persistant_task_b
  22. @browser = browser_instance
  23. login(
  24. username: 'agent1@example.com',
  25. password: 'test',
  26. url: browser_url,
  27. )
  28. sleep 3
  29. # check if task still exists
  30. click(css: '.task', wait: 0.8)
  31. match(
  32. css: '.active .newTicket input[name="title"]',
  33. value: 'some test AAA',
  34. )
  35. tasks_close_all()
  36. exists_not(css: '.active .newTicket input[name="title"]')
  37. end
  38. def test_persistant_task_with_relogin
  39. @browser = browser_instance
  40. login(
  41. username: 'agent1@example.com',
  42. password: 'test',
  43. url: browser_url,
  44. )
  45. tasks_close_all()
  46. click(css: 'a[href="#new"]')
  47. click(css: 'a[href="#ticket/create"]', wait: 0.8)
  48. set(
  49. css: '.active .newTicket input[name="title"]',
  50. value: 'INBOUND TEST#1',
  51. )
  52. set(
  53. css: '.active .newTicket [data-name="body"]',
  54. value: 'INBOUND BODY TEST#1',
  55. )
  56. sleep 2
  57. click(css: 'a[href="#new"]')
  58. click(css: 'a[href="#ticket/create"]', wait: 0.8)
  59. set(
  60. css: '.active .newTicket input[name="title"]',
  61. value: 'OUTBOUND TEST#1',
  62. )
  63. set(
  64. css: '.active .newTicket [data-name="body"]',
  65. value: 'OUTBOUND BODY TEST#1',
  66. )
  67. sleep 3
  68. logout()
  69. sleep 4
  70. # relogin with master - task are not viewable
  71. login(
  72. username: 'master@example.com',
  73. password: 'test',
  74. url: browser_url,
  75. )
  76. sleep 3
  77. match_not(
  78. css: 'body',
  79. value: 'INBOUND TEST#1',
  80. )
  81. match_not(
  82. css: 'body',
  83. value: 'OUTBOUND TEST#1',
  84. )
  85. logout()
  86. sleep 2
  87. match_not(
  88. css: 'body',
  89. value: 'INBOUND TEST#1',
  90. )
  91. match_not(
  92. css: 'body',
  93. value: 'OUTBOUND TEST#1',
  94. )
  95. # relogin with agent - task are viewable
  96. login(
  97. username: 'agent1@example.com',
  98. password: 'test',
  99. url: browser_url,
  100. )
  101. sleep 3
  102. match(
  103. css: 'body',
  104. value: 'INBOUND TEST#1',
  105. )
  106. match(
  107. css: 'body',
  108. value: 'OUTBOUND TEST#1',
  109. )
  110. end
  111. end