q_unit_spec.rb 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. require 'rails_helper'
  2. RSpec.describe 'QUnit', type: :system, authenticated: false, set_up: true, websocket: false do
  3. def q_unit_tests(test_name)
  4. visit "/tests_#{test_name}"
  5. yield if block_given?
  6. expect(page).to have_css('.result', text: 'Tests completed')
  7. expect(page).to have_css('.result .failed', text: '0')
  8. end
  9. def async_q_unit_tests(*args)
  10. q_unit_tests(*args) do
  11. wait(10, interval: 4).until_constant do
  12. find('.total').text
  13. end
  14. end
  15. end
  16. it 'Core' do
  17. async_q_unit_tests('core')
  18. end
  19. it 'I18n' do
  20. async_q_unit_tests('i18n')
  21. end
  22. context 'UI' do
  23. it 'Base' do
  24. q_unit_tests('ui')
  25. end
  26. it 'Local storage' do
  27. q_unit_tests('local_storage')
  28. end
  29. it 'Model' do
  30. async_q_unit_tests('model')
  31. end
  32. it 'Model binding' do
  33. q_unit_tests('model_binding')
  34. end
  35. it 'Model UI' do
  36. if !ENV['CI']
  37. skip("Can't run locally because of dependence of special Timezone")
  38. end
  39. q_unit_tests('model_ui')
  40. end
  41. it 'Model Ticket' do
  42. q_unit_tests('model_ticket')
  43. end
  44. it 'Ticket selector' do
  45. q_unit_tests('ticket_selector')
  46. end
  47. end
  48. context 'Form' do
  49. it 'Base' do
  50. async_q_unit_tests('form')
  51. end
  52. it 'Trim' do
  53. q_unit_tests('form_trim')
  54. end
  55. it 'Find' do
  56. q_unit_tests('form_find')
  57. end
  58. it 'Timer' do
  59. q_unit_tests('form_timer')
  60. end
  61. it 'Color' do
  62. q_unit_tests('form_color')
  63. end
  64. it 'Extended' do
  65. q_unit_tests('form_extended')
  66. end
  67. it 'Searchable select' do
  68. q_unit_tests('form_searchable_select')
  69. end
  70. it 'Tree select' do
  71. q_unit_tests('form_tree_select')
  72. end
  73. it 'Column select' do
  74. q_unit_tests('form_column_select')
  75. end
  76. it 'Ticket perform action' do
  77. q_unit_tests('form_ticket_perform_action')
  78. end
  79. it 'Validation' do
  80. q_unit_tests('form_validation')
  81. end
  82. it 'Skip rendering' do
  83. q_unit_tests('form_skip_rendering')
  84. end
  85. it 'SLA times' do
  86. q_unit_tests('form_sla_times')
  87. end
  88. end
  89. context 'Table' do
  90. it 'Base' do
  91. q_unit_tests('table')
  92. end
  93. it 'Extended' do
  94. q_unit_tests('table_extended')
  95. end
  96. it 'HTML utils' do
  97. q_unit_tests('html_utils')
  98. end
  99. it 'Taskbar' do
  100. q_unit_tests('taskbar')
  101. end
  102. end
  103. end