Maintenance: Track console js errors in chrome capybara tests.
This commit is contained in:
parent
74da7fa014
commit
2844b6d95d
7 changed files with 34 additions and 8 deletions
|
@ -150,7 +150,7 @@ class App.Search extends App.Controller
|
||||||
tabModel = $(e.currentTarget).data('tab-content')
|
tabModel = $(e.currentTarget).data('tab-content')
|
||||||
tabs.find('.js-tab').removeClass('active')
|
tabs.find('.js-tab').removeClass('active')
|
||||||
$(e.currentTarget).addClass('active')
|
$(e.currentTarget).addClass('active')
|
||||||
@renderTab(tabModel, @result[tabModel] || [])
|
@renderTab(tabModel, @result?[tabModel] || [])
|
||||||
|
|
||||||
renderTab: (model, localList) =>
|
renderTab: (model, localList) =>
|
||||||
|
|
||||||
|
@ -231,15 +231,16 @@ class App.Search extends App.Controller
|
||||||
@search(true)
|
@search(true)
|
||||||
@delay(callback, 100)
|
@delay(callback, 100)
|
||||||
|
|
||||||
|
@bulkForm.releaseController() if @bulkForm
|
||||||
@bulkForm = new App.TicketBulkForm(
|
@bulkForm = new App.TicketBulkForm(
|
||||||
holder: localeEl
|
el: @el.find('.bulkAction')
|
||||||
view: @view
|
holder: localeEl
|
||||||
callback: updateSearch
|
view: @view
|
||||||
|
callback: updateSearch
|
||||||
noSidebar: true
|
noSidebar: true
|
||||||
)
|
)
|
||||||
|
|
||||||
# start bulk action observ
|
# start bulk action observ
|
||||||
@el.append(@bulkForm.el)
|
|
||||||
localElement = @$('.js-content')
|
localElement = @$('.js-content')
|
||||||
if localElement.find('input[name="bulk"]:checked').length isnt 0
|
if localElement.find('input[name="bulk"]:checked').length isnt 0
|
||||||
@bulkForm.show()
|
@bulkForm.show()
|
||||||
|
|
|
@ -1212,13 +1212,14 @@ class Table extends App.Controller
|
||||||
|
|
||||||
@renderPopovers()
|
@renderPopovers()
|
||||||
|
|
||||||
|
@bulkForm.releaseController() if @bulkForm
|
||||||
@bulkForm = new App.TicketBulkForm(
|
@bulkForm = new App.TicketBulkForm(
|
||||||
|
el: @el.find('.bulkAction')
|
||||||
holder: @el
|
holder: @el
|
||||||
view: @view
|
view: @view
|
||||||
)
|
)
|
||||||
|
|
||||||
# start bulk action observ
|
# start bulk action observ
|
||||||
@el.append(@bulkForm.el)
|
|
||||||
localElement = @$('.table-overview')
|
localElement = @$('.table-overview')
|
||||||
if localElement.find('input[name="bulk"]:checked').length isnt 0
|
if localElement.find('input[name="bulk"]:checked').length isnt 0
|
||||||
@bulkForm.show()
|
@bulkForm.show()
|
||||||
|
|
|
@ -14,6 +14,8 @@ class App.TicketBulkForm extends App.Controller
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
super
|
||||||
|
|
||||||
|
return if !@permissionCheck('ticket.agent')
|
||||||
|
|
||||||
@configure_attributes_ticket = []
|
@configure_attributes_ticket = []
|
||||||
|
|
||||||
used_attributes = ['state_id', 'pending_time', 'priority_id', 'group_id', 'owner_id']
|
used_attributes = ['state_id', 'pending_time', 'priority_id', 'group_id', 'owner_id']
|
||||||
|
|
|
@ -21,3 +21,5 @@
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<div class="table-overview"></div>
|
<div class="table-overview"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="bulkAction hide"></div>
|
||||||
|
|
|
@ -24,3 +24,5 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="bulkAction hide"></div>
|
||||||
|
|
|
@ -34,6 +34,7 @@ returns
|
||||||
data[ app_model_ticket ][ id ] = attributes_with_association_ids
|
data[ app_model_ticket ][ id ] = attributes_with_association_ids
|
||||||
|
|
||||||
app_model_user = User.to_app_model
|
app_model_user = User.to_app_model
|
||||||
|
group.assets(data)
|
||||||
|
|
||||||
%w[created_by_id updated_by_id owner_id customer_id].each do |local_user_id|
|
%w[created_by_id updated_by_id owner_id customer_id].each do |local_user_id|
|
||||||
next if !self[ local_user_id ]
|
next if !self[ local_user_id ]
|
||||||
|
|
17
spec/support/capybara/console_errors.rb
Normal file
17
spec/support/capybara/console_errors.rb
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.after(:each, type: :system) do
|
||||||
|
next if page.driver.browser.browser != :chrome
|
||||||
|
|
||||||
|
errors = page.driver.browser.manage.logs.get(:browser).select { |m| m.level == 'SEVERE' && m.to_s =~ %r{EvalError|InternalError|RangeError|ReferenceError|SyntaxError|TypeError|URIError} }
|
||||||
|
if errors.present?
|
||||||
|
Rails.logger.error "JS ERRORS: #{errors.to_json}"
|
||||||
|
errors.each do |error|
|
||||||
|
puts "#{error.message}\n\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
expect(errors.length).to eq(0)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue