first_steps_test.rb 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. require 'browser_test_helper'
  2. class FirstStepsTest < TestCase
  3. def test_basic
  4. agent = "bob.smith_#{rand(99_999_999)}"
  5. customer = "customer.smith_#{rand(99_999_999)}"
  6. @browser = browser_instance
  7. login(
  8. username: 'master@example.com',
  9. password: 'test',
  10. url: browser_url,
  11. )
  12. tasks_close_all()
  13. click(css: '.active.content .tab[data-area="first-steps-widgets"]')
  14. watch_for(
  15. css: '.active.content',
  16. value: 'Configuration',
  17. )
  18. # invite agent (with more then one group)
  19. click(css: '.active.content .js-inviteAgent')
  20. modal_ready()
  21. set(
  22. css: '.modal [name="firstname"]',
  23. value: 'Bob',
  24. )
  25. set(
  26. css: '.modal [name="lastname"]',
  27. value: 'Smith',
  28. )
  29. set(
  30. css: '.modal [name="email"]',
  31. value: "#{agent}@example.com",
  32. )
  33. check(css: '.modal .js-groupListItem[value=full]')
  34. click(
  35. css: '.modal button.btn.btn--primary',
  36. fast: true,
  37. )
  38. watch_for(
  39. css: 'body div.modal',
  40. value: 'Sending',
  41. )
  42. watch_for_disappear(
  43. css: 'body div.modal',
  44. value: 'Sending',
  45. )
  46. modal_disappear()
  47. # invite customer
  48. click(css: '.active.content .js-inviteCustomer')
  49. modal_ready()
  50. set(
  51. css: '.modal [name="firstname"]',
  52. value: 'Client',
  53. )
  54. set(
  55. css: '.modal [name="lastname"]',
  56. value: 'Smith',
  57. )
  58. set(
  59. css: '.modal [name="email"]',
  60. value: "#{customer}@example.com",
  61. )
  62. set(
  63. css: '.modal [data-name="note"]',
  64. value: 'some note',
  65. )
  66. click(
  67. css: '.modal button.btn.btn--primary',
  68. fast: true,
  69. )
  70. watch_for(
  71. css: 'body div.modal',
  72. value: 'Sending',
  73. )
  74. watch_for_disappear(
  75. css: 'body div.modal',
  76. value: 'Sending',
  77. )
  78. modal_disappear()
  79. # test ticket
  80. click(
  81. css: '.active.content .js-testTicket',
  82. fast: true,
  83. )
  84. modal_ready()
  85. watch_for(
  86. css: 'body div.modal',
  87. value: 'A Test Ticket has been created',
  88. )
  89. click(
  90. css: '.modal .modal-body',
  91. fast: true,
  92. )
  93. watch_for_disappear(
  94. css: 'body div.modal',
  95. value: 'Test Ticket',
  96. )
  97. modal_disappear()
  98. execute(
  99. js: '$(".active.content .sidebar").show()',
  100. )
  101. watch_for(
  102. css: '.active.content .js-activityContent',
  103. value: 'Nicole Braun created Article for Test Ticket!',
  104. timeout: 35,
  105. )
  106. # check update
  107. click(css: '.active.content a[href="#channels/form"]')
  108. sleep 2
  109. switch(
  110. css: '.content.active .js-formSetting',
  111. type: 'on',
  112. )
  113. click(css: '#navigation a[href="#dashboard"]')
  114. hit = false
  115. 37.times do
  116. next if !@browser.find_elements(css: '.active.content a[href="#channels/form"].todo.is-done')[0]
  117. hit = true
  118. break
  119. end
  120. assert(hit)
  121. end
  122. end