first_steps_test.rb 2.7 KB

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