chat_test.rb 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. # encoding: utf-8
  2. # rubocop:disable all
  3. require 'browser_test_helper'
  4. class ChatTest < TestCase
  5. def test_websocket
  6. return # TODO: temp disable
  7. message = 'message 1äöüß ' + rand(99_999_999_999_999_999).to_s
  8. tests = [
  9. {
  10. name: 'start',
  11. instance1: browser_instance,
  12. instance2: browser_instance,
  13. instance1_username: 'master@example.com',
  14. instance1_password: 'test',
  15. instance2_username: 'agent1@example.com',
  16. instance2_password: 'test',
  17. url: browser_url,
  18. action: [
  19. {
  20. where: :instance1,
  21. execute: 'check',
  22. css: '#login',
  23. result: false,
  24. },
  25. {
  26. where: :instance2,
  27. execute: 'check',
  28. css: '#login',
  29. result: false,
  30. },
  31. {
  32. execute: 'wait',
  33. value: 1,
  34. },
  35. {
  36. where: :instance1,
  37. execute: 'click',
  38. css: '#chat_toogle',
  39. },
  40. {
  41. execute: 'wait',
  42. value: 8,
  43. },
  44. {
  45. where: :instance1,
  46. execute: 'click',
  47. css: '#chat_toogle',
  48. },
  49. {
  50. execute: 'wait',
  51. value: 4,
  52. },
  53. {
  54. where: :instance2,
  55. execute: 'click',
  56. css: '#chat_toogle',
  57. },
  58. {
  59. where: :instance1,
  60. execute: 'click',
  61. css: '#chat_toogle',
  62. },
  63. {
  64. execute: 'wait',
  65. value: 2,
  66. },
  67. {
  68. where: :instance1,
  69. execute: 'set',
  70. css: 'input[name="chat_message"]',
  71. value: message,
  72. },
  73. {
  74. where: :instance1,
  75. execute: 'send_key',
  76. css: 'input[name="chat_message"]',
  77. value: :enter,
  78. },
  79. {
  80. execute: 'wait',
  81. value: 6,
  82. },
  83. {
  84. where: :instance1,
  85. execute: 'match',
  86. css: '#chat_log_container',
  87. value: message,
  88. match_result: true,
  89. },
  90. {
  91. where: :instance2,
  92. execute: 'match',
  93. css: '#chat_log_container',
  94. value: message,
  95. match_result: true,
  96. },
  97. {
  98. where: :instance1,
  99. execute: 'navigate',
  100. to: browser_url,
  101. },
  102. {
  103. execute: 'wait',
  104. value: 8,
  105. },
  106. {
  107. where: :instance1,
  108. execute: 'click',
  109. css: '#chat_toogle',
  110. },
  111. {
  112. execute: 'wait',
  113. value: 8,
  114. },
  115. {
  116. where: :instance1,
  117. execute: 'match',
  118. css: '#chat_log_container',
  119. value: message,
  120. match_result: true,
  121. },
  122. ],
  123. },
  124. ]
  125. browser_double_test(tests)
  126. end
  127. end