taskbar_task_test.rb 2.6 KB

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